diff --git a/qrenderdoc/3rdparty/flowlayout/FlowLayout.cpp b/qrenderdoc/3rdparty/flowlayout/FlowLayout.cpp deleted file mode 100644 index 938585334..000000000 --- a/qrenderdoc/3rdparty/flowlayout/FlowLayout.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "FlowLayout.h" - -FlowLayout::FlowLayout(QWidget *parent, int margin, int hSpacing, int vSpacing) - : QLayout(parent), m_hSpace(hSpacing), m_vSpace(vSpacing), m_fixedGrid(false) -{ - setContentsMargins(margin, margin, margin, margin); -} - -FlowLayout::FlowLayout(int margin, int hSpacing, int vSpacing) - : m_hSpace(hSpacing), m_vSpace(vSpacing), m_fixedGrid(false) -{ - setContentsMargins(margin, margin, margin, margin); -} - -FlowLayout::~FlowLayout() -{ - QLayoutItem *item; - while ((item = takeAt(0))) - delete item; -} - -void FlowLayout::addItem(QLayoutItem *item) -{ - itemList.append(item); -} - -int FlowLayout::horizontalSpacing() const -{ - if (m_hSpace >= 0) { - return m_hSpace; - } else { - return smartSpacing(QStyle::PM_LayoutHorizontalSpacing); - } -} - -int FlowLayout::verticalSpacing() const -{ - if (m_vSpace >= 0) { - return m_vSpace; - } else { - return smartSpacing(QStyle::PM_LayoutVerticalSpacing); - } -} - -bool FlowLayout::fixedGrid() const -{ - return m_fixedGrid; -} - -void FlowLayout::setFixedGrid(bool fixedgrid) -{ - m_fixedGrid = fixedgrid; -} - -int FlowLayout::count() const -{ - return itemList.size(); -} - -QLayoutItem *FlowLayout::itemAt(int index) const -{ - return itemList.value(index); -} - -QLayoutItem *FlowLayout::takeAt(int index) -{ - if (index >= 0 && index < itemList.size()) - return itemList.takeAt(index); - else - return 0; -} - -Qt::Orientations FlowLayout::expandingDirections() const -{ - return 0; -} - -bool FlowLayout::hasHeightForWidth() const -{ - return true; -} - -int FlowLayout::heightForWidth(int width) const -{ - int height = doLayout(QRect(0, 0, width, 0), true); - return height; -} - -void FlowLayout::setGeometry(const QRect &rect) -{ - bool needUpdate = (rect != m_prevRect); - - QLayout::setGeometry(rect); - doLayout(rect, false); - - if(needUpdate) - update(); - - m_prevRect = rect; -} - -QSize FlowLayout::sizeHint() const -{ - QSize size = geometry().size(); - size.setHeight(doLayout(geometry().adjusted(0, 0, -10, 0), true)); - return size; -} - -QSize FlowLayout::minimumSize() const -{ - QSize size; - QLayoutItem *item; - foreach (item, itemList) - size = size.expandedTo(item->minimumSize()); - - size += QSize(2*margin(), 2*margin()); - return size; -} - -int FlowLayout::doLayout(const QRect &rect, bool testOnly) const -{ - int left, top, right, bottom; - getContentsMargins(&left, &top, &right, &bottom); - QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom); - int x = effectiveRect.x(); - int y = effectiveRect.y(); - int lineHeight = 0; - QSize fixedSize; - - QLayoutItem *item; - if(m_fixedGrid) { - foreach (item, itemList) { - fixedSize = fixedSize.expandedTo(item->sizeHint()); - } - } - - foreach (item, itemList) { - QWidget *wid = item->widget(); - - QSize size = m_fixedGrid ? fixedSize : item->sizeHint(); - - int spaceX = horizontalSpacing(); - if (spaceX == -1) - spaceX = wid->style()->layoutSpacing( - QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Horizontal); - int spaceY = verticalSpacing(); - if (spaceY == -1) - spaceY = wid->style()->layoutSpacing( - QSizePolicy::PushButton, QSizePolicy::PushButton, Qt::Vertical); - int nextX = x + size.width() + spaceX; - if (nextX - spaceX > effectiveRect.right() && lineHeight > 0) { - x = effectiveRect.x(); - y = y + lineHeight + spaceY; - nextX = x + size.width() + spaceX; - lineHeight = 0; - } - - if (!testOnly) - item->setGeometry(QRect(QPoint(x, y), item->sizeHint())); - - x = nextX; - lineHeight = qMax(lineHeight, size.height()); - } - return y + lineHeight - rect.y() + bottom; -} -int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const -{ - QObject *parent = this->parent(); - if (!parent) { - return -1; - } else if (parent->isWidgetType()) { - QWidget *pw = static_cast(parent); - return pw->style()->pixelMetric(pm, 0, pw); - } else { - return static_cast(parent)->spacing(); - } -} diff --git a/qrenderdoc/3rdparty/flowlayout/FlowLayout.h b/qrenderdoc/3rdparty/flowlayout/FlowLayout.h deleted file mode 100644 index 3e822b35f..000000000 --- a/qrenderdoc/3rdparty/flowlayout/FlowLayout.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef FLOWLAYOUT_H -#define FLOWLAYOUT_H - -#include -#include -#include -class FlowLayout : public QLayout -{ -public: - explicit FlowLayout(QWidget *parent, int margin = -1, int hSpacing = -1, int vSpacing = -1); - explicit FlowLayout(int margin = -1, int hSpacing = -1, int vSpacing = -1); - ~FlowLayout(); - - void addItem(QLayoutItem *item) Q_DECL_OVERRIDE; - int horizontalSpacing() const; - int verticalSpacing() const; - Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE; - bool hasHeightForWidth() const Q_DECL_OVERRIDE; - int heightForWidth(int) const Q_DECL_OVERRIDE; - int count() const Q_DECL_OVERRIDE; - QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE; - QSize minimumSize() const Q_DECL_OVERRIDE; - void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; - QSize sizeHint() const Q_DECL_OVERRIDE; - QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE; - - bool fixedGrid() const; - void setFixedGrid(bool fixedgrid); - -private: - int doLayout(const QRect &rect, bool testOnly) const; - int smartSpacing(QStyle::PixelMetric pm) const; - - QList itemList; - QRect m_prevRect; - bool m_fixedGrid; - int m_hSpace; - int m_vSpace; -}; - -#endif // FLOWLAYOUT_H diff --git a/qrenderdoc/3rdparty/scintilla/.hg_archival.txt b/qrenderdoc/3rdparty/scintilla/.hg_archival.txt deleted file mode 100644 index 77e5d50f0..000000000 --- a/qrenderdoc/3rdparty/scintilla/.hg_archival.txt +++ /dev/null @@ -1,6 +0,0 @@ -repo: bdf8c3ef2fb01ea24578e726337888e706d10b92 -node: cec95d2eeb9e7bf6a9bad56d7b9ee8d33f1bdd0d -branch: default -latesttag: rel-3-7-2 -latesttagdistance: 1 -changessincelatesttag: 1 diff --git a/qrenderdoc/3rdparty/scintilla/License.txt b/qrenderdoc/3rdparty/scintilla/License.txt deleted file mode 100644 index cbe25b2fc..000000000 --- a/qrenderdoc/3rdparty/scintilla/License.txt +++ /dev/null @@ -1,20 +0,0 @@ -License for Scintilla and SciTE - -Copyright 1998-2003 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/qrenderdoc/3rdparty/scintilla/README b/qrenderdoc/3rdparty/scintilla/README deleted file mode 100644 index ca2f2c059..000000000 --- a/qrenderdoc/3rdparty/scintilla/README +++ /dev/null @@ -1,88 +0,0 @@ -README for building of Scintilla and SciTE - -Scintilla can be built by itself. -To build SciTE, Scintilla must first be built. - - -*** GTK+/Linux version *** - -You must first have GTK+ 2.18 or later and GCC (4.8 or better) installed. -Clang may be used by adding CLANG=1 to the make command line. -Other C++ compilers may work but may require tweaking the make file. -Either GTK+ 2.x or 3.x may be used with 2.x the default and 3.x -chosen with the make argument GTK3=1. - -To build Scintilla, use the makefile located in the scintilla/gtk directory - cd scintilla/gtk - make - cd ../.. - -To build and install SciTE, use the makefile located in the scite/gtk directory - cd scite/gtk - make - sudo make install - -This installs SciTE into $prefix/bin. The value of $prefix is determined from -the location of Gnome if it is installed. This is usually /usr if installed -with Linux or /usr/local if built from source. If Gnome is not installed -/usr/bin is used as the prefix. The prefix can be overridden on the command -line like "make prefix=/opt" but the same value should be used for both make -and make install as this location is compiled into the executable. The global -properties file is installed at $prefix/share/scite/SciTEGlobal.properties. -The language specific properties files are also installed into this directory. - -To remove SciTE - sudo make uninstall - -To clean the object files which may be needed to change $prefix - make clean - -The current make file only supports static linking between SciTE and Scintilla. - - -*** Windows version *** - -A C++ compiler is required, with C++11 required for building SciTE. -Visual Studio 2015 is the development system used for most development -although Mingw32 4.8 is also supported. - -Older compilers may not have a working std::regex so this can be disabled -with the make argument NO_CXX11_REGEX=1. - -To build Scintilla, make in the scintilla/win32 directory - cd scintilla\win32 -GCC: mingw32-make -Visual C++: nmake -f scintilla.mak - cd ..\.. - -To build SciTE, use the makefiles located in the scite/win32 directory - cd scite\win32 -GCC: mingw32-make -Visual C++: nmake -f scite.mak - -An executable SciTE will now be in scite/bin. - -*** GTK+/Windows version *** - -Mingw32 is known to work. Other compilers will probably not work. - -Only Scintilla will build with GTK+ on Windows. SciTE will not work. - -To build Scintilla, make in the scintilla/gtk directory - cd scintilla\gtk - mingw32-make - -*** macOS Cocoa version *** - -Xcode 7 or 8 may be used to build Scintilla on macOS. - -There is no open source version of SciTE for macOS but there is a commercial -version available through the App Store. - -To build Scintilla, run xcodebuild in the scintilla/cocoa/ScintillaFramework directory - cd cocoa/ScintillaFramework - xcodebuild - -*** Qt version *** - -See the qt/README file to build Scintilla with Qt. diff --git a/qrenderdoc/3rdparty/scintilla/include/ILexer.h b/qrenderdoc/3rdparty/scintilla/include/ILexer.h deleted file mode 100644 index f01029178..000000000 --- a/qrenderdoc/3rdparty/scintilla/include/ILexer.h +++ /dev/null @@ -1,100 +0,0 @@ -// Scintilla source code edit control -/** @file ILexer.h - ** Interface between Scintilla and lexers. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef ILEXER_H -#define ILEXER_H - -#include "Sci_Position.h" - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -#ifdef _WIN32 - #define SCI_METHOD __stdcall -#else - #define SCI_METHOD -#endif - -enum { dvOriginal=0, dvLineEnd=1 }; - -class IDocument { -public: - virtual int SCI_METHOD Version() const = 0; - virtual void SCI_METHOD SetErrorStatus(int status) = 0; - virtual Sci_Position SCI_METHOD Length() const = 0; - virtual void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const = 0; - virtual char SCI_METHOD StyleAt(Sci_Position position) const = 0; - virtual Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const = 0; - virtual Sci_Position SCI_METHOD LineStart(Sci_Position line) const = 0; - virtual int SCI_METHOD GetLevel(Sci_Position line) const = 0; - virtual int SCI_METHOD SetLevel(Sci_Position line, int level) = 0; - virtual int SCI_METHOD GetLineState(Sci_Position line) const = 0; - virtual int SCI_METHOD SetLineState(Sci_Position line, int state) = 0; - virtual void SCI_METHOD StartStyling(Sci_Position position, char mask) = 0; - virtual bool SCI_METHOD SetStyleFor(Sci_Position length, char style) = 0; - virtual bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) = 0; - virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0; - virtual void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) = 0; - virtual void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) = 0; - virtual int SCI_METHOD CodePage() const = 0; - virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0; - virtual const char * SCI_METHOD BufferPointer() = 0; - virtual int SCI_METHOD GetLineIndentation(Sci_Position line) = 0; -}; - -class IDocumentWithLineEnd : public IDocument { -public: - virtual Sci_Position SCI_METHOD LineEnd(Sci_Position line) const = 0; - virtual Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const = 0; - virtual int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const = 0; -}; - -enum { lvOriginal=0, lvSubStyles=1 }; - -class ILexer { -public: - virtual int SCI_METHOD Version() const = 0; - virtual void SCI_METHOD Release() = 0; - virtual const char * SCI_METHOD PropertyNames() = 0; - virtual int SCI_METHOD PropertyType(const char *name) = 0; - virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0; - virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) = 0; - virtual const char * SCI_METHOD DescribeWordListSets() = 0; - virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) = 0; - virtual void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; - virtual void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; - virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0; -}; - -class ILexerWithSubStyles : public ILexer { -public: - virtual int SCI_METHOD LineEndTypesSupported() = 0; - virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0; - virtual int SCI_METHOD SubStylesStart(int styleBase) = 0; - virtual int SCI_METHOD SubStylesLength(int styleBase) = 0; - virtual int SCI_METHOD StyleFromSubStyle(int subStyle) = 0; - virtual int SCI_METHOD PrimaryStyleFromStyle(int style) = 0; - virtual void SCI_METHOD FreeSubStyles() = 0; - virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0; - virtual int SCI_METHOD DistanceToSecondaryStyles() = 0; - virtual const char * SCI_METHOD GetSubStyleBases() = 0; -}; - -class ILoader { -public: - virtual int SCI_METHOD Release() = 0; - // Returns a status code from SC_STATUS_* - virtual int SCI_METHOD AddData(char *data, Sci_Position length) = 0; - virtual void * SCI_METHOD ConvertToDocument() = 0; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/include/Platform.h b/qrenderdoc/3rdparty/scintilla/include/Platform.h deleted file mode 100644 index 1ff48ecb1..000000000 --- a/qrenderdoc/3rdparty/scintilla/include/Platform.h +++ /dev/null @@ -1,529 +0,0 @@ -// Scintilla source code edit control -/** @file Platform.h - ** Interface to platform facilities. Also includes some basic utilities. - ** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows. - **/ -// Copyright 1998-2009 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef PLATFORM_H -#define PLATFORM_H - -// PLAT_GTK = GTK+ on Linux or Win32 -// PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32 -// PLAT_WIN = Win32 API on Win32 OS -// PLAT_WX is wxWindows on any supported platform -// PLAT_TK = Tcl/TK on Linux or Win32 - -#define PLAT_GTK 0 -#define PLAT_GTK_WIN32 0 -#define PLAT_GTK_MACOSX 0 -#define PLAT_MACOSX 0 -#define PLAT_WIN 0 -#define PLAT_WX 0 -#define PLAT_QT 0 -#define PLAT_FOX 0 -#define PLAT_CURSES 0 -#define PLAT_TK 0 - -#if defined(FOX) -#undef PLAT_FOX -#define PLAT_FOX 1 - -#elif defined(__WX__) -#undef PLAT_WX -#define PLAT_WX 1 - -#elif defined(CURSES) -#undef PLAT_CURSES -#define PLAT_CURSES 1 - -#elif defined(SCINTILLA_QT) -#undef PLAT_QT -#define PLAT_QT 1 - -#elif defined(TK) -#undef PLAT_TK -#define PLAT_TK 1 - -#elif defined(GTK) -#undef PLAT_GTK -#define PLAT_GTK 1 - -#if defined(__WIN32__) || defined(_MSC_VER) -#undef PLAT_GTK_WIN32 -#define PLAT_GTK_WIN32 1 -#endif - -#if defined(__APPLE__) -#undef PLAT_GTK_MACOSX -#define PLAT_GTK_MACOSX 1 -#endif - -#elif defined(__APPLE__) - -#undef PLAT_MACOSX -#define PLAT_MACOSX 1 - -#else -#undef PLAT_WIN -#define PLAT_WIN 1 - -#endif - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -typedef float XYPOSITION; -typedef double XYACCUMULATOR; -inline int RoundXYPosition(XYPOSITION xyPos) { - return int(xyPos + 0.5); -} - -// Underlying the implementation of the platform classes are platform specific types. -// Sometimes these need to be passed around by client code so they are defined here - -typedef void *FontID; -typedef void *SurfaceID; -typedef void *WindowID; -typedef void *MenuID; -typedef void *TickerID; -typedef void *Function; -typedef void *IdlerID; - -/** - * A geometric point class. - * Point is similar to the Win32 POINT and GTK+ GdkPoint types. - */ -class Point { -public: - XYPOSITION x; - XYPOSITION y; - - explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) { - } - - static Point FromInts(int x_, int y_) { - return Point(static_cast(x_), static_cast(y_)); - } - - // Other automatically defined methods (assignment, copy constructor, destructor) are fine - - static Point FromLong(long lpoint); -}; - -/** - * A geometric rectangle class. - * PRectangle is similar to the Win32 RECT. - * PRectangles contain their top and left sides, but not their right and bottom sides. - */ -class PRectangle { -public: - XYPOSITION left; - XYPOSITION top; - XYPOSITION right; - XYPOSITION bottom; - - explicit PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) : - left(left_), top(top_), right(right_), bottom(bottom_) { - } - - static PRectangle FromInts(int left_, int top_, int right_, int bottom_) { - return PRectangle(static_cast(left_), static_cast(top_), - static_cast(right_), static_cast(bottom_)); - } - - // Other automatically defined methods (assignment, copy constructor, destructor) are fine - - bool operator==(PRectangle &rc) const { - return (rc.left == left) && (rc.right == right) && - (rc.top == top) && (rc.bottom == bottom); - } - bool Contains(Point pt) const { - return (pt.x >= left) && (pt.x <= right) && - (pt.y >= top) && (pt.y <= bottom); - } - bool ContainsWholePixel(Point pt) const { - // Does the rectangle contain all of the pixel to left/below the point - return (pt.x >= left) && ((pt.x+1) <= right) && - (pt.y >= top) && ((pt.y+1) <= bottom); - } - bool Contains(PRectangle rc) const { - return (rc.left >= left) && (rc.right <= right) && - (rc.top >= top) && (rc.bottom <= bottom); - } - bool Intersects(PRectangle other) const { - return (right > other.left) && (left < other.right) && - (bottom > other.top) && (top < other.bottom); - } - void Move(XYPOSITION xDelta, XYPOSITION yDelta) { - left += xDelta; - top += yDelta; - right += xDelta; - bottom += yDelta; - } - XYPOSITION Width() const { return right - left; } - XYPOSITION Height() const { return bottom - top; } - bool Empty() const { - return (Height() <= 0) || (Width() <= 0); - } -}; - -/** - * Holds a desired RGB colour. - */ -class ColourDesired { - long co; -public: - ColourDesired(long lcol=0) { - co = lcol; - } - - ColourDesired(unsigned int red, unsigned int green, unsigned int blue) { - Set(red, green, blue); - } - - bool operator==(const ColourDesired &other) const { - return co == other.co; - } - - void Set(long lcol) { - co = lcol; - } - - void Set(unsigned int red, unsigned int green, unsigned int blue) { - co = red | (green << 8) | (blue << 16); - } - - static inline unsigned int ValueOfHex(const char ch) { - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - else - return 0; - } - - void Set(const char *val) { - if (*val == '#') { - val++; - } - unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]); - unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]); - unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]); - Set(r, g, b); - } - - long AsLong() const { - return co; - } - - unsigned int GetRed() const { - return co & 0xff; - } - - unsigned int GetGreen() const { - return (co >> 8) & 0xff; - } - - unsigned int GetBlue() const { - return (co >> 16) & 0xff; - } -}; - -/** - * Font management. - */ - -struct FontParameters { - const char *faceName; - float size; - int weight; - bool italic; - int extraFontFlag; - int technology; - int characterSet; - - FontParameters( - const char *faceName_, - float size_=10, - int weight_=400, - bool italic_=false, - int extraFontFlag_=0, - int technology_=0, - int characterSet_=0) : - - faceName(faceName_), - size(size_), - weight(weight_), - italic(italic_), - extraFontFlag(extraFontFlag_), - technology(technology_), - characterSet(characterSet_) - { - } - -}; - -class Font { -protected: - FontID fid; - // Private so Font objects can not be copied - Font(const Font &); - Font &operator=(const Font &); -public: - Font(); - virtual ~Font(); - - virtual void Create(const FontParameters &fp); - virtual void Release(); - - FontID GetID() { return fid; } - // Alias another font - caller guarantees not to Release - void SetID(FontID fid_) { fid = fid_; } - friend class Surface; - friend class SurfaceImpl; -}; - -/** - * A surface abstracts a place to draw. - */ -class Surface { -private: - // Private so Surface objects can not be copied - Surface(const Surface &) {} - Surface &operator=(const Surface &) { return *this; } -public: - Surface() {} - virtual ~Surface() {} - static Surface *Allocate(int technology); - - virtual void Init(WindowID wid)=0; - virtual void Init(SurfaceID sid, WindowID wid)=0; - virtual void InitPixMap(int width, int height, Surface *surface_, WindowID wid)=0; - - virtual void Release()=0; - virtual bool Initialised()=0; - virtual void PenColour(ColourDesired fore)=0; - virtual int LogPixelsY()=0; - virtual int DeviceHeightFont(int points)=0; - virtual void MoveTo(int x_, int y_)=0; - virtual void LineTo(int x_, int y_)=0; - virtual void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back)=0; - virtual void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back)=0; - virtual void FillRectangle(PRectangle rc, ColourDesired back)=0; - virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0; - virtual void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back)=0; - virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, - ColourDesired outline, int alphaOutline, int flags)=0; - virtual void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) = 0; - virtual void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back)=0; - virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0; - - virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0; - virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0; - virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore)=0; - virtual void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions)=0; - virtual XYPOSITION WidthText(Font &font_, const char *s, int len)=0; - virtual XYPOSITION WidthChar(Font &font_, char ch)=0; - virtual XYPOSITION Ascent(Font &font_)=0; - virtual XYPOSITION Descent(Font &font_)=0; - virtual XYPOSITION InternalLeading(Font &font_)=0; - virtual XYPOSITION ExternalLeading(Font &font_)=0; - virtual XYPOSITION Height(Font &font_)=0; - virtual XYPOSITION AverageCharWidth(Font &font_)=0; - - virtual void SetClip(PRectangle rc)=0; - virtual void FlushCachedState()=0; - - virtual void SetUnicodeMode(bool unicodeMode_)=0; - virtual void SetDBCSMode(int codePage)=0; -}; - -/** - * A simple callback action passing one piece of untyped user data. - */ -typedef void (*CallBackAction)(void*); - -/** - * Class to hide the details of window manipulation. - * Does not own the window which will normally have a longer life than this object. - */ -class Window { -protected: - WindowID wid; -public: - Window() : wid(0), cursorLast(cursorInvalid) { - } - Window(const Window &source) : wid(source.wid), cursorLast(cursorInvalid) { - } - virtual ~Window(); - Window &operator=(WindowID wid_) { - wid = wid_; - return *this; - } - WindowID GetID() const { return wid; } - bool Created() const { return wid != 0; } - void Destroy(); - bool HasFocus(); - PRectangle GetPosition(); - void SetPosition(PRectangle rc); - void SetPositionRelative(PRectangle rc, Window relativeTo); - PRectangle GetClientPosition(); - void Show(bool show=true); - void InvalidateAll(); - void InvalidateRectangle(PRectangle rc); - virtual void SetFont(Font &font); - enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand }; - void SetCursor(Cursor curs); - void SetTitle(const char *s); - PRectangle GetMonitorRect(Point pt); -private: - Cursor cursorLast; -}; - -/** - * Listbox management. - */ - -class ListBox : public Window { -public: - ListBox(); - virtual ~ListBox(); - static ListBox *Allocate(); - - virtual void SetFont(Font &font)=0; - virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_, int technology_)=0; - virtual void SetAverageCharWidth(int width)=0; - virtual void SetVisibleRows(int rows)=0; - virtual int GetVisibleRows() const=0; - virtual PRectangle GetDesiredRect()=0; - virtual int CaretFromEdge()=0; - virtual void Clear()=0; - virtual void Append(char *s, int type = -1)=0; - virtual int Length()=0; - virtual void Select(int n)=0; - virtual int GetSelection()=0; - virtual int Find(const char *prefix)=0; - virtual void GetValue(int n, char *value, int len)=0; - virtual void RegisterImage(int type, const char *xpm_data)=0; - virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) = 0; - virtual void ClearRegisteredImages()=0; - virtual void SetDoubleClickAction(CallBackAction, void *)=0; - virtual void SetList(const char* list, char separator, char typesep)=0; -}; - -/** - * Menu management. - */ -class Menu { - MenuID mid; -public: - Menu(); - MenuID GetID() { return mid; } - void CreatePopUp(); - void Destroy(); - void Show(Point pt, Window &w); -}; - -class ElapsedTime { - long bigBit; - long littleBit; -public: - ElapsedTime(); - double Duration(bool reset=false); -}; - -/** - * Dynamic Library (DLL/SO/...) loading - */ -class DynamicLibrary { -public: - virtual ~DynamicLibrary() {} - - /// @return Pointer to function "name", or NULL on failure. - virtual Function FindFunction(const char *name) = 0; - - /// @return true if the library was loaded successfully. - virtual bool IsValid() = 0; - - /// @return An instance of a DynamicLibrary subclass with "modulePath" loaded. - static DynamicLibrary *Load(const char *modulePath); -}; - -#if defined(__clang__) -# if __has_feature(attribute_analyzer_noreturn) -# define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) -# else -# define CLANG_ANALYZER_NORETURN -# endif -#else -# define CLANG_ANALYZER_NORETURN -#endif - -/** - * Platform class used to retrieve system wide parameters such as double click speed - * and chrome colour. Not a creatable object, more of a module with several functions. - */ -class Platform { - // Private so Platform objects can not be copied - Platform(const Platform &) {} - Platform &operator=(const Platform &) { return *this; } -public: - // Should be private because no new Platforms are ever created - // but gcc warns about this - Platform() {} - ~Platform() {} - static ColourDesired Chrome(); - static ColourDesired ChromeHighlight(); - static const char *DefaultFont(); - static int DefaultFontSize(); - static unsigned int DoubleClickTime(); - static bool MouseButtonBounce(); - static void DebugDisplay(const char *s); - static bool IsKeyDown(int key); - static long SendScintilla( - WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0); - static long SendScintillaPointer( - WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0); - static bool IsDBCSLeadByte(int codePage, char ch); - static int DBCSCharLength(int codePage, const char *s); - static int DBCSCharMaxLength(); - - // These are utility functions not really tied to a platform - static int Minimum(int a, int b); - static int Maximum(int a, int b); - // Next three assume 16 bit shorts and 32 bit longs - static long LongFromTwoShorts(short a,short b) { - return (a) | ((b) << 16); - } - static short HighShortFromLong(long x) { - return static_cast(x >> 16); - } - static short LowShortFromLong(long x) { - return static_cast(x & 0xffff); - } - static void DebugPrintf(const char *format, ...); - static bool ShowAssertionPopUps(bool assertionPopUps_); - static void Assert(const char *c, const char *file, int line) CLANG_ANALYZER_NORETURN; - static int Clamp(int val, int minVal, int maxVal); -}; - -#ifdef NDEBUG -#define PLATFORM_ASSERT(c) ((void)0) -#else -#ifdef SCI_NAMESPACE -#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__)) -#else -#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__)) -#endif -#endif - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/include/SciLexer.h b/qrenderdoc/3rdparty/scintilla/include/SciLexer.h deleted file mode 100644 index 44c02a84a..000000000 --- a/qrenderdoc/3rdparty/scintilla/include/SciLexer.h +++ /dev/null @@ -1,1812 +0,0 @@ -/* Scintilla source code edit control */ -/** @file SciLexer.h - ** Interface to the added lexer functions in the SciLexer version of the edit control. - **/ -/* Copyright 1998-2002 by Neil Hodgson - * The License.txt file describes the conditions under which this software may be distributed. */ - -/* Most of this file is automatically generated from the Scintilla.iface interface definition - * file which contains any comments about the definitions. HFacer.py does the generation. */ - -#ifndef SCILEXER_H -#define SCILEXER_H - -/* SciLexer features - not in standard Scintilla */ - -/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ -#define SCLEX_CONTAINER 0 -#define SCLEX_NULL 1 -#define SCLEX_PYTHON 2 -#define SCLEX_CPP 3 -#define SCLEX_HTML 4 -#define SCLEX_XML 5 -#define SCLEX_PERL 6 -#define SCLEX_SQL 7 -#define SCLEX_VB 8 -#define SCLEX_PROPERTIES 9 -#define SCLEX_ERRORLIST 10 -#define SCLEX_MAKEFILE 11 -#define SCLEX_BATCH 12 -#define SCLEX_XCODE 13 -#define SCLEX_LATEX 14 -#define SCLEX_LUA 15 -#define SCLEX_DIFF 16 -#define SCLEX_CONF 17 -#define SCLEX_PASCAL 18 -#define SCLEX_AVE 19 -#define SCLEX_ADA 20 -#define SCLEX_LISP 21 -#define SCLEX_RUBY 22 -#define SCLEX_EIFFEL 23 -#define SCLEX_EIFFELKW 24 -#define SCLEX_TCL 25 -#define SCLEX_NNCRONTAB 26 -#define SCLEX_BULLANT 27 -#define SCLEX_VBSCRIPT 28 -#define SCLEX_BAAN 31 -#define SCLEX_MATLAB 32 -#define SCLEX_SCRIPTOL 33 -#define SCLEX_ASM 34 -#define SCLEX_CPPNOCASE 35 -#define SCLEX_FORTRAN 36 -#define SCLEX_F77 37 -#define SCLEX_CSS 38 -#define SCLEX_POV 39 -#define SCLEX_LOUT 40 -#define SCLEX_ESCRIPT 41 -#define SCLEX_PS 42 -#define SCLEX_NSIS 43 -#define SCLEX_MMIXAL 44 -#define SCLEX_CLW 45 -#define SCLEX_CLWNOCASE 46 -#define SCLEX_LOT 47 -#define SCLEX_YAML 48 -#define SCLEX_TEX 49 -#define SCLEX_METAPOST 50 -#define SCLEX_POWERBASIC 51 -#define SCLEX_FORTH 52 -#define SCLEX_ERLANG 53 -#define SCLEX_OCTAVE 54 -#define SCLEX_MSSQL 55 -#define SCLEX_VERILOG 56 -#define SCLEX_KIX 57 -#define SCLEX_GUI4CLI 58 -#define SCLEX_SPECMAN 59 -#define SCLEX_AU3 60 -#define SCLEX_APDL 61 -#define SCLEX_BASH 62 -#define SCLEX_ASN1 63 -#define SCLEX_VHDL 64 -#define SCLEX_CAML 65 -#define SCLEX_BLITZBASIC 66 -#define SCLEX_PUREBASIC 67 -#define SCLEX_HASKELL 68 -#define SCLEX_PHPSCRIPT 69 -#define SCLEX_TADS3 70 -#define SCLEX_REBOL 71 -#define SCLEX_SMALLTALK 72 -#define SCLEX_FLAGSHIP 73 -#define SCLEX_CSOUND 74 -#define SCLEX_FREEBASIC 75 -#define SCLEX_INNOSETUP 76 -#define SCLEX_OPAL 77 -#define SCLEX_SPICE 78 -#define SCLEX_D 79 -#define SCLEX_CMAKE 80 -#define SCLEX_GAP 81 -#define SCLEX_PLM 82 -#define SCLEX_PROGRESS 83 -#define SCLEX_ABAQUS 84 -#define SCLEX_ASYMPTOTE 85 -#define SCLEX_R 86 -#define SCLEX_MAGIK 87 -#define SCLEX_POWERSHELL 88 -#define SCLEX_MYSQL 89 -#define SCLEX_PO 90 -#define SCLEX_TAL 91 -#define SCLEX_COBOL 92 -#define SCLEX_TACL 93 -#define SCLEX_SORCUS 94 -#define SCLEX_POWERPRO 95 -#define SCLEX_NIMROD 96 -#define SCLEX_SML 97 -#define SCLEX_MARKDOWN 98 -#define SCLEX_TXT2TAGS 99 -#define SCLEX_A68K 100 -#define SCLEX_MODULA 101 -#define SCLEX_COFFEESCRIPT 102 -#define SCLEX_TCMD 103 -#define SCLEX_AVS 104 -#define SCLEX_ECL 105 -#define SCLEX_OSCRIPT 106 -#define SCLEX_VISUALPROLOG 107 -#define SCLEX_LITERATEHASKELL 108 -#define SCLEX_STTXT 109 -#define SCLEX_KVIRC 110 -#define SCLEX_RUST 111 -#define SCLEX_DMAP 112 -#define SCLEX_AS 113 -#define SCLEX_DMIS 114 -#define SCLEX_REGISTRY 115 -#define SCLEX_BIBTEX 116 -#define SCLEX_SREC 117 -#define SCLEX_IHEX 118 -#define SCLEX_TEHEX 119 -#define SCLEX_JSON 120 -#define SCLEX_EDIFACT 121 -#define SCLEX_AUTOMATIC 1000 -#define SCE_P_DEFAULT 0 -#define SCE_P_COMMENTLINE 1 -#define SCE_P_NUMBER 2 -#define SCE_P_STRING 3 -#define SCE_P_CHARACTER 4 -#define SCE_P_WORD 5 -#define SCE_P_TRIPLE 6 -#define SCE_P_TRIPLEDOUBLE 7 -#define SCE_P_CLASSNAME 8 -#define SCE_P_DEFNAME 9 -#define SCE_P_OPERATOR 10 -#define SCE_P_IDENTIFIER 11 -#define SCE_P_COMMENTBLOCK 12 -#define SCE_P_STRINGEOL 13 -#define SCE_P_WORD2 14 -#define SCE_P_DECORATOR 15 -#define SCE_C_DEFAULT 0 -#define SCE_C_COMMENT 1 -#define SCE_C_COMMENTLINE 2 -#define SCE_C_COMMENTDOC 3 -#define SCE_C_NUMBER 4 -#define SCE_C_WORD 5 -#define SCE_C_STRING 6 -#define SCE_C_CHARACTER 7 -#define SCE_C_UUID 8 -#define SCE_C_PREPROCESSOR 9 -#define SCE_C_OPERATOR 10 -#define SCE_C_IDENTIFIER 11 -#define SCE_C_STRINGEOL 12 -#define SCE_C_VERBATIM 13 -#define SCE_C_REGEX 14 -#define SCE_C_COMMENTLINEDOC 15 -#define SCE_C_WORD2 16 -#define SCE_C_COMMENTDOCKEYWORD 17 -#define SCE_C_COMMENTDOCKEYWORDERROR 18 -#define SCE_C_GLOBALCLASS 19 -#define SCE_C_STRINGRAW 20 -#define SCE_C_TRIPLEVERBATIM 21 -#define SCE_C_HASHQUOTEDSTRING 22 -#define SCE_C_PREPROCESSORCOMMENT 23 -#define SCE_C_PREPROCESSORCOMMENTDOC 24 -#define SCE_C_USERLITERAL 25 -#define SCE_C_TASKMARKER 26 -#define SCE_C_ESCAPESEQUENCE 27 -#define SCE_D_DEFAULT 0 -#define SCE_D_COMMENT 1 -#define SCE_D_COMMENTLINE 2 -#define SCE_D_COMMENTDOC 3 -#define SCE_D_COMMENTNESTED 4 -#define SCE_D_NUMBER 5 -#define SCE_D_WORD 6 -#define SCE_D_WORD2 7 -#define SCE_D_WORD3 8 -#define SCE_D_TYPEDEF 9 -#define SCE_D_STRING 10 -#define SCE_D_STRINGEOL 11 -#define SCE_D_CHARACTER 12 -#define SCE_D_OPERATOR 13 -#define SCE_D_IDENTIFIER 14 -#define SCE_D_COMMENTLINEDOC 15 -#define SCE_D_COMMENTDOCKEYWORD 16 -#define SCE_D_COMMENTDOCKEYWORDERROR 17 -#define SCE_D_STRINGB 18 -#define SCE_D_STRINGR 19 -#define SCE_D_WORD5 20 -#define SCE_D_WORD6 21 -#define SCE_D_WORD7 22 -#define SCE_TCL_DEFAULT 0 -#define SCE_TCL_COMMENT 1 -#define SCE_TCL_COMMENTLINE 2 -#define SCE_TCL_NUMBER 3 -#define SCE_TCL_WORD_IN_QUOTE 4 -#define SCE_TCL_IN_QUOTE 5 -#define SCE_TCL_OPERATOR 6 -#define SCE_TCL_IDENTIFIER 7 -#define SCE_TCL_SUBSTITUTION 8 -#define SCE_TCL_SUB_BRACE 9 -#define SCE_TCL_MODIFIER 10 -#define SCE_TCL_EXPAND 11 -#define SCE_TCL_WORD 12 -#define SCE_TCL_WORD2 13 -#define SCE_TCL_WORD3 14 -#define SCE_TCL_WORD4 15 -#define SCE_TCL_WORD5 16 -#define SCE_TCL_WORD6 17 -#define SCE_TCL_WORD7 18 -#define SCE_TCL_WORD8 19 -#define SCE_TCL_COMMENT_BOX 20 -#define SCE_TCL_BLOCK_COMMENT 21 -#define SCE_H_DEFAULT 0 -#define SCE_H_TAG 1 -#define SCE_H_TAGUNKNOWN 2 -#define SCE_H_ATTRIBUTE 3 -#define SCE_H_ATTRIBUTEUNKNOWN 4 -#define SCE_H_NUMBER 5 -#define SCE_H_DOUBLESTRING 6 -#define SCE_H_SINGLESTRING 7 -#define SCE_H_OTHER 8 -#define SCE_H_COMMENT 9 -#define SCE_H_ENTITY 10 -#define SCE_H_TAGEND 11 -#define SCE_H_XMLSTART 12 -#define SCE_H_XMLEND 13 -#define SCE_H_SCRIPT 14 -#define SCE_H_ASP 15 -#define SCE_H_ASPAT 16 -#define SCE_H_CDATA 17 -#define SCE_H_QUESTION 18 -#define SCE_H_VALUE 19 -#define SCE_H_XCCOMMENT 20 -#define SCE_H_SGML_DEFAULT 21 -#define SCE_H_SGML_COMMAND 22 -#define SCE_H_SGML_1ST_PARAM 23 -#define SCE_H_SGML_DOUBLESTRING 24 -#define SCE_H_SGML_SIMPLESTRING 25 -#define SCE_H_SGML_ERROR 26 -#define SCE_H_SGML_SPECIAL 27 -#define SCE_H_SGML_ENTITY 28 -#define SCE_H_SGML_COMMENT 29 -#define SCE_H_SGML_1ST_PARAM_COMMENT 30 -#define SCE_H_SGML_BLOCK_DEFAULT 31 -#define SCE_HJ_START 40 -#define SCE_HJ_DEFAULT 41 -#define SCE_HJ_COMMENT 42 -#define SCE_HJ_COMMENTLINE 43 -#define SCE_HJ_COMMENTDOC 44 -#define SCE_HJ_NUMBER 45 -#define SCE_HJ_WORD 46 -#define SCE_HJ_KEYWORD 47 -#define SCE_HJ_DOUBLESTRING 48 -#define SCE_HJ_SINGLESTRING 49 -#define SCE_HJ_SYMBOLS 50 -#define SCE_HJ_STRINGEOL 51 -#define SCE_HJ_REGEX 52 -#define SCE_HJA_START 55 -#define SCE_HJA_DEFAULT 56 -#define SCE_HJA_COMMENT 57 -#define SCE_HJA_COMMENTLINE 58 -#define SCE_HJA_COMMENTDOC 59 -#define SCE_HJA_NUMBER 60 -#define SCE_HJA_WORD 61 -#define SCE_HJA_KEYWORD 62 -#define SCE_HJA_DOUBLESTRING 63 -#define SCE_HJA_SINGLESTRING 64 -#define SCE_HJA_SYMBOLS 65 -#define SCE_HJA_STRINGEOL 66 -#define SCE_HJA_REGEX 67 -#define SCE_HB_START 70 -#define SCE_HB_DEFAULT 71 -#define SCE_HB_COMMENTLINE 72 -#define SCE_HB_NUMBER 73 -#define SCE_HB_WORD 74 -#define SCE_HB_STRING 75 -#define SCE_HB_IDENTIFIER 76 -#define SCE_HB_STRINGEOL 77 -#define SCE_HBA_START 80 -#define SCE_HBA_DEFAULT 81 -#define SCE_HBA_COMMENTLINE 82 -#define SCE_HBA_NUMBER 83 -#define SCE_HBA_WORD 84 -#define SCE_HBA_STRING 85 -#define SCE_HBA_IDENTIFIER 86 -#define SCE_HBA_STRINGEOL 87 -#define SCE_HP_START 90 -#define SCE_HP_DEFAULT 91 -#define SCE_HP_COMMENTLINE 92 -#define SCE_HP_NUMBER 93 -#define SCE_HP_STRING 94 -#define SCE_HP_CHARACTER 95 -#define SCE_HP_WORD 96 -#define SCE_HP_TRIPLE 97 -#define SCE_HP_TRIPLEDOUBLE 98 -#define SCE_HP_CLASSNAME 99 -#define SCE_HP_DEFNAME 100 -#define SCE_HP_OPERATOR 101 -#define SCE_HP_IDENTIFIER 102 -#define SCE_HPHP_COMPLEX_VARIABLE 104 -#define SCE_HPA_START 105 -#define SCE_HPA_DEFAULT 106 -#define SCE_HPA_COMMENTLINE 107 -#define SCE_HPA_NUMBER 108 -#define SCE_HPA_STRING 109 -#define SCE_HPA_CHARACTER 110 -#define SCE_HPA_WORD 111 -#define SCE_HPA_TRIPLE 112 -#define SCE_HPA_TRIPLEDOUBLE 113 -#define SCE_HPA_CLASSNAME 114 -#define SCE_HPA_DEFNAME 115 -#define SCE_HPA_OPERATOR 116 -#define SCE_HPA_IDENTIFIER 117 -#define SCE_HPHP_DEFAULT 118 -#define SCE_HPHP_HSTRING 119 -#define SCE_HPHP_SIMPLESTRING 120 -#define SCE_HPHP_WORD 121 -#define SCE_HPHP_NUMBER 122 -#define SCE_HPHP_VARIABLE 123 -#define SCE_HPHP_COMMENT 124 -#define SCE_HPHP_COMMENTLINE 125 -#define SCE_HPHP_HSTRING_VARIABLE 126 -#define SCE_HPHP_OPERATOR 127 -#define SCE_PL_DEFAULT 0 -#define SCE_PL_ERROR 1 -#define SCE_PL_COMMENTLINE 2 -#define SCE_PL_POD 3 -#define SCE_PL_NUMBER 4 -#define SCE_PL_WORD 5 -#define SCE_PL_STRING 6 -#define SCE_PL_CHARACTER 7 -#define SCE_PL_PUNCTUATION 8 -#define SCE_PL_PREPROCESSOR 9 -#define SCE_PL_OPERATOR 10 -#define SCE_PL_IDENTIFIER 11 -#define SCE_PL_SCALAR 12 -#define SCE_PL_ARRAY 13 -#define SCE_PL_HASH 14 -#define SCE_PL_SYMBOLTABLE 15 -#define SCE_PL_VARIABLE_INDEXER 16 -#define SCE_PL_REGEX 17 -#define SCE_PL_REGSUBST 18 -#define SCE_PL_LONGQUOTE 19 -#define SCE_PL_BACKTICKS 20 -#define SCE_PL_DATASECTION 21 -#define SCE_PL_HERE_DELIM 22 -#define SCE_PL_HERE_Q 23 -#define SCE_PL_HERE_QQ 24 -#define SCE_PL_HERE_QX 25 -#define SCE_PL_STRING_Q 26 -#define SCE_PL_STRING_QQ 27 -#define SCE_PL_STRING_QX 28 -#define SCE_PL_STRING_QR 29 -#define SCE_PL_STRING_QW 30 -#define SCE_PL_POD_VERB 31 -#define SCE_PL_SUB_PROTOTYPE 40 -#define SCE_PL_FORMAT_IDENT 41 -#define SCE_PL_FORMAT 42 -#define SCE_PL_STRING_VAR 43 -#define SCE_PL_XLAT 44 -#define SCE_PL_REGEX_VAR 54 -#define SCE_PL_REGSUBST_VAR 55 -#define SCE_PL_BACKTICKS_VAR 57 -#define SCE_PL_HERE_QQ_VAR 61 -#define SCE_PL_HERE_QX_VAR 62 -#define SCE_PL_STRING_QQ_VAR 64 -#define SCE_PL_STRING_QX_VAR 65 -#define SCE_PL_STRING_QR_VAR 66 -#define SCE_RB_DEFAULT 0 -#define SCE_RB_ERROR 1 -#define SCE_RB_COMMENTLINE 2 -#define SCE_RB_POD 3 -#define SCE_RB_NUMBER 4 -#define SCE_RB_WORD 5 -#define SCE_RB_STRING 6 -#define SCE_RB_CHARACTER 7 -#define SCE_RB_CLASSNAME 8 -#define SCE_RB_DEFNAME 9 -#define SCE_RB_OPERATOR 10 -#define SCE_RB_IDENTIFIER 11 -#define SCE_RB_REGEX 12 -#define SCE_RB_GLOBAL 13 -#define SCE_RB_SYMBOL 14 -#define SCE_RB_MODULE_NAME 15 -#define SCE_RB_INSTANCE_VAR 16 -#define SCE_RB_CLASS_VAR 17 -#define SCE_RB_BACKTICKS 18 -#define SCE_RB_DATASECTION 19 -#define SCE_RB_HERE_DELIM 20 -#define SCE_RB_HERE_Q 21 -#define SCE_RB_HERE_QQ 22 -#define SCE_RB_HERE_QX 23 -#define SCE_RB_STRING_Q 24 -#define SCE_RB_STRING_QQ 25 -#define SCE_RB_STRING_QX 26 -#define SCE_RB_STRING_QR 27 -#define SCE_RB_STRING_QW 28 -#define SCE_RB_WORD_DEMOTED 29 -#define SCE_RB_STDIN 30 -#define SCE_RB_STDOUT 31 -#define SCE_RB_STDERR 40 -#define SCE_RB_UPPER_BOUND 41 -#define SCE_B_DEFAULT 0 -#define SCE_B_COMMENT 1 -#define SCE_B_NUMBER 2 -#define SCE_B_KEYWORD 3 -#define SCE_B_STRING 4 -#define SCE_B_PREPROCESSOR 5 -#define SCE_B_OPERATOR 6 -#define SCE_B_IDENTIFIER 7 -#define SCE_B_DATE 8 -#define SCE_B_STRINGEOL 9 -#define SCE_B_KEYWORD2 10 -#define SCE_B_KEYWORD3 11 -#define SCE_B_KEYWORD4 12 -#define SCE_B_CONSTANT 13 -#define SCE_B_ASM 14 -#define SCE_B_LABEL 15 -#define SCE_B_ERROR 16 -#define SCE_B_HEXNUMBER 17 -#define SCE_B_BINNUMBER 18 -#define SCE_B_COMMENTBLOCK 19 -#define SCE_B_DOCLINE 20 -#define SCE_B_DOCBLOCK 21 -#define SCE_B_DOCKEYWORD 22 -#define SCE_PROPS_DEFAULT 0 -#define SCE_PROPS_COMMENT 1 -#define SCE_PROPS_SECTION 2 -#define SCE_PROPS_ASSIGNMENT 3 -#define SCE_PROPS_DEFVAL 4 -#define SCE_PROPS_KEY 5 -#define SCE_L_DEFAULT 0 -#define SCE_L_COMMAND 1 -#define SCE_L_TAG 2 -#define SCE_L_MATH 3 -#define SCE_L_COMMENT 4 -#define SCE_L_TAG2 5 -#define SCE_L_MATH2 6 -#define SCE_L_COMMENT2 7 -#define SCE_L_VERBATIM 8 -#define SCE_L_SHORTCMD 9 -#define SCE_L_SPECIAL 10 -#define SCE_L_CMDOPT 11 -#define SCE_L_ERROR 12 -#define SCE_LUA_DEFAULT 0 -#define SCE_LUA_COMMENT 1 -#define SCE_LUA_COMMENTLINE 2 -#define SCE_LUA_COMMENTDOC 3 -#define SCE_LUA_NUMBER 4 -#define SCE_LUA_WORD 5 -#define SCE_LUA_STRING 6 -#define SCE_LUA_CHARACTER 7 -#define SCE_LUA_LITERALSTRING 8 -#define SCE_LUA_PREPROCESSOR 9 -#define SCE_LUA_OPERATOR 10 -#define SCE_LUA_IDENTIFIER 11 -#define SCE_LUA_STRINGEOL 12 -#define SCE_LUA_WORD2 13 -#define SCE_LUA_WORD3 14 -#define SCE_LUA_WORD4 15 -#define SCE_LUA_WORD5 16 -#define SCE_LUA_WORD6 17 -#define SCE_LUA_WORD7 18 -#define SCE_LUA_WORD8 19 -#define SCE_LUA_LABEL 20 -#define SCE_ERR_DEFAULT 0 -#define SCE_ERR_PYTHON 1 -#define SCE_ERR_GCC 2 -#define SCE_ERR_MS 3 -#define SCE_ERR_CMD 4 -#define SCE_ERR_BORLAND 5 -#define SCE_ERR_PERL 6 -#define SCE_ERR_NET 7 -#define SCE_ERR_LUA 8 -#define SCE_ERR_CTAG 9 -#define SCE_ERR_DIFF_CHANGED 10 -#define SCE_ERR_DIFF_ADDITION 11 -#define SCE_ERR_DIFF_DELETION 12 -#define SCE_ERR_DIFF_MESSAGE 13 -#define SCE_ERR_PHP 14 -#define SCE_ERR_ELF 15 -#define SCE_ERR_IFC 16 -#define SCE_ERR_IFORT 17 -#define SCE_ERR_ABSF 18 -#define SCE_ERR_TIDY 19 -#define SCE_ERR_JAVA_STACK 20 -#define SCE_ERR_VALUE 21 -#define SCE_ERR_GCC_INCLUDED_FROM 22 -#define SCE_ERR_ESCSEQ 23 -#define SCE_ERR_ESCSEQ_UNKNOWN 24 -#define SCE_ERR_ES_BLACK 40 -#define SCE_ERR_ES_RED 41 -#define SCE_ERR_ES_GREEN 42 -#define SCE_ERR_ES_BROWN 43 -#define SCE_ERR_ES_BLUE 44 -#define SCE_ERR_ES_MAGENTA 45 -#define SCE_ERR_ES_CYAN 46 -#define SCE_ERR_ES_GRAY 47 -#define SCE_ERR_ES_DARK_GRAY 48 -#define SCE_ERR_ES_BRIGHT_RED 49 -#define SCE_ERR_ES_BRIGHT_GREEN 50 -#define SCE_ERR_ES_YELLOW 51 -#define SCE_ERR_ES_BRIGHT_BLUE 52 -#define SCE_ERR_ES_BRIGHT_MAGENTA 53 -#define SCE_ERR_ES_BRIGHT_CYAN 54 -#define SCE_ERR_ES_WHITE 55 -#define SCE_BAT_DEFAULT 0 -#define SCE_BAT_COMMENT 1 -#define SCE_BAT_WORD 2 -#define SCE_BAT_LABEL 3 -#define SCE_BAT_HIDE 4 -#define SCE_BAT_COMMAND 5 -#define SCE_BAT_IDENTIFIER 6 -#define SCE_BAT_OPERATOR 7 -#define SCE_TCMD_DEFAULT 0 -#define SCE_TCMD_COMMENT 1 -#define SCE_TCMD_WORD 2 -#define SCE_TCMD_LABEL 3 -#define SCE_TCMD_HIDE 4 -#define SCE_TCMD_COMMAND 5 -#define SCE_TCMD_IDENTIFIER 6 -#define SCE_TCMD_OPERATOR 7 -#define SCE_TCMD_ENVIRONMENT 8 -#define SCE_TCMD_EXPANSION 9 -#define SCE_TCMD_CLABEL 10 -#define SCE_MAKE_DEFAULT 0 -#define SCE_MAKE_COMMENT 1 -#define SCE_MAKE_PREPROCESSOR 2 -#define SCE_MAKE_IDENTIFIER 3 -#define SCE_MAKE_OPERATOR 4 -#define SCE_MAKE_TARGET 5 -#define SCE_MAKE_IDEOL 9 -#define SCE_DIFF_DEFAULT 0 -#define SCE_DIFF_COMMENT 1 -#define SCE_DIFF_COMMAND 2 -#define SCE_DIFF_HEADER 3 -#define SCE_DIFF_POSITION 4 -#define SCE_DIFF_DELETED 5 -#define SCE_DIFF_ADDED 6 -#define SCE_DIFF_CHANGED 7 -#define SCE_CONF_DEFAULT 0 -#define SCE_CONF_COMMENT 1 -#define SCE_CONF_NUMBER 2 -#define SCE_CONF_IDENTIFIER 3 -#define SCE_CONF_EXTENSION 4 -#define SCE_CONF_PARAMETER 5 -#define SCE_CONF_STRING 6 -#define SCE_CONF_OPERATOR 7 -#define SCE_CONF_IP 8 -#define SCE_CONF_DIRECTIVE 9 -#define SCE_AVE_DEFAULT 0 -#define SCE_AVE_COMMENT 1 -#define SCE_AVE_NUMBER 2 -#define SCE_AVE_WORD 3 -#define SCE_AVE_STRING 6 -#define SCE_AVE_ENUM 7 -#define SCE_AVE_STRINGEOL 8 -#define SCE_AVE_IDENTIFIER 9 -#define SCE_AVE_OPERATOR 10 -#define SCE_AVE_WORD1 11 -#define SCE_AVE_WORD2 12 -#define SCE_AVE_WORD3 13 -#define SCE_AVE_WORD4 14 -#define SCE_AVE_WORD5 15 -#define SCE_AVE_WORD6 16 -#define SCE_ADA_DEFAULT 0 -#define SCE_ADA_WORD 1 -#define SCE_ADA_IDENTIFIER 2 -#define SCE_ADA_NUMBER 3 -#define SCE_ADA_DELIMITER 4 -#define SCE_ADA_CHARACTER 5 -#define SCE_ADA_CHARACTEREOL 6 -#define SCE_ADA_STRING 7 -#define SCE_ADA_STRINGEOL 8 -#define SCE_ADA_LABEL 9 -#define SCE_ADA_COMMENTLINE 10 -#define SCE_ADA_ILLEGAL 11 -#define SCE_BAAN_DEFAULT 0 -#define SCE_BAAN_COMMENT 1 -#define SCE_BAAN_COMMENTDOC 2 -#define SCE_BAAN_NUMBER 3 -#define SCE_BAAN_WORD 4 -#define SCE_BAAN_STRING 5 -#define SCE_BAAN_PREPROCESSOR 6 -#define SCE_BAAN_OPERATOR 7 -#define SCE_BAAN_IDENTIFIER 8 -#define SCE_BAAN_STRINGEOL 9 -#define SCE_BAAN_WORD2 10 -#define SCE_BAAN_WORD3 11 -#define SCE_BAAN_WORD4 12 -#define SCE_BAAN_WORD5 13 -#define SCE_BAAN_WORD6 14 -#define SCE_BAAN_WORD7 15 -#define SCE_BAAN_WORD8 16 -#define SCE_BAAN_WORD9 17 -#define SCE_BAAN_TABLEDEF 18 -#define SCE_BAAN_TABLESQL 19 -#define SCE_BAAN_FUNCTION 20 -#define SCE_BAAN_DOMDEF 21 -#define SCE_BAAN_FUNCDEF 22 -#define SCE_BAAN_OBJECTDEF 23 -#define SCE_BAAN_DEFINEDEF 24 -#define SCE_LISP_DEFAULT 0 -#define SCE_LISP_COMMENT 1 -#define SCE_LISP_NUMBER 2 -#define SCE_LISP_KEYWORD 3 -#define SCE_LISP_KEYWORD_KW 4 -#define SCE_LISP_SYMBOL 5 -#define SCE_LISP_STRING 6 -#define SCE_LISP_STRINGEOL 8 -#define SCE_LISP_IDENTIFIER 9 -#define SCE_LISP_OPERATOR 10 -#define SCE_LISP_SPECIAL 11 -#define SCE_LISP_MULTI_COMMENT 12 -#define SCE_EIFFEL_DEFAULT 0 -#define SCE_EIFFEL_COMMENTLINE 1 -#define SCE_EIFFEL_NUMBER 2 -#define SCE_EIFFEL_WORD 3 -#define SCE_EIFFEL_STRING 4 -#define SCE_EIFFEL_CHARACTER 5 -#define SCE_EIFFEL_OPERATOR 6 -#define SCE_EIFFEL_IDENTIFIER 7 -#define SCE_EIFFEL_STRINGEOL 8 -#define SCE_NNCRONTAB_DEFAULT 0 -#define SCE_NNCRONTAB_COMMENT 1 -#define SCE_NNCRONTAB_TASK 2 -#define SCE_NNCRONTAB_SECTION 3 -#define SCE_NNCRONTAB_KEYWORD 4 -#define SCE_NNCRONTAB_MODIFIER 5 -#define SCE_NNCRONTAB_ASTERISK 6 -#define SCE_NNCRONTAB_NUMBER 7 -#define SCE_NNCRONTAB_STRING 8 -#define SCE_NNCRONTAB_ENVIRONMENT 9 -#define SCE_NNCRONTAB_IDENTIFIER 10 -#define SCE_FORTH_DEFAULT 0 -#define SCE_FORTH_COMMENT 1 -#define SCE_FORTH_COMMENT_ML 2 -#define SCE_FORTH_IDENTIFIER 3 -#define SCE_FORTH_CONTROL 4 -#define SCE_FORTH_KEYWORD 5 -#define SCE_FORTH_DEFWORD 6 -#define SCE_FORTH_PREWORD1 7 -#define SCE_FORTH_PREWORD2 8 -#define SCE_FORTH_NUMBER 9 -#define SCE_FORTH_STRING 10 -#define SCE_FORTH_LOCALE 11 -#define SCE_MATLAB_DEFAULT 0 -#define SCE_MATLAB_COMMENT 1 -#define SCE_MATLAB_COMMAND 2 -#define SCE_MATLAB_NUMBER 3 -#define SCE_MATLAB_KEYWORD 4 -#define SCE_MATLAB_STRING 5 -#define SCE_MATLAB_OPERATOR 6 -#define SCE_MATLAB_IDENTIFIER 7 -#define SCE_MATLAB_DOUBLEQUOTESTRING 8 -#define SCE_SCRIPTOL_DEFAULT 0 -#define SCE_SCRIPTOL_WHITE 1 -#define SCE_SCRIPTOL_COMMENTLINE 2 -#define SCE_SCRIPTOL_PERSISTENT 3 -#define SCE_SCRIPTOL_CSTYLE 4 -#define SCE_SCRIPTOL_COMMENTBLOCK 5 -#define SCE_SCRIPTOL_NUMBER 6 -#define SCE_SCRIPTOL_STRING 7 -#define SCE_SCRIPTOL_CHARACTER 8 -#define SCE_SCRIPTOL_STRINGEOL 9 -#define SCE_SCRIPTOL_KEYWORD 10 -#define SCE_SCRIPTOL_OPERATOR 11 -#define SCE_SCRIPTOL_IDENTIFIER 12 -#define SCE_SCRIPTOL_TRIPLE 13 -#define SCE_SCRIPTOL_CLASSNAME 14 -#define SCE_SCRIPTOL_PREPROCESSOR 15 -#define SCE_ASM_DEFAULT 0 -#define SCE_ASM_COMMENT 1 -#define SCE_ASM_NUMBER 2 -#define SCE_ASM_STRING 3 -#define SCE_ASM_OPERATOR 4 -#define SCE_ASM_IDENTIFIER 5 -#define SCE_ASM_CPUINSTRUCTION 6 -#define SCE_ASM_MATHINSTRUCTION 7 -#define SCE_ASM_REGISTER 8 -#define SCE_ASM_DIRECTIVE 9 -#define SCE_ASM_DIRECTIVEOPERAND 10 -#define SCE_ASM_COMMENTBLOCK 11 -#define SCE_ASM_CHARACTER 12 -#define SCE_ASM_STRINGEOL 13 -#define SCE_ASM_EXTINSTRUCTION 14 -#define SCE_ASM_COMMENTDIRECTIVE 15 -#define SCE_F_DEFAULT 0 -#define SCE_F_COMMENT 1 -#define SCE_F_NUMBER 2 -#define SCE_F_STRING1 3 -#define SCE_F_STRING2 4 -#define SCE_F_STRINGEOL 5 -#define SCE_F_OPERATOR 6 -#define SCE_F_IDENTIFIER 7 -#define SCE_F_WORD 8 -#define SCE_F_WORD2 9 -#define SCE_F_WORD3 10 -#define SCE_F_PREPROCESSOR 11 -#define SCE_F_OPERATOR2 12 -#define SCE_F_LABEL 13 -#define SCE_F_CONTINUATION 14 -#define SCE_CSS_DEFAULT 0 -#define SCE_CSS_TAG 1 -#define SCE_CSS_CLASS 2 -#define SCE_CSS_PSEUDOCLASS 3 -#define SCE_CSS_UNKNOWN_PSEUDOCLASS 4 -#define SCE_CSS_OPERATOR 5 -#define SCE_CSS_IDENTIFIER 6 -#define SCE_CSS_UNKNOWN_IDENTIFIER 7 -#define SCE_CSS_VALUE 8 -#define SCE_CSS_COMMENT 9 -#define SCE_CSS_ID 10 -#define SCE_CSS_IMPORTANT 11 -#define SCE_CSS_DIRECTIVE 12 -#define SCE_CSS_DOUBLESTRING 13 -#define SCE_CSS_SINGLESTRING 14 -#define SCE_CSS_IDENTIFIER2 15 -#define SCE_CSS_ATTRIBUTE 16 -#define SCE_CSS_IDENTIFIER3 17 -#define SCE_CSS_PSEUDOELEMENT 18 -#define SCE_CSS_EXTENDED_IDENTIFIER 19 -#define SCE_CSS_EXTENDED_PSEUDOCLASS 20 -#define SCE_CSS_EXTENDED_PSEUDOELEMENT 21 -#define SCE_CSS_MEDIA 22 -#define SCE_CSS_VARIABLE 23 -#define SCE_POV_DEFAULT 0 -#define SCE_POV_COMMENT 1 -#define SCE_POV_COMMENTLINE 2 -#define SCE_POV_NUMBER 3 -#define SCE_POV_OPERATOR 4 -#define SCE_POV_IDENTIFIER 5 -#define SCE_POV_STRING 6 -#define SCE_POV_STRINGEOL 7 -#define SCE_POV_DIRECTIVE 8 -#define SCE_POV_BADDIRECTIVE 9 -#define SCE_POV_WORD2 10 -#define SCE_POV_WORD3 11 -#define SCE_POV_WORD4 12 -#define SCE_POV_WORD5 13 -#define SCE_POV_WORD6 14 -#define SCE_POV_WORD7 15 -#define SCE_POV_WORD8 16 -#define SCE_LOUT_DEFAULT 0 -#define SCE_LOUT_COMMENT 1 -#define SCE_LOUT_NUMBER 2 -#define SCE_LOUT_WORD 3 -#define SCE_LOUT_WORD2 4 -#define SCE_LOUT_WORD3 5 -#define SCE_LOUT_WORD4 6 -#define SCE_LOUT_STRING 7 -#define SCE_LOUT_OPERATOR 8 -#define SCE_LOUT_IDENTIFIER 9 -#define SCE_LOUT_STRINGEOL 10 -#define SCE_ESCRIPT_DEFAULT 0 -#define SCE_ESCRIPT_COMMENT 1 -#define SCE_ESCRIPT_COMMENTLINE 2 -#define SCE_ESCRIPT_COMMENTDOC 3 -#define SCE_ESCRIPT_NUMBER 4 -#define SCE_ESCRIPT_WORD 5 -#define SCE_ESCRIPT_STRING 6 -#define SCE_ESCRIPT_OPERATOR 7 -#define SCE_ESCRIPT_IDENTIFIER 8 -#define SCE_ESCRIPT_BRACE 9 -#define SCE_ESCRIPT_WORD2 10 -#define SCE_ESCRIPT_WORD3 11 -#define SCE_PS_DEFAULT 0 -#define SCE_PS_COMMENT 1 -#define SCE_PS_DSC_COMMENT 2 -#define SCE_PS_DSC_VALUE 3 -#define SCE_PS_NUMBER 4 -#define SCE_PS_NAME 5 -#define SCE_PS_KEYWORD 6 -#define SCE_PS_LITERAL 7 -#define SCE_PS_IMMEVAL 8 -#define SCE_PS_PAREN_ARRAY 9 -#define SCE_PS_PAREN_DICT 10 -#define SCE_PS_PAREN_PROC 11 -#define SCE_PS_TEXT 12 -#define SCE_PS_HEXSTRING 13 -#define SCE_PS_BASE85STRING 14 -#define SCE_PS_BADSTRINGCHAR 15 -#define SCE_NSIS_DEFAULT 0 -#define SCE_NSIS_COMMENT 1 -#define SCE_NSIS_STRINGDQ 2 -#define SCE_NSIS_STRINGLQ 3 -#define SCE_NSIS_STRINGRQ 4 -#define SCE_NSIS_FUNCTION 5 -#define SCE_NSIS_VARIABLE 6 -#define SCE_NSIS_LABEL 7 -#define SCE_NSIS_USERDEFINED 8 -#define SCE_NSIS_SECTIONDEF 9 -#define SCE_NSIS_SUBSECTIONDEF 10 -#define SCE_NSIS_IFDEFINEDEF 11 -#define SCE_NSIS_MACRODEF 12 -#define SCE_NSIS_STRINGVAR 13 -#define SCE_NSIS_NUMBER 14 -#define SCE_NSIS_SECTIONGROUP 15 -#define SCE_NSIS_PAGEEX 16 -#define SCE_NSIS_FUNCTIONDEF 17 -#define SCE_NSIS_COMMENTBOX 18 -#define SCE_MMIXAL_LEADWS 0 -#define SCE_MMIXAL_COMMENT 1 -#define SCE_MMIXAL_LABEL 2 -#define SCE_MMIXAL_OPCODE 3 -#define SCE_MMIXAL_OPCODE_PRE 4 -#define SCE_MMIXAL_OPCODE_VALID 5 -#define SCE_MMIXAL_OPCODE_UNKNOWN 6 -#define SCE_MMIXAL_OPCODE_POST 7 -#define SCE_MMIXAL_OPERANDS 8 -#define SCE_MMIXAL_NUMBER 9 -#define SCE_MMIXAL_REF 10 -#define SCE_MMIXAL_CHAR 11 -#define SCE_MMIXAL_STRING 12 -#define SCE_MMIXAL_REGISTER 13 -#define SCE_MMIXAL_HEX 14 -#define SCE_MMIXAL_OPERATOR 15 -#define SCE_MMIXAL_SYMBOL 16 -#define SCE_MMIXAL_INCLUDE 17 -#define SCE_CLW_DEFAULT 0 -#define SCE_CLW_LABEL 1 -#define SCE_CLW_COMMENT 2 -#define SCE_CLW_STRING 3 -#define SCE_CLW_USER_IDENTIFIER 4 -#define SCE_CLW_INTEGER_CONSTANT 5 -#define SCE_CLW_REAL_CONSTANT 6 -#define SCE_CLW_PICTURE_STRING 7 -#define SCE_CLW_KEYWORD 8 -#define SCE_CLW_COMPILER_DIRECTIVE 9 -#define SCE_CLW_RUNTIME_EXPRESSIONS 10 -#define SCE_CLW_BUILTIN_PROCEDURES_FUNCTION 11 -#define SCE_CLW_STRUCTURE_DATA_TYPE 12 -#define SCE_CLW_ATTRIBUTE 13 -#define SCE_CLW_STANDARD_EQUATE 14 -#define SCE_CLW_ERROR 15 -#define SCE_CLW_DEPRECATED 16 -#define SCE_LOT_DEFAULT 0 -#define SCE_LOT_HEADER 1 -#define SCE_LOT_BREAK 2 -#define SCE_LOT_SET 3 -#define SCE_LOT_PASS 4 -#define SCE_LOT_FAIL 5 -#define SCE_LOT_ABORT 6 -#define SCE_YAML_DEFAULT 0 -#define SCE_YAML_COMMENT 1 -#define SCE_YAML_IDENTIFIER 2 -#define SCE_YAML_KEYWORD 3 -#define SCE_YAML_NUMBER 4 -#define SCE_YAML_REFERENCE 5 -#define SCE_YAML_DOCUMENT 6 -#define SCE_YAML_TEXT 7 -#define SCE_YAML_ERROR 8 -#define SCE_YAML_OPERATOR 9 -#define SCE_TEX_DEFAULT 0 -#define SCE_TEX_SPECIAL 1 -#define SCE_TEX_GROUP 2 -#define SCE_TEX_SYMBOL 3 -#define SCE_TEX_COMMAND 4 -#define SCE_TEX_TEXT 5 -#define SCE_METAPOST_DEFAULT 0 -#define SCE_METAPOST_SPECIAL 1 -#define SCE_METAPOST_GROUP 2 -#define SCE_METAPOST_SYMBOL 3 -#define SCE_METAPOST_COMMAND 4 -#define SCE_METAPOST_TEXT 5 -#define SCE_METAPOST_EXTRA 6 -#define SCE_ERLANG_DEFAULT 0 -#define SCE_ERLANG_COMMENT 1 -#define SCE_ERLANG_VARIABLE 2 -#define SCE_ERLANG_NUMBER 3 -#define SCE_ERLANG_KEYWORD 4 -#define SCE_ERLANG_STRING 5 -#define SCE_ERLANG_OPERATOR 6 -#define SCE_ERLANG_ATOM 7 -#define SCE_ERLANG_FUNCTION_NAME 8 -#define SCE_ERLANG_CHARACTER 9 -#define SCE_ERLANG_MACRO 10 -#define SCE_ERLANG_RECORD 11 -#define SCE_ERLANG_PREPROC 12 -#define SCE_ERLANG_NODE_NAME 13 -#define SCE_ERLANG_COMMENT_FUNCTION 14 -#define SCE_ERLANG_COMMENT_MODULE 15 -#define SCE_ERLANG_COMMENT_DOC 16 -#define SCE_ERLANG_COMMENT_DOC_MACRO 17 -#define SCE_ERLANG_ATOM_QUOTED 18 -#define SCE_ERLANG_MACRO_QUOTED 19 -#define SCE_ERLANG_RECORD_QUOTED 20 -#define SCE_ERLANG_NODE_NAME_QUOTED 21 -#define SCE_ERLANG_BIFS 22 -#define SCE_ERLANG_MODULES 23 -#define SCE_ERLANG_MODULES_ATT 24 -#define SCE_ERLANG_UNKNOWN 31 -#define SCE_MSSQL_DEFAULT 0 -#define SCE_MSSQL_COMMENT 1 -#define SCE_MSSQL_LINE_COMMENT 2 -#define SCE_MSSQL_NUMBER 3 -#define SCE_MSSQL_STRING 4 -#define SCE_MSSQL_OPERATOR 5 -#define SCE_MSSQL_IDENTIFIER 6 -#define SCE_MSSQL_VARIABLE 7 -#define SCE_MSSQL_COLUMN_NAME 8 -#define SCE_MSSQL_STATEMENT 9 -#define SCE_MSSQL_DATATYPE 10 -#define SCE_MSSQL_SYSTABLE 11 -#define SCE_MSSQL_GLOBAL_VARIABLE 12 -#define SCE_MSSQL_FUNCTION 13 -#define SCE_MSSQL_STORED_PROCEDURE 14 -#define SCE_MSSQL_DEFAULT_PREF_DATATYPE 15 -#define SCE_MSSQL_COLUMN_NAME_2 16 -#define SCE_V_DEFAULT 0 -#define SCE_V_COMMENT 1 -#define SCE_V_COMMENTLINE 2 -#define SCE_V_COMMENTLINEBANG 3 -#define SCE_V_NUMBER 4 -#define SCE_V_WORD 5 -#define SCE_V_STRING 6 -#define SCE_V_WORD2 7 -#define SCE_V_WORD3 8 -#define SCE_V_PREPROCESSOR 9 -#define SCE_V_OPERATOR 10 -#define SCE_V_IDENTIFIER 11 -#define SCE_V_STRINGEOL 12 -#define SCE_V_USER 19 -#define SCE_V_COMMENT_WORD 20 -#define SCE_V_INPUT 21 -#define SCE_V_OUTPUT 22 -#define SCE_V_INOUT 23 -#define SCE_V_PORT_CONNECT 24 -#define SCE_KIX_DEFAULT 0 -#define SCE_KIX_COMMENT 1 -#define SCE_KIX_STRING1 2 -#define SCE_KIX_STRING2 3 -#define SCE_KIX_NUMBER 4 -#define SCE_KIX_VAR 5 -#define SCE_KIX_MACRO 6 -#define SCE_KIX_KEYWORD 7 -#define SCE_KIX_FUNCTIONS 8 -#define SCE_KIX_OPERATOR 9 -#define SCE_KIX_COMMENTSTREAM 10 -#define SCE_KIX_IDENTIFIER 31 -#define SCE_GC_DEFAULT 0 -#define SCE_GC_COMMENTLINE 1 -#define SCE_GC_COMMENTBLOCK 2 -#define SCE_GC_GLOBAL 3 -#define SCE_GC_EVENT 4 -#define SCE_GC_ATTRIBUTE 5 -#define SCE_GC_CONTROL 6 -#define SCE_GC_COMMAND 7 -#define SCE_GC_STRING 8 -#define SCE_GC_OPERATOR 9 -#define SCE_SN_DEFAULT 0 -#define SCE_SN_CODE 1 -#define SCE_SN_COMMENTLINE 2 -#define SCE_SN_COMMENTLINEBANG 3 -#define SCE_SN_NUMBER 4 -#define SCE_SN_WORD 5 -#define SCE_SN_STRING 6 -#define SCE_SN_WORD2 7 -#define SCE_SN_WORD3 8 -#define SCE_SN_PREPROCESSOR 9 -#define SCE_SN_OPERATOR 10 -#define SCE_SN_IDENTIFIER 11 -#define SCE_SN_STRINGEOL 12 -#define SCE_SN_REGEXTAG 13 -#define SCE_SN_SIGNAL 14 -#define SCE_SN_USER 19 -#define SCE_AU3_DEFAULT 0 -#define SCE_AU3_COMMENT 1 -#define SCE_AU3_COMMENTBLOCK 2 -#define SCE_AU3_NUMBER 3 -#define SCE_AU3_FUNCTION 4 -#define SCE_AU3_KEYWORD 5 -#define SCE_AU3_MACRO 6 -#define SCE_AU3_STRING 7 -#define SCE_AU3_OPERATOR 8 -#define SCE_AU3_VARIABLE 9 -#define SCE_AU3_SENT 10 -#define SCE_AU3_PREPROCESSOR 11 -#define SCE_AU3_SPECIAL 12 -#define SCE_AU3_EXPAND 13 -#define SCE_AU3_COMOBJ 14 -#define SCE_AU3_UDF 15 -#define SCE_APDL_DEFAULT 0 -#define SCE_APDL_COMMENT 1 -#define SCE_APDL_COMMENTBLOCK 2 -#define SCE_APDL_NUMBER 3 -#define SCE_APDL_STRING 4 -#define SCE_APDL_OPERATOR 5 -#define SCE_APDL_WORD 6 -#define SCE_APDL_PROCESSOR 7 -#define SCE_APDL_COMMAND 8 -#define SCE_APDL_SLASHCOMMAND 9 -#define SCE_APDL_STARCOMMAND 10 -#define SCE_APDL_ARGUMENT 11 -#define SCE_APDL_FUNCTION 12 -#define SCE_SH_DEFAULT 0 -#define SCE_SH_ERROR 1 -#define SCE_SH_COMMENTLINE 2 -#define SCE_SH_NUMBER 3 -#define SCE_SH_WORD 4 -#define SCE_SH_STRING 5 -#define SCE_SH_CHARACTER 6 -#define SCE_SH_OPERATOR 7 -#define SCE_SH_IDENTIFIER 8 -#define SCE_SH_SCALAR 9 -#define SCE_SH_PARAM 10 -#define SCE_SH_BACKTICKS 11 -#define SCE_SH_HERE_DELIM 12 -#define SCE_SH_HERE_Q 13 -#define SCE_ASN1_DEFAULT 0 -#define SCE_ASN1_COMMENT 1 -#define SCE_ASN1_IDENTIFIER 2 -#define SCE_ASN1_STRING 3 -#define SCE_ASN1_OID 4 -#define SCE_ASN1_SCALAR 5 -#define SCE_ASN1_KEYWORD 6 -#define SCE_ASN1_ATTRIBUTE 7 -#define SCE_ASN1_DESCRIPTOR 8 -#define SCE_ASN1_TYPE 9 -#define SCE_ASN1_OPERATOR 10 -#define SCE_VHDL_DEFAULT 0 -#define SCE_VHDL_COMMENT 1 -#define SCE_VHDL_COMMENTLINEBANG 2 -#define SCE_VHDL_NUMBER 3 -#define SCE_VHDL_STRING 4 -#define SCE_VHDL_OPERATOR 5 -#define SCE_VHDL_IDENTIFIER 6 -#define SCE_VHDL_STRINGEOL 7 -#define SCE_VHDL_KEYWORD 8 -#define SCE_VHDL_STDOPERATOR 9 -#define SCE_VHDL_ATTRIBUTE 10 -#define SCE_VHDL_STDFUNCTION 11 -#define SCE_VHDL_STDPACKAGE 12 -#define SCE_VHDL_STDTYPE 13 -#define SCE_VHDL_USERWORD 14 -#define SCE_VHDL_BLOCK_COMMENT 15 -#define SCE_CAML_DEFAULT 0 -#define SCE_CAML_IDENTIFIER 1 -#define SCE_CAML_TAGNAME 2 -#define SCE_CAML_KEYWORD 3 -#define SCE_CAML_KEYWORD2 4 -#define SCE_CAML_KEYWORD3 5 -#define SCE_CAML_LINENUM 6 -#define SCE_CAML_OPERATOR 7 -#define SCE_CAML_NUMBER 8 -#define SCE_CAML_CHAR 9 -#define SCE_CAML_WHITE 10 -#define SCE_CAML_STRING 11 -#define SCE_CAML_COMMENT 12 -#define SCE_CAML_COMMENT1 13 -#define SCE_CAML_COMMENT2 14 -#define SCE_CAML_COMMENT3 15 -#define SCE_HA_DEFAULT 0 -#define SCE_HA_IDENTIFIER 1 -#define SCE_HA_KEYWORD 2 -#define SCE_HA_NUMBER 3 -#define SCE_HA_STRING 4 -#define SCE_HA_CHARACTER 5 -#define SCE_HA_CLASS 6 -#define SCE_HA_MODULE 7 -#define SCE_HA_CAPITAL 8 -#define SCE_HA_DATA 9 -#define SCE_HA_IMPORT 10 -#define SCE_HA_OPERATOR 11 -#define SCE_HA_INSTANCE 12 -#define SCE_HA_COMMENTLINE 13 -#define SCE_HA_COMMENTBLOCK 14 -#define SCE_HA_COMMENTBLOCK2 15 -#define SCE_HA_COMMENTBLOCK3 16 -#define SCE_HA_PRAGMA 17 -#define SCE_HA_PREPROCESSOR 18 -#define SCE_HA_STRINGEOL 19 -#define SCE_HA_RESERVED_OPERATOR 20 -#define SCE_HA_LITERATE_COMMENT 21 -#define SCE_HA_LITERATE_CODEDELIM 22 -#define SCE_T3_DEFAULT 0 -#define SCE_T3_X_DEFAULT 1 -#define SCE_T3_PREPROCESSOR 2 -#define SCE_T3_BLOCK_COMMENT 3 -#define SCE_T3_LINE_COMMENT 4 -#define SCE_T3_OPERATOR 5 -#define SCE_T3_KEYWORD 6 -#define SCE_T3_NUMBER 7 -#define SCE_T3_IDENTIFIER 8 -#define SCE_T3_S_STRING 9 -#define SCE_T3_D_STRING 10 -#define SCE_T3_X_STRING 11 -#define SCE_T3_LIB_DIRECTIVE 12 -#define SCE_T3_MSG_PARAM 13 -#define SCE_T3_HTML_TAG 14 -#define SCE_T3_HTML_DEFAULT 15 -#define SCE_T3_HTML_STRING 16 -#define SCE_T3_USER1 17 -#define SCE_T3_USER2 18 -#define SCE_T3_USER3 19 -#define SCE_T3_BRACE 20 -#define SCE_REBOL_DEFAULT 0 -#define SCE_REBOL_COMMENTLINE 1 -#define SCE_REBOL_COMMENTBLOCK 2 -#define SCE_REBOL_PREFACE 3 -#define SCE_REBOL_OPERATOR 4 -#define SCE_REBOL_CHARACTER 5 -#define SCE_REBOL_QUOTEDSTRING 6 -#define SCE_REBOL_BRACEDSTRING 7 -#define SCE_REBOL_NUMBER 8 -#define SCE_REBOL_PAIR 9 -#define SCE_REBOL_TUPLE 10 -#define SCE_REBOL_BINARY 11 -#define SCE_REBOL_MONEY 12 -#define SCE_REBOL_ISSUE 13 -#define SCE_REBOL_TAG 14 -#define SCE_REBOL_FILE 15 -#define SCE_REBOL_EMAIL 16 -#define SCE_REBOL_URL 17 -#define SCE_REBOL_DATE 18 -#define SCE_REBOL_TIME 19 -#define SCE_REBOL_IDENTIFIER 20 -#define SCE_REBOL_WORD 21 -#define SCE_REBOL_WORD2 22 -#define SCE_REBOL_WORD3 23 -#define SCE_REBOL_WORD4 24 -#define SCE_REBOL_WORD5 25 -#define SCE_REBOL_WORD6 26 -#define SCE_REBOL_WORD7 27 -#define SCE_REBOL_WORD8 28 -#define SCE_SQL_DEFAULT 0 -#define SCE_SQL_COMMENT 1 -#define SCE_SQL_COMMENTLINE 2 -#define SCE_SQL_COMMENTDOC 3 -#define SCE_SQL_NUMBER 4 -#define SCE_SQL_WORD 5 -#define SCE_SQL_STRING 6 -#define SCE_SQL_CHARACTER 7 -#define SCE_SQL_SQLPLUS 8 -#define SCE_SQL_SQLPLUS_PROMPT 9 -#define SCE_SQL_OPERATOR 10 -#define SCE_SQL_IDENTIFIER 11 -#define SCE_SQL_SQLPLUS_COMMENT 13 -#define SCE_SQL_COMMENTLINEDOC 15 -#define SCE_SQL_WORD2 16 -#define SCE_SQL_COMMENTDOCKEYWORD 17 -#define SCE_SQL_COMMENTDOCKEYWORDERROR 18 -#define SCE_SQL_USER1 19 -#define SCE_SQL_USER2 20 -#define SCE_SQL_USER3 21 -#define SCE_SQL_USER4 22 -#define SCE_SQL_QUOTEDIDENTIFIER 23 -#define SCE_SQL_QOPERATOR 24 -#define SCE_ST_DEFAULT 0 -#define SCE_ST_STRING 1 -#define SCE_ST_NUMBER 2 -#define SCE_ST_COMMENT 3 -#define SCE_ST_SYMBOL 4 -#define SCE_ST_BINARY 5 -#define SCE_ST_BOOL 6 -#define SCE_ST_SELF 7 -#define SCE_ST_SUPER 8 -#define SCE_ST_NIL 9 -#define SCE_ST_GLOBAL 10 -#define SCE_ST_RETURN 11 -#define SCE_ST_SPECIAL 12 -#define SCE_ST_KWSEND 13 -#define SCE_ST_ASSIGN 14 -#define SCE_ST_CHARACTER 15 -#define SCE_ST_SPEC_SEL 16 -#define SCE_FS_DEFAULT 0 -#define SCE_FS_COMMENT 1 -#define SCE_FS_COMMENTLINE 2 -#define SCE_FS_COMMENTDOC 3 -#define SCE_FS_COMMENTLINEDOC 4 -#define SCE_FS_COMMENTDOCKEYWORD 5 -#define SCE_FS_COMMENTDOCKEYWORDERROR 6 -#define SCE_FS_KEYWORD 7 -#define SCE_FS_KEYWORD2 8 -#define SCE_FS_KEYWORD3 9 -#define SCE_FS_KEYWORD4 10 -#define SCE_FS_NUMBER 11 -#define SCE_FS_STRING 12 -#define SCE_FS_PREPROCESSOR 13 -#define SCE_FS_OPERATOR 14 -#define SCE_FS_IDENTIFIER 15 -#define SCE_FS_DATE 16 -#define SCE_FS_STRINGEOL 17 -#define SCE_FS_CONSTANT 18 -#define SCE_FS_WORDOPERATOR 19 -#define SCE_FS_DISABLEDCODE 20 -#define SCE_FS_DEFAULT_C 21 -#define SCE_FS_COMMENTDOC_C 22 -#define SCE_FS_COMMENTLINEDOC_C 23 -#define SCE_FS_KEYWORD_C 24 -#define SCE_FS_KEYWORD2_C 25 -#define SCE_FS_NUMBER_C 26 -#define SCE_FS_STRING_C 27 -#define SCE_FS_PREPROCESSOR_C 28 -#define SCE_FS_OPERATOR_C 29 -#define SCE_FS_IDENTIFIER_C 30 -#define SCE_FS_STRINGEOL_C 31 -#define SCE_CSOUND_DEFAULT 0 -#define SCE_CSOUND_COMMENT 1 -#define SCE_CSOUND_NUMBER 2 -#define SCE_CSOUND_OPERATOR 3 -#define SCE_CSOUND_INSTR 4 -#define SCE_CSOUND_IDENTIFIER 5 -#define SCE_CSOUND_OPCODE 6 -#define SCE_CSOUND_HEADERSTMT 7 -#define SCE_CSOUND_USERKEYWORD 8 -#define SCE_CSOUND_COMMENTBLOCK 9 -#define SCE_CSOUND_PARAM 10 -#define SCE_CSOUND_ARATE_VAR 11 -#define SCE_CSOUND_KRATE_VAR 12 -#define SCE_CSOUND_IRATE_VAR 13 -#define SCE_CSOUND_GLOBAL_VAR 14 -#define SCE_CSOUND_STRINGEOL 15 -#define SCE_INNO_DEFAULT 0 -#define SCE_INNO_COMMENT 1 -#define SCE_INNO_KEYWORD 2 -#define SCE_INNO_PARAMETER 3 -#define SCE_INNO_SECTION 4 -#define SCE_INNO_PREPROC 5 -#define SCE_INNO_INLINE_EXPANSION 6 -#define SCE_INNO_COMMENT_PASCAL 7 -#define SCE_INNO_KEYWORD_PASCAL 8 -#define SCE_INNO_KEYWORD_USER 9 -#define SCE_INNO_STRING_DOUBLE 10 -#define SCE_INNO_STRING_SINGLE 11 -#define SCE_INNO_IDENTIFIER 12 -#define SCE_OPAL_SPACE 0 -#define SCE_OPAL_COMMENT_BLOCK 1 -#define SCE_OPAL_COMMENT_LINE 2 -#define SCE_OPAL_INTEGER 3 -#define SCE_OPAL_KEYWORD 4 -#define SCE_OPAL_SORT 5 -#define SCE_OPAL_STRING 6 -#define SCE_OPAL_PAR 7 -#define SCE_OPAL_BOOL_CONST 8 -#define SCE_OPAL_DEFAULT 32 -#define SCE_SPICE_DEFAULT 0 -#define SCE_SPICE_IDENTIFIER 1 -#define SCE_SPICE_KEYWORD 2 -#define SCE_SPICE_KEYWORD2 3 -#define SCE_SPICE_KEYWORD3 4 -#define SCE_SPICE_NUMBER 5 -#define SCE_SPICE_DELIMITER 6 -#define SCE_SPICE_VALUE 7 -#define SCE_SPICE_COMMENTLINE 8 -#define SCE_CMAKE_DEFAULT 0 -#define SCE_CMAKE_COMMENT 1 -#define SCE_CMAKE_STRINGDQ 2 -#define SCE_CMAKE_STRINGLQ 3 -#define SCE_CMAKE_STRINGRQ 4 -#define SCE_CMAKE_COMMANDS 5 -#define SCE_CMAKE_PARAMETERS 6 -#define SCE_CMAKE_VARIABLE 7 -#define SCE_CMAKE_USERDEFINED 8 -#define SCE_CMAKE_WHILEDEF 9 -#define SCE_CMAKE_FOREACHDEF 10 -#define SCE_CMAKE_IFDEFINEDEF 11 -#define SCE_CMAKE_MACRODEF 12 -#define SCE_CMAKE_STRINGVAR 13 -#define SCE_CMAKE_NUMBER 14 -#define SCE_GAP_DEFAULT 0 -#define SCE_GAP_IDENTIFIER 1 -#define SCE_GAP_KEYWORD 2 -#define SCE_GAP_KEYWORD2 3 -#define SCE_GAP_KEYWORD3 4 -#define SCE_GAP_KEYWORD4 5 -#define SCE_GAP_STRING 6 -#define SCE_GAP_CHAR 7 -#define SCE_GAP_OPERATOR 8 -#define SCE_GAP_COMMENT 9 -#define SCE_GAP_NUMBER 10 -#define SCE_GAP_STRINGEOL 11 -#define SCE_PLM_DEFAULT 0 -#define SCE_PLM_COMMENT 1 -#define SCE_PLM_STRING 2 -#define SCE_PLM_NUMBER 3 -#define SCE_PLM_IDENTIFIER 4 -#define SCE_PLM_OPERATOR 5 -#define SCE_PLM_CONTROL 6 -#define SCE_PLM_KEYWORD 7 -#define SCE_ABL_DEFAULT 0 -#define SCE_ABL_NUMBER 1 -#define SCE_ABL_WORD 2 -#define SCE_ABL_STRING 3 -#define SCE_ABL_CHARACTER 4 -#define SCE_ABL_PREPROCESSOR 5 -#define SCE_ABL_OPERATOR 6 -#define SCE_ABL_IDENTIFIER 7 -#define SCE_ABL_BLOCK 8 -#define SCE_ABL_END 9 -#define SCE_ABL_COMMENT 10 -#define SCE_ABL_TASKMARKER 11 -#define SCE_ABL_LINECOMMENT 12 -#define SCE_ABAQUS_DEFAULT 0 -#define SCE_ABAQUS_COMMENT 1 -#define SCE_ABAQUS_COMMENTBLOCK 2 -#define SCE_ABAQUS_NUMBER 3 -#define SCE_ABAQUS_STRING 4 -#define SCE_ABAQUS_OPERATOR 5 -#define SCE_ABAQUS_WORD 6 -#define SCE_ABAQUS_PROCESSOR 7 -#define SCE_ABAQUS_COMMAND 8 -#define SCE_ABAQUS_SLASHCOMMAND 9 -#define SCE_ABAQUS_STARCOMMAND 10 -#define SCE_ABAQUS_ARGUMENT 11 -#define SCE_ABAQUS_FUNCTION 12 -#define SCE_ASY_DEFAULT 0 -#define SCE_ASY_COMMENT 1 -#define SCE_ASY_COMMENTLINE 2 -#define SCE_ASY_NUMBER 3 -#define SCE_ASY_WORD 4 -#define SCE_ASY_STRING 5 -#define SCE_ASY_CHARACTER 6 -#define SCE_ASY_OPERATOR 7 -#define SCE_ASY_IDENTIFIER 8 -#define SCE_ASY_STRINGEOL 9 -#define SCE_ASY_COMMENTLINEDOC 10 -#define SCE_ASY_WORD2 11 -#define SCE_R_DEFAULT 0 -#define SCE_R_COMMENT 1 -#define SCE_R_KWORD 2 -#define SCE_R_BASEKWORD 3 -#define SCE_R_OTHERKWORD 4 -#define SCE_R_NUMBER 5 -#define SCE_R_STRING 6 -#define SCE_R_STRING2 7 -#define SCE_R_OPERATOR 8 -#define SCE_R_IDENTIFIER 9 -#define SCE_R_INFIX 10 -#define SCE_R_INFIXEOL 11 -#define SCE_MAGIK_DEFAULT 0 -#define SCE_MAGIK_COMMENT 1 -#define SCE_MAGIK_HYPER_COMMENT 16 -#define SCE_MAGIK_STRING 2 -#define SCE_MAGIK_CHARACTER 3 -#define SCE_MAGIK_NUMBER 4 -#define SCE_MAGIK_IDENTIFIER 5 -#define SCE_MAGIK_OPERATOR 6 -#define SCE_MAGIK_FLOW 7 -#define SCE_MAGIK_CONTAINER 8 -#define SCE_MAGIK_BRACKET_BLOCK 9 -#define SCE_MAGIK_BRACE_BLOCK 10 -#define SCE_MAGIK_SQBRACKET_BLOCK 11 -#define SCE_MAGIK_UNKNOWN_KEYWORD 12 -#define SCE_MAGIK_KEYWORD 13 -#define SCE_MAGIK_PRAGMA 14 -#define SCE_MAGIK_SYMBOL 15 -#define SCE_POWERSHELL_DEFAULT 0 -#define SCE_POWERSHELL_COMMENT 1 -#define SCE_POWERSHELL_STRING 2 -#define SCE_POWERSHELL_CHARACTER 3 -#define SCE_POWERSHELL_NUMBER 4 -#define SCE_POWERSHELL_VARIABLE 5 -#define SCE_POWERSHELL_OPERATOR 6 -#define SCE_POWERSHELL_IDENTIFIER 7 -#define SCE_POWERSHELL_KEYWORD 8 -#define SCE_POWERSHELL_CMDLET 9 -#define SCE_POWERSHELL_ALIAS 10 -#define SCE_POWERSHELL_FUNCTION 11 -#define SCE_POWERSHELL_USER1 12 -#define SCE_POWERSHELL_COMMENTSTREAM 13 -#define SCE_POWERSHELL_HERE_STRING 14 -#define SCE_POWERSHELL_HERE_CHARACTER 15 -#define SCE_POWERSHELL_COMMENTDOCKEYWORD 16 -#define SCE_MYSQL_DEFAULT 0 -#define SCE_MYSQL_COMMENT 1 -#define SCE_MYSQL_COMMENTLINE 2 -#define SCE_MYSQL_VARIABLE 3 -#define SCE_MYSQL_SYSTEMVARIABLE 4 -#define SCE_MYSQL_KNOWNSYSTEMVARIABLE 5 -#define SCE_MYSQL_NUMBER 6 -#define SCE_MYSQL_MAJORKEYWORD 7 -#define SCE_MYSQL_KEYWORD 8 -#define SCE_MYSQL_DATABASEOBJECT 9 -#define SCE_MYSQL_PROCEDUREKEYWORD 10 -#define SCE_MYSQL_STRING 11 -#define SCE_MYSQL_SQSTRING 12 -#define SCE_MYSQL_DQSTRING 13 -#define SCE_MYSQL_OPERATOR 14 -#define SCE_MYSQL_FUNCTION 15 -#define SCE_MYSQL_IDENTIFIER 16 -#define SCE_MYSQL_QUOTEDIDENTIFIER 17 -#define SCE_MYSQL_USER1 18 -#define SCE_MYSQL_USER2 19 -#define SCE_MYSQL_USER3 20 -#define SCE_MYSQL_HIDDENCOMMAND 21 -#define SCE_MYSQL_PLACEHOLDER 22 -#define SCE_PO_DEFAULT 0 -#define SCE_PO_COMMENT 1 -#define SCE_PO_MSGID 2 -#define SCE_PO_MSGID_TEXT 3 -#define SCE_PO_MSGSTR 4 -#define SCE_PO_MSGSTR_TEXT 5 -#define SCE_PO_MSGCTXT 6 -#define SCE_PO_MSGCTXT_TEXT 7 -#define SCE_PO_FUZZY 8 -#define SCE_PO_PROGRAMMER_COMMENT 9 -#define SCE_PO_REFERENCE 10 -#define SCE_PO_FLAGS 11 -#define SCE_PO_MSGID_TEXT_EOL 12 -#define SCE_PO_MSGSTR_TEXT_EOL 13 -#define SCE_PO_MSGCTXT_TEXT_EOL 14 -#define SCE_PO_ERROR 15 -#define SCE_PAS_DEFAULT 0 -#define SCE_PAS_IDENTIFIER 1 -#define SCE_PAS_COMMENT 2 -#define SCE_PAS_COMMENT2 3 -#define SCE_PAS_COMMENTLINE 4 -#define SCE_PAS_PREPROCESSOR 5 -#define SCE_PAS_PREPROCESSOR2 6 -#define SCE_PAS_NUMBER 7 -#define SCE_PAS_HEXNUMBER 8 -#define SCE_PAS_WORD 9 -#define SCE_PAS_STRING 10 -#define SCE_PAS_STRINGEOL 11 -#define SCE_PAS_CHARACTER 12 -#define SCE_PAS_OPERATOR 13 -#define SCE_PAS_ASM 14 -#define SCE_SORCUS_DEFAULT 0 -#define SCE_SORCUS_COMMAND 1 -#define SCE_SORCUS_PARAMETER 2 -#define SCE_SORCUS_COMMENTLINE 3 -#define SCE_SORCUS_STRING 4 -#define SCE_SORCUS_STRINGEOL 5 -#define SCE_SORCUS_IDENTIFIER 6 -#define SCE_SORCUS_OPERATOR 7 -#define SCE_SORCUS_NUMBER 8 -#define SCE_SORCUS_CONSTANT 9 -#define SCE_POWERPRO_DEFAULT 0 -#define SCE_POWERPRO_COMMENTBLOCK 1 -#define SCE_POWERPRO_COMMENTLINE 2 -#define SCE_POWERPRO_NUMBER 3 -#define SCE_POWERPRO_WORD 4 -#define SCE_POWERPRO_WORD2 5 -#define SCE_POWERPRO_WORD3 6 -#define SCE_POWERPRO_WORD4 7 -#define SCE_POWERPRO_DOUBLEQUOTEDSTRING 8 -#define SCE_POWERPRO_SINGLEQUOTEDSTRING 9 -#define SCE_POWERPRO_LINECONTINUE 10 -#define SCE_POWERPRO_OPERATOR 11 -#define SCE_POWERPRO_IDENTIFIER 12 -#define SCE_POWERPRO_STRINGEOL 13 -#define SCE_POWERPRO_VERBATIM 14 -#define SCE_POWERPRO_ALTQUOTE 15 -#define SCE_POWERPRO_FUNCTION 16 -#define SCE_SML_DEFAULT 0 -#define SCE_SML_IDENTIFIER 1 -#define SCE_SML_TAGNAME 2 -#define SCE_SML_KEYWORD 3 -#define SCE_SML_KEYWORD2 4 -#define SCE_SML_KEYWORD3 5 -#define SCE_SML_LINENUM 6 -#define SCE_SML_OPERATOR 7 -#define SCE_SML_NUMBER 8 -#define SCE_SML_CHAR 9 -#define SCE_SML_STRING 11 -#define SCE_SML_COMMENT 12 -#define SCE_SML_COMMENT1 13 -#define SCE_SML_COMMENT2 14 -#define SCE_SML_COMMENT3 15 -#define SCE_MARKDOWN_DEFAULT 0 -#define SCE_MARKDOWN_LINE_BEGIN 1 -#define SCE_MARKDOWN_STRONG1 2 -#define SCE_MARKDOWN_STRONG2 3 -#define SCE_MARKDOWN_EM1 4 -#define SCE_MARKDOWN_EM2 5 -#define SCE_MARKDOWN_HEADER1 6 -#define SCE_MARKDOWN_HEADER2 7 -#define SCE_MARKDOWN_HEADER3 8 -#define SCE_MARKDOWN_HEADER4 9 -#define SCE_MARKDOWN_HEADER5 10 -#define SCE_MARKDOWN_HEADER6 11 -#define SCE_MARKDOWN_PRECHAR 12 -#define SCE_MARKDOWN_ULIST_ITEM 13 -#define SCE_MARKDOWN_OLIST_ITEM 14 -#define SCE_MARKDOWN_BLOCKQUOTE 15 -#define SCE_MARKDOWN_STRIKEOUT 16 -#define SCE_MARKDOWN_HRULE 17 -#define SCE_MARKDOWN_LINK 18 -#define SCE_MARKDOWN_CODE 19 -#define SCE_MARKDOWN_CODE2 20 -#define SCE_MARKDOWN_CODEBK 21 -#define SCE_TXT2TAGS_DEFAULT 0 -#define SCE_TXT2TAGS_LINE_BEGIN 1 -#define SCE_TXT2TAGS_STRONG1 2 -#define SCE_TXT2TAGS_STRONG2 3 -#define SCE_TXT2TAGS_EM1 4 -#define SCE_TXT2TAGS_EM2 5 -#define SCE_TXT2TAGS_HEADER1 6 -#define SCE_TXT2TAGS_HEADER2 7 -#define SCE_TXT2TAGS_HEADER3 8 -#define SCE_TXT2TAGS_HEADER4 9 -#define SCE_TXT2TAGS_HEADER5 10 -#define SCE_TXT2TAGS_HEADER6 11 -#define SCE_TXT2TAGS_PRECHAR 12 -#define SCE_TXT2TAGS_ULIST_ITEM 13 -#define SCE_TXT2TAGS_OLIST_ITEM 14 -#define SCE_TXT2TAGS_BLOCKQUOTE 15 -#define SCE_TXT2TAGS_STRIKEOUT 16 -#define SCE_TXT2TAGS_HRULE 17 -#define SCE_TXT2TAGS_LINK 18 -#define SCE_TXT2TAGS_CODE 19 -#define SCE_TXT2TAGS_CODE2 20 -#define SCE_TXT2TAGS_CODEBK 21 -#define SCE_TXT2TAGS_COMMENT 22 -#define SCE_TXT2TAGS_OPTION 23 -#define SCE_TXT2TAGS_PREPROC 24 -#define SCE_TXT2TAGS_POSTPROC 25 -#define SCE_A68K_DEFAULT 0 -#define SCE_A68K_COMMENT 1 -#define SCE_A68K_NUMBER_DEC 2 -#define SCE_A68K_NUMBER_BIN 3 -#define SCE_A68K_NUMBER_HEX 4 -#define SCE_A68K_STRING1 5 -#define SCE_A68K_OPERATOR 6 -#define SCE_A68K_CPUINSTRUCTION 7 -#define SCE_A68K_EXTINSTRUCTION 8 -#define SCE_A68K_REGISTER 9 -#define SCE_A68K_DIRECTIVE 10 -#define SCE_A68K_MACRO_ARG 11 -#define SCE_A68K_LABEL 12 -#define SCE_A68K_STRING2 13 -#define SCE_A68K_IDENTIFIER 14 -#define SCE_A68K_MACRO_DECLARATION 15 -#define SCE_A68K_COMMENT_WORD 16 -#define SCE_A68K_COMMENT_SPECIAL 17 -#define SCE_A68K_COMMENT_DOXYGEN 18 -#define SCE_MODULA_DEFAULT 0 -#define SCE_MODULA_COMMENT 1 -#define SCE_MODULA_DOXYCOMM 2 -#define SCE_MODULA_DOXYKEY 3 -#define SCE_MODULA_KEYWORD 4 -#define SCE_MODULA_RESERVED 5 -#define SCE_MODULA_NUMBER 6 -#define SCE_MODULA_BASENUM 7 -#define SCE_MODULA_FLOAT 8 -#define SCE_MODULA_STRING 9 -#define SCE_MODULA_STRSPEC 10 -#define SCE_MODULA_CHAR 11 -#define SCE_MODULA_CHARSPEC 12 -#define SCE_MODULA_PROC 13 -#define SCE_MODULA_PRAGMA 14 -#define SCE_MODULA_PRGKEY 15 -#define SCE_MODULA_OPERATOR 16 -#define SCE_MODULA_BADSTR 17 -#define SCE_COFFEESCRIPT_DEFAULT 0 -#define SCE_COFFEESCRIPT_COMMENT 1 -#define SCE_COFFEESCRIPT_COMMENTLINE 2 -#define SCE_COFFEESCRIPT_COMMENTDOC 3 -#define SCE_COFFEESCRIPT_NUMBER 4 -#define SCE_COFFEESCRIPT_WORD 5 -#define SCE_COFFEESCRIPT_STRING 6 -#define SCE_COFFEESCRIPT_CHARACTER 7 -#define SCE_COFFEESCRIPT_UUID 8 -#define SCE_COFFEESCRIPT_PREPROCESSOR 9 -#define SCE_COFFEESCRIPT_OPERATOR 10 -#define SCE_COFFEESCRIPT_IDENTIFIER 11 -#define SCE_COFFEESCRIPT_STRINGEOL 12 -#define SCE_COFFEESCRIPT_VERBATIM 13 -#define SCE_COFFEESCRIPT_REGEX 14 -#define SCE_COFFEESCRIPT_COMMENTLINEDOC 15 -#define SCE_COFFEESCRIPT_WORD2 16 -#define SCE_COFFEESCRIPT_COMMENTDOCKEYWORD 17 -#define SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR 18 -#define SCE_COFFEESCRIPT_GLOBALCLASS 19 -#define SCE_COFFEESCRIPT_STRINGRAW 20 -#define SCE_COFFEESCRIPT_TRIPLEVERBATIM 21 -#define SCE_COFFEESCRIPT_COMMENTBLOCK 22 -#define SCE_COFFEESCRIPT_VERBOSE_REGEX 23 -#define SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24 -#define SCE_COFFEESCRIPT_INSTANCEPROPERTY 25 -#define SCE_AVS_DEFAULT 0 -#define SCE_AVS_COMMENTBLOCK 1 -#define SCE_AVS_COMMENTBLOCKN 2 -#define SCE_AVS_COMMENTLINE 3 -#define SCE_AVS_NUMBER 4 -#define SCE_AVS_OPERATOR 5 -#define SCE_AVS_IDENTIFIER 6 -#define SCE_AVS_STRING 7 -#define SCE_AVS_TRIPLESTRING 8 -#define SCE_AVS_KEYWORD 9 -#define SCE_AVS_FILTER 10 -#define SCE_AVS_PLUGIN 11 -#define SCE_AVS_FUNCTION 12 -#define SCE_AVS_CLIPPROP 13 -#define SCE_AVS_USERDFN 14 -#define SCE_ECL_DEFAULT 0 -#define SCE_ECL_COMMENT 1 -#define SCE_ECL_COMMENTLINE 2 -#define SCE_ECL_NUMBER 3 -#define SCE_ECL_STRING 4 -#define SCE_ECL_WORD0 5 -#define SCE_ECL_OPERATOR 6 -#define SCE_ECL_CHARACTER 7 -#define SCE_ECL_UUID 8 -#define SCE_ECL_PREPROCESSOR 9 -#define SCE_ECL_UNKNOWN 10 -#define SCE_ECL_IDENTIFIER 11 -#define SCE_ECL_STRINGEOL 12 -#define SCE_ECL_VERBATIM 13 -#define SCE_ECL_REGEX 14 -#define SCE_ECL_COMMENTLINEDOC 15 -#define SCE_ECL_WORD1 16 -#define SCE_ECL_COMMENTDOCKEYWORD 17 -#define SCE_ECL_COMMENTDOCKEYWORDERROR 18 -#define SCE_ECL_WORD2 19 -#define SCE_ECL_WORD3 20 -#define SCE_ECL_WORD4 21 -#define SCE_ECL_WORD5 22 -#define SCE_ECL_COMMENTDOC 23 -#define SCE_ECL_ADDED 24 -#define SCE_ECL_DELETED 25 -#define SCE_ECL_CHANGED 26 -#define SCE_ECL_MOVED 27 -#define SCE_OSCRIPT_DEFAULT 0 -#define SCE_OSCRIPT_LINE_COMMENT 1 -#define SCE_OSCRIPT_BLOCK_COMMENT 2 -#define SCE_OSCRIPT_DOC_COMMENT 3 -#define SCE_OSCRIPT_PREPROCESSOR 4 -#define SCE_OSCRIPT_NUMBER 5 -#define SCE_OSCRIPT_SINGLEQUOTE_STRING 6 -#define SCE_OSCRIPT_DOUBLEQUOTE_STRING 7 -#define SCE_OSCRIPT_CONSTANT 8 -#define SCE_OSCRIPT_IDENTIFIER 9 -#define SCE_OSCRIPT_GLOBAL 10 -#define SCE_OSCRIPT_KEYWORD 11 -#define SCE_OSCRIPT_OPERATOR 12 -#define SCE_OSCRIPT_LABEL 13 -#define SCE_OSCRIPT_TYPE 14 -#define SCE_OSCRIPT_FUNCTION 15 -#define SCE_OSCRIPT_OBJECT 16 -#define SCE_OSCRIPT_PROPERTY 17 -#define SCE_OSCRIPT_METHOD 18 -#define SCE_VISUALPROLOG_DEFAULT 0 -#define SCE_VISUALPROLOG_KEY_MAJOR 1 -#define SCE_VISUALPROLOG_KEY_MINOR 2 -#define SCE_VISUALPROLOG_KEY_DIRECTIVE 3 -#define SCE_VISUALPROLOG_COMMENT_BLOCK 4 -#define SCE_VISUALPROLOG_COMMENT_LINE 5 -#define SCE_VISUALPROLOG_COMMENT_KEY 6 -#define SCE_VISUALPROLOG_COMMENT_KEY_ERROR 7 -#define SCE_VISUALPROLOG_IDENTIFIER 8 -#define SCE_VISUALPROLOG_VARIABLE 9 -#define SCE_VISUALPROLOG_ANONYMOUS 10 -#define SCE_VISUALPROLOG_NUMBER 11 -#define SCE_VISUALPROLOG_OPERATOR 12 -#define SCE_VISUALPROLOG_CHARACTER 13 -#define SCE_VISUALPROLOG_CHARACTER_TOO_MANY 14 -#define SCE_VISUALPROLOG_CHARACTER_ESCAPE_ERROR 15 -#define SCE_VISUALPROLOG_STRING 16 -#define SCE_VISUALPROLOG_STRING_ESCAPE 17 -#define SCE_VISUALPROLOG_STRING_ESCAPE_ERROR 18 -#define SCE_VISUALPROLOG_STRING_EOL_OPEN 19 -#define SCE_VISUALPROLOG_STRING_VERBATIM 20 -#define SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL 21 -#define SCE_VISUALPROLOG_STRING_VERBATIM_EOL 22 -#define SCE_STTXT_DEFAULT 0 -#define SCE_STTXT_COMMENT 1 -#define SCE_STTXT_COMMENTLINE 2 -#define SCE_STTXT_KEYWORD 3 -#define SCE_STTXT_TYPE 4 -#define SCE_STTXT_FUNCTION 5 -#define SCE_STTXT_FB 6 -#define SCE_STTXT_NUMBER 7 -#define SCE_STTXT_HEXNUMBER 8 -#define SCE_STTXT_PRAGMA 9 -#define SCE_STTXT_OPERATOR 10 -#define SCE_STTXT_CHARACTER 11 -#define SCE_STTXT_STRING1 12 -#define SCE_STTXT_STRING2 13 -#define SCE_STTXT_STRINGEOL 14 -#define SCE_STTXT_IDENTIFIER 15 -#define SCE_STTXT_DATETIME 16 -#define SCE_STTXT_VARS 17 -#define SCE_STTXT_PRAGMAS 18 -#define SCE_KVIRC_DEFAULT 0 -#define SCE_KVIRC_COMMENT 1 -#define SCE_KVIRC_COMMENTBLOCK 2 -#define SCE_KVIRC_STRING 3 -#define SCE_KVIRC_WORD 4 -#define SCE_KVIRC_KEYWORD 5 -#define SCE_KVIRC_FUNCTION_KEYWORD 6 -#define SCE_KVIRC_FUNCTION 7 -#define SCE_KVIRC_VARIABLE 8 -#define SCE_KVIRC_NUMBER 9 -#define SCE_KVIRC_OPERATOR 10 -#define SCE_KVIRC_STRING_FUNCTION 11 -#define SCE_KVIRC_STRING_VARIABLE 12 -#define SCE_RUST_DEFAULT 0 -#define SCE_RUST_COMMENTBLOCK 1 -#define SCE_RUST_COMMENTLINE 2 -#define SCE_RUST_COMMENTBLOCKDOC 3 -#define SCE_RUST_COMMENTLINEDOC 4 -#define SCE_RUST_NUMBER 5 -#define SCE_RUST_WORD 6 -#define SCE_RUST_WORD2 7 -#define SCE_RUST_WORD3 8 -#define SCE_RUST_WORD4 9 -#define SCE_RUST_WORD5 10 -#define SCE_RUST_WORD6 11 -#define SCE_RUST_WORD7 12 -#define SCE_RUST_STRING 13 -#define SCE_RUST_STRINGR 14 -#define SCE_RUST_CHARACTER 15 -#define SCE_RUST_OPERATOR 16 -#define SCE_RUST_IDENTIFIER 17 -#define SCE_RUST_LIFETIME 18 -#define SCE_RUST_MACRO 19 -#define SCE_RUST_LEXERROR 20 -#define SCE_RUST_BYTESTRING 21 -#define SCE_RUST_BYTESTRINGR 22 -#define SCE_RUST_BYTECHARACTER 23 -#define SCE_DMAP_DEFAULT 0 -#define SCE_DMAP_COMMENT 1 -#define SCE_DMAP_NUMBER 2 -#define SCE_DMAP_STRING1 3 -#define SCE_DMAP_STRING2 4 -#define SCE_DMAP_STRINGEOL 5 -#define SCE_DMAP_OPERATOR 6 -#define SCE_DMAP_IDENTIFIER 7 -#define SCE_DMAP_WORD 8 -#define SCE_DMAP_WORD2 9 -#define SCE_DMAP_WORD3 10 -#define SCE_DMIS_DEFAULT 0 -#define SCE_DMIS_COMMENT 1 -#define SCE_DMIS_STRING 2 -#define SCE_DMIS_NUMBER 3 -#define SCE_DMIS_KEYWORD 4 -#define SCE_DMIS_MAJORWORD 5 -#define SCE_DMIS_MINORWORD 6 -#define SCE_DMIS_UNSUPPORTED_MAJOR 7 -#define SCE_DMIS_UNSUPPORTED_MINOR 8 -#define SCE_DMIS_LABEL 9 -#define SCE_REG_DEFAULT 0 -#define SCE_REG_COMMENT 1 -#define SCE_REG_VALUENAME 2 -#define SCE_REG_STRING 3 -#define SCE_REG_HEXDIGIT 4 -#define SCE_REG_VALUETYPE 5 -#define SCE_REG_ADDEDKEY 6 -#define SCE_REG_DELETEDKEY 7 -#define SCE_REG_ESCAPED 8 -#define SCE_REG_KEYPATH_GUID 9 -#define SCE_REG_STRING_GUID 10 -#define SCE_REG_PARAMETER 11 -#define SCE_REG_OPERATOR 12 -#define SCE_BIBTEX_DEFAULT 0 -#define SCE_BIBTEX_ENTRY 1 -#define SCE_BIBTEX_UNKNOWN_ENTRY 2 -#define SCE_BIBTEX_KEY 3 -#define SCE_BIBTEX_PARAMETER 4 -#define SCE_BIBTEX_VALUE 5 -#define SCE_BIBTEX_COMMENT 6 -#define SCE_HEX_DEFAULT 0 -#define SCE_HEX_RECSTART 1 -#define SCE_HEX_RECTYPE 2 -#define SCE_HEX_RECTYPE_UNKNOWN 3 -#define SCE_HEX_BYTECOUNT 4 -#define SCE_HEX_BYTECOUNT_WRONG 5 -#define SCE_HEX_NOADDRESS 6 -#define SCE_HEX_DATAADDRESS 7 -#define SCE_HEX_RECCOUNT 8 -#define SCE_HEX_STARTADDRESS 9 -#define SCE_HEX_ADDRESSFIELD_UNKNOWN 10 -#define SCE_HEX_EXTENDEDADDRESS 11 -#define SCE_HEX_DATA_ODD 12 -#define SCE_HEX_DATA_EVEN 13 -#define SCE_HEX_DATA_UNKNOWN 14 -#define SCE_HEX_DATA_EMPTY 15 -#define SCE_HEX_CHECKSUM 16 -#define SCE_HEX_CHECKSUM_WRONG 17 -#define SCE_HEX_GARBAGE 18 -#define SCE_JSON_DEFAULT 0 -#define SCE_JSON_NUMBER 1 -#define SCE_JSON_STRING 2 -#define SCE_JSON_STRINGEOL 3 -#define SCE_JSON_PROPERTYNAME 4 -#define SCE_JSON_ESCAPESEQUENCE 5 -#define SCE_JSON_LINECOMMENT 6 -#define SCE_JSON_BLOCKCOMMENT 7 -#define SCE_JSON_OPERATOR 8 -#define SCE_JSON_URI 9 -#define SCE_JSON_COMPACTIRI 10 -#define SCE_JSON_KEYWORD 11 -#define SCE_JSON_LDKEYWORD 12 -#define SCE_JSON_ERROR 13 -#define SCE_EDI_DEFAULT 0 -#define SCE_EDI_SEGMENTSTART 1 -#define SCE_EDI_SEGMENTEND 2 -#define SCE_EDI_SEP_ELEMENT 3 -#define SCE_EDI_SEP_COMPOSITE 4 -#define SCE_EDI_SEP_RELEASE 5 -#define SCE_EDI_UNA 6 -#define SCE_EDI_UNH 7 -#define SCE_EDI_BADSEGMENT 8 -/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/include/Sci_Position.h b/qrenderdoc/3rdparty/scintilla/include/Sci_Position.h deleted file mode 100644 index a83e2864f..000000000 --- a/qrenderdoc/3rdparty/scintilla/include/Sci_Position.h +++ /dev/null @@ -1,21 +0,0 @@ -// Scintilla source code edit control -/** @file Sci_Position.h - ** Define the Sci_Position type used in Scintilla's external interfaces. - ** These need to be available to clients written in C so are not in a C++ namespace. - **/ -// Copyright 2015 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef SCI_POSITION_H -#define SCI_POSITION_H - -// Basic signed type used throughout interface -typedef int Sci_Position; - -// Unsigned variant used for ILexer::Lex and ILexer::Fold -typedef unsigned int Sci_PositionU; - -// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE -typedef long Sci_PositionCR; - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/include/Scintilla.h b/qrenderdoc/3rdparty/scintilla/include/Scintilla.h deleted file mode 100644 index 6a36d24f4..000000000 --- a/qrenderdoc/3rdparty/scintilla/include/Scintilla.h +++ /dev/null @@ -1,1208 +0,0 @@ -/* Scintilla source code edit control */ -/** @file Scintilla.h - ** Interface to the edit control. - **/ -/* Copyright 1998-2003 by Neil Hodgson - * The License.txt file describes the conditions under which this software may be distributed. */ - -/* Most of this file is automatically generated from the Scintilla.iface interface definition - * file which contains any comments about the definitions. HFacer.py does the generation. */ - -#ifndef SCINTILLA_H -#define SCINTILLA_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(_WIN32) -/* Return false on failure: */ -int Scintilla_RegisterClasses(void *hInstance); -int Scintilla_ReleaseResources(void); -#endif -int Scintilla_LinkLexers(void); - -#ifdef __cplusplus -} -#endif - -// Include header that defines basic numeric types. -#if defined(_MSC_VER) -// Older releases of MSVC did not have stdint.h. -#include -#else -#include -#endif - -// Define uptr_t, an unsigned integer type large enough to hold a pointer. -typedef uintptr_t uptr_t; -// Define sptr_t, a signed integer large enough to hold a pointer. -typedef intptr_t sptr_t; - -#include "Sci_Position.h" - -typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); - -/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ -#define INVALID_POSITION -1 -#define SCI_START 2000 -#define SCI_OPTIONAL_START 3000 -#define SCI_LEXER_START 4000 -#define SCI_ADDTEXT 2001 -#define SCI_ADDSTYLEDTEXT 2002 -#define SCI_INSERTTEXT 2003 -#define SCI_CHANGEINSERTION 2672 -#define SCI_CLEARALL 2004 -#define SCI_DELETERANGE 2645 -#define SCI_CLEARDOCUMENTSTYLE 2005 -#define SCI_GETLENGTH 2006 -#define SCI_GETCHARAT 2007 -#define SCI_GETCURRENTPOS 2008 -#define SCI_GETANCHOR 2009 -#define SCI_GETSTYLEAT 2010 -#define SCI_REDO 2011 -#define SCI_SETUNDOCOLLECTION 2012 -#define SCI_SELECTALL 2013 -#define SCI_SETSAVEPOINT 2014 -#define SCI_GETSTYLEDTEXT 2015 -#define SCI_CANREDO 2016 -#define SCI_MARKERLINEFROMHANDLE 2017 -#define SCI_MARKERDELETEHANDLE 2018 -#define SCI_GETUNDOCOLLECTION 2019 -#define SCWS_INVISIBLE 0 -#define SCWS_VISIBLEALWAYS 1 -#define SCWS_VISIBLEAFTERINDENT 2 -#define SCWS_VISIBLEONLYININDENT 3 -#define SCI_GETVIEWWS 2020 -#define SCI_SETVIEWWS 2021 -#define SCTD_LONGARROW 0 -#define SCTD_STRIKEOUT 1 -#define SCI_GETTABDRAWMODE 2698 -#define SCI_SETTABDRAWMODE 2699 -#define SCI_POSITIONFROMPOINT 2022 -#define SCI_POSITIONFROMPOINTCLOSE 2023 -#define SCI_GOTOLINE 2024 -#define SCI_GOTOPOS 2025 -#define SCI_SETANCHOR 2026 -#define SCI_GETCURLINE 2027 -#define SCI_GETENDSTYLED 2028 -#define SC_EOL_CRLF 0 -#define SC_EOL_CR 1 -#define SC_EOL_LF 2 -#define SCI_CONVERTEOLS 2029 -#define SCI_GETEOLMODE 2030 -#define SCI_SETEOLMODE 2031 -#define SCI_STARTSTYLING 2032 -#define SCI_SETSTYLING 2033 -#define SCI_GETBUFFEREDDRAW 2034 -#define SCI_SETBUFFEREDDRAW 2035 -#define SCI_SETTABWIDTH 2036 -#define SCI_GETTABWIDTH 2121 -#define SCI_CLEARTABSTOPS 2675 -#define SCI_ADDTABSTOP 2676 -#define SCI_GETNEXTTABSTOP 2677 -#define SC_CP_UTF8 65001 -#define SCI_SETCODEPAGE 2037 -#define SC_IME_WINDOWED 0 -#define SC_IME_INLINE 1 -#define SCI_GETIMEINTERACTION 2678 -#define SCI_SETIMEINTERACTION 2679 -#define MARKER_MAX 31 -#define SC_MARK_CIRCLE 0 -#define SC_MARK_ROUNDRECT 1 -#define SC_MARK_ARROW 2 -#define SC_MARK_SMALLRECT 3 -#define SC_MARK_SHORTARROW 4 -#define SC_MARK_EMPTY 5 -#define SC_MARK_ARROWDOWN 6 -#define SC_MARK_MINUS 7 -#define SC_MARK_PLUS 8 -#define SC_MARK_VLINE 9 -#define SC_MARK_LCORNER 10 -#define SC_MARK_TCORNER 11 -#define SC_MARK_BOXPLUS 12 -#define SC_MARK_BOXPLUSCONNECTED 13 -#define SC_MARK_BOXMINUS 14 -#define SC_MARK_BOXMINUSCONNECTED 15 -#define SC_MARK_LCORNERCURVE 16 -#define SC_MARK_TCORNERCURVE 17 -#define SC_MARK_CIRCLEPLUS 18 -#define SC_MARK_CIRCLEPLUSCONNECTED 19 -#define SC_MARK_CIRCLEMINUS 20 -#define SC_MARK_CIRCLEMINUSCONNECTED 21 -#define SC_MARK_BACKGROUND 22 -#define SC_MARK_DOTDOTDOT 23 -#define SC_MARK_ARROWS 24 -#define SC_MARK_PIXMAP 25 -#define SC_MARK_FULLRECT 26 -#define SC_MARK_LEFTRECT 27 -#define SC_MARK_AVAILABLE 28 -#define SC_MARK_UNDERLINE 29 -#define SC_MARK_RGBAIMAGE 30 -#define SC_MARK_BOOKMARK 31 -#define SC_MARK_CHARACTER 10000 -#define SC_MARKNUM_FOLDEREND 25 -#define SC_MARKNUM_FOLDEROPENMID 26 -#define SC_MARKNUM_FOLDERMIDTAIL 27 -#define SC_MARKNUM_FOLDERTAIL 28 -#define SC_MARKNUM_FOLDERSUB 29 -#define SC_MARKNUM_FOLDER 30 -#define SC_MARKNUM_FOLDEROPEN 31 -#define SC_MASK_FOLDERS 0xFE000000 -#define SCI_MARKERDEFINE 2040 -#define SCI_MARKERSETFORE 2041 -#define SCI_MARKERSETBACK 2042 -#define SCI_MARKERSETBACKSELECTED 2292 -#define SCI_MARKERENABLEHIGHLIGHT 2293 -#define SCI_MARKERADD 2043 -#define SCI_MARKERDELETE 2044 -#define SCI_MARKERDELETEALL 2045 -#define SCI_MARKERGET 2046 -#define SCI_MARKERNEXT 2047 -#define SCI_MARKERPREVIOUS 2048 -#define SCI_MARKERDEFINEPIXMAP 2049 -#define SCI_MARKERADDSET 2466 -#define SCI_MARKERSETALPHA 2476 -#define SC_MAX_MARGIN 4 -#define SC_MARGIN_SYMBOL 0 -#define SC_MARGIN_NUMBER 1 -#define SC_MARGIN_BACK 2 -#define SC_MARGIN_FORE 3 -#define SC_MARGIN_TEXT 4 -#define SC_MARGIN_RTEXT 5 -#define SC_MARGIN_COLOUR 6 -#define SCI_SETMARGINTYPEN 2240 -#define SCI_GETMARGINTYPEN 2241 -#define SCI_SETMARGINWIDTHN 2242 -#define SCI_GETMARGINWIDTHN 2243 -#define SCI_SETMARGINMASKN 2244 -#define SCI_GETMARGINMASKN 2245 -#define SCI_SETMARGINSENSITIVEN 2246 -#define SCI_GETMARGINSENSITIVEN 2247 -#define SCI_SETMARGINCURSORN 2248 -#define SCI_GETMARGINCURSORN 2249 -#define SCI_SETMARGINBACKN 2250 -#define SCI_GETMARGINBACKN 2251 -#define SCI_SETMARGINS 2252 -#define SCI_GETMARGINS 2253 -#define STYLE_DEFAULT 32 -#define STYLE_LINENUMBER 33 -#define STYLE_BRACELIGHT 34 -#define STYLE_BRACEBAD 35 -#define STYLE_CONTROLCHAR 36 -#define STYLE_INDENTGUIDE 37 -#define STYLE_CALLTIP 38 -#define STYLE_FOLDDISPLAYTEXT 39 -#define STYLE_LASTPREDEFINED 39 -#define STYLE_MAX 255 -#define SC_CHARSET_ANSI 0 -#define SC_CHARSET_DEFAULT 1 -#define SC_CHARSET_BALTIC 186 -#define SC_CHARSET_CHINESEBIG5 136 -#define SC_CHARSET_EASTEUROPE 238 -#define SC_CHARSET_GB2312 134 -#define SC_CHARSET_GREEK 161 -#define SC_CHARSET_HANGUL 129 -#define SC_CHARSET_MAC 77 -#define SC_CHARSET_OEM 255 -#define SC_CHARSET_RUSSIAN 204 -#define SC_CHARSET_OEM866 866 -#define SC_CHARSET_CYRILLIC 1251 -#define SC_CHARSET_SHIFTJIS 128 -#define SC_CHARSET_SYMBOL 2 -#define SC_CHARSET_TURKISH 162 -#define SC_CHARSET_JOHAB 130 -#define SC_CHARSET_HEBREW 177 -#define SC_CHARSET_ARABIC 178 -#define SC_CHARSET_VIETNAMESE 163 -#define SC_CHARSET_THAI 222 -#define SC_CHARSET_8859_15 1000 -#define SCI_STYLECLEARALL 2050 -#define SCI_STYLESETFORE 2051 -#define SCI_STYLESETBACK 2052 -#define SCI_STYLESETBOLD 2053 -#define SCI_STYLESETITALIC 2054 -#define SCI_STYLESETSIZE 2055 -#define SCI_STYLESETFONT 2056 -#define SCI_STYLESETEOLFILLED 2057 -#define SCI_STYLERESETDEFAULT 2058 -#define SCI_STYLESETUNDERLINE 2059 -#define SC_CASE_MIXED 0 -#define SC_CASE_UPPER 1 -#define SC_CASE_LOWER 2 -#define SC_CASE_CAMEL 3 -#define SCI_STYLEGETFORE 2481 -#define SCI_STYLEGETBACK 2482 -#define SCI_STYLEGETBOLD 2483 -#define SCI_STYLEGETITALIC 2484 -#define SCI_STYLEGETSIZE 2485 -#define SCI_STYLEGETFONT 2486 -#define SCI_STYLEGETEOLFILLED 2487 -#define SCI_STYLEGETUNDERLINE 2488 -#define SCI_STYLEGETCASE 2489 -#define SCI_STYLEGETCHARACTERSET 2490 -#define SCI_STYLEGETVISIBLE 2491 -#define SCI_STYLEGETCHANGEABLE 2492 -#define SCI_STYLEGETHOTSPOT 2493 -#define SCI_STYLESETCASE 2060 -#define SC_FONT_SIZE_MULTIPLIER 100 -#define SCI_STYLESETSIZEFRACTIONAL 2061 -#define SCI_STYLEGETSIZEFRACTIONAL 2062 -#define SC_WEIGHT_NORMAL 400 -#define SC_WEIGHT_SEMIBOLD 600 -#define SC_WEIGHT_BOLD 700 -#define SCI_STYLESETWEIGHT 2063 -#define SCI_STYLEGETWEIGHT 2064 -#define SCI_STYLESETCHARACTERSET 2066 -#define SCI_STYLESETHOTSPOT 2409 -#define SCI_SETSELFORE 2067 -#define SCI_SETSELBACK 2068 -#define SCI_GETSELALPHA 2477 -#define SCI_SETSELALPHA 2478 -#define SCI_GETSELEOLFILLED 2479 -#define SCI_SETSELEOLFILLED 2480 -#define SCI_SETCARETFORE 2069 -#define SCI_ASSIGNCMDKEY 2070 -#define SCI_CLEARCMDKEY 2071 -#define SCI_CLEARALLCMDKEYS 2072 -#define SCI_SETSTYLINGEX 2073 -#define SCI_STYLESETVISIBLE 2074 -#define SCI_GETCARETPERIOD 2075 -#define SCI_SETCARETPERIOD 2076 -#define SCI_SETWORDCHARS 2077 -#define SCI_GETWORDCHARS 2646 -#define SCI_BEGINUNDOACTION 2078 -#define SCI_ENDUNDOACTION 2079 -#define INDIC_PLAIN 0 -#define INDIC_SQUIGGLE 1 -#define INDIC_TT 2 -#define INDIC_DIAGONAL 3 -#define INDIC_STRIKE 4 -#define INDIC_HIDDEN 5 -#define INDIC_BOX 6 -#define INDIC_ROUNDBOX 7 -#define INDIC_STRAIGHTBOX 8 -#define INDIC_DASH 9 -#define INDIC_DOTS 10 -#define INDIC_SQUIGGLELOW 11 -#define INDIC_DOTBOX 12 -#define INDIC_SQUIGGLEPIXMAP 13 -#define INDIC_COMPOSITIONTHICK 14 -#define INDIC_COMPOSITIONTHIN 15 -#define INDIC_FULLBOX 16 -#define INDIC_TEXTFORE 17 -#define INDIC_POINT 18 -#define INDIC_POINTCHARACTER 19 -#define INDIC_IME 32 -#define INDIC_IME_MAX 35 -#define INDIC_MAX 35 -#define INDIC_CONTAINER 8 -#define INDIC0_MASK 0x20 -#define INDIC1_MASK 0x40 -#define INDIC2_MASK 0x80 -#define INDICS_MASK 0xE0 -#define SCI_INDICSETSTYLE 2080 -#define SCI_INDICGETSTYLE 2081 -#define SCI_INDICSETFORE 2082 -#define SCI_INDICGETFORE 2083 -#define SCI_INDICSETUNDER 2510 -#define SCI_INDICGETUNDER 2511 -#define SCI_INDICSETHOVERSTYLE 2680 -#define SCI_INDICGETHOVERSTYLE 2681 -#define SCI_INDICSETHOVERFORE 2682 -#define SCI_INDICGETHOVERFORE 2683 -#define SC_INDICVALUEBIT 0x1000000 -#define SC_INDICVALUEMASK 0xFFFFFF -#define SC_INDICFLAG_VALUEFORE 1 -#define SCI_INDICSETFLAGS 2684 -#define SCI_INDICGETFLAGS 2685 -#define SCI_SETWHITESPACEFORE 2084 -#define SCI_SETWHITESPACEBACK 2085 -#define SCI_SETWHITESPACESIZE 2086 -#define SCI_GETWHITESPACESIZE 2087 -#define SCI_SETSTYLEBITS 2090 -#define SCI_GETSTYLEBITS 2091 -#define SCI_SETLINESTATE 2092 -#define SCI_GETLINESTATE 2093 -#define SCI_GETMAXLINESTATE 2094 -#define SCI_GETCARETLINEVISIBLE 2095 -#define SCI_SETCARETLINEVISIBLE 2096 -#define SCI_GETCARETLINEBACK 2097 -#define SCI_SETCARETLINEBACK 2098 -#define SCI_STYLESETCHANGEABLE 2099 -#define SCI_AUTOCSHOW 2100 -#define SCI_AUTOCCANCEL 2101 -#define SCI_AUTOCACTIVE 2102 -#define SCI_AUTOCPOSSTART 2103 -#define SCI_AUTOCCOMPLETE 2104 -#define SCI_AUTOCSTOPS 2105 -#define SCI_AUTOCSETSEPARATOR 2106 -#define SCI_AUTOCGETSEPARATOR 2107 -#define SCI_AUTOCSELECT 2108 -#define SCI_AUTOCSETCANCELATSTART 2110 -#define SCI_AUTOCGETCANCELATSTART 2111 -#define SCI_AUTOCSETFILLUPS 2112 -#define SCI_AUTOCSETCHOOSESINGLE 2113 -#define SCI_AUTOCGETCHOOSESINGLE 2114 -#define SCI_AUTOCSETIGNORECASE 2115 -#define SCI_AUTOCGETIGNORECASE 2116 -#define SCI_USERLISTSHOW 2117 -#define SCI_AUTOCSETAUTOHIDE 2118 -#define SCI_AUTOCGETAUTOHIDE 2119 -#define SCI_AUTOCSETDROPRESTOFWORD 2270 -#define SCI_AUTOCGETDROPRESTOFWORD 2271 -#define SCI_REGISTERIMAGE 2405 -#define SCI_CLEARREGISTEREDIMAGES 2408 -#define SCI_AUTOCGETTYPESEPARATOR 2285 -#define SCI_AUTOCSETTYPESEPARATOR 2286 -#define SCI_AUTOCSETMAXWIDTH 2208 -#define SCI_AUTOCGETMAXWIDTH 2209 -#define SCI_AUTOCSETMAXHEIGHT 2210 -#define SCI_AUTOCGETMAXHEIGHT 2211 -#define SCI_SETINDENT 2122 -#define SCI_GETINDENT 2123 -#define SCI_SETUSETABS 2124 -#define SCI_GETUSETABS 2125 -#define SCI_SETLINEINDENTATION 2126 -#define SCI_GETLINEINDENTATION 2127 -#define SCI_GETLINEINDENTPOSITION 2128 -#define SCI_GETCOLUMN 2129 -#define SCI_COUNTCHARACTERS 2633 -#define SCI_SETHSCROLLBAR 2130 -#define SCI_GETHSCROLLBAR 2131 -#define SC_IV_NONE 0 -#define SC_IV_REAL 1 -#define SC_IV_LOOKFORWARD 2 -#define SC_IV_LOOKBOTH 3 -#define SCI_SETINDENTATIONGUIDES 2132 -#define SCI_GETINDENTATIONGUIDES 2133 -#define SCI_SETHIGHLIGHTGUIDE 2134 -#define SCI_GETHIGHLIGHTGUIDE 2135 -#define SCI_GETLINEENDPOSITION 2136 -#define SCI_GETCODEPAGE 2137 -#define SCI_GETCARETFORE 2138 -#define SCI_GETREADONLY 2140 -#define SCI_SETCURRENTPOS 2141 -#define SCI_SETSELECTIONSTART 2142 -#define SCI_GETSELECTIONSTART 2143 -#define SCI_SETSELECTIONEND 2144 -#define SCI_GETSELECTIONEND 2145 -#define SCI_SETEMPTYSELECTION 2556 -#define SCI_SETPRINTMAGNIFICATION 2146 -#define SCI_GETPRINTMAGNIFICATION 2147 -#define SC_PRINT_NORMAL 0 -#define SC_PRINT_INVERTLIGHT 1 -#define SC_PRINT_BLACKONWHITE 2 -#define SC_PRINT_COLOURONWHITE 3 -#define SC_PRINT_COLOURONWHITEDEFAULTBG 4 -#define SCI_SETPRINTCOLOURMODE 2148 -#define SCI_GETPRINTCOLOURMODE 2149 -#define SCFIND_WHOLEWORD 0x2 -#define SCFIND_MATCHCASE 0x4 -#define SCFIND_WORDSTART 0x00100000 -#define SCFIND_REGEXP 0x00200000 -#define SCFIND_POSIX 0x00400000 -#define SCFIND_CXX11REGEX 0x00800000 -#define SCI_FINDTEXT 2150 -#define SCI_FORMATRANGE 2151 -#define SCI_GETFIRSTVISIBLELINE 2152 -#define SCI_GETLINE 2153 -#define SCI_GETLINECOUNT 2154 -#define SCI_SETMARGINLEFT 2155 -#define SCI_GETMARGINLEFT 2156 -#define SCI_SETMARGINRIGHT 2157 -#define SCI_GETMARGINRIGHT 2158 -#define SCI_GETMODIFY 2159 -#define SCI_SETSEL 2160 -#define SCI_GETSELTEXT 2161 -#define SCI_GETTEXTRANGE 2162 -#define SCI_HIDESELECTION 2163 -#define SCI_POINTXFROMPOSITION 2164 -#define SCI_POINTYFROMPOSITION 2165 -#define SCI_LINEFROMPOSITION 2166 -#define SCI_POSITIONFROMLINE 2167 -#define SCI_LINESCROLL 2168 -#define SCI_SCROLLCARET 2169 -#define SCI_SCROLLRANGE 2569 -#define SCI_REPLACESEL 2170 -#define SCI_SETREADONLY 2171 -#define SCI_NULL 2172 -#define SCI_CANPASTE 2173 -#define SCI_CANUNDO 2174 -#define SCI_EMPTYUNDOBUFFER 2175 -#define SCI_UNDO 2176 -#define SCI_CUT 2177 -#define SCI_COPY 2178 -#define SCI_PASTE 2179 -#define SCI_CLEAR 2180 -#define SCI_SETTEXT 2181 -#define SCI_GETTEXT 2182 -#define SCI_GETTEXTLENGTH 2183 -#define SCI_GETDIRECTFUNCTION 2184 -#define SCI_GETDIRECTPOINTER 2185 -#define SCI_SETOVERTYPE 2186 -#define SCI_GETOVERTYPE 2187 -#define SCI_SETCARETWIDTH 2188 -#define SCI_GETCARETWIDTH 2189 -#define SCI_SETTARGETSTART 2190 -#define SCI_GETTARGETSTART 2191 -#define SCI_SETTARGETEND 2192 -#define SCI_GETTARGETEND 2193 -#define SCI_SETTARGETRANGE 2686 -#define SCI_GETTARGETTEXT 2687 -#define SCI_TARGETFROMSELECTION 2287 -#define SCI_TARGETWHOLEDOCUMENT 2690 -#define SCI_REPLACETARGET 2194 -#define SCI_REPLACETARGETRE 2195 -#define SCI_SEARCHINTARGET 2197 -#define SCI_SETSEARCHFLAGS 2198 -#define SCI_GETSEARCHFLAGS 2199 -#define SCI_CALLTIPSHOW 2200 -#define SCI_CALLTIPCANCEL 2201 -#define SCI_CALLTIPACTIVE 2202 -#define SCI_CALLTIPPOSSTART 2203 -#define SCI_CALLTIPSETPOSSTART 2214 -#define SCI_CALLTIPSETHLT 2204 -#define SCI_CALLTIPSETBACK 2205 -#define SCI_CALLTIPSETFORE 2206 -#define SCI_CALLTIPSETFOREHLT 2207 -#define SCI_CALLTIPUSESTYLE 2212 -#define SCI_CALLTIPSETPOSITION 2213 -#define SCI_VISIBLEFROMDOCLINE 2220 -#define SCI_DOCLINEFROMVISIBLE 2221 -#define SCI_WRAPCOUNT 2235 -#define SC_FOLDLEVELBASE 0x400 -#define SC_FOLDLEVELWHITEFLAG 0x1000 -#define SC_FOLDLEVELHEADERFLAG 0x2000 -#define SC_FOLDLEVELNUMBERMASK 0x0FFF -#define SCI_SETFOLDLEVEL 2222 -#define SCI_GETFOLDLEVEL 2223 -#define SCI_GETLASTCHILD 2224 -#define SCI_GETFOLDPARENT 2225 -#define SCI_SHOWLINES 2226 -#define SCI_HIDELINES 2227 -#define SCI_GETLINEVISIBLE 2228 -#define SCI_GETALLLINESVISIBLE 2236 -#define SCI_SETFOLDEXPANDED 2229 -#define SCI_GETFOLDEXPANDED 2230 -#define SCI_TOGGLEFOLD 2231 -#define SCI_TOGGLEFOLDSHOWTEXT 2700 -#define SC_FOLDDISPLAYTEXT_HIDDEN 0 -#define SC_FOLDDISPLAYTEXT_STANDARD 1 -#define SC_FOLDDISPLAYTEXT_BOXED 2 -#define SCI_FOLDDISPLAYTEXTSETSTYLE 2701 -#define SC_FOLDACTION_CONTRACT 0 -#define SC_FOLDACTION_EXPAND 1 -#define SC_FOLDACTION_TOGGLE 2 -#define SCI_FOLDLINE 2237 -#define SCI_FOLDCHILDREN 2238 -#define SCI_EXPANDCHILDREN 2239 -#define SCI_FOLDALL 2662 -#define SCI_ENSUREVISIBLE 2232 -#define SC_AUTOMATICFOLD_SHOW 0x0001 -#define SC_AUTOMATICFOLD_CLICK 0x0002 -#define SC_AUTOMATICFOLD_CHANGE 0x0004 -#define SCI_SETAUTOMATICFOLD 2663 -#define SCI_GETAUTOMATICFOLD 2664 -#define SC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 -#define SC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 -#define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 -#define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 -#define SC_FOLDFLAG_LEVELNUMBERS 0x0040 -#define SC_FOLDFLAG_LINESTATE 0x0080 -#define SCI_SETFOLDFLAGS 2233 -#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234 -#define SCI_SETTABINDENTS 2260 -#define SCI_GETTABINDENTS 2261 -#define SCI_SETBACKSPACEUNINDENTS 2262 -#define SCI_GETBACKSPACEUNINDENTS 2263 -#define SC_TIME_FOREVER 10000000 -#define SCI_SETMOUSEDWELLTIME 2264 -#define SCI_GETMOUSEDWELLTIME 2265 -#define SCI_WORDSTARTPOSITION 2266 -#define SCI_WORDENDPOSITION 2267 -#define SCI_ISRANGEWORD 2691 -#define SC_IDLESTYLING_NONE 0 -#define SC_IDLESTYLING_TOVISIBLE 1 -#define SC_IDLESTYLING_AFTERVISIBLE 2 -#define SC_IDLESTYLING_ALL 3 -#define SCI_SETIDLESTYLING 2692 -#define SCI_GETIDLESTYLING 2693 -#define SC_WRAP_NONE 0 -#define SC_WRAP_WORD 1 -#define SC_WRAP_CHAR 2 -#define SC_WRAP_WHITESPACE 3 -#define SCI_SETWRAPMODE 2268 -#define SCI_GETWRAPMODE 2269 -#define SC_WRAPVISUALFLAG_NONE 0x0000 -#define SC_WRAPVISUALFLAG_END 0x0001 -#define SC_WRAPVISUALFLAG_START 0x0002 -#define SC_WRAPVISUALFLAG_MARGIN 0x0004 -#define SCI_SETWRAPVISUALFLAGS 2460 -#define SCI_GETWRAPVISUALFLAGS 2461 -#define SC_WRAPVISUALFLAGLOC_DEFAULT 0x0000 -#define SC_WRAPVISUALFLAGLOC_END_BY_TEXT 0x0001 -#define SC_WRAPVISUALFLAGLOC_START_BY_TEXT 0x0002 -#define SCI_SETWRAPVISUALFLAGSLOCATION 2462 -#define SCI_GETWRAPVISUALFLAGSLOCATION 2463 -#define SCI_SETWRAPSTARTINDENT 2464 -#define SCI_GETWRAPSTARTINDENT 2465 -#define SC_WRAPINDENT_FIXED 0 -#define SC_WRAPINDENT_SAME 1 -#define SC_WRAPINDENT_INDENT 2 -#define SCI_SETWRAPINDENTMODE 2472 -#define SCI_GETWRAPINDENTMODE 2473 -#define SC_CACHE_NONE 0 -#define SC_CACHE_CARET 1 -#define SC_CACHE_PAGE 2 -#define SC_CACHE_DOCUMENT 3 -#define SCI_SETLAYOUTCACHE 2272 -#define SCI_GETLAYOUTCACHE 2273 -#define SCI_SETSCROLLWIDTH 2274 -#define SCI_GETSCROLLWIDTH 2275 -#define SCI_SETSCROLLWIDTHTRACKING 2516 -#define SCI_GETSCROLLWIDTHTRACKING 2517 -#define SCI_TEXTWIDTH 2276 -#define SCI_SETENDATLASTLINE 2277 -#define SCI_GETENDATLASTLINE 2278 -#define SCI_TEXTHEIGHT 2279 -#define SCI_SETVSCROLLBAR 2280 -#define SCI_GETVSCROLLBAR 2281 -#define SCI_APPENDTEXT 2282 -#define SCI_GETTWOPHASEDRAW 2283 -#define SCI_SETTWOPHASEDRAW 2284 -#define SC_PHASES_ONE 0 -#define SC_PHASES_TWO 1 -#define SC_PHASES_MULTIPLE 2 -#define SCI_GETPHASESDRAW 2673 -#define SCI_SETPHASESDRAW 2674 -#define SC_EFF_QUALITY_MASK 0xF -#define SC_EFF_QUALITY_DEFAULT 0 -#define SC_EFF_QUALITY_NON_ANTIALIASED 1 -#define SC_EFF_QUALITY_ANTIALIASED 2 -#define SC_EFF_QUALITY_LCD_OPTIMIZED 3 -#define SCI_SETFONTQUALITY 2611 -#define SCI_GETFONTQUALITY 2612 -#define SCI_SETFIRSTVISIBLELINE 2613 -#define SC_MULTIPASTE_ONCE 0 -#define SC_MULTIPASTE_EACH 1 -#define SCI_SETMULTIPASTE 2614 -#define SCI_GETMULTIPASTE 2615 -#define SCI_GETTAG 2616 -#define SCI_LINESJOIN 2288 -#define SCI_LINESSPLIT 2289 -#define SCI_SETFOLDMARGINCOLOUR 2290 -#define SCI_SETFOLDMARGINHICOLOUR 2291 -#define SCI_LINEDOWN 2300 -#define SCI_LINEDOWNEXTEND 2301 -#define SCI_LINEUP 2302 -#define SCI_LINEUPEXTEND 2303 -#define SCI_CHARLEFT 2304 -#define SCI_CHARLEFTEXTEND 2305 -#define SCI_CHARRIGHT 2306 -#define SCI_CHARRIGHTEXTEND 2307 -#define SCI_WORDLEFT 2308 -#define SCI_WORDLEFTEXTEND 2309 -#define SCI_WORDRIGHT 2310 -#define SCI_WORDRIGHTEXTEND 2311 -#define SCI_HOME 2312 -#define SCI_HOMEEXTEND 2313 -#define SCI_LINEEND 2314 -#define SCI_LINEENDEXTEND 2315 -#define SCI_DOCUMENTSTART 2316 -#define SCI_DOCUMENTSTARTEXTEND 2317 -#define SCI_DOCUMENTEND 2318 -#define SCI_DOCUMENTENDEXTEND 2319 -#define SCI_PAGEUP 2320 -#define SCI_PAGEUPEXTEND 2321 -#define SCI_PAGEDOWN 2322 -#define SCI_PAGEDOWNEXTEND 2323 -#define SCI_EDITTOGGLEOVERTYPE 2324 -#define SCI_CANCEL 2325 -#define SCI_DELETEBACK 2326 -#define SCI_TAB 2327 -#define SCI_BACKTAB 2328 -#define SCI_NEWLINE 2329 -#define SCI_FORMFEED 2330 -#define SCI_VCHOME 2331 -#define SCI_VCHOMEEXTEND 2332 -#define SCI_ZOOMIN 2333 -#define SCI_ZOOMOUT 2334 -#define SCI_DELWORDLEFT 2335 -#define SCI_DELWORDRIGHT 2336 -#define SCI_DELWORDRIGHTEND 2518 -#define SCI_LINECUT 2337 -#define SCI_LINEDELETE 2338 -#define SCI_LINETRANSPOSE 2339 -#define SCI_LINEDUPLICATE 2404 -#define SCI_LOWERCASE 2340 -#define SCI_UPPERCASE 2341 -#define SCI_LINESCROLLDOWN 2342 -#define SCI_LINESCROLLUP 2343 -#define SCI_DELETEBACKNOTLINE 2344 -#define SCI_HOMEDISPLAY 2345 -#define SCI_HOMEDISPLAYEXTEND 2346 -#define SCI_LINEENDDISPLAY 2347 -#define SCI_LINEENDDISPLAYEXTEND 2348 -#define SCI_HOMEWRAP 2349 -#define SCI_HOMEWRAPEXTEND 2450 -#define SCI_LINEENDWRAP 2451 -#define SCI_LINEENDWRAPEXTEND 2452 -#define SCI_VCHOMEWRAP 2453 -#define SCI_VCHOMEWRAPEXTEND 2454 -#define SCI_LINECOPY 2455 -#define SCI_MOVECARETINSIDEVIEW 2401 -#define SCI_LINELENGTH 2350 -#define SCI_BRACEHIGHLIGHT 2351 -#define SCI_BRACEHIGHLIGHTINDICATOR 2498 -#define SCI_BRACEBADLIGHT 2352 -#define SCI_BRACEBADLIGHTINDICATOR 2499 -#define SCI_BRACEMATCH 2353 -#define SCI_GETVIEWEOL 2355 -#define SCI_SETVIEWEOL 2356 -#define SCI_GETDOCPOINTER 2357 -#define SCI_SETDOCPOINTER 2358 -#define SCI_SETMODEVENTMASK 2359 -#define EDGE_NONE 0 -#define EDGE_LINE 1 -#define EDGE_BACKGROUND 2 -#define EDGE_MULTILINE 3 -#define SCI_GETEDGECOLUMN 2360 -#define SCI_SETEDGECOLUMN 2361 -#define SCI_GETEDGEMODE 2362 -#define SCI_SETEDGEMODE 2363 -#define SCI_GETEDGECOLOUR 2364 -#define SCI_SETEDGECOLOUR 2365 -#define SCI_MULTIEDGEADDLINE 2694 -#define SCI_MULTIEDGECLEARALL 2695 -#define SCI_SEARCHANCHOR 2366 -#define SCI_SEARCHNEXT 2367 -#define SCI_SEARCHPREV 2368 -#define SCI_LINESONSCREEN 2370 -#define SC_POPUP_NEVER 0 -#define SC_POPUP_ALL 1 -#define SC_POPUP_TEXT 2 -#define SCI_USEPOPUP 2371 -#define SCI_SELECTIONISRECTANGLE 2372 -#define SCI_SETZOOM 2373 -#define SCI_GETZOOM 2374 -#define SCI_CREATEDOCUMENT 2375 -#define SCI_ADDREFDOCUMENT 2376 -#define SCI_RELEASEDOCUMENT 2377 -#define SCI_GETMODEVENTMASK 2378 -#define SCI_SETFOCUS 2380 -#define SCI_GETFOCUS 2381 -#define SC_STATUS_OK 0 -#define SC_STATUS_FAILURE 1 -#define SC_STATUS_BADALLOC 2 -#define SC_STATUS_WARN_START 1000 -#define SC_STATUS_WARN_REGEX 1001 -#define SCI_SETSTATUS 2382 -#define SCI_GETSTATUS 2383 -#define SCI_SETMOUSEDOWNCAPTURES 2384 -#define SCI_GETMOUSEDOWNCAPTURES 2385 -#define SCI_SETMOUSEWHEELCAPTURES 2696 -#define SCI_GETMOUSEWHEELCAPTURES 2697 -#define SC_CURSORNORMAL -1 -#define SC_CURSORARROW 2 -#define SC_CURSORWAIT 4 -#define SC_CURSORREVERSEARROW 7 -#define SCI_SETCURSOR 2386 -#define SCI_GETCURSOR 2387 -#define SCI_SETCONTROLCHARSYMBOL 2388 -#define SCI_GETCONTROLCHARSYMBOL 2389 -#define SCI_WORDPARTLEFT 2390 -#define SCI_WORDPARTLEFTEXTEND 2391 -#define SCI_WORDPARTRIGHT 2392 -#define SCI_WORDPARTRIGHTEXTEND 2393 -#define VISIBLE_SLOP 0x01 -#define VISIBLE_STRICT 0x04 -#define SCI_SETVISIBLEPOLICY 2394 -#define SCI_DELLINELEFT 2395 -#define SCI_DELLINERIGHT 2396 -#define SCI_SETXOFFSET 2397 -#define SCI_GETXOFFSET 2398 -#define SCI_CHOOSECARETX 2399 -#define SCI_GRABFOCUS 2400 -#define CARET_SLOP 0x01 -#define CARET_STRICT 0x04 -#define CARET_JUMPS 0x10 -#define CARET_EVEN 0x08 -#define SCI_SETXCARETPOLICY 2402 -#define SCI_SETYCARETPOLICY 2403 -#define SCI_SETPRINTWRAPMODE 2406 -#define SCI_GETPRINTWRAPMODE 2407 -#define SCI_SETHOTSPOTACTIVEFORE 2410 -#define SCI_GETHOTSPOTACTIVEFORE 2494 -#define SCI_SETHOTSPOTACTIVEBACK 2411 -#define SCI_GETHOTSPOTACTIVEBACK 2495 -#define SCI_SETHOTSPOTACTIVEUNDERLINE 2412 -#define SCI_GETHOTSPOTACTIVEUNDERLINE 2496 -#define SCI_SETHOTSPOTSINGLELINE 2421 -#define SCI_GETHOTSPOTSINGLELINE 2497 -#define SCI_PARADOWN 2413 -#define SCI_PARADOWNEXTEND 2414 -#define SCI_PARAUP 2415 -#define SCI_PARAUPEXTEND 2416 -#define SCI_POSITIONBEFORE 2417 -#define SCI_POSITIONAFTER 2418 -#define SCI_POSITIONRELATIVE 2670 -#define SCI_COPYRANGE 2419 -#define SCI_COPYTEXT 2420 -#define SC_SEL_STREAM 0 -#define SC_SEL_RECTANGLE 1 -#define SC_SEL_LINES 2 -#define SC_SEL_THIN 3 -#define SCI_SETSELECTIONMODE 2422 -#define SCI_GETSELECTIONMODE 2423 -#define SCI_GETLINESELSTARTPOSITION 2424 -#define SCI_GETLINESELENDPOSITION 2425 -#define SCI_LINEDOWNRECTEXTEND 2426 -#define SCI_LINEUPRECTEXTEND 2427 -#define SCI_CHARLEFTRECTEXTEND 2428 -#define SCI_CHARRIGHTRECTEXTEND 2429 -#define SCI_HOMERECTEXTEND 2430 -#define SCI_VCHOMERECTEXTEND 2431 -#define SCI_LINEENDRECTEXTEND 2432 -#define SCI_PAGEUPRECTEXTEND 2433 -#define SCI_PAGEDOWNRECTEXTEND 2434 -#define SCI_STUTTEREDPAGEUP 2435 -#define SCI_STUTTEREDPAGEUPEXTEND 2436 -#define SCI_STUTTEREDPAGEDOWN 2437 -#define SCI_STUTTEREDPAGEDOWNEXTEND 2438 -#define SCI_WORDLEFTEND 2439 -#define SCI_WORDLEFTENDEXTEND 2440 -#define SCI_WORDRIGHTEND 2441 -#define SCI_WORDRIGHTENDEXTEND 2442 -#define SCI_SETWHITESPACECHARS 2443 -#define SCI_GETWHITESPACECHARS 2647 -#define SCI_SETPUNCTUATIONCHARS 2648 -#define SCI_GETPUNCTUATIONCHARS 2649 -#define SCI_SETCHARSDEFAULT 2444 -#define SCI_AUTOCGETCURRENT 2445 -#define SCI_AUTOCGETCURRENTTEXT 2610 -#define SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0 -#define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1 -#define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634 -#define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR 2635 -#define SC_MULTIAUTOC_ONCE 0 -#define SC_MULTIAUTOC_EACH 1 -#define SCI_AUTOCSETMULTI 2636 -#define SCI_AUTOCGETMULTI 2637 -#define SC_ORDER_PRESORTED 0 -#define SC_ORDER_PERFORMSORT 1 -#define SC_ORDER_CUSTOM 2 -#define SCI_AUTOCSETORDER 2660 -#define SCI_AUTOCGETORDER 2661 -#define SCI_ALLOCATE 2446 -#define SCI_TARGETASUTF8 2447 -#define SCI_SETLENGTHFORENCODE 2448 -#define SCI_ENCODEDFROMUTF8 2449 -#define SCI_FINDCOLUMN 2456 -#define SCI_GETCARETSTICKY 2457 -#define SCI_SETCARETSTICKY 2458 -#define SC_CARETSTICKY_OFF 0 -#define SC_CARETSTICKY_ON 1 -#define SC_CARETSTICKY_WHITESPACE 2 -#define SCI_TOGGLECARETSTICKY 2459 -#define SCI_SETPASTECONVERTENDINGS 2467 -#define SCI_GETPASTECONVERTENDINGS 2468 -#define SCI_SELECTIONDUPLICATE 2469 -#define SC_ALPHA_TRANSPARENT 0 -#define SC_ALPHA_OPAQUE 255 -#define SC_ALPHA_NOALPHA 256 -#define SCI_SETCARETLINEBACKALPHA 2470 -#define SCI_GETCARETLINEBACKALPHA 2471 -#define CARETSTYLE_INVISIBLE 0 -#define CARETSTYLE_LINE 1 -#define CARETSTYLE_BLOCK 2 -#define SCI_SETCARETSTYLE 2512 -#define SCI_GETCARETSTYLE 2513 -#define SCI_SETINDICATORCURRENT 2500 -#define SCI_GETINDICATORCURRENT 2501 -#define SCI_SETINDICATORVALUE 2502 -#define SCI_GETINDICATORVALUE 2503 -#define SCI_INDICATORFILLRANGE 2504 -#define SCI_INDICATORCLEARRANGE 2505 -#define SCI_INDICATORALLONFOR 2506 -#define SCI_INDICATORVALUEAT 2507 -#define SCI_INDICATORSTART 2508 -#define SCI_INDICATOREND 2509 -#define SCI_SETPOSITIONCACHE 2514 -#define SCI_GETPOSITIONCACHE 2515 -#define SCI_COPYALLOWLINE 2519 -#define SCI_GETCHARACTERPOINTER 2520 -#define SCI_GETRANGEPOINTER 2643 -#define SCI_GETGAPPOSITION 2644 -#define SCI_INDICSETALPHA 2523 -#define SCI_INDICGETALPHA 2524 -#define SCI_INDICSETOUTLINEALPHA 2558 -#define SCI_INDICGETOUTLINEALPHA 2559 -#define SCI_SETEXTRAASCENT 2525 -#define SCI_GETEXTRAASCENT 2526 -#define SCI_SETEXTRADESCENT 2527 -#define SCI_GETEXTRADESCENT 2528 -#define SCI_MARKERSYMBOLDEFINED 2529 -#define SCI_MARGINSETTEXT 2530 -#define SCI_MARGINGETTEXT 2531 -#define SCI_MARGINSETSTYLE 2532 -#define SCI_MARGINGETSTYLE 2533 -#define SCI_MARGINSETSTYLES 2534 -#define SCI_MARGINGETSTYLES 2535 -#define SCI_MARGINTEXTCLEARALL 2536 -#define SCI_MARGINSETSTYLEOFFSET 2537 -#define SCI_MARGINGETSTYLEOFFSET 2538 -#define SC_MARGINOPTION_NONE 0 -#define SC_MARGINOPTION_SUBLINESELECT 1 -#define SCI_SETMARGINOPTIONS 2539 -#define SCI_GETMARGINOPTIONS 2557 -#define SCI_ANNOTATIONSETTEXT 2540 -#define SCI_ANNOTATIONGETTEXT 2541 -#define SCI_ANNOTATIONSETSTYLE 2542 -#define SCI_ANNOTATIONGETSTYLE 2543 -#define SCI_ANNOTATIONSETSTYLES 2544 -#define SCI_ANNOTATIONGETSTYLES 2545 -#define SCI_ANNOTATIONGETLINES 2546 -#define SCI_ANNOTATIONCLEARALL 2547 -#define ANNOTATION_HIDDEN 0 -#define ANNOTATION_STANDARD 1 -#define ANNOTATION_BOXED 2 -#define ANNOTATION_INDENTED 3 -#define SCI_ANNOTATIONSETVISIBLE 2548 -#define SCI_ANNOTATIONGETVISIBLE 2549 -#define SCI_ANNOTATIONSETSTYLEOFFSET 2550 -#define SCI_ANNOTATIONGETSTYLEOFFSET 2551 -#define SCI_RELEASEALLEXTENDEDSTYLES 2552 -#define SCI_ALLOCATEEXTENDEDSTYLES 2553 -#define UNDO_MAY_COALESCE 1 -#define SCI_ADDUNDOACTION 2560 -#define SCI_CHARPOSITIONFROMPOINT 2561 -#define SCI_CHARPOSITIONFROMPOINTCLOSE 2562 -#define SCI_SETMOUSESELECTIONRECTANGULARSWITCH 2668 -#define SCI_GETMOUSESELECTIONRECTANGULARSWITCH 2669 -#define SCI_SETMULTIPLESELECTION 2563 -#define SCI_GETMULTIPLESELECTION 2564 -#define SCI_SETADDITIONALSELECTIONTYPING 2565 -#define SCI_GETADDITIONALSELECTIONTYPING 2566 -#define SCI_SETADDITIONALCARETSBLINK 2567 -#define SCI_GETADDITIONALCARETSBLINK 2568 -#define SCI_SETADDITIONALCARETSVISIBLE 2608 -#define SCI_GETADDITIONALCARETSVISIBLE 2609 -#define SCI_GETSELECTIONS 2570 -#define SCI_GETSELECTIONEMPTY 2650 -#define SCI_CLEARSELECTIONS 2571 -#define SCI_SETSELECTION 2572 -#define SCI_ADDSELECTION 2573 -#define SCI_DROPSELECTIONN 2671 -#define SCI_SETMAINSELECTION 2574 -#define SCI_GETMAINSELECTION 2575 -#define SCI_SETSELECTIONNCARET 2576 -#define SCI_GETSELECTIONNCARET 2577 -#define SCI_SETSELECTIONNANCHOR 2578 -#define SCI_GETSELECTIONNANCHOR 2579 -#define SCI_SETSELECTIONNCARETVIRTUALSPACE 2580 -#define SCI_GETSELECTIONNCARETVIRTUALSPACE 2581 -#define SCI_SETSELECTIONNANCHORVIRTUALSPACE 2582 -#define SCI_GETSELECTIONNANCHORVIRTUALSPACE 2583 -#define SCI_SETSELECTIONNSTART 2584 -#define SCI_GETSELECTIONNSTART 2585 -#define SCI_SETSELECTIONNEND 2586 -#define SCI_GETSELECTIONNEND 2587 -#define SCI_SETRECTANGULARSELECTIONCARET 2588 -#define SCI_GETRECTANGULARSELECTIONCARET 2589 -#define SCI_SETRECTANGULARSELECTIONANCHOR 2590 -#define SCI_GETRECTANGULARSELECTIONANCHOR 2591 -#define SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE 2592 -#define SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE 2593 -#define SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE 2594 -#define SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE 2595 -#define SCVS_NONE 0 -#define SCVS_RECTANGULARSELECTION 1 -#define SCVS_USERACCESSIBLE 2 -#define SCVS_NOWRAPLINESTART 4 -#define SCI_SETVIRTUALSPACEOPTIONS 2596 -#define SCI_GETVIRTUALSPACEOPTIONS 2597 -#define SCI_SETRECTANGULARSELECTIONMODIFIER 2598 -#define SCI_GETRECTANGULARSELECTIONMODIFIER 2599 -#define SCI_SETADDITIONALSELFORE 2600 -#define SCI_SETADDITIONALSELBACK 2601 -#define SCI_SETADDITIONALSELALPHA 2602 -#define SCI_GETADDITIONALSELALPHA 2603 -#define SCI_SETADDITIONALCARETFORE 2604 -#define SCI_GETADDITIONALCARETFORE 2605 -#define SCI_ROTATESELECTION 2606 -#define SCI_SWAPMAINANCHORCARET 2607 -#define SCI_MULTIPLESELECTADDNEXT 2688 -#define SCI_MULTIPLESELECTADDEACH 2689 -#define SCI_CHANGELEXERSTATE 2617 -#define SCI_CONTRACTEDFOLDNEXT 2618 -#define SCI_VERTICALCENTRECARET 2619 -#define SCI_MOVESELECTEDLINESUP 2620 -#define SCI_MOVESELECTEDLINESDOWN 2621 -#define SCI_SETIDENTIFIER 2622 -#define SCI_GETIDENTIFIER 2623 -#define SCI_RGBAIMAGESETWIDTH 2624 -#define SCI_RGBAIMAGESETHEIGHT 2625 -#define SCI_RGBAIMAGESETSCALE 2651 -#define SCI_MARKERDEFINERGBAIMAGE 2626 -#define SCI_REGISTERRGBAIMAGE 2627 -#define SCI_SCROLLTOSTART 2628 -#define SCI_SCROLLTOEND 2629 -#define SC_TECHNOLOGY_DEFAULT 0 -#define SC_TECHNOLOGY_DIRECTWRITE 1 -#define SC_TECHNOLOGY_DIRECTWRITERETAIN 2 -#define SC_TECHNOLOGY_DIRECTWRITEDC 3 -#define SCI_SETTECHNOLOGY 2630 -#define SCI_GETTECHNOLOGY 2631 -#define SCI_CREATELOADER 2632 -#define SCI_FINDINDICATORSHOW 2640 -#define SCI_FINDINDICATORFLASH 2641 -#define SCI_FINDINDICATORHIDE 2642 -#define SCI_VCHOMEDISPLAY 2652 -#define SCI_VCHOMEDISPLAYEXTEND 2653 -#define SCI_GETCARETLINEVISIBLEALWAYS 2654 -#define SCI_SETCARETLINEVISIBLEALWAYS 2655 -#define SC_LINE_END_TYPE_DEFAULT 0 -#define SC_LINE_END_TYPE_UNICODE 1 -#define SCI_SETLINEENDTYPESALLOWED 2656 -#define SCI_GETLINEENDTYPESALLOWED 2657 -#define SCI_GETLINEENDTYPESACTIVE 2658 -#define SCI_SETREPRESENTATION 2665 -#define SCI_GETREPRESENTATION 2666 -#define SCI_CLEARREPRESENTATION 2667 -#define SCI_STARTRECORD 3001 -#define SCI_STOPRECORD 3002 -#define SCI_SETLEXER 4001 -#define SCI_GETLEXER 4002 -#define SCI_COLOURISE 4003 -#define SCI_SETPROPERTY 4004 -#define KEYWORDSET_MAX 8 -#define SCI_SETKEYWORDS 4005 -#define SCI_SETLEXERLANGUAGE 4006 -#define SCI_LOADLEXERLIBRARY 4007 -#define SCI_GETPROPERTY 4008 -#define SCI_GETPROPERTYEXPANDED 4009 -#define SCI_GETPROPERTYINT 4010 -#define SCI_GETSTYLEBITSNEEDED 4011 -#define SCI_GETLEXERLANGUAGE 4012 -#define SCI_PRIVATELEXERCALL 4013 -#define SCI_PROPERTYNAMES 4014 -#define SC_TYPE_BOOLEAN 0 -#define SC_TYPE_INTEGER 1 -#define SC_TYPE_STRING 2 -#define SCI_PROPERTYTYPE 4015 -#define SCI_DESCRIBEPROPERTY 4016 -#define SCI_DESCRIBEKEYWORDSETS 4017 -#define SCI_GETLINEENDTYPESSUPPORTED 4018 -#define SCI_ALLOCATESUBSTYLES 4020 -#define SCI_GETSUBSTYLESSTART 4021 -#define SCI_GETSUBSTYLESLENGTH 4022 -#define SCI_GETSTYLEFROMSUBSTYLE 4027 -#define SCI_GETPRIMARYSTYLEFROMSTYLE 4028 -#define SCI_FREESUBSTYLES 4023 -#define SCI_SETIDENTIFIERS 4024 -#define SCI_DISTANCETOSECONDARYSTYLES 4025 -#define SCI_GETSUBSTYLEBASES 4026 -#define SC_MOD_INSERTTEXT 0x1 -#define SC_MOD_DELETETEXT 0x2 -#define SC_MOD_CHANGESTYLE 0x4 -#define SC_MOD_CHANGEFOLD 0x8 -#define SC_PERFORMED_USER 0x10 -#define SC_PERFORMED_UNDO 0x20 -#define SC_PERFORMED_REDO 0x40 -#define SC_MULTISTEPUNDOREDO 0x80 -#define SC_LASTSTEPINUNDOREDO 0x100 -#define SC_MOD_CHANGEMARKER 0x200 -#define SC_MOD_BEFOREINSERT 0x400 -#define SC_MOD_BEFOREDELETE 0x800 -#define SC_MULTILINEUNDOREDO 0x1000 -#define SC_STARTACTION 0x2000 -#define SC_MOD_CHANGEINDICATOR 0x4000 -#define SC_MOD_CHANGELINESTATE 0x8000 -#define SC_MOD_CHANGEMARGIN 0x10000 -#define SC_MOD_CHANGEANNOTATION 0x20000 -#define SC_MOD_CONTAINER 0x40000 -#define SC_MOD_LEXERSTATE 0x80000 -#define SC_MOD_INSERTCHECK 0x100000 -#define SC_MOD_CHANGETABSTOPS 0x200000 -#define SC_MODEVENTMASKALL 0x3FFFFF -#define SC_UPDATE_CONTENT 0x1 -#define SC_UPDATE_SELECTION 0x2 -#define SC_UPDATE_V_SCROLL 0x4 -#define SC_UPDATE_H_SCROLL 0x8 -#define SCEN_CHANGE 768 -#define SCEN_SETFOCUS 512 -#define SCEN_KILLFOCUS 256 -#define SCK_DOWN 300 -#define SCK_UP 301 -#define SCK_LEFT 302 -#define SCK_RIGHT 303 -#define SCK_HOME 304 -#define SCK_END 305 -#define SCK_PRIOR 306 -#define SCK_NEXT 307 -#define SCK_DELETE 308 -#define SCK_INSERT 309 -#define SCK_ESCAPE 7 -#define SCK_BACK 8 -#define SCK_TAB 9 -#define SCK_RETURN 13 -#define SCK_ADD 310 -#define SCK_SUBTRACT 311 -#define SCK_DIVIDE 312 -#define SCK_WIN 313 -#define SCK_RWIN 314 -#define SCK_MENU 315 -#define SCMOD_NORM 0 -#define SCMOD_SHIFT 1 -#define SCMOD_CTRL 2 -#define SCMOD_ALT 4 -#define SCMOD_SUPER 8 -#define SCMOD_META 16 -#define SC_AC_FILLUP 1 -#define SC_AC_DOUBLECLICK 2 -#define SC_AC_TAB 3 -#define SC_AC_NEWLINE 4 -#define SC_AC_COMMAND 5 -#define SCN_STYLENEEDED 2000 -#define SCN_CHARADDED 2001 -#define SCN_SAVEPOINTREACHED 2002 -#define SCN_SAVEPOINTLEFT 2003 -#define SCN_MODIFYATTEMPTRO 2004 -#define SCN_KEY 2005 -#define SCN_DOUBLECLICK 2006 -#define SCN_UPDATEUI 2007 -#define SCN_MODIFIED 2008 -#define SCN_MACRORECORD 2009 -#define SCN_MARGINCLICK 2010 -#define SCN_NEEDSHOWN 2011 -#define SCN_PAINTED 2013 -#define SCN_USERLISTSELECTION 2014 -#define SCN_URIDROPPED 2015 -#define SCN_DWELLSTART 2016 -#define SCN_DWELLEND 2017 -#define SCN_ZOOM 2018 -#define SCN_HOTSPOTCLICK 2019 -#define SCN_HOTSPOTDOUBLECLICK 2020 -#define SCN_CALLTIPCLICK 2021 -#define SCN_AUTOCSELECTION 2022 -#define SCN_INDICATORCLICK 2023 -#define SCN_INDICATORRELEASE 2024 -#define SCN_AUTOCCANCELLED 2025 -#define SCN_AUTOCCHARDELETED 2026 -#define SCN_HOTSPOTRELEASECLICK 2027 -#define SCN_FOCUSIN 2028 -#define SCN_FOCUSOUT 2029 -#define SCN_AUTOCCOMPLETED 2030 -#define SCN_MARGINRIGHTCLICK 2031 -/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ - -/* These structures are defined to be exactly the same shape as the Win32 - * CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. - * So older code that treats Scintilla as a RichEdit will work. */ - -struct Sci_CharacterRange { - Sci_PositionCR cpMin; - Sci_PositionCR cpMax; -}; - -struct Sci_TextRange { - struct Sci_CharacterRange chrg; - char *lpstrText; -}; - -struct Sci_TextToFind { - struct Sci_CharacterRange chrg; - const char *lpstrText; - struct Sci_CharacterRange chrgText; -}; - -typedef void *Sci_SurfaceID; - -struct Sci_Rectangle { - int left; - int top; - int right; - int bottom; -}; - -/* This structure is used in printing and requires some of the graphics types - * from Platform.h. Not needed by most client code. */ - -struct Sci_RangeToFormat { - Sci_SurfaceID hdc; - Sci_SurfaceID hdcTarget; - struct Sci_Rectangle rc; - struct Sci_Rectangle rcPage; - struct Sci_CharacterRange chrg; -}; - -#ifndef __cplusplus -/* For the GTK+ platform, g-ir-scanner needs to have these typedefs. This - * is not required in C++ code and actually seems to break ScintillaEditPy */ -typedef struct Sci_NotifyHeader Sci_NotifyHeader; -typedef struct SCNotification SCNotification; -#endif - -struct Sci_NotifyHeader { - /* Compatible with Windows NMHDR. - * hwndFrom is really an environment specific window handle or pointer - * but most clients of Scintilla.h do not have this type visible. */ - void *hwndFrom; - uptr_t idFrom; - unsigned int code; -}; - -struct SCNotification { - Sci_NotifyHeader nmhdr; - Sci_Position position; - /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */ - /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */ - /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */ - /* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ - /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */ - - int ch; - /* SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, */ - /* SCN_USERLISTSELECTION */ - int modifiers; - /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */ - /* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ - - int modificationType; /* SCN_MODIFIED */ - const char *text; - /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */ - - Sci_Position length; /* SCN_MODIFIED */ - Sci_Position linesAdded; /* SCN_MODIFIED */ - int message; /* SCN_MACRORECORD */ - uptr_t wParam; /* SCN_MACRORECORD */ - sptr_t lParam; /* SCN_MACRORECORD */ - Sci_Position line; /* SCN_MODIFIED */ - int foldLevelNow; /* SCN_MODIFIED */ - int foldLevelPrev; /* SCN_MODIFIED */ - int margin; /* SCN_MARGINCLICK */ - int listType; /* SCN_USERLISTSELECTION */ - int x; /* SCN_DWELLSTART, SCN_DWELLEND */ - int y; /* SCN_DWELLSTART, SCN_DWELLEND */ - int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ - Sci_Position annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */ - int updated; /* SCN_UPDATEUI */ - int listCompletionMethod; - /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION, */ -}; - -#ifdef INCLUDE_DEPRECATED_FEATURES - -#define SCI_SETKEYSUNICODE 2521 -#define SCI_GETKEYSUNICODE 2522 - -#define CharacterRange Sci_CharacterRange -#define TextRange Sci_TextRange -#define TextToFind Sci_TextToFind -#define RangeToFormat Sci_RangeToFormat -#define NotifyHeader Sci_NotifyHeader - -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/include/ScintillaWidget.h b/qrenderdoc/3rdparty/scintilla/include/ScintillaWidget.h deleted file mode 100644 index 1721f65d9..000000000 --- a/qrenderdoc/3rdparty/scintilla/include/ScintillaWidget.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Scintilla source code edit control */ -/* @file ScintillaWidget.h - * Definition of Scintilla widget for GTK+. - * Only needed by GTK+ code but is harmless on other platforms. - * This comment is not a doc-comment as that causes warnings from g-ir-scanner. - */ -/* Copyright 1998-2001 by Neil Hodgson - * The License.txt file describes the conditions under which this software may be distributed. */ - -#ifndef SCINTILLAWIDGET_H -#define SCINTILLAWIDGET_H - -#if defined(GTK) - -#ifdef __cplusplus -extern "C" { -#endif - -#define SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, scintilla_get_type (), ScintillaObject) -#define SCINTILLA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass) -#define IS_SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, scintilla_get_type ()) - -#define SCINTILLA_TYPE_OBJECT (scintilla_object_get_type()) -#define SCINTILLA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SCINTILLA_TYPE_OBJECT, ScintillaObject)) -#define SCINTILLA_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCINTILLA_TYPE_OBJECT)) -#define SCINTILLA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass)) -#define SCINTILLA_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SCINTILLA_TYPE_OBJECT)) -#define SCINTILLA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass)) - -typedef struct _ScintillaObject ScintillaObject; -typedef struct _ScintillaClass ScintillaObjectClass; - -struct _ScintillaObject { - GtkContainer cont; - void *pscin; -}; - -struct _ScintillaClass { - GtkContainerClass parent_class; - - void (* command) (ScintillaObject *sci, int cmd, GtkWidget *window); - void (* notify) (ScintillaObject *sci, int id, SCNotification *scn); -}; - -GType scintilla_object_get_type (void); -GtkWidget* scintilla_object_new (void); -gintptr scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam); - - -GType scnotification_get_type (void); -#define SCINTILLA_TYPE_NOTIFICATION (scnotification_get_type()) - -#ifndef G_IR_SCANNING -/* The legacy names confuse the g-ir-scanner program */ -typedef struct _ScintillaClass ScintillaClass; - -GType scintilla_get_type (void); -GtkWidget* scintilla_new (void); -void scintilla_set_id (ScintillaObject *sci, uptr_t id); -sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam); -void scintilla_release_resources(void); -#endif - -#define SCINTILLA_NOTIFY "sci-notify" - -#ifdef __cplusplus -} -#endif - -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/include/qt/ScintillaDocument.h b/qrenderdoc/3rdparty/scintilla/include/qt/ScintillaDocument.h deleted file mode 100644 index 510127f94..000000000 --- a/qrenderdoc/3rdparty/scintilla/include/qt/ScintillaDocument.h +++ /dev/null @@ -1,109 +0,0 @@ -// ScintillaDocument.h -// Wrapper for Scintilla document object so it can be manipulated independently. -// Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware - -#ifndef SCINTILLADOCUMENT_H -#define SCINTILLADOCUMENT_H - -#include - -class WatcherHelper; - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -#ifndef EXPORT_IMPORT_API -#ifdef WIN32 -#ifdef MAKING_LIBRARY -#define EXPORT_IMPORT_API __declspec(dllexport) -#else -// Defining dllimport upsets moc -#define EXPORT_IMPORT_API __declspec(dllimport) -//#define EXPORT_IMPORT_API -#endif -#else -#define EXPORT_IMPORT_API -#endif -#endif - -class EXPORT_IMPORT_API ScintillaDocument : public QObject -{ - Q_OBJECT - - void *pdoc; - WatcherHelper *docWatcher; - -public: - explicit ScintillaDocument(QObject *parent = 0, void *pdoc_=0); - virtual ~ScintillaDocument(); - void *pointer(); - - int line_from_position(int pos); - bool is_cr_lf(int pos); - bool delete_chars(int pos, int len); - int undo(); - int redo(); - bool can_undo(); - bool can_redo(); - void delete_undo_history(); - bool set_undo_collection(bool collect_undo); - bool is_collecting_undo(); - void begin_undo_action(); - void end_undo_action(); - void set_save_point(); - bool is_save_point(); - void set_read_only(bool read_only); - bool is_read_only(); - void insert_string(int position, QByteArray &str); - QByteArray get_char_range(int position, int length); - char style_at(int position); - int line_start(int lineno); - int line_end(int lineno); - int line_end_position(int pos); - int length(); - int lines_total(); - void start_styling(int position, char flags); - bool set_style_for(int length, char style); - int get_end_styled(); - void ensure_styled_to(int position); - void set_current_indicator(int indic); - void decoration_fill_range(int position, int value, int fillLength); - int decorations_value_at(int indic, int position); - int decorations_start(int indic, int position); - int decorations_end(int indic, int position); - int get_code_page(); - void set_code_page(int code_page); - int get_eol_mode(); - void set_eol_mode(int eol_mode); - int move_position_outside_char(int pos, int move_dir, bool check_line_end); - - int get_character(int pos); // Calls GetCharacterAndWidth(pos, NULL) - -private: - void emit_modify_attempt(); - void emit_save_point(bool atSavePoint); - void emit_modified(int position, int modification_type, const QByteArray& text, int length, - int linesAdded, int line, int foldLevelNow, int foldLevelPrev); - void emit_style_needed(int pos); - void emit_lexer_changed(); - void emit_error_occurred(int status); - -signals: - void modify_attempt(); - void save_point(bool atSavePoint); - void modified(int position, int modification_type, const QByteArray& text, int length, - int linesAdded, int line, int foldLevelNow, int foldLevelPrev); - void style_needed(int pos); - void lexer_changed(); - void error_occurred(int status); - - friend class ::WatcherHelper; - -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif // SCINTILLADOCUMENT_H diff --git a/qrenderdoc/3rdparty/scintilla/include/qt/ScintillaEdit.h b/qrenderdoc/3rdparty/scintilla/include/qt/ScintillaEdit.h deleted file mode 100644 index 56d2cfe46..000000000 --- a/qrenderdoc/3rdparty/scintilla/include/qt/ScintillaEdit.h +++ /dev/null @@ -1,766 +0,0 @@ -// ScintillaEdit.h -// Extended version of ScintillaEditBase with a method for each API -// Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware - -#ifndef SCINTILLAEDIT_H -#define SCINTILLAEDIT_H - -#include - -#include "ScintillaEditBase.h" -#include "ScintillaDocument.h" - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -#ifndef EXPORT_IMPORT_API -#ifdef WIN32 -#ifdef MAKING_LIBRARY -#define EXPORT_IMPORT_API __declspec(dllexport) -#else -// Defining dllimport upsets moc -#define EXPORT_IMPORT_API __declspec(dllimport) -//#define EXPORT_IMPORT_API -#endif -#else -#define EXPORT_IMPORT_API -#endif -#endif - -class EXPORT_IMPORT_API ScintillaEdit : public ScintillaEditBase { - Q_OBJECT - -public: - ScintillaEdit(QWidget *parent = 0); - virtual ~ScintillaEdit(); - - QByteArray TextReturner(int message, uptr_t wParam) const; - - QPairfind_text(int flags, const char *text, int cpMin, int cpMax); - QByteArray get_text_range(int start, int end); - ScintillaDocument *get_doc(); - void set_doc(ScintillaDocument *pdoc_); - - // Same as previous two methods but with Qt style names - QPairfindText(int flags, const char *text, int cpMin, int cpMax) { - return find_text(flags, text, cpMin, cpMax); - } - - QByteArray textRange(int start, int end) { - return get_text_range(start, end); - } - - // Exposing the FORMATRANGE api with both underscore & qt style names - long format_range(bool draw, QPaintDevice* target, QPaintDevice* measure, - const QRect& print_rect, const QRect& page_rect, - long range_start, long range_end); - long formatRange(bool draw, QPaintDevice* target, QPaintDevice* measure, - const QRect& print_rect, const QRect& page_rect, - long range_start, long range_end) { - return format_range(draw, target, measure, print_rect, page_rect, - range_start, range_end); - } - -/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ - void addText(sptr_t length, const char * text); - void addStyledText(sptr_t length, const char * c); - void insertText(sptr_t pos, const char * text); - void changeInsertion(sptr_t length, const char * text); - void clearAll(); - void deleteRange(sptr_t start, sptr_t lengthDelete); - void clearDocumentStyle(); - sptr_t length() const; - sptr_t charAt(sptr_t pos) const; - sptr_t currentPos() const; - sptr_t anchor() const; - sptr_t styleAt(sptr_t pos) const; - void redo(); - void setUndoCollection(bool collectUndo); - void selectAll(); - void setSavePoint(); - bool canRedo(); - sptr_t markerLineFromHandle(sptr_t markerHandle); - void markerDeleteHandle(sptr_t markerHandle); - bool undoCollection() const; - sptr_t viewWS() const; - void setViewWS(sptr_t viewWS); - sptr_t tabDrawMode() const; - void setTabDrawMode(sptr_t tabDrawMode); - sptr_t positionFromPoint(sptr_t x, sptr_t y); - sptr_t positionFromPointClose(sptr_t x, sptr_t y); - void gotoLine(sptr_t line); - void gotoPos(sptr_t caret); - void setAnchor(sptr_t anchor); - QByteArray getCurLine(sptr_t length); - sptr_t endStyled() const; - void convertEOLs(sptr_t eolMode); - sptr_t eOLMode() const; - void setEOLMode(sptr_t eolMode); - void startStyling(sptr_t start, sptr_t unused); - void setStyling(sptr_t length, sptr_t style); - bool bufferedDraw() const; - void setBufferedDraw(bool buffered); - void setTabWidth(sptr_t tabWidth); - sptr_t tabWidth() const; - void clearTabStops(sptr_t line); - void addTabStop(sptr_t line, sptr_t x); - sptr_t getNextTabStop(sptr_t line, sptr_t x); - void setCodePage(sptr_t codePage); - sptr_t iMEInteraction() const; - void setIMEInteraction(sptr_t imeInteraction); - void markerDefine(sptr_t markerNumber, sptr_t markerSymbol); - void markerSetFore(sptr_t markerNumber, sptr_t fore); - void markerSetBack(sptr_t markerNumber, sptr_t back); - void markerSetBackSelected(sptr_t markerNumber, sptr_t back); - void markerEnableHighlight(bool enabled); - sptr_t markerAdd(sptr_t line, sptr_t markerNumber); - void markerDelete(sptr_t line, sptr_t markerNumber); - void markerDeleteAll(sptr_t markerNumber); - sptr_t markerGet(sptr_t line); - sptr_t markerNext(sptr_t lineStart, sptr_t markerMask); - sptr_t markerPrevious(sptr_t lineStart, sptr_t markerMask); - void markerDefinePixmap(sptr_t markerNumber, const char * pixmap); - void markerAddSet(sptr_t line, sptr_t markerSet); - void markerSetAlpha(sptr_t markerNumber, sptr_t alpha); - void setMarginTypeN(sptr_t margin, sptr_t marginType); - sptr_t marginTypeN(sptr_t margin) const; - void setMarginWidthN(sptr_t margin, sptr_t pixelWidth); - sptr_t marginWidthN(sptr_t margin) const; - void setMarginMaskN(sptr_t margin, sptr_t mask); - sptr_t marginMaskN(sptr_t margin) const; - void setMarginSensitiveN(sptr_t margin, bool sensitive); - bool marginSensitiveN(sptr_t margin) const; - void setMarginCursorN(sptr_t margin, sptr_t cursor); - sptr_t marginCursorN(sptr_t margin) const; - void setMarginBackN(sptr_t margin, sptr_t back); - sptr_t marginBackN(sptr_t margin) const; - void setMargins(sptr_t margins); - sptr_t margins() const; - void styleClearAll(); - void styleSetFore(sptr_t style, sptr_t fore); - void styleSetBack(sptr_t style, sptr_t back); - void styleSetBold(sptr_t style, bool bold); - void styleSetItalic(sptr_t style, bool italic); - void styleSetSize(sptr_t style, sptr_t sizePoints); - void styleSetFont(sptr_t style, const char * fontName); - void styleSetEOLFilled(sptr_t style, bool eolFilled); - void styleResetDefault(); - void styleSetUnderline(sptr_t style, bool underline); - sptr_t styleFore(sptr_t style) const; - sptr_t styleBack(sptr_t style) const; - bool styleBold(sptr_t style) const; - bool styleItalic(sptr_t style) const; - sptr_t styleSize(sptr_t style) const; - QByteArray styleFont(sptr_t style) const; - bool styleEOLFilled(sptr_t style) const; - bool styleUnderline(sptr_t style) const; - sptr_t styleCase(sptr_t style) const; - sptr_t styleCharacterSet(sptr_t style) const; - bool styleVisible(sptr_t style) const; - bool styleChangeable(sptr_t style) const; - bool styleHotSpot(sptr_t style) const; - void styleSetCase(sptr_t style, sptr_t caseVisible); - void styleSetSizeFractional(sptr_t style, sptr_t sizeHundredthPoints); - sptr_t styleSizeFractional(sptr_t style) const; - void styleSetWeight(sptr_t style, sptr_t weight); - sptr_t styleWeight(sptr_t style) const; - void styleSetCharacterSet(sptr_t style, sptr_t characterSet); - void styleSetHotSpot(sptr_t style, bool hotspot); - void setSelFore(bool useSetting, sptr_t fore); - void setSelBack(bool useSetting, sptr_t back); - sptr_t selAlpha() const; - void setSelAlpha(sptr_t alpha); - bool selEOLFilled() const; - void setSelEOLFilled(bool filled); - void setCaretFore(sptr_t fore); - void assignCmdKey(sptr_t keyDefinition, sptr_t sciCommand); - void clearCmdKey(sptr_t keyDefinition); - void clearAllCmdKeys(); - void setStylingEx(sptr_t length, const char * styles); - void styleSetVisible(sptr_t style, bool visible); - sptr_t caretPeriod() const; - void setCaretPeriod(sptr_t periodMilliseconds); - void setWordChars(const char * characters); - QByteArray wordChars() const; - void beginUndoAction(); - void endUndoAction(); - void indicSetStyle(sptr_t indicator, sptr_t indicatorStyle); - sptr_t indicStyle(sptr_t indicator) const; - void indicSetFore(sptr_t indicator, sptr_t fore); - sptr_t indicFore(sptr_t indicator) const; - void indicSetUnder(sptr_t indicator, bool under); - bool indicUnder(sptr_t indicator) const; - void indicSetHoverStyle(sptr_t indicator, sptr_t indicatorStyle); - sptr_t indicHoverStyle(sptr_t indicator) const; - void indicSetHoverFore(sptr_t indicator, sptr_t fore); - sptr_t indicHoverFore(sptr_t indicator) const; - void indicSetFlags(sptr_t indicator, sptr_t flags); - sptr_t indicFlags(sptr_t indicator) const; - void setWhitespaceFore(bool useSetting, sptr_t fore); - void setWhitespaceBack(bool useSetting, sptr_t back); - void setWhitespaceSize(sptr_t size); - sptr_t whitespaceSize() const; - void setStyleBits(sptr_t bits); - sptr_t styleBits() const; - void setLineState(sptr_t line, sptr_t state); - sptr_t lineState(sptr_t line) const; - sptr_t maxLineState() const; - bool caretLineVisible() const; - void setCaretLineVisible(bool show); - sptr_t caretLineBack() const; - void setCaretLineBack(sptr_t back); - void styleSetChangeable(sptr_t style, bool changeable); - void autoCShow(sptr_t lengthEntered, const char * itemList); - void autoCCancel(); - bool autoCActive(); - sptr_t autoCPosStart(); - void autoCComplete(); - void autoCStops(const char * characterSet); - void autoCSetSeparator(sptr_t separatorCharacter); - sptr_t autoCSeparator() const; - void autoCSelect(const char * select); - void autoCSetCancelAtStart(bool cancel); - bool autoCCancelAtStart() const; - void autoCSetFillUps(const char * characterSet); - void autoCSetChooseSingle(bool chooseSingle); - bool autoCChooseSingle() const; - void autoCSetIgnoreCase(bool ignoreCase); - bool autoCIgnoreCase() const; - void userListShow(sptr_t listType, const char * itemList); - void autoCSetAutoHide(bool autoHide); - bool autoCAutoHide() const; - void autoCSetDropRestOfWord(bool dropRestOfWord); - bool autoCDropRestOfWord() const; - void registerImage(sptr_t type, const char * xpmData); - void clearRegisteredImages(); - sptr_t autoCTypeSeparator() const; - void autoCSetTypeSeparator(sptr_t separatorCharacter); - void autoCSetMaxWidth(sptr_t characterCount); - sptr_t autoCMaxWidth() const; - void autoCSetMaxHeight(sptr_t rowCount); - sptr_t autoCMaxHeight() const; - void setIndent(sptr_t indentSize); - sptr_t indent() const; - void setUseTabs(bool useTabs); - bool useTabs() const; - void setLineIndentation(sptr_t line, sptr_t indentation); - sptr_t lineIndentation(sptr_t line) const; - sptr_t lineIndentPosition(sptr_t line) const; - sptr_t column(sptr_t pos) const; - sptr_t countCharacters(sptr_t start, sptr_t end); - void setHScrollBar(bool visible); - bool hScrollBar() const; - void setIndentationGuides(sptr_t indentView); - sptr_t indentationGuides() const; - void setHighlightGuide(sptr_t column); - sptr_t highlightGuide() const; - sptr_t lineEndPosition(sptr_t line) const; - sptr_t codePage() const; - sptr_t caretFore() const; - bool readOnly() const; - void setCurrentPos(sptr_t caret); - void setSelectionStart(sptr_t anchor); - sptr_t selectionStart() const; - void setSelectionEnd(sptr_t caret); - sptr_t selectionEnd() const; - void setEmptySelection(sptr_t caret); - void setPrintMagnification(sptr_t magnification); - sptr_t printMagnification() const; - void setPrintColourMode(sptr_t mode); - sptr_t printColourMode() const; - sptr_t firstVisibleLine() const; - QByteArray getLine(sptr_t line); - sptr_t lineCount() const; - void setMarginLeft(sptr_t pixelWidth); - sptr_t marginLeft() const; - void setMarginRight(sptr_t pixelWidth); - sptr_t marginRight() const; - bool modify() const; - void setSel(sptr_t anchor, sptr_t caret); - QByteArray getSelText(); - void hideSelection(bool hide); - sptr_t pointXFromPosition(sptr_t pos); - sptr_t pointYFromPosition(sptr_t pos); - sptr_t lineFromPosition(sptr_t pos); - sptr_t positionFromLine(sptr_t line); - void lineScroll(sptr_t columns, sptr_t lines); - void scrollCaret(); - void scrollRange(sptr_t secondary, sptr_t primary); - void replaceSel(const char * text); - void setReadOnly(bool readOnly); - void null(); - bool canPaste(); - bool canUndo(); - void emptyUndoBuffer(); - void undo(); - void cut(); - void copy(); - void paste(); - void clear(); - void setText(const char * text); - QByteArray getText(sptr_t length); - sptr_t textLength() const; - sptr_t directFunction() const; - sptr_t directPointer() const; - void setOvertype(bool overType); - bool overtype() const; - void setCaretWidth(sptr_t pixelWidth); - sptr_t caretWidth() const; - void setTargetStart(sptr_t start); - sptr_t targetStart() const; - void setTargetEnd(sptr_t end); - sptr_t targetEnd() const; - void setTargetRange(sptr_t start, sptr_t end); - QByteArray targetText() const; - void targetFromSelection(); - void targetWholeDocument(); - sptr_t replaceTarget(sptr_t length, const char * text); - sptr_t replaceTargetRE(sptr_t length, const char * text); - sptr_t searchInTarget(sptr_t length, const char * text); - void setSearchFlags(sptr_t searchFlags); - sptr_t searchFlags() const; - void callTipShow(sptr_t pos, const char * definition); - void callTipCancel(); - bool callTipActive(); - sptr_t callTipPosStart(); - void callTipSetPosStart(sptr_t posStart); - void callTipSetHlt(sptr_t highlightStart, sptr_t highlightEnd); - void callTipSetBack(sptr_t back); - void callTipSetFore(sptr_t fore); - void callTipSetForeHlt(sptr_t fore); - void callTipUseStyle(sptr_t tabSize); - void callTipSetPosition(bool above); - sptr_t visibleFromDocLine(sptr_t docLine); - sptr_t docLineFromVisible(sptr_t displayLine); - sptr_t wrapCount(sptr_t docLine); - void setFoldLevel(sptr_t line, sptr_t level); - sptr_t foldLevel(sptr_t line) const; - sptr_t lastChild(sptr_t line, sptr_t level) const; - sptr_t foldParent(sptr_t line) const; - void showLines(sptr_t lineStart, sptr_t lineEnd); - void hideLines(sptr_t lineStart, sptr_t lineEnd); - bool lineVisible(sptr_t line) const; - bool allLinesVisible() const; - void setFoldExpanded(sptr_t line, bool expanded); - bool foldExpanded(sptr_t line) const; - void toggleFold(sptr_t line); - void toggleFoldShowText(sptr_t line, const char * text); - void foldDisplayTextSetStyle(sptr_t style); - void foldLine(sptr_t line, sptr_t action); - void foldChildren(sptr_t line, sptr_t action); - void expandChildren(sptr_t line, sptr_t level); - void foldAll(sptr_t action); - void ensureVisible(sptr_t line); - void setAutomaticFold(sptr_t automaticFold); - sptr_t automaticFold() const; - void setFoldFlags(sptr_t flags); - void ensureVisibleEnforcePolicy(sptr_t line); - void setTabIndents(bool tabIndents); - bool tabIndents() const; - void setBackSpaceUnIndents(bool bsUnIndents); - bool backSpaceUnIndents() const; - void setMouseDwellTime(sptr_t periodMilliseconds); - sptr_t mouseDwellTime() const; - sptr_t wordStartPosition(sptr_t pos, bool onlyWordCharacters); - sptr_t wordEndPosition(sptr_t pos, bool onlyWordCharacters); - bool isRangeWord(sptr_t start, sptr_t end); - void setIdleStyling(sptr_t idleStyling); - sptr_t idleStyling() const; - void setWrapMode(sptr_t wrapMode); - sptr_t wrapMode() const; - void setWrapVisualFlags(sptr_t wrapVisualFlags); - sptr_t wrapVisualFlags() const; - void setWrapVisualFlagsLocation(sptr_t wrapVisualFlagsLocation); - sptr_t wrapVisualFlagsLocation() const; - void setWrapStartIndent(sptr_t indent); - sptr_t wrapStartIndent() const; - void setWrapIndentMode(sptr_t wrapIndentMode); - sptr_t wrapIndentMode() const; - void setLayoutCache(sptr_t cacheMode); - sptr_t layoutCache() const; - void setScrollWidth(sptr_t pixelWidth); - sptr_t scrollWidth() const; - void setScrollWidthTracking(bool tracking); - bool scrollWidthTracking() const; - sptr_t textWidth(sptr_t style, const char * text); - void setEndAtLastLine(bool endAtLastLine); - bool endAtLastLine() const; - sptr_t textHeight(sptr_t line); - void setVScrollBar(bool visible); - bool vScrollBar() const; - void appendText(sptr_t length, const char * text); - bool twoPhaseDraw() const; - void setTwoPhaseDraw(bool twoPhase); - sptr_t phasesDraw() const; - void setPhasesDraw(sptr_t phases); - void setFontQuality(sptr_t fontQuality); - sptr_t fontQuality() const; - void setFirstVisibleLine(sptr_t displayLine); - void setMultiPaste(sptr_t multiPaste); - sptr_t multiPaste() const; - QByteArray tag(sptr_t tagNumber) const; - void linesJoin(); - void linesSplit(sptr_t pixelWidth); - void setFoldMarginColour(bool useSetting, sptr_t back); - void setFoldMarginHiColour(bool useSetting, sptr_t fore); - void lineDown(); - void lineDownExtend(); - void lineUp(); - void lineUpExtend(); - void charLeft(); - void charLeftExtend(); - void charRight(); - void charRightExtend(); - void wordLeft(); - void wordLeftExtend(); - void wordRight(); - void wordRightExtend(); - void home(); - void homeExtend(); - void lineEnd(); - void lineEndExtend(); - void documentStart(); - void documentStartExtend(); - void documentEnd(); - void documentEndExtend(); - void pageUp(); - void pageUpExtend(); - void pageDown(); - void pageDownExtend(); - void editToggleOvertype(); - void cancel(); - void deleteBack(); - void tab(); - void backTab(); - void newLine(); - void formFeed(); - void vCHome(); - void vCHomeExtend(); - void zoomIn(); - void zoomOut(); - void delWordLeft(); - void delWordRight(); - void delWordRightEnd(); - void lineCut(); - void lineDelete(); - void lineTranspose(); - void lineDuplicate(); - void lowerCase(); - void upperCase(); - void lineScrollDown(); - void lineScrollUp(); - void deleteBackNotLine(); - void homeDisplay(); - void homeDisplayExtend(); - void lineEndDisplay(); - void lineEndDisplayExtend(); - void homeWrap(); - void homeWrapExtend(); - void lineEndWrap(); - void lineEndWrapExtend(); - void vCHomeWrap(); - void vCHomeWrapExtend(); - void lineCopy(); - void moveCaretInsideView(); - sptr_t lineLength(sptr_t line); - void braceHighlight(sptr_t posA, sptr_t posB); - void braceHighlightIndicator(bool useSetting, sptr_t indicator); - void braceBadLight(sptr_t pos); - void braceBadLightIndicator(bool useSetting, sptr_t indicator); - sptr_t braceMatch(sptr_t pos, sptr_t maxReStyle); - bool viewEOL() const; - void setViewEOL(bool visible); - sptr_t docPointer() const; - void setDocPointer(sptr_t doc); - void setModEventMask(sptr_t eventMask); - sptr_t edgeColumn() const; - void setEdgeColumn(sptr_t column); - sptr_t edgeMode() const; - void setEdgeMode(sptr_t edgeMode); - sptr_t edgeColour() const; - void setEdgeColour(sptr_t edgeColour); - void multiEdgeAddLine(sptr_t column, sptr_t edgeColour); - void multiEdgeClearAll(); - void searchAnchor(); - sptr_t searchNext(sptr_t searchFlags, const char * text); - sptr_t searchPrev(sptr_t searchFlags, const char * text); - sptr_t linesOnScreen() const; - void usePopUp(sptr_t popUpMode); - bool selectionIsRectangle() const; - void setZoom(sptr_t zoomInPoints); - sptr_t zoom() const; - sptr_t createDocument(); - void addRefDocument(sptr_t doc); - void releaseDocument(sptr_t doc); - sptr_t modEventMask() const; - void setFocus(bool focus); - bool focus() const; - void setStatus(sptr_t status); - sptr_t status() const; - void setMouseDownCaptures(bool captures); - bool mouseDownCaptures() const; - void setMouseWheelCaptures(bool captures); - bool mouseWheelCaptures() const; - void setCursor(sptr_t cursorType); - sptr_t cursor() const; - void setControlCharSymbol(sptr_t symbol); - sptr_t controlCharSymbol() const; - void wordPartLeft(); - void wordPartLeftExtend(); - void wordPartRight(); - void wordPartRightExtend(); - void setVisiblePolicy(sptr_t visiblePolicy, sptr_t visibleSlop); - void delLineLeft(); - void delLineRight(); - void setXOffset(sptr_t xOffset); - sptr_t xOffset() const; - void chooseCaretX(); - void grabFocus(); - void setXCaretPolicy(sptr_t caretPolicy, sptr_t caretSlop); - void setYCaretPolicy(sptr_t caretPolicy, sptr_t caretSlop); - void setPrintWrapMode(sptr_t wrapMode); - sptr_t printWrapMode() const; - void setHotspotActiveFore(bool useSetting, sptr_t fore); - sptr_t hotspotActiveFore() const; - void setHotspotActiveBack(bool useSetting, sptr_t back); - sptr_t hotspotActiveBack() const; - void setHotspotActiveUnderline(bool underline); - bool hotspotActiveUnderline() const; - void setHotspotSingleLine(bool singleLine); - bool hotspotSingleLine() const; - void paraDown(); - void paraDownExtend(); - void paraUp(); - void paraUpExtend(); - sptr_t positionBefore(sptr_t pos); - sptr_t positionAfter(sptr_t pos); - sptr_t positionRelative(sptr_t pos, sptr_t relative); - void copyRange(sptr_t start, sptr_t end); - void copyText(sptr_t length, const char * text); - void setSelectionMode(sptr_t selectionMode); - sptr_t selectionMode() const; - sptr_t getLineSelStartPosition(sptr_t line); - sptr_t getLineSelEndPosition(sptr_t line); - void lineDownRectExtend(); - void lineUpRectExtend(); - void charLeftRectExtend(); - void charRightRectExtend(); - void homeRectExtend(); - void vCHomeRectExtend(); - void lineEndRectExtend(); - void pageUpRectExtend(); - void pageDownRectExtend(); - void stutteredPageUp(); - void stutteredPageUpExtend(); - void stutteredPageDown(); - void stutteredPageDownExtend(); - void wordLeftEnd(); - void wordLeftEndExtend(); - void wordRightEnd(); - void wordRightEndExtend(); - void setWhitespaceChars(const char * characters); - QByteArray whitespaceChars() const; - void setPunctuationChars(const char * characters); - QByteArray punctuationChars() const; - void setCharsDefault(); - sptr_t autoCCurrent() const; - QByteArray autoCCurrentText() const; - void autoCSetCaseInsensitiveBehaviour(sptr_t behaviour); - sptr_t autoCCaseInsensitiveBehaviour() const; - void autoCSetMulti(sptr_t multi); - sptr_t autoCMulti() const; - void autoCSetOrder(sptr_t order); - sptr_t autoCOrder() const; - void allocate(sptr_t bytes); - QByteArray targetAsUTF8(); - void setLengthForEncode(sptr_t bytes); - QByteArray encodedFromUTF8(const char * utf8); - sptr_t findColumn(sptr_t line, sptr_t column); - sptr_t caretSticky() const; - void setCaretSticky(sptr_t useCaretStickyBehaviour); - void toggleCaretSticky(); - void setPasteConvertEndings(bool convert); - bool pasteConvertEndings() const; - void selectionDuplicate(); - void setCaretLineBackAlpha(sptr_t alpha); - sptr_t caretLineBackAlpha() const; - void setCaretStyle(sptr_t caretStyle); - sptr_t caretStyle() const; - void setIndicatorCurrent(sptr_t indicator); - sptr_t indicatorCurrent() const; - void setIndicatorValue(sptr_t value); - sptr_t indicatorValue() const; - void indicatorFillRange(sptr_t start, sptr_t lengthFill); - void indicatorClearRange(sptr_t start, sptr_t lengthClear); - sptr_t indicatorAllOnFor(sptr_t pos); - sptr_t indicatorValueAt(sptr_t indicator, sptr_t pos); - sptr_t indicatorStart(sptr_t indicator, sptr_t pos); - sptr_t indicatorEnd(sptr_t indicator, sptr_t pos); - void setPositionCache(sptr_t size); - sptr_t positionCache() const; - void copyAllowLine(); - sptr_t characterPointer() const; - sptr_t rangePointer(sptr_t start, sptr_t lengthRange) const; - sptr_t gapPosition() const; - void indicSetAlpha(sptr_t indicator, sptr_t alpha); - sptr_t indicAlpha(sptr_t indicator) const; - void indicSetOutlineAlpha(sptr_t indicator, sptr_t alpha); - sptr_t indicOutlineAlpha(sptr_t indicator) const; - void setExtraAscent(sptr_t extraAscent); - sptr_t extraAscent() const; - void setExtraDescent(sptr_t extraDescent); - sptr_t extraDescent() const; - sptr_t markerSymbolDefined(sptr_t markerNumber); - void marginSetText(sptr_t line, const char * text); - QByteArray marginText(sptr_t line) const; - void marginSetStyle(sptr_t line, sptr_t style); - sptr_t marginStyle(sptr_t line) const; - void marginSetStyles(sptr_t line, const char * styles); - QByteArray marginStyles(sptr_t line) const; - void marginTextClearAll(); - void marginSetStyleOffset(sptr_t style); - sptr_t marginStyleOffset() const; - void setMarginOptions(sptr_t marginOptions); - sptr_t marginOptions() const; - void annotationSetText(sptr_t line, const char * text); - QByteArray annotationText(sptr_t line) const; - void annotationSetStyle(sptr_t line, sptr_t style); - sptr_t annotationStyle(sptr_t line) const; - void annotationSetStyles(sptr_t line, const char * styles); - QByteArray annotationStyles(sptr_t line) const; - sptr_t annotationLines(sptr_t line) const; - void annotationClearAll(); - void annotationSetVisible(sptr_t visible); - sptr_t annotationVisible() const; - void annotationSetStyleOffset(sptr_t style); - sptr_t annotationStyleOffset() const; - void releaseAllExtendedStyles(); - sptr_t allocateExtendedStyles(sptr_t numberStyles); - void addUndoAction(sptr_t token, sptr_t flags); - sptr_t charPositionFromPoint(sptr_t x, sptr_t y); - sptr_t charPositionFromPointClose(sptr_t x, sptr_t y); - void setMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch); - bool mouseSelectionRectangularSwitch() const; - void setMultipleSelection(bool multipleSelection); - bool multipleSelection() const; - void setAdditionalSelectionTyping(bool additionalSelectionTyping); - bool additionalSelectionTyping() const; - void setAdditionalCaretsBlink(bool additionalCaretsBlink); - bool additionalCaretsBlink() const; - void setAdditionalCaretsVisible(bool additionalCaretsVisible); - bool additionalCaretsVisible() const; - sptr_t selections() const; - bool selectionEmpty() const; - void clearSelections(); - sptr_t setSelection(sptr_t caret, sptr_t anchor); - sptr_t addSelection(sptr_t caret, sptr_t anchor); - void dropSelectionN(sptr_t selection); - void setMainSelection(sptr_t selection); - sptr_t mainSelection() const; - void setSelectionNCaret(sptr_t selection, sptr_t caret); - sptr_t selectionNCaret(sptr_t selection) const; - void setSelectionNAnchor(sptr_t selection, sptr_t anchor); - sptr_t selectionNAnchor(sptr_t selection) const; - void setSelectionNCaretVirtualSpace(sptr_t selection, sptr_t space); - sptr_t selectionNCaretVirtualSpace(sptr_t selection) const; - void setSelectionNAnchorVirtualSpace(sptr_t selection, sptr_t space); - sptr_t selectionNAnchorVirtualSpace(sptr_t selection) const; - void setSelectionNStart(sptr_t selection, sptr_t anchor); - sptr_t selectionNStart(sptr_t selection) const; - void setSelectionNEnd(sptr_t selection, sptr_t caret); - sptr_t selectionNEnd(sptr_t selection) const; - void setRectangularSelectionCaret(sptr_t caret); - sptr_t rectangularSelectionCaret() const; - void setRectangularSelectionAnchor(sptr_t anchor); - sptr_t rectangularSelectionAnchor() const; - void setRectangularSelectionCaretVirtualSpace(sptr_t space); - sptr_t rectangularSelectionCaretVirtualSpace() const; - void setRectangularSelectionAnchorVirtualSpace(sptr_t space); - sptr_t rectangularSelectionAnchorVirtualSpace() const; - void setVirtualSpaceOptions(sptr_t virtualSpaceOptions); - sptr_t virtualSpaceOptions() const; - void setRectangularSelectionModifier(sptr_t modifier); - sptr_t rectangularSelectionModifier() const; - void setAdditionalSelFore(sptr_t fore); - void setAdditionalSelBack(sptr_t back); - void setAdditionalSelAlpha(sptr_t alpha); - sptr_t additionalSelAlpha() const; - void setAdditionalCaretFore(sptr_t fore); - sptr_t additionalCaretFore() const; - void rotateSelection(); - void swapMainAnchorCaret(); - void multipleSelectAddNext(); - void multipleSelectAddEach(); - sptr_t changeLexerState(sptr_t start, sptr_t end); - sptr_t contractedFoldNext(sptr_t lineStart); - void verticalCentreCaret(); - void moveSelectedLinesUp(); - void moveSelectedLinesDown(); - void setIdentifier(sptr_t identifier); - sptr_t identifier() const; - void rGBAImageSetWidth(sptr_t width); - void rGBAImageSetHeight(sptr_t height); - void rGBAImageSetScale(sptr_t scalePercent); - void markerDefineRGBAImage(sptr_t markerNumber, const char * pixels); - void registerRGBAImage(sptr_t type, const char * pixels); - void scrollToStart(); - void scrollToEnd(); - void setTechnology(sptr_t technology); - sptr_t technology() const; - sptr_t createLoader(sptr_t bytes); - void findIndicatorShow(sptr_t start, sptr_t end); - void findIndicatorFlash(sptr_t start, sptr_t end); - void findIndicatorHide(); - void vCHomeDisplay(); - void vCHomeDisplayExtend(); - bool caretLineVisibleAlways() const; - void setCaretLineVisibleAlways(bool alwaysVisible); - void setLineEndTypesAllowed(sptr_t lineEndBitSet); - sptr_t lineEndTypesAllowed() const; - sptr_t lineEndTypesActive() const; - void setRepresentation(const char * encodedCharacter, const char * representation); - QByteArray representation(const char * encodedCharacter) const; - void clearRepresentation(const char * encodedCharacter); - void startRecord(); - void stopRecord(); - void setLexer(sptr_t lexer); - sptr_t lexer() const; - void colourise(sptr_t start, sptr_t end); - void setProperty(const char * key, const char * value); - void setKeyWords(sptr_t keyWordSet, const char * keyWords); - void setLexerLanguage(const char * language); - void loadLexerLibrary(const char * path); - QByteArray property(const char * key) const; - QByteArray propertyExpanded(const char * key) const; - sptr_t propertyInt(const char * key, sptr_t defaultValue) const; - sptr_t styleBitsNeeded() const; - QByteArray lexerLanguage() const; - sptr_t privateLexerCall(sptr_t operation, sptr_t pointer); - QByteArray propertyNames(); - sptr_t propertyType(const char * name); - QByteArray describeProperty(const char * name); - QByteArray describeKeyWordSets(); - sptr_t lineEndTypesSupported() const; - sptr_t allocateSubStyles(sptr_t styleBase, sptr_t numberStyles); - sptr_t subStylesStart(sptr_t styleBase) const; - sptr_t subStylesLength(sptr_t styleBase) const; - sptr_t styleFromSubStyle(sptr_t subStyle) const; - sptr_t primaryStyleFromStyle(sptr_t style) const; - void freeSubStyles(); - void setIdentifiers(sptr_t style, const char * identifiers); - sptr_t distanceToSecondaryStyles() const; - QByteArray subStyleBases() const; -/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ - -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#if defined(__GNUC__) -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif - -#endif /* SCINTILLAEDIT_H */ diff --git a/qrenderdoc/3rdparty/scintilla/include/qt/ScintillaEditBase.h b/qrenderdoc/3rdparty/scintilla/include/qt/ScintillaEditBase.h deleted file mode 100644 index a7ba73427..000000000 --- a/qrenderdoc/3rdparty/scintilla/include/qt/ScintillaEditBase.h +++ /dev/null @@ -1,156 +0,0 @@ -// -// Copyright (c) 1990-2011, Scientific Toolworks, Inc. -// -// The License.txt file describes the conditions under which this software may be distributed. -// -// Author: Jason Haslam -// -// Additions Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware -// ScintillaWidget.h - Qt widget that wraps ScintillaQt and provides events and scrolling - - -#ifndef SCINTILLAEDITBASE_H -#define SCINTILLAEDITBASE_H - -#include "../Platform.h" -#include "../Scintilla.h" - -#include -#include -#include - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class ScintillaQt; -class SurfaceImpl; -struct SCNotification; - -#ifdef WIN32 -#ifdef MAKING_LIBRARY -#define EXPORT_IMPORT_API __declspec(dllexport) -#else -// Defining dllimport upsets moc -#define EXPORT_IMPORT_API __declspec(dllimport) -//#define EXPORT_IMPORT_API -#endif -#else -#define EXPORT_IMPORT_API -#endif - -class EXPORT_IMPORT_API ScintillaEditBase : public QAbstractScrollArea { - Q_OBJECT - -public: - explicit ScintillaEditBase(QWidget *parent = 0); - virtual ~ScintillaEditBase(); - - virtual sptr_t send( - unsigned int iMessage, - uptr_t wParam = 0, - sptr_t lParam = 0) const; - - virtual sptr_t sends( - unsigned int iMessage, - uptr_t wParam = 0, - const char *s = 0) const; - -public slots: - // Scroll events coming from GUI to be sent to Scintilla. - void scrollHorizontal(int value); - void scrollVertical(int value); - - // Emit Scintilla notifications as signals. - void notifyParent(SCNotification scn); - void event_command(uptr_t wParam, sptr_t lParam); - -signals: - void horizontalScrolled(int value); - void verticalScrolled(int value); - void horizontalRangeChanged(int max, int page); - void verticalRangeChanged(int max, int page); - void notifyChange(); - void linesAdded(int linesAdded); - - // Clients can use this hook to add additional - // formats (e.g. rich text) to the MIME data. - void aboutToCopy(QMimeData *data); - - // Scintilla Notifications - void styleNeeded(int position); - void charAdded(int ch); - void savePointChanged(bool dirty); - void modifyAttemptReadOnly(); - void key(int key); - void doubleClick(int position, int line); - void updateUi(); - void modified(int type, int position, int length, int linesAdded, - const QByteArray &text, int line, int foldNow, int foldPrev); - void macroRecord(int message, uptr_t wParam, sptr_t lParam); - void marginClicked(int position, int modifiers, int margin); - void textAreaClicked(int line, int modifiers); - void needShown(int position, int length); - void painted(); - void userListSelection(); // Wants some args. - void uriDropped(); // Wants some args. - void dwellStart(int x, int y); - void dwellEnd(int x, int y); - void zoom(int zoom); - void hotSpotClick(int position, int modifiers); - void hotSpotDoubleClick(int position, int modifiers); - void callTipClick(); - void autoCompleteSelection(int position, const QString &text); - void autoCompleteCancelled(); - - // Base notifications for compatibility with other Scintilla implementations - void notify(SCNotification *pscn); - void command(uptr_t wParam, sptr_t lParam); - - // GUI event notifications needed under Qt - void buttonPressed(QMouseEvent *event); - void buttonReleased(QMouseEvent *event); - void keyPressed(QKeyEvent *event); - void resized(); - -protected: - virtual bool event(QEvent *event); - virtual void paintEvent(QPaintEvent *event); - virtual void wheelEvent(QWheelEvent *event); - virtual void focusInEvent(QFocusEvent *event); - virtual void focusOutEvent(QFocusEvent *event); - virtual void resizeEvent(QResizeEvent *event); - virtual void keyPressEvent(QKeyEvent *event); - virtual void mousePressEvent(QMouseEvent *event); - virtual void mouseReleaseEvent(QMouseEvent *event); - virtual void mouseDoubleClickEvent(QMouseEvent *event); - virtual void mouseMoveEvent(QMouseEvent *event); - virtual void contextMenuEvent(QContextMenuEvent *event); - virtual void dragEnterEvent(QDragEnterEvent *event); - virtual void dragLeaveEvent(QDragLeaveEvent *event); - virtual void dragMoveEvent(QDragMoveEvent *event); - virtual void dropEvent(QDropEvent *event); - virtual void inputMethodEvent(QInputMethodEvent *event); - virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; - virtual void scrollContentsBy(int, int) {} - -private: - ScintillaQt *sqt; - - QTime time; - - int preeditPos; - QString preeditString; - - int wheelDelta; - - static bool IsHangul(const QChar qchar); - void MoveImeCarets(int offset); - void DrawImeIndicator(int indicator, int len); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif /* SCINTILLAEDITBASE_H */ diff --git a/qrenderdoc/3rdparty/scintilla/lexers/LexCPP.cxx b/qrenderdoc/3rdparty/scintilla/lexers/LexCPP.cxx deleted file mode 100644 index ec040fbf6..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexers/LexCPP.cxx +++ /dev/null @@ -1,1640 +0,0 @@ -// Scintilla source code edit control -/** @file LexCPP.cxx - ** Lexer for C++, C, Java, and JavaScript. - ** Further folding features and configuration properties added by "Udo Lechner" - **/ -// Copyright 1998-2005 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "CharacterSet.h" -#include "LexerModule.h" -#include "OptionSet.h" -#include "SparseState.h" -#include "SubStyles.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -namespace { - // Use an unnamed namespace to protect the functions and classes from name conflicts - -bool IsSpaceEquiv(int state) { - return (state <= SCE_C_COMMENTDOC) || - // including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE - (state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) || - (state == SCE_C_COMMENTDOCKEYWORDERROR); -} - -// Preconditions: sc.currentPos points to a character after '+' or '-'. -// The test for pos reaching 0 should be redundant, -// and is in only for safety measures. -// Limitation: this code will give the incorrect answer for code like -// a = b+++/ptn/... -// Putting a space between the '++' post-inc operator and the '+' binary op -// fixes this, and is highly recommended for readability anyway. -bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) { - Sci_Position pos = (Sci_Position) sc.currentPos; - while (--pos > 0) { - char ch = styler[pos]; - if (ch == '+' || ch == '-') { - return styler[pos - 1] == ch; - } - } - return false; -} - -bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) { - // Don't look at styles, so no need to flush. - Sci_Position pos = (Sci_Position) sc.currentPos; - Sci_Position currentLine = styler.GetLine(pos); - Sci_Position lineStartPos = styler.LineStart(currentLine); - while (--pos > lineStartPos) { - char ch = styler.SafeGetCharAt(pos); - if (ch != ' ' && ch != '\t') { - break; - } - } - const char *retBack = "nruter"; - const char *s = retBack; - while (*s - && pos >= lineStartPos - && styler.SafeGetCharAt(pos) == *s) { - s++; - pos--; - } - return !*s; -} - -bool IsSpaceOrTab(int ch) { - return ch == ' ' || ch == '\t'; -} - -bool OnlySpaceOrTab(const std::string &s) { - for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) { - if (!IsSpaceOrTab(*it)) - return false; - } - return true; -} - -std::vector StringSplit(const std::string &text, int separator) { - std::vector vs(text.empty() ? 0 : 1); - for (std::string::const_iterator it = text.begin(); it != text.end(); ++it) { - if (*it == separator) { - vs.push_back(std::string()); - } else { - vs.back() += *it; - } - } - return vs; -} - -struct BracketPair { - std::vector::iterator itBracket; - std::vector::iterator itEndBracket; -}; - -BracketPair FindBracketPair(std::vector &tokens) { - BracketPair bp; - std::vector::iterator itTok = std::find(tokens.begin(), tokens.end(), "("); - bp.itBracket = tokens.end(); - bp.itEndBracket = tokens.end(); - if (itTok != tokens.end()) { - bp.itBracket = itTok; - size_t nest = 0; - while (itTok != tokens.end()) { - if (*itTok == "(") { - nest++; - } else if (*itTok == ")") { - nest--; - if (nest == 0) { - bp.itEndBracket = itTok; - return bp; - } - } - ++itTok; - } - } - bp.itBracket = tokens.end(); - return bp; -} - -void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, - int activity, WordList &markerList, bool caseSensitive){ - if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) { - const int lengthMarker = 50; - char marker[lengthMarker+1]; - Sci_Position currPos = (Sci_Position) sc.currentPos; - int i = 0; - while (i < lengthMarker) { - char ch = styler.SafeGetCharAt(currPos + i); - if (IsASpace(ch) || isoperator(ch)) { - break; - } - if (caseSensitive) - marker[i] = ch; - else - marker[i] = static_cast(tolower(ch)); - i++; - } - marker[i] = '\0'; - if (markerList.InList(marker)) { - sc.SetState(SCE_C_TASKMARKER|activity); - } - } -} - -struct EscapeSequence { - int digitsLeft; - CharacterSet setHexDigits; - CharacterSet setOctDigits; - CharacterSet setNoneNumeric; - CharacterSet *escapeSetValid; - EscapeSequence() { - digitsLeft = 0; - escapeSetValid = 0; - setHexDigits = CharacterSet(CharacterSet::setDigits, "ABCDEFabcdef"); - setOctDigits = CharacterSet(CharacterSet::setNone, "01234567"); - } - void resetEscapeState(int nextChar) { - digitsLeft = 0; - escapeSetValid = &setNoneNumeric; - if (nextChar == 'U') { - digitsLeft = 9; - escapeSetValid = &setHexDigits; - } else if (nextChar == 'u') { - digitsLeft = 5; - escapeSetValid = &setHexDigits; - } else if (nextChar == 'x') { - digitsLeft = 5; - escapeSetValid = &setHexDigits; - } else if (setOctDigits.Contains(nextChar)) { - digitsLeft = 3; - escapeSetValid = &setOctDigits; - } - } - bool atEscapeEnd(int currChar) const { - return (digitsLeft <= 0) || !escapeSetValid->Contains(currChar); - } -}; - -std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) { - std::string restOfLine; - Sci_Position i =0; - char ch = styler.SafeGetCharAt(start, '\n'); - Sci_Position endLine = styler.LineEnd(styler.GetLine(start)); - while (((start+i) < endLine) && (ch != '\r')) { - char chNext = styler.SafeGetCharAt(start + i + 1, '\n'); - if (ch == '/' && (chNext == '/' || chNext == '*')) - break; - if (allowSpace || (ch != ' ')) - restOfLine += ch; - i++; - ch = chNext; - } - return restOfLine; -} - -bool IsStreamCommentStyle(int style) { - return style == SCE_C_COMMENT || - style == SCE_C_COMMENTDOC || - style == SCE_C_COMMENTDOCKEYWORD || - style == SCE_C_COMMENTDOCKEYWORDERROR; -} - -struct PPDefinition { - Sci_Position line; - std::string key; - std::string value; - bool isUndef; - std::string arguments; - PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, const std::string &arguments_="") : - line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) { - } -}; - -class LinePPState { - int state; - int ifTaken; - int level; - bool ValidLevel() const { - return level >= 0 && level < 32; - } - int maskLevel() const { - return 1 << level; - } -public: - LinePPState() : state(0), ifTaken(0), level(-1) { - } - bool IsInactive() const { - return state != 0; - } - bool CurrentIfTaken() const { - return (ifTaken & maskLevel()) != 0; - } - void StartSection(bool on) { - level++; - if (ValidLevel()) { - if (on) { - state &= ~maskLevel(); - ifTaken |= maskLevel(); - } else { - state |= maskLevel(); - ifTaken &= ~maskLevel(); - } - } - } - void EndSection() { - if (ValidLevel()) { - state &= ~maskLevel(); - ifTaken &= ~maskLevel(); - } - level--; - } - void InvertCurrentLevel() { - if (ValidLevel()) { - state ^= maskLevel(); - ifTaken |= maskLevel(); - } - } -}; - -// Hold the preprocessor state for each line seen. -// Currently one entry per line but could become sparse with just one entry per preprocessor line. -class PPStates { - std::vector vlls; -public: - LinePPState ForLine(Sci_Position line) const { - if ((line > 0) && (vlls.size() > static_cast(line))) { - return vlls[line]; - } else { - return LinePPState(); - } - } - void Add(Sci_Position line, LinePPState lls) { - vlls.resize(line+1); - vlls[line] = lls; - } -}; - -// An individual named option for use in an OptionSet - -// Options used for LexerCPP -struct OptionsCPP { - bool stylingWithinPreprocessor; - bool identifiersAllowDollars; - bool trackPreprocessor; - bool updatePreprocessor; - bool verbatimStringsAllowEscapes; - bool triplequotedStrings; - bool hashquotedStrings; - bool backQuotedStrings; - bool escapeSequence; - bool fold; - bool foldSyntaxBased; - bool foldComment; - bool foldCommentMultiline; - bool foldCommentExplicit; - std::string foldExplicitStart; - std::string foldExplicitEnd; - bool foldExplicitAnywhere; - bool foldPreprocessor; - bool foldPreprocessorAtElse; - bool foldCompact; - bool foldAtElse; - OptionsCPP() { - stylingWithinPreprocessor = false; - identifiersAllowDollars = true; - trackPreprocessor = true; - updatePreprocessor = true; - verbatimStringsAllowEscapes = false; - triplequotedStrings = false; - hashquotedStrings = false; - backQuotedStrings = false; - escapeSequence = false; - fold = false; - foldSyntaxBased = true; - foldComment = false; - foldCommentMultiline = true; - foldCommentExplicit = true; - foldExplicitStart = ""; - foldExplicitEnd = ""; - foldExplicitAnywhere = false; - foldPreprocessor = false; - foldPreprocessorAtElse = false; - foldCompact = false; - foldAtElse = false; - } -}; - -const char *const cppWordLists[] = { - "Primary keywords and identifiers", - "Secondary keywords and identifiers", - "Documentation comment keywords", - "Global classes and typedefs", - "Preprocessor definitions", - "Task marker and error marker keywords", - 0, -}; - -struct OptionSetCPP : public OptionSet { - OptionSetCPP() { - DefineProperty("styling.within.preprocessor", &OptionsCPP::stylingWithinPreprocessor, - "For C++ code, determines whether all preprocessor code is styled in the " - "preprocessor style (0, the default) or only from the initial # to the end " - "of the command word(1)."); - - DefineProperty("lexer.cpp.allow.dollars", &OptionsCPP::identifiersAllowDollars, - "Set to 0 to disallow the '$' character in identifiers with the cpp lexer."); - - DefineProperty("lexer.cpp.track.preprocessor", &OptionsCPP::trackPreprocessor, - "Set to 1 to interpret #if/#else/#endif to grey out code that is not active."); - - DefineProperty("lexer.cpp.update.preprocessor", &OptionsCPP::updatePreprocessor, - "Set to 1 to update preprocessor definitions when #define found."); - - DefineProperty("lexer.cpp.verbatim.strings.allow.escapes", &OptionsCPP::verbatimStringsAllowEscapes, - "Set to 1 to allow verbatim strings to contain escape sequences."); - - DefineProperty("lexer.cpp.triplequoted.strings", &OptionsCPP::triplequotedStrings, - "Set to 1 to enable highlighting of triple-quoted strings."); - - DefineProperty("lexer.cpp.hashquoted.strings", &OptionsCPP::hashquotedStrings, - "Set to 1 to enable highlighting of hash-quoted strings."); - - DefineProperty("lexer.cpp.backquoted.strings", &OptionsCPP::backQuotedStrings, - "Set to 1 to enable highlighting of back-quoted raw strings ."); - - DefineProperty("lexer.cpp.escape.sequence", &OptionsCPP::escapeSequence, - "Set to 1 to enable highlighting of escape sequences in strings"); - - DefineProperty("fold", &OptionsCPP::fold); - - DefineProperty("fold.cpp.syntax.based", &OptionsCPP::foldSyntaxBased, - "Set this property to 0 to disable syntax based folding."); - - DefineProperty("fold.comment", &OptionsCPP::foldComment, - "This option enables folding multi-line comments and explicit fold points when using the C++ lexer. " - "Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //} " - "at the end of a section that should fold."); - - DefineProperty("fold.cpp.comment.multiline", &OptionsCPP::foldCommentMultiline, - "Set this property to 0 to disable folding multi-line comments when fold.comment=1."); - - DefineProperty("fold.cpp.comment.explicit", &OptionsCPP::foldCommentExplicit, - "Set this property to 0 to disable folding explicit fold points when fold.comment=1."); - - DefineProperty("fold.cpp.explicit.start", &OptionsCPP::foldExplicitStart, - "The string to use for explicit fold start points, replacing the standard //{."); - - DefineProperty("fold.cpp.explicit.end", &OptionsCPP::foldExplicitEnd, - "The string to use for explicit fold end points, replacing the standard //}."); - - DefineProperty("fold.cpp.explicit.anywhere", &OptionsCPP::foldExplicitAnywhere, - "Set this property to 1 to enable explicit fold points anywhere, not just in line comments."); - - DefineProperty("fold.cpp.preprocessor.at.else", &OptionsCPP::foldPreprocessorAtElse, - "This option enables folding on a preprocessor #else or #endif line of an #if statement."); - - DefineProperty("fold.preprocessor", &OptionsCPP::foldPreprocessor, - "This option enables folding preprocessor directives when using the C++ lexer. " - "Includes C#'s explicit #region and #endregion folding directives."); - - DefineProperty("fold.compact", &OptionsCPP::foldCompact); - - DefineProperty("fold.at.else", &OptionsCPP::foldAtElse, - "This option enables C++ folding on a \"} else {\" line of an if statement."); - - DefineWordListSets(cppWordLists); - } -}; - -const char styleSubable[] = {SCE_C_IDENTIFIER, SCE_C_COMMENTDOCKEYWORD, 0}; - -} - -class LexerCPP : public ILexerWithSubStyles { - bool caseSensitive; - CharacterSet setWord; - CharacterSet setNegationOp; - CharacterSet setArithmethicOp; - CharacterSet setRelOp; - CharacterSet setLogicalOp; - CharacterSet setWordStart; - PPStates vlls; - std::vector ppDefineHistory; - WordList keywords; - WordList keywords2; - WordList keywords3; - WordList keywords4; - WordList ppDefinitions; - WordList markerList; - struct SymbolValue { - std::string value; - std::string arguments; - SymbolValue(const std::string &value_="", const std::string &arguments_="") : value(value_), arguments(arguments_) { - } - SymbolValue &operator = (const std::string &value_) { - value = value_; - arguments.clear(); - return *this; - } - bool IsMacro() const { - return !arguments.empty(); - } - }; - typedef std::map SymbolTable; - SymbolTable preprocessorDefinitionsStart; - OptionsCPP options; - OptionSetCPP osCPP; - EscapeSequence escapeSeq; - SparseState rawStringTerminators; - enum { activeFlag = 0x40 }; - enum { ssIdentifier, ssDocKeyword }; - SubStyles subStyles; -public: - explicit LexerCPP(bool caseSensitive_) : - caseSensitive(caseSensitive_), - setWord(CharacterSet::setAlphaNum, "._", 0x80, true), - setNegationOp(CharacterSet::setNone, "!"), - setArithmethicOp(CharacterSet::setNone, "+-/*%"), - setRelOp(CharacterSet::setNone, "=!<>"), - setLogicalOp(CharacterSet::setNone, "|&"), - subStyles(styleSubable, 0x80, 0x40, activeFlag) { - } - virtual ~LexerCPP() { - } - void SCI_METHOD Release() { - delete this; - } - int SCI_METHOD Version() const { - return lvSubStyles; - } - const char * SCI_METHOD PropertyNames() { - return osCPP.PropertyNames(); - } - int SCI_METHOD PropertyType(const char *name) { - return osCPP.PropertyType(name); - } - const char * SCI_METHOD DescribeProperty(const char *name) { - return osCPP.DescribeProperty(name); - } - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); - const char * SCI_METHOD DescribeWordListSets() { - return osCPP.DescribeWordListSets(); - } - Sci_Position SCI_METHOD WordListSet(int n, const char *wl); - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); - - void * SCI_METHOD PrivateCall(int, void *) { - return 0; - } - - int SCI_METHOD LineEndTypesSupported() { - return SC_LINE_END_TYPE_UNICODE; - } - - int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) { - return subStyles.Allocate(styleBase, numberStyles); - } - int SCI_METHOD SubStylesStart(int styleBase) { - return subStyles.Start(styleBase); - } - int SCI_METHOD SubStylesLength(int styleBase) { - return subStyles.Length(styleBase); - } - int SCI_METHOD StyleFromSubStyle(int subStyle) { - int styleBase = subStyles.BaseStyle(MaskActive(subStyle)); - int active = subStyle & activeFlag; - return styleBase | active; - } - int SCI_METHOD PrimaryStyleFromStyle(int style) { - return MaskActive(style); - } - void SCI_METHOD FreeSubStyles() { - subStyles.Free(); - } - void SCI_METHOD SetIdentifiers(int style, const char *identifiers) { - subStyles.SetIdentifiers(style, identifiers); - } - int SCI_METHOD DistanceToSecondaryStyles() { - return activeFlag; - } - const char * SCI_METHOD GetSubStyleBases() { - return styleSubable; - } - - static ILexer *LexerFactoryCPP() { - return new LexerCPP(true); - } - static ILexer *LexerFactoryCPPInsensitive() { - return new LexerCPP(false); - } - static int MaskActive(int style) { - return style & ~activeFlag; - } - void EvaluateTokens(std::vector &tokens, const SymbolTable &preprocessorDefinitions); - std::vector Tokenize(const std::string &expr) const; - bool EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions); -}; - -Sci_Position SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) { - if (osCPP.PropertySet(&options, key, val)) { - if (strcmp(key, "lexer.cpp.allow.dollars") == 0) { - setWord = CharacterSet(CharacterSet::setAlphaNum, "._", 0x80, true); - if (options.identifiersAllowDollars) { - setWord.Add('$'); - } - } - return 0; - } - return -1; -} - -Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { - WordList *wordListN = 0; - switch (n) { - case 0: - wordListN = &keywords; - break; - case 1: - wordListN = &keywords2; - break; - case 2: - wordListN = &keywords3; - break; - case 3: - wordListN = &keywords4; - break; - case 4: - wordListN = &ppDefinitions; - break; - case 5: - wordListN = &markerList; - break; - } - Sci_Position firstModification = -1; - if (wordListN) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - if (n == 4) { - // Rebuild preprocessorDefinitions - preprocessorDefinitionsStart.clear(); - for (int nDefinition = 0; nDefinition < ppDefinitions.Length(); nDefinition++) { - const char *cpDefinition = ppDefinitions.WordAt(nDefinition); - const char *cpEquals = strchr(cpDefinition, '='); - if (cpEquals) { - std::string name(cpDefinition, cpEquals - cpDefinition); - std::string val(cpEquals+1); - size_t bracket = name.find('('); - size_t bracketEnd = name.find(')'); - if ((bracket != std::string::npos) && (bracketEnd != std::string::npos)) { - // Macro - std::string args = name.substr(bracket + 1, bracketEnd - bracket - 1); - name = name.substr(0, bracket); - preprocessorDefinitionsStart[name] = SymbolValue(val, args); - } else { - preprocessorDefinitionsStart[name] = val; - } - } else { - std::string name(cpDefinition); - std::string val("1"); - preprocessorDefinitionsStart[name] = val; - } - } - } - } - } - return firstModification; -} - -// Functor used to truncate history -struct After { - Sci_Position line; - explicit After(Sci_Position line_) : line(line_) {} - bool operator()(PPDefinition &p) const { - return p.line > line; - } -}; - -void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - LexAccessor styler(pAccess); - - CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); - CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); - - CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]"); - - setWordStart = CharacterSet(CharacterSet::setAlpha, "_", 0x80, true); - - CharacterSet setInvalidRawFirst(CharacterSet::setNone, " )\\\t\v\f\n"); - - if (options.identifiersAllowDollars) { - setWordStart.Add('$'); - } - - int chPrevNonWhite = ' '; - int visibleChars = 0; - bool lastWordWasUUID = false; - int styleBeforeDCKeyword = SCE_C_DEFAULT; - int styleBeforeTaskMarker = SCE_C_DEFAULT; - bool continuationLine = false; - bool isIncludePreprocessor = false; - bool isStringInPreprocessor = false; - bool inRERange = false; - bool seenDocKeyBrace = false; - - Sci_Position lineCurrent = styler.GetLine(startPos); - if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) || - (MaskActive(initStyle) == SCE_C_COMMENTLINE) || - (MaskActive(initStyle) == SCE_C_COMMENTLINEDOC)) { - // Set continuationLine if last character of previous line is '\' - if (lineCurrent > 0) { - Sci_Position endLinePrevious = styler.LineEnd(lineCurrent - 1); - if (endLinePrevious > 0) { - continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\'; - } - } - } - - // look back to set chPrevNonWhite properly for better regex colouring - if (startPos > 0) { - Sci_Position back = startPos; - while (--back && IsSpaceEquiv(MaskActive(styler.StyleAt(back)))) - ; - if (MaskActive(styler.StyleAt(back)) == SCE_C_OPERATOR) { - chPrevNonWhite = styler.SafeGetCharAt(back); - } - } - - StyleContext sc(startPos, length, initStyle, styler); - LinePPState preproc = vlls.ForLine(lineCurrent); - - bool definitionsChanged = false; - - // Truncate ppDefineHistory before current line - - if (!options.updatePreprocessor) - ppDefineHistory.clear(); - - std::vector::iterator itInvalid = std::find_if(ppDefineHistory.begin(), ppDefineHistory.end(), After(lineCurrent-1)); - if (itInvalid != ppDefineHistory.end()) { - ppDefineHistory.erase(itInvalid, ppDefineHistory.end()); - definitionsChanged = true; - } - - SymbolTable preprocessorDefinitions = preprocessorDefinitionsStart; - for (std::vector::iterator itDef = ppDefineHistory.begin(); itDef != ppDefineHistory.end(); ++itDef) { - if (itDef->isUndef) - preprocessorDefinitions.erase(itDef->key); - else - preprocessorDefinitions[itDef->key] = SymbolValue(itDef->value, itDef->arguments); - } - - std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1); - SparseState rawSTNew(lineCurrent); - - int activitySet = preproc.IsInactive() ? activeFlag : 0; - - const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_C_IDENTIFIER); - const WordClassifier &classifierDocKeyWords = subStyles.Classifier(SCE_C_COMMENTDOCKEYWORD); - - Sci_Position lineEndNext = styler.LineEnd(lineCurrent); - - for (; sc.More();) { - - if (sc.atLineStart) { - // Using MaskActive() is not needed in the following statement. - // Inside inactive preprocessor declaration, state will be reset anyway at the end of this block. - if ((sc.state == SCE_C_STRING) || (sc.state == SCE_C_CHARACTER)) { - // Prevent SCE_C_STRINGEOL from leaking back to previous line which - // ends with a line continuation by locking in the state up to this position. - sc.SetState(sc.state); - } - if ((MaskActive(sc.state) == SCE_C_PREPROCESSOR) && (!continuationLine)) { - sc.SetState(SCE_C_DEFAULT|activitySet); - } - // Reset states to beginning of colourise so no surprises - // if different sets of lines lexed. - visibleChars = 0; - lastWordWasUUID = false; - isIncludePreprocessor = false; - inRERange = false; - if (preproc.IsInactive()) { - activitySet = activeFlag; - sc.SetState(sc.state | activitySet); - } - } - - if (sc.atLineEnd) { - lineCurrent++; - lineEndNext = styler.LineEnd(lineCurrent); - vlls.Add(lineCurrent, preproc); - if (rawStringTerminator != "") { - rawSTNew.Set(lineCurrent-1, rawStringTerminator); - } - } - - // Handle line continuation generically. - if (sc.ch == '\\') { - if (static_cast((sc.currentPos+1)) >= lineEndNext) { - lineCurrent++; - lineEndNext = styler.LineEnd(lineCurrent); - vlls.Add(lineCurrent, preproc); - if (rawStringTerminator != "") { - rawSTNew.Set(lineCurrent-1, rawStringTerminator); - } - sc.Forward(); - if (sc.ch == '\r' && sc.chNext == '\n') { - // Even in UTF-8, \r and \n are separate - sc.Forward(); - } - continuationLine = true; - sc.Forward(); - continue; - } - } - - const bool atLineEndBeforeSwitch = sc.atLineEnd; - - // Determine if the current state should terminate. - switch (MaskActive(sc.state)) { - case SCE_C_OPERATOR: - sc.SetState(SCE_C_DEFAULT|activitySet); - break; - case SCE_C_NUMBER: - // We accept almost anything because of hex. and number suffixes - if (sc.ch == '_') { - sc.ChangeState(SCE_C_USERLITERAL|activitySet); - } else if (!(setWord.Contains(sc.ch) - || (sc.ch == '\'') - || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E' || - sc.chPrev == 'p' || sc.chPrev == 'P')))) { - sc.SetState(SCE_C_DEFAULT|activitySet); - } - break; - case SCE_C_USERLITERAL: - if (!(setWord.Contains(sc.ch))) - sc.SetState(SCE_C_DEFAULT|activitySet); - break; - case SCE_C_IDENTIFIER: - if (sc.atLineStart || sc.atLineEnd || !setWord.Contains(sc.ch) || (sc.ch == '.')) { - char s[1000]; - if (caseSensitive) { - sc.GetCurrent(s, sizeof(s)); - } else { - sc.GetCurrentLowered(s, sizeof(s)); - } - if (keywords.InList(s)) { - lastWordWasUUID = strcmp(s, "uuid") == 0; - sc.ChangeState(SCE_C_WORD|activitySet); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_C_WORD2|activitySet); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_C_GLOBALCLASS|activitySet); - } else { - int subStyle = classifierIdentifiers.ValueFor(s); - if (subStyle >= 0) { - sc.ChangeState(subStyle|activitySet); - } - } - const bool literalString = sc.ch == '\"'; - if (literalString || sc.ch == '\'') { - size_t lenS = strlen(s); - const bool raw = literalString && sc.chPrev == 'R' && !setInvalidRawFirst.Contains(sc.chNext); - if (raw) - s[lenS--] = '\0'; - bool valid = - (lenS == 0) || - ((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) || - ((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8')); - if (valid) { - if (literalString) { - if (raw) { - // Set the style of the string prefix to SCE_C_STRINGRAW but then change to - // SCE_C_DEFAULT as that allows the raw string start code to run. - sc.ChangeState(SCE_C_STRINGRAW|activitySet); - sc.SetState(SCE_C_DEFAULT|activitySet); - } else { - sc.ChangeState(SCE_C_STRING|activitySet); - } - } else { - sc.ChangeState(SCE_C_CHARACTER|activitySet); - } - } else { - sc.SetState(SCE_C_DEFAULT | activitySet); - } - } else { - sc.SetState(SCE_C_DEFAULT|activitySet); - } - } - break; - case SCE_C_PREPROCESSOR: - if (options.stylingWithinPreprocessor) { - if (IsASpace(sc.ch)) { - sc.SetState(SCE_C_DEFAULT|activitySet); - } - } else if (isStringInPreprocessor && (sc.Match('>') || sc.Match('\"') || sc.atLineEnd)) { - isStringInPreprocessor = false; - } else if (!isStringInPreprocessor) { - if ((isIncludePreprocessor && sc.Match('<')) || sc.Match('\"')) { - isStringInPreprocessor = true; - } else if (sc.Match('/', '*')) { - if (sc.Match("/**") || sc.Match("/*!")) { - sc.SetState(SCE_C_PREPROCESSORCOMMENTDOC|activitySet); - } else { - sc.SetState(SCE_C_PREPROCESSORCOMMENT|activitySet); - } - sc.Forward(); // Eat the * - } else if (sc.Match('/', '/')) { - sc.SetState(SCE_C_DEFAULT|activitySet); - } - } - break; - case SCE_C_PREPROCESSORCOMMENT: - case SCE_C_PREPROCESSORCOMMENTDOC: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_C_PREPROCESSOR|activitySet); - continue; // Without advancing in case of '\'. - } - break; - case SCE_C_COMMENT: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); - } else { - styleBeforeTaskMarker = SCE_C_COMMENT; - highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive); - } - break; - case SCE_C_COMMENTDOC: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); - } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support - // Verify that we have the conditions to mark a comment-doc-keyword - if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { - styleBeforeDCKeyword = SCE_C_COMMENTDOC; - sc.SetState(SCE_C_COMMENTDOCKEYWORD|activitySet); - } - } - break; - case SCE_C_COMMENTLINE: - if (sc.atLineStart && !continuationLine) { - sc.SetState(SCE_C_DEFAULT|activitySet); - } else { - styleBeforeTaskMarker = SCE_C_COMMENTLINE; - highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive); - } - break; - case SCE_C_COMMENTLINEDOC: - if (sc.atLineStart && !continuationLine) { - sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support - // Verify that we have the conditions to mark a comment-doc-keyword - if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { - styleBeforeDCKeyword = SCE_C_COMMENTLINEDOC; - sc.SetState(SCE_C_COMMENTDOCKEYWORD|activitySet); - } - } - break; - case SCE_C_COMMENTDOCKEYWORD: - if ((styleBeforeDCKeyword == SCE_C_COMMENTDOC) && sc.Match('*', '/')) { - sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); - sc.Forward(); - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); - seenDocKeyBrace = false; - } else if (sc.ch == '[' || sc.ch == '{') { - seenDocKeyBrace = true; - } else if (!setDoxygen.Contains(sc.ch) - && !(seenDocKeyBrace && (sc.ch == ',' || sc.ch == '.'))) { - char s[100]; - if (caseSensitive) { - sc.GetCurrent(s, sizeof(s)); - } else { - sc.GetCurrentLowered(s, sizeof(s)); - } - if (!(IsASpace(sc.ch) || (sc.ch == 0))) { - sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet); - } else if (!keywords3.InList(s + 1)) { - int subStyleCDKW = classifierDocKeyWords.ValueFor(s+1); - if (subStyleCDKW >= 0) { - sc.ChangeState(subStyleCDKW|activitySet); - } else { - sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet); - } - } - sc.SetState(styleBeforeDCKeyword|activitySet); - seenDocKeyBrace = false; - } - break; - case SCE_C_STRING: - if (sc.atLineEnd) { - sc.ChangeState(SCE_C_STRINGEOL|activitySet); - } else if (isIncludePreprocessor) { - if (sc.ch == '>') { - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); - isIncludePreprocessor = false; - } - } else if (sc.ch == '\\') { - if (options.escapeSequence) { - sc.SetState(SCE_C_ESCAPESEQUENCE|activitySet); - escapeSeq.resetEscapeState(sc.chNext); - } - sc.Forward(); // Skip all characters after the backslash - } else if (sc.ch == '\"') { - if (sc.chNext == '_') { - sc.ChangeState(SCE_C_USERLITERAL|activitySet); - } else { - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); - } - } - break; - case SCE_C_ESCAPESEQUENCE: - escapeSeq.digitsLeft--; - if (!escapeSeq.atEscapeEnd(sc.ch)) { - break; - } - if (sc.ch == '"') { - sc.SetState(SCE_C_STRING|activitySet); - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); - } else if (sc.ch == '\\') { - escapeSeq.resetEscapeState(sc.chNext); - sc.Forward(); - } else { - sc.SetState(SCE_C_STRING|activitySet); - if (sc.atLineEnd) { - sc.ChangeState(SCE_C_STRINGEOL|activitySet); - } - } - break; - case SCE_C_HASHQUOTEDSTRING: - if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); - } - break; - case SCE_C_STRINGRAW: - if (sc.Match(rawStringTerminator.c_str())) { - for (size_t termPos=rawStringTerminator.size(); termPos; termPos--) - sc.Forward(); - sc.SetState(SCE_C_DEFAULT|activitySet); - rawStringTerminator = ""; - } - break; - case SCE_C_CHARACTER: - if (sc.atLineEnd) { - sc.ChangeState(SCE_C_STRINGEOL|activitySet); - } else if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\'') { - if (sc.chNext == '_') { - sc.ChangeState(SCE_C_USERLITERAL|activitySet); - } else { - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); - } - } - break; - case SCE_C_REGEX: - if (sc.atLineStart) { - sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (! inRERange && sc.ch == '/') { - sc.Forward(); - while ((sc.ch < 0x80) && islower(sc.ch)) - sc.Forward(); // gobble regex flags - sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (sc.ch == '\\' && (static_cast(sc.currentPos+1) < lineEndNext)) { - // Gobble up the escaped character - sc.Forward(); - } else if (sc.ch == '[') { - inRERange = true; - } else if (sc.ch == ']') { - inRERange = false; - } - break; - case SCE_C_STRINGEOL: - if (sc.atLineStart) { - sc.SetState(SCE_C_DEFAULT|activitySet); - } - break; - case SCE_C_VERBATIM: - if (options.verbatimStringsAllowEscapes && (sc.ch == '\\')) { - sc.Forward(); // Skip all characters after the backslash - } else if (sc.ch == '\"') { - if (sc.chNext == '\"') { - sc.Forward(); - } else { - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); - } - } - break; - case SCE_C_TRIPLEVERBATIM: - if (sc.Match("\"\"\"")) { - while (sc.Match('"')) { - sc.Forward(); - } - sc.SetState(SCE_C_DEFAULT|activitySet); - } - break; - case SCE_C_UUID: - if (sc.atLineEnd || sc.ch == ')') { - sc.SetState(SCE_C_DEFAULT|activitySet); - } - break; - case SCE_C_TASKMARKER: - if (isoperator(sc.ch) || IsASpace(sc.ch)) { - sc.SetState(styleBeforeTaskMarker|activitySet); - styleBeforeTaskMarker = SCE_C_DEFAULT; - } - } - - if (sc.atLineEnd && !atLineEndBeforeSwitch) { - // State exit processing consumed characters up to end of line. - lineCurrent++; - lineEndNext = styler.LineEnd(lineCurrent); - vlls.Add(lineCurrent, preproc); - } - - // Determine if a new state should be entered. - if (MaskActive(sc.state) == SCE_C_DEFAULT) { - if (sc.Match('@', '\"')) { - sc.SetState(SCE_C_VERBATIM|activitySet); - sc.Forward(); - } else if (options.triplequotedStrings && sc.Match("\"\"\"")) { - sc.SetState(SCE_C_TRIPLEVERBATIM|activitySet); - sc.Forward(2); - } else if (options.hashquotedStrings && sc.Match('#', '\"')) { - sc.SetState(SCE_C_HASHQUOTEDSTRING|activitySet); - sc.Forward(); - } else if (options.backQuotedStrings && sc.Match('`')) { - sc.SetState(SCE_C_STRINGRAW|activitySet); - rawStringTerminator = "`"; - } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - if (lastWordWasUUID) { - sc.SetState(SCE_C_UUID|activitySet); - lastWordWasUUID = false; - } else { - sc.SetState(SCE_C_NUMBER|activitySet); - } - } else if (!sc.atLineEnd && (setWordStart.Contains(sc.ch) || (sc.ch == '@'))) { - if (lastWordWasUUID) { - sc.SetState(SCE_C_UUID|activitySet); - lastWordWasUUID = false; - } else { - sc.SetState(SCE_C_IDENTIFIER|activitySet); - } - } else if (sc.Match('/', '*')) { - if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style - sc.SetState(SCE_C_COMMENTDOC|activitySet); - } else { - sc.SetState(SCE_C_COMMENT|activitySet); - } - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } else if (sc.Match('/', '/')) { - if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!")) - // Support of Qt/Doxygen doc. style - sc.SetState(SCE_C_COMMENTLINEDOC|activitySet); - else - sc.SetState(SCE_C_COMMENTLINE|activitySet); - } else if (sc.ch == '/' - && (setOKBeforeRE.Contains(chPrevNonWhite) - || followsReturnKeyword(sc, styler)) - && (!setCouldBePostOp.Contains(chPrevNonWhite) - || !FollowsPostfixOperator(sc, styler))) { - sc.SetState(SCE_C_REGEX|activitySet); // JavaScript's RegEx - inRERange = false; - } else if (sc.ch == '\"') { - if (sc.chPrev == 'R') { - styler.Flush(); - if (MaskActive(styler.StyleAt(sc.currentPos - 1)) == SCE_C_STRINGRAW) { - sc.SetState(SCE_C_STRINGRAW|activitySet); - rawStringTerminator = ")"; - for (Sci_Position termPos = sc.currentPos + 1;; termPos++) { - char chTerminator = styler.SafeGetCharAt(termPos, '('); - if (chTerminator == '(') - break; - rawStringTerminator += chTerminator; - } - rawStringTerminator += '\"'; - } else { - sc.SetState(SCE_C_STRING|activitySet); - } - } else { - sc.SetState(SCE_C_STRING|activitySet); - } - isIncludePreprocessor = false; // ensure that '>' won't end the string - } else if (isIncludePreprocessor && sc.ch == '<') { - sc.SetState(SCE_C_STRING|activitySet); - } else if (sc.ch == '\'') { - sc.SetState(SCE_C_CHARACTER|activitySet); - } else if (sc.ch == '#' && visibleChars == 0) { - // Preprocessor commands are alone on their line - sc.SetState(SCE_C_PREPROCESSOR|activitySet); - // Skip whitespace between # and preprocessor word - do { - sc.Forward(); - } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); - if (sc.atLineEnd) { - sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (sc.Match("include")) { - isIncludePreprocessor = true; - } else { - if (options.trackPreprocessor) { - if (sc.Match("ifdef") || sc.Match("ifndef")) { - bool isIfDef = sc.Match("ifdef"); - int i = isIfDef ? 5 : 6; - std::string restOfLine = GetRestOfLine(styler, sc.currentPos + i + 1, false); - bool foundDef = preprocessorDefinitions.find(restOfLine) != preprocessorDefinitions.end(); - preproc.StartSection(isIfDef == foundDef); - } else if (sc.Match("if")) { - std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 2, true); - bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions); - preproc.StartSection(ifGood); - } else if (sc.Match("else")) { - if (!preproc.CurrentIfTaken()) { - preproc.InvertCurrentLevel(); - activitySet = preproc.IsInactive() ? activeFlag : 0; - if (!activitySet) - sc.ChangeState(SCE_C_PREPROCESSOR|activitySet); - } else if (!preproc.IsInactive()) { - preproc.InvertCurrentLevel(); - activitySet = preproc.IsInactive() ? activeFlag : 0; - if (!activitySet) - sc.ChangeState(SCE_C_PREPROCESSOR|activitySet); - } - } else if (sc.Match("elif")) { - // Ensure only one chosen out of #if .. #elif .. #elif .. #else .. #endif - if (!preproc.CurrentIfTaken()) { - // Similar to #if - std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 2, true); - bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions); - if (ifGood) { - preproc.InvertCurrentLevel(); - activitySet = preproc.IsInactive() ? activeFlag : 0; - if (!activitySet) - sc.ChangeState(SCE_C_PREPROCESSOR|activitySet); - } - } else if (!preproc.IsInactive()) { - preproc.InvertCurrentLevel(); - activitySet = preproc.IsInactive() ? activeFlag : 0; - if (!activitySet) - sc.ChangeState(SCE_C_PREPROCESSOR|activitySet); - } - } else if (sc.Match("endif")) { - preproc.EndSection(); - activitySet = preproc.IsInactive() ? activeFlag : 0; - sc.ChangeState(SCE_C_PREPROCESSOR|activitySet); - } else if (sc.Match("define")) { - if (options.updatePreprocessor && !preproc.IsInactive()) { - std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true); - size_t startName = 0; - while ((startName < restOfLine.length()) && IsSpaceOrTab(restOfLine[startName])) - startName++; - size_t endName = startName; - while ((endName < restOfLine.length()) && setWord.Contains(static_cast(restOfLine[endName]))) - endName++; - std::string key = restOfLine.substr(startName, endName-startName); - if ((endName < restOfLine.length()) && (restOfLine.at(endName) == '(')) { - // Macro - size_t endArgs = endName; - while ((endArgs < restOfLine.length()) && (restOfLine[endArgs] != ')')) - endArgs++; - std::string args = restOfLine.substr(endName + 1, endArgs - endName - 1); - size_t startValue = endArgs+1; - while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue])) - startValue++; - std::string value; - if (startValue < restOfLine.length()) - value = restOfLine.substr(startValue); - preprocessorDefinitions[key] = SymbolValue(value, args); - ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args)); - definitionsChanged = true; - } else { - // Value - size_t startValue = endName; - while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue])) - startValue++; - std::string value = restOfLine.substr(startValue); - preprocessorDefinitions[key] = value; - ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value)); - definitionsChanged = true; - } - } - } else if (sc.Match("undef")) { - if (options.updatePreprocessor && !preproc.IsInactive()) { - const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, false); - std::vector tokens = Tokenize(restOfLine); - if (tokens.size() >= 1) { - const std::string key = tokens[0]; - preprocessorDefinitions.erase(key); - ppDefineHistory.push_back(PPDefinition(lineCurrent, key, "", true)); - definitionsChanged = true; - } - } - } - } - } - } else if (isoperator(sc.ch)) { - sc.SetState(SCE_C_OPERATOR|activitySet); - } - } - - if (!IsASpace(sc.ch) && !IsSpaceEquiv(MaskActive(sc.state))) { - chPrevNonWhite = sc.ch; - visibleChars++; - } - continuationLine = false; - sc.Forward(); - } - const bool rawStringsChanged = rawStringTerminators.Merge(rawSTNew, lineCurrent); - if (definitionsChanged || rawStringsChanged) - styler.ChangeLexerState(startPos, startPos + length); - sc.Complete(); -} - -// Store both the current line's fold level and the next lines in the -// level store to make it easy to pick up with each increment -// and to make it possible to fiddle the current level for "} else {". - -void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - - if (!options.fold) - return; - - LexAccessor styler(pAccess); - - Sci_PositionU endPos = startPos + length; - int visibleChars = 0; - bool inLineComment = false; - Sci_Position lineCurrent = styler.GetLine(startPos); - int levelCurrent = SC_FOLDLEVELBASE; - if (lineCurrent > 0) - levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; - Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1); - int levelMinCurrent = levelCurrent; - int levelNext = levelCurrent; - char chNext = styler[startPos]; - int styleNext = MaskActive(styler.StyleAt(startPos)); - int style = MaskActive(initStyle); - const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); - for (Sci_PositionU i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; - style = styleNext; - styleNext = MaskActive(styler.StyleAt(i + 1)); - bool atEOL = i == (lineStartNext-1); - if ((style == SCE_C_COMMENTLINE) || (style == SCE_C_COMMENTLINEDOC)) - inLineComment = true; - if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style) && !inLineComment) { - if (!IsStreamCommentStyle(stylePrev)) { - levelNext++; - } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { - // Comments don't end at end of line and the next character may be unstyled. - levelNext--; - } - } - if (options.foldComment && options.foldCommentExplicit && ((style == SCE_C_COMMENTLINE) || options.foldExplicitAnywhere)) { - if (userDefinedFoldMarkers) { - if (styler.Match(i, options.foldExplicitStart.c_str())) { - levelNext++; - } else if (styler.Match(i, options.foldExplicitEnd.c_str())) { - levelNext--; - } - } else { - if ((ch == '/') && (chNext == '/')) { - char chNext2 = styler.SafeGetCharAt(i + 2); - if (chNext2 == '{') { - levelNext++; - } else if (chNext2 == '}') { - levelNext--; - } - } - } - } - if (options.foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { - if (ch == '#') { - Sci_PositionU j = i + 1; - while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { - j++; - } - if (styler.Match(j, "region") || styler.Match(j, "if")) { - levelNext++; - } else if (styler.Match(j, "end")) { - levelNext--; - } - - if (options.foldPreprocessorAtElse && (styler.Match(j, "else") || styler.Match(j, "elif"))) { - levelMinCurrent--; - } - } - } - if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) { - if (ch == '{' || ch == '[' || ch == '(') { - // Measure the minimum before a '{' to allow - // folding on "} else {" - if (options.foldAtElse && levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (ch == '}' || ch == ']' || ch == ')') { - levelNext--; - } - } - if (!IsASpace(ch)) - visibleChars++; - if (atEOL || (i == endPos-1)) { - int levelUse = levelCurrent; - if ((options.foldSyntaxBased && options.foldAtElse) || - (options.foldPreprocessor && options.foldPreprocessorAtElse) - ) { - levelUse = levelMinCurrent; - } - int lev = levelUse | levelNext << 16; - if (visibleChars == 0 && options.foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if (levelUse < levelNext) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - lineStartNext = styler.LineStart(lineCurrent+1); - levelCurrent = levelNext; - levelMinCurrent = levelCurrent; - if (atEOL && (i == static_cast(styler.Length()-1))) { - // There is an empty line at end of file so give it same level and empty - styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); - } - visibleChars = 0; - inLineComment = false; - } - } -} - -void LexerCPP::EvaluateTokens(std::vector &tokens, const SymbolTable &preprocessorDefinitions) { - - // Remove whitespace tokens - tokens.erase(std::remove_if(tokens.begin(), tokens.end(), OnlySpaceOrTab), tokens.end()); - - // Evaluate defined statements to either 0 or 1 - for (size_t i=0; (i+1)) - SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i+2]); - if (it != preprocessorDefinitions.end()) { - val = "1"; - } - tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4); - } else { - // Spurious '(' so erase as more likely to result in false - tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 2); - } - } else { - // defined - SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i+1]); - if (it != preprocessorDefinitions.end()) { - val = "1"; - } - } - tokens[i] = val; - } else { - i++; - } - } - - // Evaluate identifiers - const size_t maxIterations = 100; - size_t iterations = 0; // Limit number of iterations in case there is a recursive macro. - for (size_t i = 0; (i(tokens[i][0]))) { - SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i]); - if (it != preprocessorDefinitions.end()) { - // Tokenize value - std::vector macroTokens = Tokenize(it->second.value); - if (it->second.IsMacro()) { - if ((i + 1 < tokens.size()) && (tokens.at(i + 1) == "(")) { - // Create map of argument name to value - std::vector argumentNames = StringSplit(it->second.arguments, ','); - std::map arguments; - size_t arg = 0; - size_t tok = i+2; - while ((tok < tokens.size()) && (arg < argumentNames.size()) && (tokens.at(tok) != ")")) { - if (tokens.at(tok) != ",") { - arguments[argumentNames.at(arg)] = tokens.at(tok); - arg++; - } - tok++; - } - - // Remove invocation - tokens.erase(tokens.begin() + i, tokens.begin() + tok + 1); - - // Substitute values into macro - macroTokens.erase(std::remove_if(macroTokens.begin(), macroTokens.end(), OnlySpaceOrTab), macroTokens.end()); - - for (size_t iMacro = 0; iMacro < macroTokens.size();) { - if (setWordStart.Contains(static_cast(macroTokens[iMacro][0]))) { - std::map::const_iterator itFind = arguments.find(macroTokens[iMacro]); - if (itFind != arguments.end()) { - // TODO: Possible that value will be expression so should insert tokenized form - macroTokens[iMacro] = itFind->second; - } - } - iMacro++; - } - - // Insert results back into tokens - tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end()); - - } else { - i++; - } - } else { - // Remove invocation - tokens.erase(tokens.begin() + i); - // Insert results back into tokens - tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end()); - } - } else { - // Identifier not found - tokens.erase(tokens.begin() + i); - } - } else { - i++; - } - } - - // Find bracketed subexpressions and recurse on them - BracketPair bracketPair = FindBracketPair(tokens); - while (bracketPair.itBracket != tokens.end()) { - std::vector inBracket(bracketPair.itBracket + 1, bracketPair.itEndBracket); - EvaluateTokens(inBracket, preprocessorDefinitions); - - // The insertion is done before the removal because there were failures with the opposite approach - tokens.insert(bracketPair.itBracket, inBracket.begin(), inBracket.end()); - - bracketPair = FindBracketPair(tokens); - tokens.erase(bracketPair.itBracket, bracketPair.itEndBracket + 1); - - bracketPair = FindBracketPair(tokens); - } - - // Evaluate logical negations - for (size_t j=0; (j+1)::iterator itInsert = - tokens.erase(tokens.begin() + j, tokens.begin() + j + 2); - tokens.insert(itInsert, isTrue ? "1" : "0"); - } else { - j++; - } - } - - // Evaluate expressions in precedence order - enum precedence { precArithmetic, precRelative, precLogical }; - for (int prec=precArithmetic; prec <= precLogical; prec++) { - // Looking at 3 tokens at a time so end at 2 before end - for (size_t k=0; (k+2)") - result = valA > valB; - else if (tokens[k+1] == ">=") - result = valA >= valB; - else if (tokens[k+1] == "==") - result = valA == valB; - else if (tokens[k+1] == "!=") - result = valA != valB; - else if (tokens[k+1] == "||") - result = valA || valB; - else if (tokens[k+1] == "&&") - result = valA && valB; - char sResult[30]; - sprintf(sResult, "%d", result); - std::vector::iterator itInsert = - tokens.erase(tokens.begin() + k, tokens.begin() + k + 3); - tokens.insert(itInsert, sResult); - } else { - k++; - } - } - } -} - -std::vector LexerCPP::Tokenize(const std::string &expr) const { - // Break into tokens - std::vector tokens; - const char *cp = expr.c_str(); - while (*cp) { - std::string word; - if (setWord.Contains(static_cast(*cp))) { - // Identifiers and numbers - while (setWord.Contains(static_cast(*cp))) { - word += *cp; - cp++; - } - } else if (IsSpaceOrTab(*cp)) { - while (IsSpaceOrTab(*cp)) { - word += *cp; - cp++; - } - } else if (setRelOp.Contains(static_cast(*cp))) { - word += *cp; - cp++; - if (setRelOp.Contains(static_cast(*cp))) { - word += *cp; - cp++; - } - } else if (setLogicalOp.Contains(static_cast(*cp))) { - word += *cp; - cp++; - if (setLogicalOp.Contains(static_cast(*cp))) { - word += *cp; - cp++; - } - } else { - // Should handle strings, characters, and comments here - word += *cp; - cp++; - } - tokens.push_back(word); - } - return tokens; -} - -bool LexerCPP::EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions) { - std::vector tokens = Tokenize(expr); - - EvaluateTokens(tokens, preprocessorDefinitions); - - // "0" or "" -> false else true - bool isFalse = tokens.empty() || - ((tokens.size() == 1) && ((tokens[0] == "") || tokens[0] == "0")); - return !isFalse; -} - -LexerModule lmCPP(SCLEX_CPP, LexerCPP::LexerFactoryCPP, "cpp", cppWordLists); -LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, LexerCPP::LexerFactoryCPPInsensitive, "cppnocase", cppWordLists); diff --git a/qrenderdoc/3rdparty/scintilla/lexers/LexDiff.cxx b/qrenderdoc/3rdparty/scintilla/lexers/LexDiff.cxx deleted file mode 100644 index baa8368f6..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexers/LexDiff.cxx +++ /dev/null @@ -1,153 +0,0 @@ -// Scintilla source code edit control -/** @file LexDiff.cxx - ** Lexer for diff results. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "CharacterSet.h" -#include "LexerModule.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { - return (styler[i] == '\n') || - ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); -} - -#define DIFF_BUFFER_START_SIZE 16 -// Note that ColouriseDiffLine analyzes only the first DIFF_BUFFER_START_SIZE -// characters of each line to classify the line. - -static void ColouriseDiffLine(char *lineBuffer, Sci_Position endLine, Accessor &styler) { - // It is needed to remember the current state to recognize starting - // comment lines before the first "diff " or "--- ". If a real - // difference starts then each line starting with ' ' is a whitespace - // otherwise it is considered a comment (Only in..., Binary file...) - if (0 == strncmp(lineBuffer, "diff ", 5)) { - styler.ColourTo(endLine, SCE_DIFF_COMMAND); - } else if (0 == strncmp(lineBuffer, "Index: ", 7)) { // For subversion's diff - styler.ColourTo(endLine, SCE_DIFF_COMMAND); - } else if (0 == strncmp(lineBuffer, "---", 3) && lineBuffer[3] != '-') { - // In a context diff, --- appears in both the header and the position markers - if (lineBuffer[3] == ' ' && atoi(lineBuffer + 4) && !strchr(lineBuffer, '/')) - styler.ColourTo(endLine, SCE_DIFF_POSITION); - else if (lineBuffer[3] == '\r' || lineBuffer[3] == '\n') - styler.ColourTo(endLine, SCE_DIFF_POSITION); - else - styler.ColourTo(endLine, SCE_DIFF_HEADER); - } else if (0 == strncmp(lineBuffer, "+++ ", 4)) { - // I don't know of any diff where "+++ " is a position marker, but for - // consistency, do the same as with "--- " and "*** ". - if (atoi(lineBuffer+4) && !strchr(lineBuffer, '/')) - styler.ColourTo(endLine, SCE_DIFF_POSITION); - else - styler.ColourTo(endLine, SCE_DIFF_HEADER); - } else if (0 == strncmp(lineBuffer, "====", 4)) { // For p4's diff - styler.ColourTo(endLine, SCE_DIFF_HEADER); - } else if (0 == strncmp(lineBuffer, "***", 3)) { - // In a context diff, *** appears in both the header and the position markers. - // Also ******** is a chunk header, but here it's treated as part of the - // position marker since there is no separate style for a chunk header. - if (lineBuffer[3] == ' ' && atoi(lineBuffer+4) && !strchr(lineBuffer, '/')) - styler.ColourTo(endLine, SCE_DIFF_POSITION); - else if (lineBuffer[3] == '*') - styler.ColourTo(endLine, SCE_DIFF_POSITION); - else - styler.ColourTo(endLine, SCE_DIFF_HEADER); - } else if (0 == strncmp(lineBuffer, "? ", 2)) { // For difflib - styler.ColourTo(endLine, SCE_DIFF_HEADER); - } else if (lineBuffer[0] == '@') { - styler.ColourTo(endLine, SCE_DIFF_POSITION); - } else if (lineBuffer[0] >= '0' && lineBuffer[0] <= '9') { - styler.ColourTo(endLine, SCE_DIFF_POSITION); - } else if (lineBuffer[0] == '-' || lineBuffer[0] == '<') { - styler.ColourTo(endLine, SCE_DIFF_DELETED); - } else if (lineBuffer[0] == '+' || lineBuffer[0] == '>') { - styler.ColourTo(endLine, SCE_DIFF_ADDED); - } else if (lineBuffer[0] == '!') { - styler.ColourTo(endLine, SCE_DIFF_CHANGED); - } else if (lineBuffer[0] != ' ') { - styler.ColourTo(endLine, SCE_DIFF_COMMENT); - } else { - styler.ColourTo(endLine, SCE_DIFF_DEFAULT); - } -} - -static void ColouriseDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - char lineBuffer[DIFF_BUFFER_START_SIZE] = ""; - styler.StartAt(startPos); - styler.StartSegment(startPos); - Sci_PositionU linePos = 0; - for (Sci_PositionU i = startPos; i < startPos + length; i++) { - if (AtEOL(styler, i)) { - if (linePos < DIFF_BUFFER_START_SIZE) { - lineBuffer[linePos] = 0; - } - ColouriseDiffLine(lineBuffer, i, styler); - linePos = 0; - } else if (linePos < DIFF_BUFFER_START_SIZE - 1) { - lineBuffer[linePos++] = styler[i]; - } else if (linePos == DIFF_BUFFER_START_SIZE - 1) { - lineBuffer[linePos++] = 0; - } - } - if (linePos > 0) { // Last line does not have ending characters - if (linePos < DIFF_BUFFER_START_SIZE) { - lineBuffer[linePos] = 0; - } - ColouriseDiffLine(lineBuffer, startPos + length - 1, styler); - } -} - -static void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - Sci_Position curLine = styler.GetLine(startPos); - Sci_Position curLineStart = styler.LineStart(curLine); - int prevLevel = curLine > 0 ? styler.LevelAt(curLine - 1) : SC_FOLDLEVELBASE; - int nextLevel; - - do { - int lineType = styler.StyleAt(curLineStart); - if (lineType == SCE_DIFF_COMMAND) - nextLevel = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; - else if (lineType == SCE_DIFF_HEADER) - nextLevel = (SC_FOLDLEVELBASE + 1) | SC_FOLDLEVELHEADERFLAG; - else if (lineType == SCE_DIFF_POSITION && styler[curLineStart] != '-') - nextLevel = (SC_FOLDLEVELBASE + 2) | SC_FOLDLEVELHEADERFLAG; - else if (prevLevel & SC_FOLDLEVELHEADERFLAG) - nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1; - else - nextLevel = prevLevel; - - if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel)) - styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG); - - styler.SetLevel(curLine, nextLevel); - prevLevel = nextLevel; - - curLineStart = styler.LineStart(++curLine); - } while (static_cast(startPos)+length > curLineStart); -} - -static const char *const emptyWordListDesc[] = { - 0 -}; - -LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc); diff --git a/qrenderdoc/3rdparty/scintilla/lexers/LexErrorList.cxx b/qrenderdoc/3rdparty/scintilla/lexers/LexErrorList.cxx deleted file mode 100644 index 6dc6b025e..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexers/LexErrorList.cxx +++ /dev/null @@ -1,394 +0,0 @@ -// Scintilla source code edit control -/** @file LexErrorList.cxx - ** Lexer for error lists. Used for the output pane in SciTE. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "CharacterSet.h" -#include "LexerModule.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static bool strstart(const char *haystack, const char *needle) { - return strncmp(haystack, needle, strlen(needle)) == 0; -} - -static bool Is0To9(char ch) { - return (ch >= '0') && (ch <= '9'); -} - -static bool Is1To9(char ch) { - return (ch >= '1') && (ch <= '9'); -} - -static bool IsAlphabetic(int ch) { - return IsASCII(ch) && isalpha(ch); -} - -static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { - return (styler[i] == '\n') || - ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); -} - -static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci_Position &startValue) { - if (lineBuffer[0] == '>') { - // Command or return status - return SCE_ERR_CMD; - } else if (lineBuffer[0] == '<') { - // Diff removal. - return SCE_ERR_DIFF_DELETION; - } else if (lineBuffer[0] == '!') { - return SCE_ERR_DIFF_CHANGED; - } else if (lineBuffer[0] == '+') { - if (strstart(lineBuffer, "+++ ")) { - return SCE_ERR_DIFF_MESSAGE; - } else { - return SCE_ERR_DIFF_ADDITION; - } - } else if (lineBuffer[0] == '-') { - if (strstart(lineBuffer, "--- ")) { - return SCE_ERR_DIFF_MESSAGE; - } else { - return SCE_ERR_DIFF_DELETION; - } - } else if (strstart(lineBuffer, "cf90-")) { - // Absoft Pro Fortran 90/95 v8.2 error and/or warning message - return SCE_ERR_ABSF; - } else if (strstart(lineBuffer, "fortcom:")) { - // Intel Fortran Compiler v8.0 error/warning message - return SCE_ERR_IFORT; - } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) { - return SCE_ERR_PYTHON; - } else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) { - return SCE_ERR_PHP; - } else if ((strstart(lineBuffer, "Error ") || - strstart(lineBuffer, "Warning ")) && - strstr(lineBuffer, " at (") && - strstr(lineBuffer, ") : ") && - (strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) { - // Intel Fortran Compiler error/warning message - return SCE_ERR_IFC; - } else if (strstart(lineBuffer, "Error ")) { - // Borland error message - return SCE_ERR_BORLAND; - } else if (strstart(lineBuffer, "Warning ")) { - // Borland warning message - return SCE_ERR_BORLAND; - } else if (strstr(lineBuffer, "at line ") && - (strstr(lineBuffer, "at line ") < (lineBuffer + lengthLine)) && - strstr(lineBuffer, "file ") && - (strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) { - // Lua 4 error message - return SCE_ERR_LUA; - } else if (strstr(lineBuffer, " at ") && - (strstr(lineBuffer, " at ") < (lineBuffer + lengthLine)) && - strstr(lineBuffer, " line ") && - (strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) && - (strstr(lineBuffer, " at ") + 4 < (strstr(lineBuffer, " line ")))) { - // perl error message: - // at line - return SCE_ERR_PERL; - } else if ((memcmp(lineBuffer, " at ", 6) == 0) && - strstr(lineBuffer, ":line ")) { - // A .NET traceback - return SCE_ERR_NET; - } else if (strstart(lineBuffer, "Line ") && - strstr(lineBuffer, ", file ")) { - // Essential Lahey Fortran error message - return SCE_ERR_ELF; - } else if (strstart(lineBuffer, "line ") && - strstr(lineBuffer, " column ")) { - // HTML tidy style: line 42 column 1 - return SCE_ERR_TIDY; - } else if (strstart(lineBuffer, "\tat ") && - strstr(lineBuffer, "(") && - strstr(lineBuffer, ".java:")) { - // Java stack back trace - return SCE_ERR_JAVA_STACK; - } else if (strstart(lineBuffer, "In file included from ") || - strstart(lineBuffer, " from ")) { - // GCC showing include path to following error - return SCE_ERR_GCC_INCLUDED_FROM; - } else if (strstr(lineBuffer, "warning LNK")) { - // Microsoft linker warning: - // { : } warning LNK9999 - return SCE_ERR_MS; - } else { - // Look for one of the following formats: - // GCC: :: - // Microsoft: () : - // Common: (): warning|error|note|remark|catastrophic|fatal - // Common: () warning|error|note|remark|catastrophic|fatal - // Microsoft: (,) - // CTags: \t\t - // Lua 5 traceback: \t:: - // Lua 5.1: : :: - bool initialTab = (lineBuffer[0] == '\t'); - bool initialColonPart = false; - bool canBeCtags = !initialTab; // For ctags must have an identifier with no spaces then a tab - enum { stInitial, - stGccStart, stGccDigit, stGccColumn, stGcc, - stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet, - stCtagsStart, stCtagsFile, stCtagsStartString, stCtagsStringDollar, stCtags, - stUnrecognized - } state = stInitial; - for (Sci_PositionU i = 0; i < lengthLine; i++) { - char ch = lineBuffer[i]; - char chNext = ' '; - if ((i + 1) < lengthLine) - chNext = lineBuffer[i + 1]; - if (state == stInitial) { - if (ch == ':') { - // May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix) - if ((chNext != '\\') && (chNext != '/') && (chNext != ' ')) { - // This check is not completely accurate as may be on - // GTK+ with a file name that includes ':'. - state = stGccStart; - } else if (chNext == ' ') { // indicates a Lua 5.1 error message - initialColonPart = true; - } - } else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) { - // May be Microsoft - // Check against '0' often removes phone numbers - state = stMsStart; - } else if ((ch == '\t') && canBeCtags) { - // May be CTags - state = stCtagsStart; - } else if (ch == ' ') { - canBeCtags = false; - } - } else if (state == stGccStart) { // : - state = Is0To9(ch) ? stGccDigit : stUnrecognized; - } else if (state == stGccDigit) { // : - if (ch == ':') { - state = stGccColumn; // :9.*: is GCC - startValue = i + 1; - } else if (!Is0To9(ch)) { - state = stUnrecognized; - } - } else if (state == stGccColumn) { // :: - if (!Is0To9(ch)) { - state = stGcc; - if (ch == ':') - startValue = i + 1; - break; - } - } else if (state == stMsStart) { // ( - state = Is0To9(ch) ? stMsDigit : stUnrecognized; - } else if (state == stMsDigit) { // ( - if (ch == ',') { - state = stMsDigitComma; - } else if (ch == ')') { - state = stMsBracket; - } else if ((ch != ' ') && !Is0To9(ch)) { - state = stUnrecognized; - } - } else if (state == stMsBracket) { // () - if ((ch == ' ') && (chNext == ':')) { - state = stMsVc; - } else if ((ch == ':' && chNext == ' ') || (ch == ' ')) { - // Possibly Delphi.. don't test against chNext as it's one of the strings below. - char word[512]; - Sci_PositionU j, chPos; - unsigned numstep; - chPos = 0; - if (ch == ' ') - numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i. - else - numstep = 2; // otherwise add 2. - for (j = i + numstep; j < lengthLine && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++) - word[chPos++] = lineBuffer[j]; - word[chPos] = 0; - if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") || - !CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") || - !CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) { - state = stMsVc; - } else { - state = stUnrecognized; - } - } else { - state = stUnrecognized; - } - } else if (state == stMsDigitComma) { // (, - if (ch == ')') { - state = stMsDotNet; - break; - } else if ((ch != ' ') && !Is0To9(ch)) { - state = stUnrecognized; - } - } else if (state == stCtagsStart) { - if (ch == '\t') { - state = stCtagsFile; - } - } else if (state == stCtagsFile) { - if ((lineBuffer[i - 1] == '\t') && - ((ch == '/' && chNext == '^') || Is0To9(ch))) { - state = stCtags; - break; - } else if ((ch == '/') && (chNext == '^')) { - state = stCtagsStartString; - } - } else if ((state == stCtagsStartString) && ((lineBuffer[i] == '$') && (lineBuffer[i + 1] == '/'))) { - state = stCtagsStringDollar; - break; - } - } - if (state == stGcc) { - return initialColonPart ? SCE_ERR_LUA : SCE_ERR_GCC; - } else if ((state == stMsVc) || (state == stMsDotNet)) { - return SCE_ERR_MS; - } else if ((state == stCtagsStringDollar) || (state == stCtags)) { - return SCE_ERR_CTAG; - } else if (initialColonPart && strstr(lineBuffer, ": warning C")) { - // Microsoft warning without line number - // : warning C9999 - return SCE_ERR_MS; - } else { - return SCE_ERR_DEFAULT; - } - } -} - -#define CSI "\033[" - -namespace { - -bool SequenceEnd(int ch) { - return (ch == 0) || ((ch >= '@') && (ch <= '~')); -} - -int StyleFromSequence(const char *seq) { - int bold = 0; - int colour = 0; - while (!SequenceEnd(*seq)) { - if (Is0To9(*seq)) { - int base = *seq - '0'; - if (Is0To9(seq[1])) { - base = base * 10; - base += seq[1] - '0'; - seq++; - } - if (base == 0) { - colour = 0; - bold = 0; - } - else if (base == 1) { - bold = 1; - } - else if (base >= 30 && base <= 37) { - colour = base - 30; - } - } - seq++; - } - return SCE_ERR_ES_BLACK + bold * 8 + colour; -} - -} - -static void ColouriseErrorListLine( - char *lineBuffer, - Sci_PositionU lengthLine, - Sci_PositionU endPos, - Accessor &styler, - bool valueSeparate, - bool escapeSequences) { - Sci_Position startValue = -1; - int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue); - if (escapeSequences && strstr(lineBuffer, CSI)) { - const int startPos = endPos - lengthLine; - const char *linePortion = lineBuffer; - int startPortion = startPos; - int portionStyle = style; - while (const char *startSeq = strstr(linePortion, CSI)) { - if (startSeq > linePortion) { - styler.ColourTo(startPortion + static_cast(startSeq - linePortion), portionStyle); - } - const char *endSeq = startSeq + 2; - while (!SequenceEnd(*endSeq)) - endSeq++; - const int endSeqPosition = startPortion + static_cast(endSeq - linePortion) + 1; - switch (*endSeq) { - case 0: - styler.ColourTo(endPos, SCE_ERR_ESCSEQ_UNKNOWN); - return; - case 'm': // Colour command - styler.ColourTo(endSeqPosition, SCE_ERR_ESCSEQ); - portionStyle = StyleFromSequence(startSeq+2); - break; - case 'K': // Erase to end of line -> ignore - styler.ColourTo(endSeqPosition, SCE_ERR_ESCSEQ); - break; - default: - styler.ColourTo(endSeqPosition, SCE_ERR_ESCSEQ_UNKNOWN); - portionStyle = style; - } - startPortion = endSeqPosition; - linePortion = endSeq + 1; - } - styler.ColourTo(endPos, portionStyle); - } else { - if (valueSeparate && (startValue >= 0)) { - styler.ColourTo(endPos - (lengthLine - startValue), style); - styler.ColourTo(endPos, SCE_ERR_VALUE); - } else { - styler.ColourTo(endPos, style); - } - } -} - -static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - char lineBuffer[10000]; - styler.StartAt(startPos); - styler.StartSegment(startPos); - Sci_PositionU linePos = 0; - - // property lexer.errorlist.value.separate - // For lines in the output pane that are matches from Find in Files or GCC-style - // diagnostics, style the path and line number separately from the rest of the - // line with style 21 used for the rest of the line. - // This allows matched text to be more easily distinguished from its location. - bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0; - - // property lexer.errorlist.escape.sequences - // Set to 1 to interpret escape sequences. - const bool escapeSequences = styler.GetPropertyInt("lexer.errorlist.escape.sequences") != 0; - - for (Sci_PositionU i = startPos; i < startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { - // End of line (or of line buffer) met, colourise it - lineBuffer[linePos] = '\0'; - ColouriseErrorListLine(lineBuffer, linePos, i, styler, valueSeparate, escapeSequences); - linePos = 0; - } - } - if (linePos > 0) { // Last line does not have ending characters - lineBuffer[linePos] = '\0'; - ColouriseErrorListLine(lineBuffer, linePos, startPos + length - 1, styler, valueSeparate, escapeSequences); - } -} - -static const char *const emptyWordListDesc[] = { - 0 -}; - -LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc); diff --git a/qrenderdoc/3rdparty/scintilla/lexers/LexHTML.cxx b/qrenderdoc/3rdparty/scintilla/lexers/LexHTML.cxx deleted file mode 100644 index bd14534d4..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexers/LexHTML.cxx +++ /dev/null @@ -1,2203 +0,0 @@ -// Scintilla source code edit control -/** @file LexHTML.cxx - ** Lexer for HTML. - **/ -// Copyright 1998-2005 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "StringCopy.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "CharacterSet.h" -#include "LexerModule.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -#define SCE_HA_JS (SCE_HJA_START - SCE_HJ_START) -#define SCE_HA_VBS (SCE_HBA_START - SCE_HB_START) -#define SCE_HA_PYTHON (SCE_HPA_START - SCE_HP_START) - -enum script_type { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML, eScriptSGML, eScriptSGMLblock, eScriptComment }; -enum script_mode { eHtml = 0, eNonHtmlScript, eNonHtmlPreProc, eNonHtmlScriptPreProc }; - -static inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); -} - -static inline bool IsAWordStart(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_'); -} - -inline bool IsOperator(int ch) { - if (IsASCII(ch) && isalnum(ch)) - return false; - // '.' left out as it is used to make up numbers - if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || - ch == '(' || ch == ')' || ch == '-' || ch == '+' || - ch == '=' || ch == '|' || ch == '{' || ch == '}' || - ch == '[' || ch == ']' || ch == ':' || ch == ';' || - ch == '<' || ch == '>' || ch == ',' || ch == '/' || - ch == '?' || ch == '!' || ch == '.' || ch == '~') - return true; - return false; -} - -static void GetTextSegment(Accessor &styler, Sci_PositionU start, Sci_PositionU end, char *s, size_t len) { - Sci_PositionU i = 0; - for (; (i < end - start + 1) && (i < len-1); i++) { - s[i] = static_cast(MakeLowerCase(styler[start + i])); - } - s[i] = '\0'; -} - -static const char *GetNextWord(Accessor &styler, Sci_PositionU start, char *s, size_t sLen) { - - Sci_PositionU i = 0; - for (; i < sLen-1; i++) { - char ch = static_cast(styler.SafeGetCharAt(start + i)); - if ((i == 0) && !IsAWordStart(ch)) - break; - if ((i > 0) && !IsAWordChar(ch)) - break; - s[i] = ch; - } - s[i] = '\0'; - - return s; -} - -static script_type segIsScriptingIndicator(Accessor &styler, Sci_PositionU start, Sci_PositionU end, script_type prevValue) { - char s[100]; - GetTextSegment(styler, start, end, s, sizeof(s)); - //Platform::DebugPrintf("Scripting indicator [%s]\n", s); - if (strstr(s, "src")) // External script - return eScriptNone; - if (strstr(s, "vbs")) - return eScriptVBS; - if (strstr(s, "pyth")) - return eScriptPython; - if (strstr(s, "javas")) - return eScriptJS; - if (strstr(s, "jscr")) - return eScriptJS; - if (strstr(s, "php")) - return eScriptPHP; - if (strstr(s, "xml")) { - const char *xml = strstr(s, "xml"); - for (const char *t=s; t= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) { - return eScriptPython; - } else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) { - return eScriptVBS; - } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) { - return eScriptJS; - } else if ((state >= SCE_HPHP_DEFAULT) && (state <= SCE_HPHP_COMMENTLINE)) { - return eScriptPHP; - } else if ((state >= SCE_H_SGML_DEFAULT) && (state < SCE_H_SGML_BLOCK_DEFAULT)) { - return eScriptSGML; - } else if (state == SCE_H_SGML_BLOCK_DEFAULT) { - return eScriptSGMLblock; - } else { - return eScriptNone; - } -} - -static int statePrintForState(int state, script_mode inScriptType) { - int StateToPrint = state; - - if (state >= SCE_HJ_START) { - if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) { - StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_PYTHON); - } else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) { - StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_VBS); - } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) { - StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_JS); - } - } - - return StateToPrint; -} - -static int stateForPrintState(int StateToPrint) { - int state; - - if ((StateToPrint >= SCE_HPA_START) && (StateToPrint <= SCE_HPA_IDENTIFIER)) { - state = StateToPrint - SCE_HA_PYTHON; - } else if ((StateToPrint >= SCE_HBA_START) && (StateToPrint <= SCE_HBA_STRINGEOL)) { - state = StateToPrint - SCE_HA_VBS; - } else if ((StateToPrint >= SCE_HJA_START) && (StateToPrint <= SCE_HJA_REGEX)) { - state = StateToPrint - SCE_HA_JS; - } else { - state = StateToPrint; - } - - return state; -} - -static inline bool IsNumber(Sci_PositionU start, Accessor &styler) { - return IsADigit(styler[start]) || (styler[start] == '.') || - (styler[start] == '-') || (styler[start] == '#'); -} - -static inline bool isStringState(int state) { - bool bResult; - - switch (state) { - case SCE_HJ_DOUBLESTRING: - case SCE_HJ_SINGLESTRING: - case SCE_HJA_DOUBLESTRING: - case SCE_HJA_SINGLESTRING: - case SCE_HB_STRING: - case SCE_HBA_STRING: - case SCE_HP_STRING: - case SCE_HP_CHARACTER: - case SCE_HP_TRIPLE: - case SCE_HP_TRIPLEDOUBLE: - case SCE_HPA_STRING: - case SCE_HPA_CHARACTER: - case SCE_HPA_TRIPLE: - case SCE_HPA_TRIPLEDOUBLE: - case SCE_HPHP_HSTRING: - case SCE_HPHP_SIMPLESTRING: - case SCE_HPHP_HSTRING_VARIABLE: - case SCE_HPHP_COMPLEX_VARIABLE: - bResult = true; - break; - default : - bResult = false; - break; - } - return bResult; -} - -static inline bool stateAllowsTermination(int state) { - bool allowTermination = !isStringState(state); - if (allowTermination) { - switch (state) { - case SCE_HB_COMMENTLINE: - case SCE_HPHP_COMMENT: - case SCE_HP_COMMENTLINE: - case SCE_HPA_COMMENTLINE: - allowTermination = false; - } - } - return allowTermination; -} - -// not really well done, since it's only comments that should lex the %> and <% -static inline bool isCommentASPState(int state) { - bool bResult; - - switch (state) { - case SCE_HJ_COMMENT: - case SCE_HJ_COMMENTLINE: - case SCE_HJ_COMMENTDOC: - case SCE_HB_COMMENTLINE: - case SCE_HP_COMMENTLINE: - case SCE_HPHP_COMMENT: - case SCE_HPHP_COMMENTLINE: - bResult = true; - break; - default : - bResult = false; - break; - } - return bResult; -} - -static void classifyAttribHTML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { - bool wordIsNumber = IsNumber(start, styler); - char chAttr = SCE_H_ATTRIBUTEUNKNOWN; - if (wordIsNumber) { - chAttr = SCE_H_NUMBER; - } else { - char s[100]; - GetTextSegment(styler, start, end, s, sizeof(s)); - if (keywords.InList(s)) - chAttr = SCE_H_ATTRIBUTE; - } - if ((chAttr == SCE_H_ATTRIBUTEUNKNOWN) && !keywords) - // No keywords -> all are known - chAttr = SCE_H_ATTRIBUTE; - styler.ColourTo(end, chAttr); -} - -static int classifyTagHTML(Sci_PositionU start, Sci_PositionU end, - WordList &keywords, Accessor &styler, bool &tagDontFold, - bool caseSensitive, bool isXml, bool allowScripts) { - char withSpace[30 + 2] = " "; - const char *s = withSpace + 1; - // Copy after the '<' - Sci_PositionU i = 1; - for (Sci_PositionU cPos = start; cPos <= end && i < 30; cPos++) { - char ch = styler[cPos]; - if ((ch != '<') && (ch != '/')) { - withSpace[i++] = caseSensitive ? ch : static_cast(MakeLowerCase(ch)); - } - } - - //The following is only a quick hack, to see if this whole thing would work - //we first need the tagname with a trailing space... - withSpace[i] = ' '; - withSpace[i+1] = '\0'; - - // if the current language is XML, I can fold any tag - // if the current language is HTML, I don't want to fold certain tags (input, meta, etc.) - //...to find it in the list of no-container-tags - tagDontFold = (!isXml) && (NULL != strstr(" area base basefont br col command embed frame hr img input isindex keygen link meta param source track wbr ", withSpace)); - - //now we can remove the trailing space - withSpace[i] = '\0'; - - // No keywords -> all are known - char chAttr = SCE_H_TAGUNKNOWN; - if (s[0] == '!') { - chAttr = SCE_H_SGML_DEFAULT; - } else if (!keywords || keywords.InList(s)) { - chAttr = SCE_H_TAG; - } - styler.ColourTo(end, chAttr); - if (chAttr == SCE_H_TAG) { - if (allowScripts && 0 == strcmp(s, "script")) { - // check to see if this is a self-closing tag by sniffing ahead - bool isSelfClose = false; - for (Sci_PositionU cPos = end; cPos <= end + 200; cPos++) { - char ch = styler.SafeGetCharAt(cPos, '\0'); - if (ch == '\0' || ch == '>') - break; - else if (ch == '/' && styler.SafeGetCharAt(cPos + 1, '\0') == '>') { - isSelfClose = true; - break; - } - } - - // do not enter a script state if the tag self-closed - if (!isSelfClose) - chAttr = SCE_H_SCRIPT; - } else if (!isXml && 0 == strcmp(s, "comment")) { - chAttr = SCE_H_COMMENT; - } - } - return chAttr; -} - -static void classifyWordHTJS(Sci_PositionU start, Sci_PositionU end, - WordList &keywords, Accessor &styler, script_mode inScriptType) { - char s[30 + 1]; - Sci_PositionU i = 0; - for (; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - } - s[i] = '\0'; - - char chAttr = SCE_HJ_WORD; - bool wordIsNumber = IsADigit(s[0]) || ((s[0] == '.') && IsADigit(s[1])); - if (wordIsNumber) { - chAttr = SCE_HJ_NUMBER; - } else if (keywords.InList(s)) { - chAttr = SCE_HJ_KEYWORD; - } - styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); -} - -static int classifyWordHTVB(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, script_mode inScriptType) { - char chAttr = SCE_HB_IDENTIFIER; - bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); - if (wordIsNumber) { - chAttr = SCE_HB_NUMBER; - } else { - char s[100]; - GetTextSegment(styler, start, end, s, sizeof(s)); - if (keywords.InList(s)) { - chAttr = SCE_HB_WORD; - if (strcmp(s, "rem") == 0) - chAttr = SCE_HB_COMMENTLINE; - } - } - styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); - if (chAttr == SCE_HB_COMMENTLINE) - return SCE_HB_COMMENTLINE; - else - return SCE_HB_DEFAULT; -} - -static void classifyWordHTPy(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType, bool isMako) { - bool wordIsNumber = IsADigit(styler[start]); - char s[30 + 1]; - Sci_PositionU i = 0; - for (; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - } - s[i] = '\0'; - char chAttr = SCE_HP_IDENTIFIER; - if (0 == strcmp(prevWord, "class")) - chAttr = SCE_HP_CLASSNAME; - else if (0 == strcmp(prevWord, "def")) - chAttr = SCE_HP_DEFNAME; - else if (wordIsNumber) - chAttr = SCE_HP_NUMBER; - else if (keywords.InList(s)) - chAttr = SCE_HP_WORD; - else if (isMako && 0 == strcmp(s, "block")) - chAttr = SCE_HP_WORD; - styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); - strcpy(prevWord, s); -} - -// Update the word colour to default or keyword -// Called when in a PHP word -static void classifyWordHTPHP(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { - char chAttr = SCE_HPHP_DEFAULT; - bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1])); - if (wordIsNumber) { - chAttr = SCE_HPHP_NUMBER; - } else { - char s[100]; - GetTextSegment(styler, start, end, s, sizeof(s)); - if (keywords.InList(s)) - chAttr = SCE_HPHP_WORD; - } - styler.ColourTo(end, chAttr); -} - -static bool isWordHSGML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { - char s[30 + 1]; - Sci_PositionU i = 0; - for (; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - } - s[i] = '\0'; - return keywords.InList(s); -} - -static bool isWordCdata(Sci_PositionU start, Sci_PositionU end, Accessor &styler) { - char s[30 + 1]; - Sci_PositionU i = 0; - for (; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - } - s[i] = '\0'; - return (0 == strcmp(s, "[CDATA[")); -} - -// Return the first state to reach when entering a scripting language -static int StateForScript(script_type scriptLanguage) { - int Result; - switch (scriptLanguage) { - case eScriptVBS: - Result = SCE_HB_START; - break; - case eScriptPython: - Result = SCE_HP_START; - break; - case eScriptPHP: - Result = SCE_HPHP_DEFAULT; - break; - case eScriptXML: - Result = SCE_H_TAGUNKNOWN; - break; - case eScriptSGML: - Result = SCE_H_SGML_DEFAULT; - break; - case eScriptComment: - Result = SCE_H_COMMENT; - break; - default : - Result = SCE_HJ_START; - break; - } - return Result; -} - -static inline bool issgmlwordchar(int ch) { - return !IsASCII(ch) || - (isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '['); -} - -static inline bool IsPhpWordStart(int ch) { - return (IsASCII(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f); -} - -static inline bool IsPhpWordChar(int ch) { - return IsADigit(ch) || IsPhpWordStart(ch); -} - -static bool InTagState(int state) { - return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN || - state == SCE_H_SCRIPT || - state == SCE_H_ATTRIBUTE || state == SCE_H_ATTRIBUTEUNKNOWN || - state == SCE_H_NUMBER || state == SCE_H_OTHER || - state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING; -} - -static bool IsCommentState(const int state) { - return state == SCE_H_COMMENT || state == SCE_H_SGML_COMMENT; -} - -static bool IsScriptCommentState(const int state) { - return state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTLINE || state == SCE_HJA_COMMENT || - state == SCE_HJA_COMMENTLINE || state == SCE_HB_COMMENTLINE || state == SCE_HBA_COMMENTLINE; -} - -static bool isLineEnd(int ch) { - return ch == '\r' || ch == '\n'; -} - -static bool isMakoBlockEnd(const int ch, const int chNext, const char *blockType) { - if (strlen(blockType) == 0) { - return ((ch == '%') && (chNext == '>')); - } else if ((0 == strcmp(blockType, "inherit")) || - (0 == strcmp(blockType, "namespace")) || - (0 == strcmp(blockType, "include")) || - (0 == strcmp(blockType, "page"))) { - return ((ch == '/') && (chNext == '>')); - } else if (0 == strcmp(blockType, "%")) { - if (ch == '/' && isLineEnd(chNext)) - return 1; - else - return isLineEnd(ch); - } else if (0 == strcmp(blockType, "{")) { - return ch == '}'; - } else { - return (ch == '>'); - } -} - -static bool isDjangoBlockEnd(const int ch, const int chNext, const char *blockType) { - if (strlen(blockType) == 0) { - return 0; - } else if (0 == strcmp(blockType, "%")) { - return ((ch == '%') && (chNext == '}')); - } else if (0 == strcmp(blockType, "{")) { - return ((ch == '}') && (chNext == '}')); - } else { - return 0; - } -} - -static bool isPHPStringState(int state) { - return - (state == SCE_HPHP_HSTRING) || - (state == SCE_HPHP_SIMPLESTRING) || - (state == SCE_HPHP_HSTRING_VARIABLE) || - (state == SCE_HPHP_COMPLEX_VARIABLE); -} - -static Sci_Position FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, Sci_Position i, const Sci_Position lengthDoc, Accessor &styler, bool &isSimpleString) { - Sci_Position j; - const Sci_Position beginning = i - 1; - bool isValidSimpleString = false; - - while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t')) - i++; - - char ch = styler.SafeGetCharAt(i); - const char chNext = styler.SafeGetCharAt(i + 1); - if (!IsPhpWordStart(ch)) { - if (ch == '\'' && IsPhpWordStart(chNext)) { - i++; - ch = chNext; - isSimpleString = true; - } else { - phpStringDelimiter[0] = '\0'; - return beginning; - } - } - phpStringDelimiter[0] = ch; - i++; - - for (j = i; j < lengthDoc && !isLineEnd(styler[j]); j++) { - if (!IsPhpWordChar(styler[j])) { - if (isSimpleString && (styler[j] == '\'') && isLineEnd(styler.SafeGetCharAt(j + 1))) { - isValidSimpleString = true; - j++; - break; - } else { - phpStringDelimiter[0] = '\0'; - return beginning; - } - } - if (j - i < phpStringDelimiterSize - 2) - phpStringDelimiter[j-i+1] = styler[j]; - else - i++; - } - if (isSimpleString && !isValidSimpleString) { - phpStringDelimiter[0] = '\0'; - return beginning; - } - phpStringDelimiter[j-i+1 - (isSimpleString ? 1 : 0)] = '\0'; - return j - 1; -} - -static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler, bool isXml) { - WordList &keywords = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - WordList &keywords3 = *keywordlists[2]; - WordList &keywords4 = *keywordlists[3]; - WordList &keywords5 = *keywordlists[4]; - WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords - - styler.StartAt(startPos); - char prevWord[200]; - prevWord[0] = '\0'; - char phpStringDelimiter[200]; // PHP is not limited in length, we are - phpStringDelimiter[0] = '\0'; - int StateToPrint = initStyle; - int state = stateForPrintState(StateToPrint); - char makoBlockType[200]; - makoBlockType[0] = '\0'; - int makoComment = 0; - char djangoBlockType[2]; - djangoBlockType[0] = '\0'; - - // If inside a tag, it may be a script tag, so reread from the start of line starting tag to ensure any language tags are seen - if (InTagState(state)) { - while ((startPos > 0) && (InTagState(styler.StyleAt(startPos - 1)))) { - Sci_Position backLineStart = styler.LineStart(styler.GetLine(startPos-1)); - length += startPos - backLineStart; - startPos = backLineStart; - } - state = SCE_H_DEFAULT; - } - // String can be heredoc, must find a delimiter first. Reread from beginning of line containing the string, to get the correct lineState - if (isPHPStringState(state)) { - while (startPos > 0 && (isPHPStringState(state) || !isLineEnd(styler[startPos - 1]))) { - startPos--; - length++; - state = styler.StyleAt(startPos); - } - if (startPos == 0) - state = SCE_H_DEFAULT; - } - styler.StartAt(startPos); - - /* Nothing handles getting out of these, so we need not start in any of them. - * As we're at line start and they can't span lines, we'll re-detect them anyway */ - switch (state) { - case SCE_H_QUESTION: - case SCE_H_XMLSTART: - case SCE_H_XMLEND: - case SCE_H_ASP: - state = SCE_H_DEFAULT; - break; - } - - Sci_Position lineCurrent = styler.GetLine(startPos); - int lineState; - if (lineCurrent > 0) { - lineState = styler.GetLineState(lineCurrent-1); - } else { - // Default client and ASP scripting language is JavaScript - lineState = eScriptJS << 8; - - // property asp.default.language - // Script in ASP code is initially assumed to be in JavaScript. - // To change this to VBScript set asp.default.language to 2. Python is 3. - lineState |= styler.GetPropertyInt("asp.default.language", eScriptJS) << 4; - } - script_mode inScriptType = script_mode((lineState >> 0) & 0x03); // 2 bits of scripting mode - bool tagOpened = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag - bool tagClosing = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag - bool tagDontFold = false; //some HTML tags should not be folded - script_type aspScript = script_type((lineState >> 4) & 0x0F); // 4 bits of script name - script_type clientScript = script_type((lineState >> 8) & 0x0F); // 4 bits of script name - int beforePreProc = (lineState >> 12) & 0xFF; // 8 bits of state - - script_type scriptLanguage = ScriptOfState(state); - // If eNonHtmlScript coincides with SCE_H_COMMENT, assume eScriptComment - if (inScriptType == eNonHtmlScript && state == SCE_H_COMMENT) { - scriptLanguage = eScriptComment; - } - script_type beforeLanguage = ScriptOfState(beforePreProc); - - // property fold.html - // Folding is turned on or off for HTML and XML files with this option. - // The fold option must also be on for folding to occur. - const bool foldHTML = styler.GetPropertyInt("fold.html", 0) != 0; - - const bool fold = foldHTML && styler.GetPropertyInt("fold", 0); - - // property fold.html.preprocessor - // Folding is turned on or off for scripts embedded in HTML files with this option. - // The default is on. - const bool foldHTMLPreprocessor = foldHTML && styler.GetPropertyInt("fold.html.preprocessor", 1); - - const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - - // property fold.hypertext.comment - // Allow folding for comments in scripts embedded in HTML. - // The default is off. - const bool foldComment = fold && styler.GetPropertyInt("fold.hypertext.comment", 0) != 0; - - // property fold.hypertext.heredoc - // Allow folding for heredocs in scripts embedded in HTML. - // The default is off. - const bool foldHeredoc = fold && styler.GetPropertyInt("fold.hypertext.heredoc", 0) != 0; - - // property html.tags.case.sensitive - // For XML and HTML, setting this property to 1 will make tags match in a case - // sensitive way which is the expected behaviour for XML and XHTML. - const bool caseSensitive = styler.GetPropertyInt("html.tags.case.sensitive", 0) != 0; - - // property lexer.xml.allow.scripts - // Set to 0 to disable scripts in XML. - const bool allowScripts = styler.GetPropertyInt("lexer.xml.allow.scripts", 1) != 0; - - // property lexer.html.mako - // Set to 1 to enable the mako template language. - const bool isMako = styler.GetPropertyInt("lexer.html.mako", 0) != 0; - - // property lexer.html.django - // Set to 1 to enable the django template language. - const bool isDjango = styler.GetPropertyInt("lexer.html.django", 0) != 0; - - const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true); - const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", 0x80, true); - const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", 0x80, true); - // TODO: also handle + and - (except if they're part of ++ or --) and return keywords - const CharacterSet setOKBeforeJSRE(CharacterSet::setNone, "([{=,:;!%^&*|?~"); - - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - int visibleChars = 0; - int lineStartVisibleChars = 0; - - int chPrev = ' '; - int ch = ' '; - int chPrevNonWhite = ' '; - // look back to set chPrevNonWhite properly for better regex colouring - if (scriptLanguage == eScriptJS && startPos > 0) { - Sci_Position back = startPos; - int style = 0; - while (--back) { - style = styler.StyleAt(back); - if (style < SCE_HJ_DEFAULT || style > SCE_HJ_COMMENTDOC) - // includes SCE_HJ_COMMENT & SCE_HJ_COMMENTLINE - break; - } - if (style == SCE_HJ_SYMBOLS) { - chPrevNonWhite = static_cast(styler.SafeGetCharAt(back)); - } - } - - styler.StartSegment(startPos); - const Sci_Position lengthDoc = startPos + length; - for (Sci_Position i = startPos; i < lengthDoc; i++) { - const int chPrev2 = chPrev; - chPrev = ch; - if (!IsASpace(ch) && state != SCE_HJ_COMMENT && - state != SCE_HJ_COMMENTLINE && state != SCE_HJ_COMMENTDOC) - chPrevNonWhite = ch; - ch = static_cast(styler[i]); - int chNext = static_cast(styler.SafeGetCharAt(i + 1)); - const int chNext2 = static_cast(styler.SafeGetCharAt(i + 2)); - - // Handle DBCS codepages - if (styler.IsLeadByte(static_cast(ch))) { - chPrev = ' '; - i += 1; - continue; - } - - if ((!IsASpace(ch) || !foldCompact) && fold) - visibleChars++; - if (!IsASpace(ch)) - lineStartVisibleChars++; - - // decide what is the current state to print (depending of the script tag) - StateToPrint = statePrintForState(state, inScriptType); - - // handle script folding - if (fold) { - switch (scriptLanguage) { - case eScriptJS: - case eScriptPHP: - //not currently supported case eScriptVBS: - - if ((state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (state != SCE_HJ_COMMENT) && (state != SCE_HJ_COMMENTLINE) && (state != SCE_HJ_COMMENTDOC) && (!isStringState(state))) { - //Platform::DebugPrintf("state=%d, StateToPrint=%d, initStyle=%d\n", state, StateToPrint, initStyle); - //if ((state == SCE_HPHP_OPERATOR) || (state == SCE_HPHP_DEFAULT) || (state == SCE_HJ_SYMBOLS) || (state == SCE_HJ_START) || (state == SCE_HJ_DEFAULT)) { - if (ch == '#') { - Sci_Position j = i + 1; - while ((j < lengthDoc) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { - j++; - } - if (styler.Match(j, "region") || styler.Match(j, "if")) { - levelCurrent++; - } else if (styler.Match(j, "end")) { - levelCurrent--; - } - } else if ((ch == '{') || (ch == '}') || (foldComment && (ch == '/') && (chNext == '*'))) { - levelCurrent += (((ch == '{') || (ch == '/')) ? 1 : -1); - } - } else if (((state == SCE_HPHP_COMMENT) || (state == SCE_HJ_COMMENT)) && foldComment && (ch == '*') && (chNext == '/')) { - levelCurrent--; - } - break; - case eScriptPython: - if (state != SCE_HP_COMMENTLINE && !isMako) { - if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) { - levelCurrent++; - } else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) { - // check if the number of tabs is lower than the level - int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8; - for (Sci_Position j = 0; Findlevel > 0; j++) { - char chTmp = styler.SafeGetCharAt(i + j + 1); - if (chTmp == '\t') { - Findlevel -= 8; - } else if (chTmp == ' ') { - Findlevel--; - } else { - break; - } - } - - if (Findlevel > 0) { - levelCurrent -= Findlevel / 8; - if (Findlevel % 8) - levelCurrent--; - } - } - } - break; - default: - break; - } - } - - if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { - // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix) - // Avoid triggering two times on Dos/Win - // New line -> record any line state onto /next/ line - if (fold) { - int lev = levelPrev; - if (visibleChars == 0) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - - styler.SetLevel(lineCurrent, lev); - visibleChars = 0; - levelPrev = levelCurrent; - } - styler.SetLineState(lineCurrent, - ((inScriptType & 0x03) << 0) | - ((tagOpened ? 1 : 0) << 2) | - ((tagClosing ? 1 : 0) << 3) | - ((aspScript & 0x0F) << 4) | - ((clientScript & 0x0F) << 8) | - ((beforePreProc & 0xFF) << 12)); - lineCurrent++; - lineStartVisibleChars = 0; - } - - // handle start of Mako comment line - if (isMako && ch == '#' && chNext == '#') { - makoComment = 1; - state = SCE_HP_COMMENTLINE; - } - - // handle end of Mako comment line - else if (isMako && makoComment && (ch == '\r' || ch == '\n')) { - makoComment = 0; - styler.ColourTo(i - 1, StateToPrint); - if (scriptLanguage == eScriptPython) { - state = SCE_HP_DEFAULT; - } else { - state = SCE_H_DEFAULT; - } - } - - // Allow falling through to mako handling code if newline is going to end a block - if (((ch == '\r' && chNext != '\n') || (ch == '\n')) && - (!isMako || (0 != strcmp(makoBlockType, "%")))) { - } - // Ignore everything in mako comment until the line ends - else if (isMako && makoComment) { - } - - // generic end of script processing - else if ((inScriptType == eNonHtmlScript) && (ch == '<') && (chNext == '/')) { - // Check if it's the end of the script tag (or any other HTML tag) - switch (state) { - // in these cases, you can embed HTML tags (to confirm !!!!!!!!!!!!!!!!!!!!!!) - case SCE_H_DOUBLESTRING: - case SCE_H_SINGLESTRING: - case SCE_HJ_COMMENT: - case SCE_HJ_COMMENTDOC: - //case SCE_HJ_COMMENTLINE: // removed as this is a common thing done to hide - // the end of script marker from some JS interpreters. - case SCE_HB_COMMENTLINE: - case SCE_HBA_COMMENTLINE: - case SCE_HJ_DOUBLESTRING: - case SCE_HJ_SINGLESTRING: - case SCE_HJ_REGEX: - case SCE_HB_STRING: - case SCE_HBA_STRING: - case SCE_HP_STRING: - case SCE_HP_TRIPLE: - case SCE_HP_TRIPLEDOUBLE: - case SCE_HPHP_HSTRING: - case SCE_HPHP_SIMPLESTRING: - case SCE_HPHP_COMMENT: - case SCE_HPHP_COMMENTLINE: - break; - default : - // check if the closing tag is a script tag - if (const char *tag = - state == SCE_HJ_COMMENTLINE || isXml ? "script" : - state == SCE_H_COMMENT ? "comment" : 0) { - Sci_Position j = i + 2; - int chr; - do { - chr = static_cast(*tag++); - } while (chr != 0 && chr == MakeLowerCase(styler.SafeGetCharAt(j++))); - if (chr != 0) break; - } - // closing tag of the script (it's a closing HTML tag anyway) - styler.ColourTo(i - 1, StateToPrint); - state = SCE_H_TAGUNKNOWN; - inScriptType = eHtml; - scriptLanguage = eScriptNone; - clientScript = eScriptJS; - i += 2; - visibleChars += 2; - tagClosing = true; - continue; - } - } - - ///////////////////////////////////// - // handle the start of PHP pre-processor = Non-HTML - else if ((state != SCE_H_ASPAT) && - !isStringState(state) && - (state != SCE_HPHP_COMMENT) && - (state != SCE_HPHP_COMMENTLINE) && - (ch == '<') && - (chNext == '?') && - !IsScriptCommentState(state)) { - beforeLanguage = scriptLanguage; - scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 6, isXml ? eScriptXML : eScriptPHP); - if ((scriptLanguage != eScriptPHP) && (isStringState(state) || (state==SCE_H_COMMENT))) continue; - styler.ColourTo(i - 1, StateToPrint); - beforePreProc = state; - i++; - visibleChars++; - i += PrintScriptingIndicatorOffset(styler, styler.GetStartSegment() + 2, i + 6); - if (scriptLanguage == eScriptXML) - styler.ColourTo(i, SCE_H_XMLSTART); - else - styler.ColourTo(i, SCE_H_QUESTION); - state = StateForScript(scriptLanguage); - if (inScriptType == eNonHtmlScript) - inScriptType = eNonHtmlScriptPreProc; - else - inScriptType = eNonHtmlPreProc; - // Fold whole script, but not if the XML first tag (all XML-like tags in this case) - if (foldHTMLPreprocessor && (scriptLanguage != eScriptXML)) { - levelCurrent++; - } - // should be better - ch = static_cast(styler.SafeGetCharAt(i)); - continue; - } - - // handle the start Mako template Python code - else if (isMako && scriptLanguage == eScriptNone && ((ch == '<' && chNext == '%') || - (lineStartVisibleChars == 1 && ch == '%') || - (lineStartVisibleChars == 1 && ch == '/' && chNext == '%') || - (ch == '$' && chNext == '{') || - (ch == '<' && chNext == '/' && chNext2 == '%'))) { - if (ch == '%' || ch == '/') - StringCopy(makoBlockType, "%"); - else if (ch == '$') - StringCopy(makoBlockType, "{"); - else if (chNext == '/') - GetNextWord(styler, i+3, makoBlockType, sizeof(makoBlockType)); - else - GetNextWord(styler, i+2, makoBlockType, sizeof(makoBlockType)); - styler.ColourTo(i - 1, StateToPrint); - beforePreProc = state; - if (inScriptType == eNonHtmlScript) - inScriptType = eNonHtmlScriptPreProc; - else - inScriptType = eNonHtmlPreProc; - - if (chNext == '/') { - i += 2; - visibleChars += 2; - } else if (ch != '%') { - i++; - visibleChars++; - } - state = SCE_HP_START; - scriptLanguage = eScriptPython; - styler.ColourTo(i, SCE_H_ASP); - - if (ch != '%' && ch != '$' && ch != '/') { - i += static_cast(strlen(makoBlockType)); - visibleChars += static_cast(strlen(makoBlockType)); - if (keywords4.InList(makoBlockType)) - styler.ColourTo(i, SCE_HP_WORD); - else - styler.ColourTo(i, SCE_H_TAGUNKNOWN); - } - - ch = static_cast(styler.SafeGetCharAt(i)); - continue; - } - - // handle the start/end of Django comment - else if (isDjango && state != SCE_H_COMMENT && (ch == '{' && chNext == '#')) { - styler.ColourTo(i - 1, StateToPrint); - beforePreProc = state; - beforeLanguage = scriptLanguage; - if (inScriptType == eNonHtmlScript) - inScriptType = eNonHtmlScriptPreProc; - else - inScriptType = eNonHtmlPreProc; - i += 1; - visibleChars += 1; - scriptLanguage = eScriptComment; - state = SCE_H_COMMENT; - styler.ColourTo(i, SCE_H_ASP); - ch = static_cast(styler.SafeGetCharAt(i)); - continue; - } else if (isDjango && state == SCE_H_COMMENT && (ch == '#' && chNext == '}')) { - styler.ColourTo(i - 1, StateToPrint); - i += 1; - visibleChars += 1; - styler.ColourTo(i, SCE_H_ASP); - state = beforePreProc; - if (inScriptType == eNonHtmlScriptPreProc) - inScriptType = eNonHtmlScript; - else - inScriptType = eHtml; - scriptLanguage = beforeLanguage; - continue; - } - - // handle the start Django template code - else if (isDjango && scriptLanguage != eScriptPython && (ch == '{' && (chNext == '%' || chNext == '{'))) { - if (chNext == '%') - StringCopy(djangoBlockType, "%"); - else - StringCopy(djangoBlockType, "{"); - styler.ColourTo(i - 1, StateToPrint); - beforePreProc = state; - if (inScriptType == eNonHtmlScript) - inScriptType = eNonHtmlScriptPreProc; - else - inScriptType = eNonHtmlPreProc; - - i += 1; - visibleChars += 1; - state = SCE_HP_START; - beforeLanguage = scriptLanguage; - scriptLanguage = eScriptPython; - styler.ColourTo(i, SCE_H_ASP); - - ch = static_cast(styler.SafeGetCharAt(i)); - continue; - } - - // handle the start of ASP pre-processor = Non-HTML - else if (!isMako && !isDjango && !isCommentASPState(state) && (ch == '<') && (chNext == '%') && !isPHPStringState(state)) { - styler.ColourTo(i - 1, StateToPrint); - beforePreProc = state; - if (inScriptType == eNonHtmlScript) - inScriptType = eNonHtmlScriptPreProc; - else - inScriptType = eNonHtmlPreProc; - - if (chNext2 == '@') { - i += 2; // place as if it was the second next char treated - visibleChars += 2; - state = SCE_H_ASPAT; - } else if ((chNext2 == '-') && (styler.SafeGetCharAt(i + 3) == '-')) { - styler.ColourTo(i + 3, SCE_H_ASP); - state = SCE_H_XCCOMMENT; - scriptLanguage = eScriptVBS; - continue; - } else { - if (chNext2 == '=') { - i += 2; // place as if it was the second next char treated - visibleChars += 2; - } else { - i++; // place as if it was the next char treated - visibleChars++; - } - - state = StateForScript(aspScript); - } - scriptLanguage = eScriptVBS; - styler.ColourTo(i, SCE_H_ASP); - // fold whole script - if (foldHTMLPreprocessor) - levelCurrent++; - // should be better - ch = static_cast(styler.SafeGetCharAt(i)); - continue; - } - - ///////////////////////////////////// - // handle the start of SGML language (DTD) - else if (((scriptLanguage == eScriptNone) || (scriptLanguage == eScriptXML)) && - (chPrev == '<') && - (ch == '!') && - (StateToPrint != SCE_H_CDATA) && - (!IsCommentState(StateToPrint)) && - (!IsScriptCommentState(StateToPrint))) { - beforePreProc = state; - styler.ColourTo(i - 2, StateToPrint); - if ((chNext == '-') && (chNext2 == '-')) { - state = SCE_H_COMMENT; // wait for a pending command - styler.ColourTo(i + 2, SCE_H_COMMENT); - i += 2; // follow styling after the -- - } else if (isWordCdata(i + 1, i + 7, styler)) { - state = SCE_H_CDATA; - } else { - styler.ColourTo(i, SCE_H_SGML_DEFAULT); // ') { - i++; - visibleChars++; - } - else if (0 == strcmp(makoBlockType, "%") && ch == '/') { - i++; - visibleChars++; - } - if (0 != strcmp(makoBlockType, "%") || ch == '/') { - styler.ColourTo(i, SCE_H_ASP); - } - state = beforePreProc; - if (inScriptType == eNonHtmlScriptPreProc) - inScriptType = eNonHtmlScript; - else - inScriptType = eHtml; - scriptLanguage = eScriptNone; - continue; - } - - // handle the end of Django template code - else if (isDjango && - ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && - (scriptLanguage != eScriptNone) && stateAllowsTermination(state) && - isDjangoBlockEnd(ch, chNext, djangoBlockType)) { - if (state == SCE_H_ASPAT) { - aspScript = segIsScriptingIndicator(styler, - styler.GetStartSegment(), i - 1, aspScript); - } - if (state == SCE_HP_WORD) { - classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako); - } else { - styler.ColourTo(i - 1, StateToPrint); - } - i += 1; - visibleChars += 1; - styler.ColourTo(i, SCE_H_ASP); - state = beforePreProc; - if (inScriptType == eNonHtmlScriptPreProc) - inScriptType = eNonHtmlScript; - else - inScriptType = eHtml; - scriptLanguage = beforeLanguage; - continue; - } - - // handle the end of a pre-processor = Non-HTML - else if ((!isMako && !isDjango && ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && - (((scriptLanguage != eScriptNone) && stateAllowsTermination(state))) && - (((ch == '%') || (ch == '?')) && (chNext == '>'))) || - ((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) { - if (state == SCE_H_ASPAT) { - aspScript = segIsScriptingIndicator(styler, - styler.GetStartSegment(), i - 1, aspScript); - } - // Bounce out of any ASP mode - switch (state) { - case SCE_HJ_WORD: - classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, styler, inScriptType); - break; - case SCE_HB_WORD: - classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler, inScriptType); - break; - case SCE_HP_WORD: - classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako); - break; - case SCE_HPHP_WORD: - classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler); - break; - case SCE_H_XCCOMMENT: - styler.ColourTo(i - 1, state); - break; - default : - styler.ColourTo(i - 1, StateToPrint); - break; - } - if (scriptLanguage != eScriptSGML) { - i++; - visibleChars++; - } - if (ch == '%') - styler.ColourTo(i, SCE_H_ASP); - else if (scriptLanguage == eScriptXML) - styler.ColourTo(i, SCE_H_XMLEND); - else if (scriptLanguage == eScriptSGML) - styler.ColourTo(i, SCE_H_SGML_DEFAULT); - else - styler.ColourTo(i, SCE_H_QUESTION); - state = beforePreProc; - if (inScriptType == eNonHtmlScriptPreProc) - inScriptType = eNonHtmlScript; - else - inScriptType = eHtml; - // Unfold all scripting languages, except for XML tag - if (foldHTMLPreprocessor && (scriptLanguage != eScriptXML)) { - levelCurrent--; - } - scriptLanguage = beforeLanguage; - continue; - } - ///////////////////////////////////// - - switch (state) { - case SCE_H_DEFAULT: - if (ch == '<') { - // in HTML, fold on tag open and unfold on tag close - tagOpened = true; - tagClosing = (chNext == '/'); - styler.ColourTo(i - 1, StateToPrint); - if (chNext != '!') - state = SCE_H_TAGUNKNOWN; - } else if (ch == '&') { - styler.ColourTo(i - 1, SCE_H_DEFAULT); - state = SCE_H_ENTITY; - } - break; - case SCE_H_SGML_DEFAULT: - case SCE_H_SGML_BLOCK_DEFAULT: -// if (scriptLanguage == eScriptSGMLblock) -// StateToPrint = SCE_H_SGML_BLOCK_DEFAULT; - - if (ch == '\"') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_H_SGML_DOUBLESTRING; - } else if (ch == '\'') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_H_SGML_SIMPLESTRING; - } else if ((ch == '-') && (chPrev == '-')) { - if (static_cast(styler.GetStartSegment()) <= (i - 2)) { - styler.ColourTo(i - 2, StateToPrint); - } - state = SCE_H_SGML_COMMENT; - } else if (IsASCII(ch) && isalpha(ch) && (chPrev == '%')) { - styler.ColourTo(i - 2, StateToPrint); - state = SCE_H_SGML_ENTITY; - } else if (ch == '#') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_H_SGML_SPECIAL; - } else if (ch == '[') { - styler.ColourTo(i - 1, StateToPrint); - scriptLanguage = eScriptSGMLblock; - state = SCE_H_SGML_BLOCK_DEFAULT; - } else if (ch == ']') { - if (scriptLanguage == eScriptSGMLblock) { - styler.ColourTo(i, StateToPrint); - scriptLanguage = eScriptSGML; - } else { - styler.ColourTo(i - 1, StateToPrint); - styler.ColourTo(i, SCE_H_SGML_ERROR); - } - state = SCE_H_SGML_DEFAULT; - } else if (scriptLanguage == eScriptSGMLblock) { - if ((ch == '!') && (chPrev == '<')) { - styler.ColourTo(i - 2, StateToPrint); - styler.ColourTo(i, SCE_H_SGML_DEFAULT); - state = SCE_H_SGML_COMMAND; - } else if (ch == '>') { - styler.ColourTo(i - 1, StateToPrint); - styler.ColourTo(i, SCE_H_SGML_DEFAULT); - } - } - break; - case SCE_H_SGML_COMMAND: - if ((ch == '-') && (chPrev == '-')) { - styler.ColourTo(i - 2, StateToPrint); - state = SCE_H_SGML_COMMENT; - } else if (!issgmlwordchar(ch)) { - if (isWordHSGML(styler.GetStartSegment(), i - 1, keywords6, styler)) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_H_SGML_1ST_PARAM; - } else { - state = SCE_H_SGML_ERROR; - } - } - break; - case SCE_H_SGML_1ST_PARAM: - // wait for the beginning of the word - if ((ch == '-') && (chPrev == '-')) { - if (scriptLanguage == eScriptSGMLblock) { - styler.ColourTo(i - 2, SCE_H_SGML_BLOCK_DEFAULT); - } else { - styler.ColourTo(i - 2, SCE_H_SGML_DEFAULT); - } - state = SCE_H_SGML_1ST_PARAM_COMMENT; - } else if (issgmlwordchar(ch)) { - if (scriptLanguage == eScriptSGMLblock) { - styler.ColourTo(i - 1, SCE_H_SGML_BLOCK_DEFAULT); - } else { - styler.ColourTo(i - 1, SCE_H_SGML_DEFAULT); - } - // find the length of the word - int size = 1; - while (setHTMLWord.Contains(static_cast(styler.SafeGetCharAt(i + size)))) - size++; - styler.ColourTo(i + size - 1, StateToPrint); - i += size - 1; - visibleChars += size - 1; - ch = static_cast(styler.SafeGetCharAt(i)); - if (scriptLanguage == eScriptSGMLblock) { - state = SCE_H_SGML_BLOCK_DEFAULT; - } else { - state = SCE_H_SGML_DEFAULT; - } - continue; - } - break; - case SCE_H_SGML_ERROR: - if ((ch == '-') && (chPrev == '-')) { - styler.ColourTo(i - 2, StateToPrint); - state = SCE_H_SGML_COMMENT; - } - break; - case SCE_H_SGML_DOUBLESTRING: - if (ch == '\"') { - styler.ColourTo(i, StateToPrint); - state = SCE_H_SGML_DEFAULT; - } - break; - case SCE_H_SGML_SIMPLESTRING: - if (ch == '\'') { - styler.ColourTo(i, StateToPrint); - state = SCE_H_SGML_DEFAULT; - } - break; - case SCE_H_SGML_COMMENT: - if ((ch == '-') && (chPrev == '-')) { - styler.ColourTo(i, StateToPrint); - state = SCE_H_SGML_DEFAULT; - } - break; - case SCE_H_CDATA: - if ((chPrev2 == ']') && (chPrev == ']') && (ch == '>')) { - styler.ColourTo(i, StateToPrint); - state = SCE_H_DEFAULT; - levelCurrent--; - } - break; - case SCE_H_COMMENT: - if ((scriptLanguage != eScriptComment) && (chPrev2 == '-') && (chPrev == '-') && (ch == '>')) { - styler.ColourTo(i, StateToPrint); - state = SCE_H_DEFAULT; - levelCurrent--; - } - break; - case SCE_H_SGML_1ST_PARAM_COMMENT: - if ((ch == '-') && (chPrev == '-')) { - styler.ColourTo(i, SCE_H_SGML_COMMENT); - state = SCE_H_SGML_1ST_PARAM; - } - break; - case SCE_H_SGML_SPECIAL: - if (!(IsASCII(ch) && isupper(ch))) { - styler.ColourTo(i - 1, StateToPrint); - if (isalnum(ch)) { - state = SCE_H_SGML_ERROR; - } else { - state = SCE_H_SGML_DEFAULT; - } - } - break; - case SCE_H_SGML_ENTITY: - if (ch == ';') { - styler.ColourTo(i, StateToPrint); - state = SCE_H_SGML_DEFAULT; - } else if (!(IsASCII(ch) && isalnum(ch)) && ch != '-' && ch != '.') { - styler.ColourTo(i, SCE_H_SGML_ERROR); - state = SCE_H_SGML_DEFAULT; - } - break; - case SCE_H_ENTITY: - if (ch == ';') { - styler.ColourTo(i, StateToPrint); - state = SCE_H_DEFAULT; - } - if (ch != '#' && !(IsASCII(ch) && isalnum(ch)) // Should check that '#' follows '&', but it is unlikely anyway... - && ch != '.' && ch != '-' && ch != '_' && ch != ':') { // valid in XML - if (!IsASCII(ch)) // Possibly start of a multibyte character so don't allow this byte to be in entity style - styler.ColourTo(i-1, SCE_H_TAGUNKNOWN); - else - styler.ColourTo(i, SCE_H_TAGUNKNOWN); - state = SCE_H_DEFAULT; - } - break; - case SCE_H_TAGUNKNOWN: - if (!setTagContinue.Contains(ch) && !((ch == '/') && (chPrev == '<'))) { - int eClass = classifyTagHTML(styler.GetStartSegment(), - i - 1, keywords, styler, tagDontFold, caseSensitive, isXml, allowScripts); - if (eClass == SCE_H_SCRIPT || eClass == SCE_H_COMMENT) { - if (!tagClosing) { - inScriptType = eNonHtmlScript; - scriptLanguage = eClass == SCE_H_SCRIPT ? clientScript : eScriptComment; - } else { - scriptLanguage = eScriptNone; - } - eClass = SCE_H_TAG; - } - if (ch == '>') { - styler.ColourTo(i, eClass); - if (inScriptType == eNonHtmlScript) { - state = StateForScript(scriptLanguage); - } else { - state = SCE_H_DEFAULT; - } - tagOpened = false; - if (!tagDontFold) { - if (tagClosing) { - levelCurrent--; - } else { - levelCurrent++; - } - } - tagClosing = false; - } else if (ch == '/' && chNext == '>') { - if (eClass == SCE_H_TAGUNKNOWN) { - styler.ColourTo(i + 1, SCE_H_TAGUNKNOWN); - } else { - styler.ColourTo(i - 1, StateToPrint); - styler.ColourTo(i + 1, SCE_H_TAGEND); - } - i++; - ch = chNext; - state = SCE_H_DEFAULT; - tagOpened = false; - } else { - if (eClass != SCE_H_TAGUNKNOWN) { - if (eClass == SCE_H_SGML_DEFAULT) { - state = SCE_H_SGML_DEFAULT; - } else { - state = SCE_H_OTHER; - } - } - } - } - break; - case SCE_H_ATTRIBUTE: - if (!setAttributeContinue.Contains(ch)) { - if (inScriptType == eNonHtmlScript) { - int scriptLanguagePrev = scriptLanguage; - clientScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage); - scriptLanguage = clientScript; - if ((scriptLanguagePrev != scriptLanguage) && (scriptLanguage == eScriptNone)) - inScriptType = eHtml; - } - classifyAttribHTML(styler.GetStartSegment(), i - 1, keywords, styler); - if (ch == '>') { - styler.ColourTo(i, SCE_H_TAG); - if (inScriptType == eNonHtmlScript) { - state = StateForScript(scriptLanguage); - } else { - state = SCE_H_DEFAULT; - } - tagOpened = false; - if (!tagDontFold) { - if (tagClosing) { - levelCurrent--; - } else { - levelCurrent++; - } - } - tagClosing = false; - } else if (ch == '=') { - styler.ColourTo(i, SCE_H_OTHER); - state = SCE_H_VALUE; - } else { - state = SCE_H_OTHER; - } - } - break; - case SCE_H_OTHER: - if (ch == '>') { - styler.ColourTo(i - 1, StateToPrint); - styler.ColourTo(i, SCE_H_TAG); - if (inScriptType == eNonHtmlScript) { - state = StateForScript(scriptLanguage); - } else { - state = SCE_H_DEFAULT; - } - tagOpened = false; - if (!tagDontFold) { - if (tagClosing) { - levelCurrent--; - } else { - levelCurrent++; - } - } - tagClosing = false; - } else if (ch == '\"') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_H_DOUBLESTRING; - } else if (ch == '\'') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_H_SINGLESTRING; - } else if (ch == '=') { - styler.ColourTo(i, StateToPrint); - state = SCE_H_VALUE; - } else if (ch == '/' && chNext == '>') { - styler.ColourTo(i - 1, StateToPrint); - styler.ColourTo(i + 1, SCE_H_TAGEND); - i++; - ch = chNext; - state = SCE_H_DEFAULT; - tagOpened = false; - } else if (ch == '?' && chNext == '>') { - styler.ColourTo(i - 1, StateToPrint); - styler.ColourTo(i + 1, SCE_H_XMLEND); - i++; - ch = chNext; - state = SCE_H_DEFAULT; - } else if (setHTMLWord.Contains(ch)) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_H_ATTRIBUTE; - } - break; - case SCE_H_DOUBLESTRING: - if (ch == '\"') { - if (inScriptType == eNonHtmlScript) { - scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); - } - styler.ColourTo(i, SCE_H_DOUBLESTRING); - state = SCE_H_OTHER; - } - break; - case SCE_H_SINGLESTRING: - if (ch == '\'') { - if (inScriptType == eNonHtmlScript) { - scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); - } - styler.ColourTo(i, SCE_H_SINGLESTRING); - state = SCE_H_OTHER; - } - break; - case SCE_H_VALUE: - if (!setHTMLWord.Contains(ch)) { - if (ch == '\"' && chPrev == '=') { - // Should really test for being first character - state = SCE_H_DOUBLESTRING; - } else if (ch == '\'' && chPrev == '=') { - state = SCE_H_SINGLESTRING; - } else { - if (IsNumber(styler.GetStartSegment(), styler)) { - styler.ColourTo(i - 1, SCE_H_NUMBER); - } else { - styler.ColourTo(i - 1, StateToPrint); - } - if (ch == '>') { - styler.ColourTo(i, SCE_H_TAG); - if (inScriptType == eNonHtmlScript) { - state = StateForScript(scriptLanguage); - } else { - state = SCE_H_DEFAULT; - } - tagOpened = false; - if (!tagDontFold) { - if (tagClosing) { - levelCurrent--; - } else { - levelCurrent++; - } - } - tagClosing = false; - } else { - state = SCE_H_OTHER; - } - } - } - break; - case SCE_HJ_DEFAULT: - case SCE_HJ_START: - case SCE_HJ_SYMBOLS: - if (IsAWordStart(ch)) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_WORD; - } else if (ch == '/' && chNext == '*') { - styler.ColourTo(i - 1, StateToPrint); - if (chNext2 == '*') - state = SCE_HJ_COMMENTDOC; - else - state = SCE_HJ_COMMENT; - if (chNext2 == '/') { - // Eat the * so it isn't used for the end of the comment - i++; - } - } else if (ch == '/' && chNext == '/') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_COMMENTLINE; - } else if (ch == '/' && setOKBeforeJSRE.Contains(chPrevNonWhite)) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_REGEX; - } else if (ch == '\"') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_DOUBLESTRING; - } else if (ch == '\'') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_SINGLESTRING; - } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && - styler.SafeGetCharAt(i + 3) == '-') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_COMMENTLINE; - } else if ((ch == '-') && (chNext == '-') && (chNext2 == '>')) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_COMMENTLINE; - i += 2; - } else if (IsOperator(ch)) { - styler.ColourTo(i - 1, StateToPrint); - styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType)); - state = SCE_HJ_DEFAULT; - } else if ((ch == ' ') || (ch == '\t')) { - if (state == SCE_HJ_START) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_DEFAULT; - } - } - break; - case SCE_HJ_WORD: - if (!IsAWordChar(ch)) { - classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, styler, inScriptType); - //styler.ColourTo(i - 1, eHTJSKeyword); - state = SCE_HJ_DEFAULT; - if (ch == '/' && chNext == '*') { - if (chNext2 == '*') - state = SCE_HJ_COMMENTDOC; - else - state = SCE_HJ_COMMENT; - } else if (ch == '/' && chNext == '/') { - state = SCE_HJ_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_HJ_DOUBLESTRING; - } else if (ch == '\'') { - state = SCE_HJ_SINGLESTRING; - } else if ((ch == '-') && (chNext == '-') && (chNext2 == '>')) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_COMMENTLINE; - i += 2; - } else if (IsOperator(ch)) { - styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType)); - state = SCE_HJ_DEFAULT; - } - } - break; - case SCE_HJ_COMMENT: - case SCE_HJ_COMMENTDOC: - if (ch == '/' && chPrev == '*') { - styler.ColourTo(i, StateToPrint); - state = SCE_HJ_DEFAULT; - ch = ' '; - } - break; - case SCE_HJ_COMMENTLINE: - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, statePrintForState(SCE_HJ_COMMENTLINE, inScriptType)); - state = SCE_HJ_DEFAULT; - ch = ' '; - } - break; - case SCE_HJ_DOUBLESTRING: - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - } - } else if (ch == '\"') { - styler.ColourTo(i, statePrintForState(SCE_HJ_DOUBLESTRING, inScriptType)); - state = SCE_HJ_DEFAULT; - } else if ((inScriptType == eNonHtmlScript) && (ch == '-') && (chNext == '-') && (chNext2 == '>')) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_COMMENTLINE; - i += 2; - } else if (isLineEnd(ch)) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_STRINGEOL; - } - break; - case SCE_HJ_SINGLESTRING: - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - } - } else if (ch == '\'') { - styler.ColourTo(i, statePrintForState(SCE_HJ_SINGLESTRING, inScriptType)); - state = SCE_HJ_DEFAULT; - } else if ((inScriptType == eNonHtmlScript) && (ch == '-') && (chNext == '-') && (chNext2 == '>')) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_COMMENTLINE; - i += 2; - } else if (isLineEnd(ch)) { - styler.ColourTo(i - 1, StateToPrint); - if (chPrev != '\\' && (chPrev2 != '\\' || chPrev != '\r' || ch != '\n')) { - state = SCE_HJ_STRINGEOL; - } - } - break; - case SCE_HJ_STRINGEOL: - if (!isLineEnd(ch)) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_DEFAULT; - } else if (!isLineEnd(chNext)) { - styler.ColourTo(i, StateToPrint); - state = SCE_HJ_DEFAULT; - } - break; - case SCE_HJ_REGEX: - if (ch == '\r' || ch == '\n' || ch == '/') { - if (ch == '/') { - while (IsASCII(chNext) && islower(chNext)) { // gobble regex flags - i++; - ch = chNext; - chNext = static_cast(styler.SafeGetCharAt(i + 1)); - } - } - styler.ColourTo(i, StateToPrint); - state = SCE_HJ_DEFAULT; - } else if (ch == '\\') { - // Gobble up the quoted character - if (chNext == '\\' || chNext == '/') { - i++; - ch = chNext; - chNext = static_cast(styler.SafeGetCharAt(i + 1)); - } - } - break; - case SCE_HB_DEFAULT: - case SCE_HB_START: - if (IsAWordStart(ch)) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HB_WORD; - } else if (ch == '\'') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HB_COMMENTLINE; - } else if (ch == '\"') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HB_STRING; - } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && - styler.SafeGetCharAt(i + 3) == '-') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HB_COMMENTLINE; - } else if (IsOperator(ch)) { - styler.ColourTo(i - 1, StateToPrint); - styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType)); - state = SCE_HB_DEFAULT; - } else if ((ch == ' ') || (ch == '\t')) { - if (state == SCE_HB_START) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HB_DEFAULT; - } - } - break; - case SCE_HB_WORD: - if (!IsAWordChar(ch)) { - state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler, inScriptType); - if (state == SCE_HB_DEFAULT) { - if (ch == '\"') { - state = SCE_HB_STRING; - } else if (ch == '\'') { - state = SCE_HB_COMMENTLINE; - } else if (IsOperator(ch)) { - styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType)); - state = SCE_HB_DEFAULT; - } - } - } - break; - case SCE_HB_STRING: - if (ch == '\"') { - styler.ColourTo(i, StateToPrint); - state = SCE_HB_DEFAULT; - } else if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HB_STRINGEOL; - } - break; - case SCE_HB_COMMENTLINE: - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HB_DEFAULT; - } - break; - case SCE_HB_STRINGEOL: - if (!isLineEnd(ch)) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HB_DEFAULT; - } else if (!isLineEnd(chNext)) { - styler.ColourTo(i, StateToPrint); - state = SCE_HB_DEFAULT; - } - break; - case SCE_HP_DEFAULT: - case SCE_HP_START: - if (IsAWordStart(ch)) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HP_WORD; - } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && - styler.SafeGetCharAt(i + 3) == '-') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HP_COMMENTLINE; - } else if (ch == '#') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HP_COMMENTLINE; - } else if (ch == '\"') { - styler.ColourTo(i - 1, StateToPrint); - if (chNext == '\"' && chNext2 == '\"') { - i += 2; - state = SCE_HP_TRIPLEDOUBLE; - ch = ' '; - chPrev = ' '; - chNext = static_cast(styler.SafeGetCharAt(i + 1)); - } else { - // state = statePrintForState(SCE_HP_STRING,inScriptType); - state = SCE_HP_STRING; - } - } else if (ch == '\'') { - styler.ColourTo(i - 1, StateToPrint); - if (chNext == '\'' && chNext2 == '\'') { - i += 2; - state = SCE_HP_TRIPLE; - ch = ' '; - chPrev = ' '; - chNext = static_cast(styler.SafeGetCharAt(i + 1)); - } else { - state = SCE_HP_CHARACTER; - } - } else if (IsOperator(ch)) { - styler.ColourTo(i - 1, StateToPrint); - styler.ColourTo(i, statePrintForState(SCE_HP_OPERATOR, inScriptType)); - } else if ((ch == ' ') || (ch == '\t')) { - if (state == SCE_HP_START) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HP_DEFAULT; - } - } - break; - case SCE_HP_WORD: - if (!IsAWordChar(ch)) { - classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako); - state = SCE_HP_DEFAULT; - if (ch == '#') { - state = SCE_HP_COMMENTLINE; - } else if (ch == '\"') { - if (chNext == '\"' && chNext2 == '\"') { - i += 2; - state = SCE_HP_TRIPLEDOUBLE; - ch = ' '; - chPrev = ' '; - chNext = static_cast(styler.SafeGetCharAt(i + 1)); - } else { - state = SCE_HP_STRING; - } - } else if (ch == '\'') { - if (chNext == '\'' && chNext2 == '\'') { - i += 2; - state = SCE_HP_TRIPLE; - ch = ' '; - chPrev = ' '; - chNext = static_cast(styler.SafeGetCharAt(i + 1)); - } else { - state = SCE_HP_CHARACTER; - } - } else if (IsOperator(ch)) { - styler.ColourTo(i, statePrintForState(SCE_HP_OPERATOR, inScriptType)); - } - } - break; - case SCE_HP_COMMENTLINE: - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HP_DEFAULT; - } - break; - case SCE_HP_STRING: - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = static_cast(styler.SafeGetCharAt(i + 1)); - } - } else if (ch == '\"') { - styler.ColourTo(i, StateToPrint); - state = SCE_HP_DEFAULT; - } - break; - case SCE_HP_CHARACTER: - if (ch == '\\') { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') { - i++; - ch = chNext; - chNext = static_cast(styler.SafeGetCharAt(i + 1)); - } - } else if (ch == '\'') { - styler.ColourTo(i, StateToPrint); - state = SCE_HP_DEFAULT; - } - break; - case SCE_HP_TRIPLE: - if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { - styler.ColourTo(i, StateToPrint); - state = SCE_HP_DEFAULT; - } - break; - case SCE_HP_TRIPLEDOUBLE: - if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { - styler.ColourTo(i, StateToPrint); - state = SCE_HP_DEFAULT; - } - break; - ///////////// start - PHP state handling - case SCE_HPHP_WORD: - if (!IsAWordChar(ch)) { - classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler); - if (ch == '/' && chNext == '*') { - i++; - state = SCE_HPHP_COMMENT; - } else if (ch == '/' && chNext == '/') { - i++; - state = SCE_HPHP_COMMENTLINE; - } else if (ch == '#') { - state = SCE_HPHP_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_HPHP_HSTRING; - StringCopy(phpStringDelimiter, "\""); - } else if (styler.Match(i, "<<<")) { - bool isSimpleString = false; - i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString); - if (strlen(phpStringDelimiter)) { - state = (isSimpleString ? SCE_HPHP_SIMPLESTRING : SCE_HPHP_HSTRING); - if (foldHeredoc) levelCurrent++; - } - } else if (ch == '\'') { - state = SCE_HPHP_SIMPLESTRING; - StringCopy(phpStringDelimiter, "\'"); - } else if (ch == '$' && IsPhpWordStart(chNext)) { - state = SCE_HPHP_VARIABLE; - } else if (IsOperator(ch)) { - state = SCE_HPHP_OPERATOR; - } else { - state = SCE_HPHP_DEFAULT; - } - } - break; - case SCE_HPHP_NUMBER: - // recognize bases 8,10 or 16 integers OR floating-point numbers - if (!IsADigit(ch) - && strchr(".xXabcdefABCDEF", ch) == NULL - && ((ch != '-' && ch != '+') || (chPrev != 'e' && chPrev != 'E'))) { - styler.ColourTo(i - 1, SCE_HPHP_NUMBER); - if (IsOperator(ch)) - state = SCE_HPHP_OPERATOR; - else - state = SCE_HPHP_DEFAULT; - } - break; - case SCE_HPHP_VARIABLE: - if (!IsPhpWordChar(chNext)) { - styler.ColourTo(i, SCE_HPHP_VARIABLE); - state = SCE_HPHP_DEFAULT; - } - break; - case SCE_HPHP_COMMENT: - if (ch == '/' && chPrev == '*') { - styler.ColourTo(i, StateToPrint); - state = SCE_HPHP_DEFAULT; - } - break; - case SCE_HPHP_COMMENTLINE: - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HPHP_DEFAULT; - } - break; - case SCE_HPHP_HSTRING: - if (ch == '\\' && (phpStringDelimiter[0] == '\"' || chNext == '$' || chNext == '{')) { - // skip the next char - i++; - } else if (((ch == '{' && chNext == '$') || (ch == '$' && chNext == '{')) - && IsPhpWordStart(chNext2)) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HPHP_COMPLEX_VARIABLE; - } else if (ch == '$' && IsPhpWordStart(chNext)) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HPHP_HSTRING_VARIABLE; - } else if (styler.Match(i, phpStringDelimiter)) { - if (phpStringDelimiter[0] == '\"') { - styler.ColourTo(i, StateToPrint); - state = SCE_HPHP_DEFAULT; - } else if (isLineEnd(chPrev)) { - const int psdLength = static_cast(strlen(phpStringDelimiter)); - const char chAfterPsd = styler.SafeGetCharAt(i + psdLength); - const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1); - if (isLineEnd(chAfterPsd) || - (chAfterPsd == ';' && isLineEnd(chAfterPsd2))) { - i += (((i + psdLength) < lengthDoc) ? psdLength : lengthDoc) - 1; - styler.ColourTo(i, StateToPrint); - state = SCE_HPHP_DEFAULT; - if (foldHeredoc) levelCurrent--; - } - } - } - break; - case SCE_HPHP_SIMPLESTRING: - if (phpStringDelimiter[0] == '\'') { - if (ch == '\\') { - // skip the next char - i++; - } else if (ch == '\'') { - styler.ColourTo(i, StateToPrint); - state = SCE_HPHP_DEFAULT; - } - } else if (isLineEnd(chPrev) && styler.Match(i, phpStringDelimiter)) { - const int psdLength = static_cast(strlen(phpStringDelimiter)); - const char chAfterPsd = styler.SafeGetCharAt(i + psdLength); - const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1); - if (isLineEnd(chAfterPsd) || - (chAfterPsd == ';' && isLineEnd(chAfterPsd2))) { - i += (((i + psdLength) < lengthDoc) ? psdLength : lengthDoc) - 1; - styler.ColourTo(i, StateToPrint); - state = SCE_HPHP_DEFAULT; - if (foldHeredoc) levelCurrent--; - } - } - break; - case SCE_HPHP_HSTRING_VARIABLE: - if (!IsPhpWordChar(chNext)) { - styler.ColourTo(i, StateToPrint); - state = SCE_HPHP_HSTRING; - } - break; - case SCE_HPHP_COMPLEX_VARIABLE: - if (ch == '}') { - styler.ColourTo(i, StateToPrint); - state = SCE_HPHP_HSTRING; - } - break; - case SCE_HPHP_OPERATOR: - case SCE_HPHP_DEFAULT: - styler.ColourTo(i - 1, StateToPrint); - if (IsADigit(ch) || (ch == '.' && IsADigit(chNext))) { - state = SCE_HPHP_NUMBER; - } else if (IsAWordStart(ch)) { - state = SCE_HPHP_WORD; - } else if (ch == '/' && chNext == '*') { - i++; - state = SCE_HPHP_COMMENT; - } else if (ch == '/' && chNext == '/') { - i++; - state = SCE_HPHP_COMMENTLINE; - } else if (ch == '#') { - state = SCE_HPHP_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_HPHP_HSTRING; - StringCopy(phpStringDelimiter, "\""); - } else if (styler.Match(i, "<<<")) { - bool isSimpleString = false; - i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString); - if (strlen(phpStringDelimiter)) { - state = (isSimpleString ? SCE_HPHP_SIMPLESTRING : SCE_HPHP_HSTRING); - if (foldHeredoc) levelCurrent++; - } - } else if (ch == '\'') { - state = SCE_HPHP_SIMPLESTRING; - StringCopy(phpStringDelimiter, "\'"); - } else if (ch == '$' && IsPhpWordStart(chNext)) { - state = SCE_HPHP_VARIABLE; - } else if (IsOperator(ch)) { - state = SCE_HPHP_OPERATOR; - } else if ((state == SCE_HPHP_OPERATOR) && (IsASpace(ch))) { - state = SCE_HPHP_DEFAULT; - } - break; - ///////////// end - PHP state handling - } - - // Some of the above terminated their lexeme but since the same character starts - // the same class again, only reenter if non empty segment. - - bool nonEmptySegment = i >= static_cast(styler.GetStartSegment()); - if (state == SCE_HB_DEFAULT) { // One of the above succeeded - if ((ch == '\"') && (nonEmptySegment)) { - state = SCE_HB_STRING; - } else if (ch == '\'') { - state = SCE_HB_COMMENTLINE; - } else if (IsAWordStart(ch)) { - state = SCE_HB_WORD; - } else if (IsOperator(ch)) { - styler.ColourTo(i, SCE_HB_DEFAULT); - } - } else if (state == SCE_HBA_DEFAULT) { // One of the above succeeded - if ((ch == '\"') && (nonEmptySegment)) { - state = SCE_HBA_STRING; - } else if (ch == '\'') { - state = SCE_HBA_COMMENTLINE; - } else if (IsAWordStart(ch)) { - state = SCE_HBA_WORD; - } else if (IsOperator(ch)) { - styler.ColourTo(i, SCE_HBA_DEFAULT); - } - } else if (state == SCE_HJ_DEFAULT) { // One of the above succeeded - if (ch == '/' && chNext == '*') { - if (styler.SafeGetCharAt(i + 2) == '*') - state = SCE_HJ_COMMENTDOC; - else - state = SCE_HJ_COMMENT; - } else if (ch == '/' && chNext == '/') { - state = SCE_HJ_COMMENTLINE; - } else if ((ch == '\"') && (nonEmptySegment)) { - state = SCE_HJ_DOUBLESTRING; - } else if ((ch == '\'') && (nonEmptySegment)) { - state = SCE_HJ_SINGLESTRING; - } else if (IsAWordStart(ch)) { - state = SCE_HJ_WORD; - } else if (IsOperator(ch)) { - styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType)); - } - } - } - - switch (state) { - case SCE_HJ_WORD: - classifyWordHTJS(styler.GetStartSegment(), lengthDoc - 1, keywords2, styler, inScriptType); - break; - case SCE_HB_WORD: - classifyWordHTVB(styler.GetStartSegment(), lengthDoc - 1, keywords3, styler, inScriptType); - break; - case SCE_HP_WORD: - classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywords4, styler, prevWord, inScriptType, isMako); - break; - case SCE_HPHP_WORD: - classifyWordHTPHP(styler.GetStartSegment(), lengthDoc - 1, keywords5, styler); - break; - default: - StateToPrint = statePrintForState(state, inScriptType); - if (static_cast(styler.GetStartSegment()) < lengthDoc) - styler.ColourTo(lengthDoc - 1, StateToPrint); - break; - } - - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - if (fold) { - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); - } -} - -static void ColouriseXMLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - // Passing in true because we're lexing XML - ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists, styler, true); -} - -static void ColouriseHTMLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - // Passing in false because we're notlexing XML - ColouriseHyperTextDoc(startPos, length, initStyle, keywordlists, styler, false); -} - -static void ColourisePHPScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - if (startPos == 0) - initStyle = SCE_HPHP_DEFAULT; - ColouriseHTMLDoc(startPos, length, initStyle, keywordlists, styler); -} - -static const char * const htmlWordListDesc[] = { - "HTML elements and attributes", - "JavaScript keywords", - "VBScript keywords", - "Python keywords", - "PHP keywords", - "SGML and DTD keywords", - 0, -}; - -static const char * const phpscriptWordListDesc[] = { - "", //Unused - "", //Unused - "", //Unused - "", //Unused - "PHP keywords", - "", //Unused - 0, -}; - -LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc); -LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc); -LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc); diff --git a/qrenderdoc/3rdparty/scintilla/lexers/LexJSON.cxx b/qrenderdoc/3rdparty/scintilla/lexers/LexJSON.cxx deleted file mode 100644 index 6c060611f..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexers/LexJSON.cxx +++ /dev/null @@ -1,499 +0,0 @@ -// Scintilla source code edit control -/** - * @file LexJSON.cxx - * @date February 19, 2016 - * @brief Lexer for JSON and JSON-LD formats - * @author nkmathew - * - * The License.txt file describes the conditions under which this software may - * be distributed. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "StyleContext.h" -#include "CharacterSet.h" -#include "LexerModule.h" -#include "OptionSet.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static const char *const JSONWordListDesc[] = { - "JSON Keywords", - "JSON-LD Keywords", - 0 -}; - -/** - * Used to detect compact IRI/URLs in JSON-LD without first looking ahead for the - * colon separating the prefix and suffix - * - * https://www.w3.org/TR/json-ld/#dfn-compact-iri - */ -struct CompactIRI { - int colonCount; - bool foundInvalidChar; - CharacterSet setCompactIRI; - CompactIRI() { - colonCount = 0; - foundInvalidChar = false; - setCompactIRI = CharacterSet(CharacterSet::setAlpha, "$_-"); - } - void resetState() { - colonCount = 0; - foundInvalidChar = false; - } - void checkChar(int ch) { - if (ch == ':') { - colonCount++; - } else { - foundInvalidChar |= !setCompactIRI.Contains(ch); - } - } - bool shouldHighlight() const { - return !foundInvalidChar && colonCount == 1; - } -}; - -/** - * Keeps track of escaped characters in strings as per: - * - * https://tools.ietf.org/html/rfc7159#section-7 - */ -struct EscapeSequence { - int digitsLeft; - CharacterSet setHexDigits; - CharacterSet setEscapeChars; - EscapeSequence() { - digitsLeft = 0; - setHexDigits = CharacterSet(CharacterSet::setDigits, "ABCDEFabcdef"); - setEscapeChars = CharacterSet(CharacterSet::setNone, "\\\"tnbfru/"); - } - // Returns true if the following character is a valid escaped character - bool newSequence(int nextChar) { - digitsLeft = 0; - if (nextChar == 'u') { - digitsLeft = 5; - } else if (!setEscapeChars.Contains(nextChar)) { - return false; - } - return true; - } - bool atEscapeEnd() const { - return digitsLeft <= 0; - } - bool isInvalidChar(int currChar) const { - return !setHexDigits.Contains(currChar); - } -}; - -struct OptionsJSON { - bool foldCompact; - bool fold; - bool allowComments; - bool escapeSequence; - OptionsJSON() { - foldCompact = false; - fold = false; - allowComments = false; - escapeSequence = false; - } -}; - -struct OptionSetJSON : public OptionSet { - OptionSetJSON() { - DefineProperty("lexer.json.escape.sequence", &OptionsJSON::escapeSequence, - "Set to 1 to enable highlighting of escape sequences in strings"); - - DefineProperty("lexer.json.allow.comments", &OptionsJSON::allowComments, - "Set to 1 to enable highlighting of line/block comments in JSON"); - - DefineProperty("fold.compact", &OptionsJSON::foldCompact); - DefineProperty("fold", &OptionsJSON::fold); - DefineWordListSets(JSONWordListDesc); - } -}; - -class LexerJSON : public ILexer { - OptionsJSON options; - OptionSetJSON optSetJSON; - EscapeSequence escapeSeq; - WordList keywordsJSON; - WordList keywordsJSONLD; - CharacterSet setOperators; - CharacterSet setURL; - CharacterSet setKeywordJSONLD; - CharacterSet setKeywordJSON; - CompactIRI compactIRI; - - static bool IsNextNonWhitespace(LexAccessor &styler, Sci_Position start, char ch) { - Sci_Position i = 0; - while (i < 50) { - i++; - char curr = styler.SafeGetCharAt(start+i, '\0'); - char next = styler.SafeGetCharAt(start+i+1, '\0'); - bool atEOL = (curr == '\r' && next != '\n') || (curr == '\n'); - if (curr == ch) { - return true; - } else if (!isspacechar(curr) || atEOL) { - return false; - } - } - return false; - } - - /** - * Looks for the colon following the end quote - * - * Assumes property names of lengths no longer than a 100 characters. - * The colon is also expected to be less than 50 spaces after the end - * quote for the string to be considered a property name - */ - static bool AtPropertyName(LexAccessor &styler, Sci_Position start) { - Sci_Position i = 0; - bool escaped = false; - while (i < 100) { - i++; - char curr = styler.SafeGetCharAt(start+i, '\0'); - if (escaped) { - escaped = false; - continue; - } - escaped = curr == '\\'; - if (curr == '"') { - return IsNextNonWhitespace(styler, start+i, ':'); - } else if (!curr) { - return false; - } - } - return false; - } - - static bool IsNextWordInList(WordList &keywordList, CharacterSet wordSet, - StyleContext &context, LexAccessor &styler) { - char word[51]; - Sci_Position currPos = (Sci_Position) context.currentPos; - int i = 0; - while (i < 50) { - char ch = styler.SafeGetCharAt(currPos + i); - if (!wordSet.Contains(ch)) { - break; - } - word[i] = ch; - i++; - } - word[i] = '\0'; - return keywordList.InList(word); - } - - public: - LexerJSON() : - setOperators(CharacterSet::setNone, "[{}]:,"), - setURL(CharacterSet::setAlphaNum, "-._~:/?#[]@!$&'()*+,),="), - setKeywordJSONLD(CharacterSet::setAlpha, ":@"), - setKeywordJSON(CharacterSet::setAlpha, "$_") { - } - virtual ~LexerJSON() {} - virtual int SCI_METHOD Version() const { - return lvOriginal; - } - virtual void SCI_METHOD Release() { - delete this; - } - virtual const char *SCI_METHOD PropertyNames() { - return optSetJSON.PropertyNames(); - } - virtual int SCI_METHOD PropertyType(const char *name) { - return optSetJSON.PropertyType(name); - } - virtual const char *SCI_METHOD DescribeProperty(const char *name) { - return optSetJSON.DescribeProperty(name); - } - virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) { - if (optSetJSON.PropertySet(&options, key, val)) { - return 0; - } - return -1; - } - virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) { - WordList *wordListN = 0; - switch (n) { - case 0: - wordListN = &keywordsJSON; - break; - case 1: - wordListN = &keywordsJSONLD; - break; - } - Sci_Position firstModification = -1; - if (wordListN) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - } - } - return firstModification; - } - virtual void *SCI_METHOD PrivateCall(int, void *) { - return 0; - } - static ILexer *LexerFactoryJSON() { - return new LexerJSON; - } - virtual const char *SCI_METHOD DescribeWordListSets() { - return optSetJSON.DescribeWordListSets(); - } - virtual void SCI_METHOD Lex(Sci_PositionU startPos, - Sci_Position length, - int initStyle, - IDocument *pAccess); - virtual void SCI_METHOD Fold(Sci_PositionU startPos, - Sci_Position length, - int initStyle, - IDocument *pAccess); -}; - -void SCI_METHOD LexerJSON::Lex(Sci_PositionU startPos, - Sci_Position length, - int initStyle, - IDocument *pAccess) { - LexAccessor styler(pAccess); - StyleContext context(startPos, length, initStyle, styler); - int stringStyleBefore = SCE_JSON_STRING; - while (context.More()) { - switch (context.state) { - case SCE_JSON_BLOCKCOMMENT: - if (context.Match("*/")) { - context.Forward(); - context.ForwardSetState(SCE_JSON_DEFAULT); - } - break; - case SCE_JSON_LINECOMMENT: - if (context.atLineEnd) { - context.SetState(SCE_JSON_DEFAULT); - } - break; - case SCE_JSON_STRINGEOL: - if (context.atLineStart) { - context.SetState(SCE_JSON_DEFAULT); - } - break; - case SCE_JSON_ESCAPESEQUENCE: - escapeSeq.digitsLeft--; - if (!escapeSeq.atEscapeEnd()) { - if (escapeSeq.isInvalidChar(context.ch)) { - context.SetState(SCE_JSON_ERROR); - } - break; - } - if (context.ch == '"') { - context.SetState(stringStyleBefore); - context.ForwardSetState(SCE_C_DEFAULT); - } else if (context.ch == '\\') { - if (!escapeSeq.newSequence(context.chNext)) { - context.SetState(SCE_JSON_ERROR); - } - context.Forward(); - } else { - context.SetState(stringStyleBefore); - if (context.atLineEnd) { - context.ChangeState(SCE_JSON_STRINGEOL); - } - } - break; - case SCE_JSON_PROPERTYNAME: - case SCE_JSON_STRING: - if (context.ch == '"') { - if (compactIRI.shouldHighlight()) { - context.ChangeState(SCE_JSON_COMPACTIRI); - context.ForwardSetState(SCE_JSON_DEFAULT); - compactIRI.resetState(); - } else { - context.ForwardSetState(SCE_JSON_DEFAULT); - } - } else if (context.atLineEnd) { - context.ChangeState(SCE_JSON_STRINGEOL); - } else if (context.ch == '\\') { - stringStyleBefore = context.state; - if (options.escapeSequence) { - context.SetState(SCE_JSON_ESCAPESEQUENCE); - if (!escapeSeq.newSequence(context.chNext)) { - context.SetState(SCE_JSON_ERROR); - } - } - context.Forward(); - } else if (context.Match("https://") || - context.Match("http://") || - context.Match("ssh://") || - context.Match("git://") || - context.Match("svn://") || - context.Match("ftp://") || - context.Match("mailto:")) { - // Handle most common URI schemes only - stringStyleBefore = context.state; - context.SetState(SCE_JSON_URI); - } else if (context.ch == '@') { - // https://www.w3.org/TR/json-ld/#dfn-keyword - if (IsNextWordInList(keywordsJSONLD, setKeywordJSONLD, context, styler)) { - stringStyleBefore = context.state; - context.SetState(SCE_JSON_LDKEYWORD); - } - } else { - compactIRI.checkChar(context.ch); - } - break; - case SCE_JSON_LDKEYWORD: - case SCE_JSON_URI: - if ((!setKeywordJSONLD.Contains(context.ch) && - (context.state == SCE_JSON_LDKEYWORD)) || - (!setURL.Contains(context.ch))) { - context.SetState(stringStyleBefore); - } - if (context.ch == '"') { - context.ForwardSetState(SCE_JSON_DEFAULT); - } else if (context.atLineEnd) { - context.ChangeState(SCE_JSON_STRINGEOL); - } - break; - case SCE_JSON_OPERATOR: - case SCE_JSON_NUMBER: - context.SetState(SCE_JSON_DEFAULT); - break; - case SCE_JSON_ERROR: - if (context.atLineEnd) { - context.SetState(SCE_JSON_DEFAULT); - } - break; - case SCE_JSON_KEYWORD: - if (!setKeywordJSON.Contains(context.ch)) { - context.SetState(SCE_JSON_DEFAULT); - } - break; - } - if (context.state == SCE_JSON_DEFAULT) { - if (context.ch == '"') { - compactIRI.resetState(); - context.SetState(SCE_JSON_STRING); - Sci_Position currPos = static_cast(context.currentPos); - if (AtPropertyName(styler, currPos)) { - context.SetState(SCE_JSON_PROPERTYNAME); - } - } else if (setOperators.Contains(context.ch)) { - context.SetState(SCE_JSON_OPERATOR); - } else if (options.allowComments && context.Match("/*")) { - context.SetState(SCE_JSON_BLOCKCOMMENT); - context.Forward(); - } else if (options.allowComments && context.Match("//")) { - context.SetState(SCE_JSON_LINECOMMENT); - } else if (setKeywordJSON.Contains(context.ch)) { - if (IsNextWordInList(keywordsJSON, setKeywordJSON, context, styler)) { - context.SetState(SCE_JSON_KEYWORD); - } - } - bool numberStart = - IsADigit(context.ch) && (context.chPrev == '+'|| - context.chPrev == '-' || - context.atLineStart || - IsASpace(context.chPrev) || - setOperators.Contains(context.chPrev)); - bool exponentPart = - tolower(context.ch) == 'e' && - IsADigit(context.chPrev) && - (IsADigit(context.chNext) || - context.chNext == '+' || - context.chNext == '-'); - bool signPart = - (context.ch == '-' || context.ch == '+') && - ((tolower(context.chPrev) == 'e' && IsADigit(context.chNext)) || - ((IsASpace(context.chPrev) || setOperators.Contains(context.chPrev)) - && IsADigit(context.chNext))); - bool adjacentDigit = - IsADigit(context.ch) && IsADigit(context.chPrev); - bool afterExponent = IsADigit(context.ch) && tolower(context.chPrev) == 'e'; - bool dotPart = context.ch == '.' && - IsADigit(context.chPrev) && - IsADigit(context.chNext); - bool afterDot = IsADigit(context.ch) && context.chPrev == '.'; - if (numberStart || - exponentPart || - signPart || - adjacentDigit || - dotPart || - afterExponent || - afterDot) { - context.SetState(SCE_JSON_NUMBER); - } else if (context.state == SCE_JSON_DEFAULT && !IsASpace(context.ch)) { - context.SetState(SCE_JSON_ERROR); - } - } - context.Forward(); - } - context.Complete(); -} - -void SCI_METHOD LexerJSON::Fold(Sci_PositionU startPos, - Sci_Position length, - int, - IDocument *pAccess) { - if (!options.fold) { - return; - } - LexAccessor styler(pAccess); - Sci_PositionU currLine = styler.GetLine(startPos); - Sci_PositionU endPos = startPos + length; - int currLevel = SC_FOLDLEVELBASE; - if (currLine > 0) - currLevel = styler.LevelAt(currLine - 1) >> 16; - int nextLevel = currLevel; - int visibleChars = 0; - for (Sci_PositionU i = startPos; i < endPos; i++) { - char curr = styler.SafeGetCharAt(i); - char next = styler.SafeGetCharAt(i+1); - bool atEOL = (curr == '\r' && next != '\n') || (curr == '\n'); - if (styler.StyleAt(i) == SCE_JSON_OPERATOR) { - if (curr == '{' || curr == '[') { - nextLevel++; - } else if (curr == '}' || curr == ']') { - nextLevel--; - } - } - if (atEOL || i == (endPos-1)) { - int level = currLevel | nextLevel << 16; - if (!visibleChars && options.foldCompact) { - level |= SC_FOLDLEVELWHITEFLAG; - } else if (nextLevel > currLevel) { - level |= SC_FOLDLEVELHEADERFLAG; - } - if (level != styler.LevelAt(currLine)) { - styler.SetLevel(currLine, level); - } - currLine++; - currLevel = nextLevel; - visibleChars = 0; - } - if (!isspacechar(curr)) { - visibleChars++; - } - } -} - -LexerModule lmJSON(SCLEX_JSON, - LexerJSON::LexerFactoryJSON, - "json", - JSONWordListDesc); diff --git a/qrenderdoc/3rdparty/scintilla/lexers/LexNull.cxx b/qrenderdoc/3rdparty/scintilla/lexers/LexNull.cxx deleted file mode 100644 index 34876775d..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexers/LexNull.cxx +++ /dev/null @@ -1,40 +0,0 @@ -// Scintilla source code edit control -/** @file LexNull.cxx - ** Lexer for no language. Used for plain text and unrecognized files. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "CharacterSet.h" -#include "LexerModule.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static void ColouriseNullDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], - Accessor &styler) { - // Null language means all style bytes are 0 so just mark the end - no need to fill in. - if (length > 0) { - styler.StartAt(startPos + length - 1); - styler.StartSegment(startPos + length - 1); - styler.ColourTo(startPos + length - 1, 0); - } -} - -LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null"); diff --git a/qrenderdoc/3rdparty/scintilla/lexers/LexPython.cxx b/qrenderdoc/3rdparty/scintilla/lexers/LexPython.cxx deleted file mode 100644 index 19dd0ca3b..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexers/LexPython.cxx +++ /dev/null @@ -1,746 +0,0 @@ -// Scintilla source code edit control -/** @file LexPython.cxx - ** Lexer for Python. - **/ -// Copyright 1998-2002 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "CharacterSet.h" -#include "LexerModule.h" -#include "OptionSet.h" -#include "SubStyles.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -namespace { - // Use an unnamed namespace to protect the functions and classes from name conflicts - -/* kwCDef, kwCTypeName only used for Cython */ -enum kwType { kwOther, kwClass, kwDef, kwImport, kwCDef, kwCTypeName, kwCPDef }; - -enum literalsAllowed { litNone = 0, litU = 1, litB = 2 }; - -const int indicatorWhitespace = 1; - -bool IsPyComment(Accessor &styler, Sci_Position pos, Sci_Position len) { - return len > 0 && styler[pos] == '#'; -} - -bool IsPyStringTypeChar(int ch, literalsAllowed allowed) { - return - ((allowed & litB) && (ch == 'b' || ch == 'B')) || - ((allowed & litU) && (ch == 'u' || ch == 'U')); -} - -bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed allowed) { - if (ch == '\'' || ch == '"') - return true; - if (IsPyStringTypeChar(ch, allowed)) { - if (chNext == '"' || chNext == '\'') - return true; - if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\'')) - return true; - } - if ((ch == 'r' || ch == 'R') && (chNext == '"' || chNext == '\'')) - return true; - - return false; -} - -/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */ -int GetPyStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex, literalsAllowed allowed) { - char ch = styler.SafeGetCharAt(i); - char chNext = styler.SafeGetCharAt(i + 1); - - // Advance beyond r, u, or ur prefix (or r, b, or br in Python 3.0), but bail if there are any unexpected chars - if (ch == 'r' || ch == 'R') { - i++; - ch = styler.SafeGetCharAt(i); - chNext = styler.SafeGetCharAt(i + 1); - } else if (IsPyStringTypeChar(ch, allowed)) { - if (chNext == 'r' || chNext == 'R') - i += 2; - else - i += 1; - ch = styler.SafeGetCharAt(i); - chNext = styler.SafeGetCharAt(i + 1); - } - - if (ch != '"' && ch != '\'') { - *nextIndex = i + 1; - return SCE_P_DEFAULT; - } - - if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) { - *nextIndex = i + 3; - - if (ch == '"') - return SCE_P_TRIPLEDOUBLE; - else - return SCE_P_TRIPLE; - } else { - *nextIndex = i + 1; - - if (ch == '"') - return SCE_P_STRING; - else - return SCE_P_CHARACTER; - } -} - -inline bool IsAWordChar(int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); -} - -inline bool IsAWordStart(int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_'); -} - -static bool IsFirstNonWhitespace(Sci_Position pos, Accessor &styler) { - Sci_Position line = styler.GetLine(pos); - Sci_Position start_pos = styler.LineStart(line); - for (Sci_Position i = start_pos; i < pos; i++) { - char ch = styler[i]; - if (!(ch == ' ' || ch == '\t')) - return false; - } - return true; -} - -// Options used for LexerPython -struct OptionsPython { - int whingeLevel; - bool base2or8Literals; - bool stringsU; - bool stringsB; - bool stringsOverNewline; - bool keywords2NoSubIdentifiers; - bool fold; - bool foldQuotes; - bool foldCompact; - - OptionsPython() { - whingeLevel = 0; - base2or8Literals = true; - stringsU = true; - stringsB = true; - stringsOverNewline = false; - keywords2NoSubIdentifiers = false; - fold = false; - foldQuotes = false; - foldCompact = false; - } - - literalsAllowed AllowedLiterals() const { - literalsAllowed allowedLiterals = stringsU ? litU : litNone; - if (stringsB) - allowedLiterals = static_cast(allowedLiterals | litB); - return allowedLiterals; - } -}; - -static const char *const pythonWordListDesc[] = { - "Keywords", - "Highlighted identifiers", - 0 -}; - -struct OptionSetPython : public OptionSet { - OptionSetPython() { - DefineProperty("tab.timmy.whinge.level", &OptionsPython::whingeLevel, - "For Python code, checks whether indenting is consistent. " - "The default, 0 turns off indentation checking, " - "1 checks whether each line is potentially inconsistent with the previous line, " - "2 checks whether any space characters occur before a tab character in the indentation, " - "3 checks whether any spaces are in the indentation, and " - "4 checks for any tab characters in the indentation. " - "1 is a good level to use."); - - DefineProperty("lexer.python.literals.binary", &OptionsPython::base2or8Literals, - "Set to 0 to not recognise Python 3 binary and octal literals: 0b1011 0o712."); - - DefineProperty("lexer.python.strings.u", &OptionsPython::stringsU, - "Set to 0 to not recognise Python Unicode literals u\"x\" as used before Python 3."); - - DefineProperty("lexer.python.strings.b", &OptionsPython::stringsB, - "Set to 0 to not recognise Python 3 bytes literals b\"x\"."); - - DefineProperty("lexer.python.strings.over.newline", &OptionsPython::stringsOverNewline, - "Set to 1 to allow strings to span newline characters."); - - DefineProperty("lexer.python.keywords2.no.sub.identifiers", &OptionsPython::keywords2NoSubIdentifiers, - "When enabled, it will not style keywords2 items that are used as a sub-identifier. " - "Example: when set, will not highlight \"foo.open\" when \"open\" is a keywords2 item."); - - DefineProperty("fold", &OptionsPython::fold); - - DefineProperty("fold.quotes.python", &OptionsPython::foldQuotes, - "This option enables folding multi-line quoted strings when using the Python lexer."); - - DefineProperty("fold.compact", &OptionsPython::foldCompact); - - DefineWordListSets(pythonWordListDesc); - } -}; - -const char styleSubable[] = { SCE_P_IDENTIFIER, 0 }; - -} - -class LexerPython : public ILexerWithSubStyles { - WordList keywords; - WordList keywords2; - OptionsPython options; - OptionSetPython osPython; - enum { ssIdentifier }; - SubStyles subStyles; -public: - explicit LexerPython() : - subStyles(styleSubable, 0x80, 0x40, 0) { - } - virtual ~LexerPython() { - } - void SCI_METHOD Release() { - delete this; - } - int SCI_METHOD Version() const { - return lvSubStyles; - } - const char * SCI_METHOD PropertyNames() { - return osPython.PropertyNames(); - } - int SCI_METHOD PropertyType(const char *name) { - return osPython.PropertyType(name); - } - const char * SCI_METHOD DescribeProperty(const char *name) { - return osPython.DescribeProperty(name); - } - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); - const char * SCI_METHOD DescribeWordListSets() { - return osPython.DescribeWordListSets(); - } - Sci_Position SCI_METHOD WordListSet(int n, const char *wl); - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); - - void * SCI_METHOD PrivateCall(int, void *) { - return 0; - } - - int SCI_METHOD LineEndTypesSupported() { - return SC_LINE_END_TYPE_UNICODE; - } - - int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) { - return subStyles.Allocate(styleBase, numberStyles); - } - int SCI_METHOD SubStylesStart(int styleBase) { - return subStyles.Start(styleBase); - } - int SCI_METHOD SubStylesLength(int styleBase) { - return subStyles.Length(styleBase); - } - int SCI_METHOD StyleFromSubStyle(int subStyle) { - int styleBase = subStyles.BaseStyle(subStyle); - return styleBase; - } - int SCI_METHOD PrimaryStyleFromStyle(int style) { - return style; - } - void SCI_METHOD FreeSubStyles() { - subStyles.Free(); - } - void SCI_METHOD SetIdentifiers(int style, const char *identifiers) { - subStyles.SetIdentifiers(style, identifiers); - } - int SCI_METHOD DistanceToSecondaryStyles() { - return 0; - } - const char * SCI_METHOD GetSubStyleBases() { - return styleSubable; - } - - static ILexer *LexerFactoryPython() { - return new LexerPython(); - } -}; - -Sci_Position SCI_METHOD LexerPython::PropertySet(const char *key, const char *val) { - if (osPython.PropertySet(&options, key, val)) { - return 0; - } - return -1; -} - -Sci_Position SCI_METHOD LexerPython::WordListSet(int n, const char *wl) { - WordList *wordListN = 0; - switch (n) { - case 0: - wordListN = &keywords; - break; - case 1: - wordListN = &keywords2; - break; - } - Sci_Position firstModification = -1; - if (wordListN) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - } - } - return firstModification; -} - -void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - Accessor styler(pAccess, NULL); - - const Sci_Position endPos = startPos + length; - - // Backtrack to previous line in case need to fix its tab whinging - Sci_Position lineCurrent = styler.GetLine(startPos); - if (startPos > 0) { - if (lineCurrent > 0) { - lineCurrent--; - // Look for backslash-continued lines - while (lineCurrent > 0) { - Sci_Position eolPos = styler.LineStart(lineCurrent) - 1; - int eolStyle = styler.StyleAt(eolPos); - if (eolStyle == SCE_P_STRING - || eolStyle == SCE_P_CHARACTER - || eolStyle == SCE_P_STRINGEOL) { - lineCurrent -= 1; - } else { - break; - } - } - startPos = styler.LineStart(lineCurrent); - } - initStyle = startPos == 0 ? SCE_P_DEFAULT : styler.StyleAt(startPos - 1); - } - - const literalsAllowed allowedLiterals = options.AllowedLiterals(); - - initStyle = initStyle & 31; - if (initStyle == SCE_P_STRINGEOL) { - initStyle = SCE_P_DEFAULT; - } - - kwType kwLast = kwOther; - int spaceFlags = 0; - styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment); - bool base_n_number = false; - - const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_P_IDENTIFIER); - - StyleContext sc(startPos, endPos - startPos, initStyle, styler); - - bool indentGood = true; - Sci_Position startIndicator = sc.currentPos; - bool inContinuedString = false; - - for (; sc.More(); sc.Forward()) { - - if (sc.atLineStart) { - styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment); - indentGood = true; - if (options.whingeLevel == 1) { - indentGood = (spaceFlags & wsInconsistent) == 0; - } else if (options.whingeLevel == 2) { - indentGood = (spaceFlags & wsSpaceTab) == 0; - } else if (options.whingeLevel == 3) { - indentGood = (spaceFlags & wsSpace) == 0; - } else if (options.whingeLevel == 4) { - indentGood = (spaceFlags & wsTab) == 0; - } - if (!indentGood) { - styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 0); - startIndicator = sc.currentPos; - } - } - - if (sc.atLineEnd) { - if ((sc.state == SCE_P_DEFAULT) || - (sc.state == SCE_P_TRIPLE) || - (sc.state == SCE_P_TRIPLEDOUBLE)) { - // Perform colourisation of white space and triple quoted strings at end of each line to allow - // tab marking to work inside white space and triple quoted strings - sc.SetState(sc.state); - } - lineCurrent++; - if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) { - if (inContinuedString || options.stringsOverNewline) { - inContinuedString = false; - } else { - sc.ChangeState(SCE_P_STRINGEOL); - sc.ForwardSetState(SCE_P_DEFAULT); - } - } - if (!sc.More()) - break; - } - - bool needEOLCheck = false; - - // Check for a state end - if (sc.state == SCE_P_OPERATOR) { - kwLast = kwOther; - sc.SetState(SCE_P_DEFAULT); - } else if (sc.state == SCE_P_NUMBER) { - if (!IsAWordChar(sc.ch) && - !(!base_n_number && ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) { - sc.SetState(SCE_P_DEFAULT); - } - } else if (sc.state == SCE_P_IDENTIFIER) { - if ((sc.ch == '.') || (!IsAWordChar(sc.ch))) { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - int style = SCE_P_IDENTIFIER; - if ((kwLast == kwImport) && (strcmp(s, "as") == 0)) { - style = SCE_P_WORD; - } else if (keywords.InList(s)) { - style = SCE_P_WORD; - } else if (kwLast == kwClass) { - style = SCE_P_CLASSNAME; - } else if (kwLast == kwDef) { - style = SCE_P_DEFNAME; - } else if (kwLast == kwCDef || kwLast == kwCPDef) { - Sci_Position pos = sc.currentPos; - unsigned char ch = styler.SafeGetCharAt(pos, '\0'); - while (ch != '\0') { - if (ch == '(') { - style = SCE_P_DEFNAME; - break; - } else if (ch == ':') { - style = SCE_P_CLASSNAME; - break; - } else if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') { - pos++; - ch = styler.SafeGetCharAt(pos, '\0'); - } else { - break; - } - } - } else if (keywords2.InList(s)) { - if (options.keywords2NoSubIdentifiers) { - // We don't want to highlight keywords2 - // that are used as a sub-identifier, - // i.e. not open in "foo.open". - Sci_Position pos = styler.GetStartSegment() - 1; - if (pos < 0 || (styler.SafeGetCharAt(pos, '\0') != '.')) - style = SCE_P_WORD2; - } else { - style = SCE_P_WORD2; - } - } else { - int subStyle = classifierIdentifiers.ValueFor(s); - if (subStyle >= 0) { - style = subStyle; - } - } - sc.ChangeState(style); - sc.SetState(SCE_P_DEFAULT); - if (style == SCE_P_WORD) { - if (0 == strcmp(s, "class")) - kwLast = kwClass; - else if (0 == strcmp(s, "def")) - kwLast = kwDef; - else if (0 == strcmp(s, "import")) - kwLast = kwImport; - else if (0 == strcmp(s, "cdef")) - kwLast = kwCDef; - else if (0 == strcmp(s, "cpdef")) - kwLast = kwCPDef; - else if (0 == strcmp(s, "cimport")) - kwLast = kwImport; - else if (kwLast != kwCDef && kwLast != kwCPDef) - kwLast = kwOther; - } else if (kwLast != kwCDef && kwLast != kwCPDef) { - kwLast = kwOther; - } - } - } else if ((sc.state == SCE_P_COMMENTLINE) || (sc.state == SCE_P_COMMENTBLOCK)) { - if (sc.ch == '\r' || sc.ch == '\n') { - sc.SetState(SCE_P_DEFAULT); - } - } else if (sc.state == SCE_P_DECORATOR) { - if (!IsAWordChar(sc.ch)) { - sc.SetState(SCE_P_DEFAULT); - } - } else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) { - if (sc.ch == '\\') { - if ((sc.chNext == '\r') && (sc.GetRelative(2) == '\n')) { - sc.Forward(); - } - if (sc.chNext == '\n' || sc.chNext == '\r') { - inContinuedString = true; - } else { - // Don't roll over the newline. - sc.Forward(); - } - } else if ((sc.state == SCE_P_STRING) && (sc.ch == '\"')) { - sc.ForwardSetState(SCE_P_DEFAULT); - needEOLCheck = true; - } else if ((sc.state == SCE_P_CHARACTER) && (sc.ch == '\'')) { - sc.ForwardSetState(SCE_P_DEFAULT); - needEOLCheck = true; - } - } else if (sc.state == SCE_P_TRIPLE) { - if (sc.ch == '\\') { - sc.Forward(); - } else if (sc.Match("\'\'\'")) { - sc.Forward(); - sc.Forward(); - sc.ForwardSetState(SCE_P_DEFAULT); - needEOLCheck = true; - } - } else if (sc.state == SCE_P_TRIPLEDOUBLE) { - if (sc.ch == '\\') { - sc.Forward(); - } else if (sc.Match("\"\"\"")) { - sc.Forward(); - sc.Forward(); - sc.ForwardSetState(SCE_P_DEFAULT); - needEOLCheck = true; - } - } - - if (!indentGood && !IsASpaceOrTab(sc.ch)) { - styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 1); - startIndicator = sc.currentPos; - indentGood = true; - } - - // One cdef or cpdef line, clear kwLast only at end of line - if ((kwLast == kwCDef || kwLast == kwCPDef) && sc.atLineEnd) { - kwLast = kwOther; - } - - // State exit code may have moved on to end of line - if (needEOLCheck && sc.atLineEnd) { - lineCurrent++; - styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment); - if (!sc.More()) - break; - } - - // Check for a new state starting character - if (sc.state == SCE_P_DEFAULT) { - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - if (sc.ch == '0' && (sc.chNext == 'x' || sc.chNext == 'X')) { - base_n_number = true; - sc.SetState(SCE_P_NUMBER); - } else if (sc.ch == '0' && - (sc.chNext == 'o' || sc.chNext == 'O' || sc.chNext == 'b' || sc.chNext == 'B')) { - if (options.base2or8Literals) { - base_n_number = true; - sc.SetState(SCE_P_NUMBER); - } else { - sc.SetState(SCE_P_NUMBER); - sc.ForwardSetState(SCE_P_IDENTIFIER); - } - } else { - base_n_number = false; - sc.SetState(SCE_P_NUMBER); - } - } else if ((IsASCII(sc.ch) && isoperator(static_cast(sc.ch))) || sc.ch == '`') { - sc.SetState(SCE_P_OPERATOR); - } else if (sc.ch == '#') { - sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE); - } else if (sc.ch == '@') { - if (IsFirstNonWhitespace(sc.currentPos, styler)) - sc.SetState(SCE_P_DECORATOR); - else - sc.SetState(SCE_P_OPERATOR); - } else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2), allowedLiterals)) { - Sci_PositionU nextIndex = 0; - sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex, allowedLiterals)); - while (nextIndex > (sc.currentPos + 1) && sc.More()) { - sc.Forward(); - } - } else if (IsAWordStart(sc.ch)) { - sc.SetState(SCE_P_IDENTIFIER); - } - } - } - styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 0); - sc.Complete(); -} - -static bool IsCommentLine(Sci_Position line, Accessor &styler) { - Sci_Position pos = styler.LineStart(line); - Sci_Position eol_pos = styler.LineStart(line + 1) - 1; - for (Sci_Position i = pos; i < eol_pos; i++) { - char ch = styler[i]; - if (ch == '#') - return true; - else if (ch != ' ' && ch != '\t') - return false; - } - return false; -} - -static bool IsQuoteLine(Sci_Position line, Accessor &styler) { - int style = styler.StyleAt(styler.LineStart(line)) & 31; - return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE)); -} - - -void SCI_METHOD LexerPython::Fold(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/, IDocument *pAccess) { - if (!options.fold) - return; - - Accessor styler(pAccess, NULL); - - const Sci_Position maxPos = startPos + length; - const Sci_Position maxLines = (maxPos == styler.Length()) ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line - const Sci_Position docLines = styler.GetLine(styler.Length()); // Available last line - - // Backtrack to previous non-blank line so we can determine indent level - // for any white space lines (needed esp. within triple quoted strings) - // and so we can fix any preceding fold level (which is why we go back - // at least one line in all cases) - int spaceFlags = 0; - Sci_Position lineCurrent = styler.GetLine(startPos); - int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); - while (lineCurrent > 0) { - lineCurrent--; - indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); - if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG) && - (!IsCommentLine(lineCurrent, styler)) && - (!IsQuoteLine(lineCurrent, styler))) - break; - } - int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; - - // Set up initial loop state - startPos = styler.LineStart(lineCurrent); - int prev_state = SCE_P_DEFAULT & 31; - if (lineCurrent >= 1) - prev_state = styler.StyleAt(startPos - 1) & 31; - int prevQuote = options.foldQuotes && ((prev_state == SCE_P_TRIPLE) || (prev_state == SCE_P_TRIPLEDOUBLE)); - - // Process all characters to end of requested range or end of any triple quote - //that hangs over the end of the range. Cap processing in all cases - // to end of document (in case of unclosed quote at end). - while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) || prevQuote)) { - - // Gather info - int lev = indentCurrent; - Sci_Position lineNext = lineCurrent + 1; - int indentNext = indentCurrent; - int quote = false; - if (lineNext <= docLines) { - // Information about next line is only available if not at end of document - indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL); - Sci_Position lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext); - int style = styler.StyleAt(lookAtPos) & 31; - quote = options.foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE)); - } - const int quote_start = (quote && !prevQuote); - const int quote_continue = (quote && prevQuote); - if (!quote || !prevQuote) - indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; - if (quote) - indentNext = indentCurrentLevel; - if (indentNext & SC_FOLDLEVELWHITEFLAG) - indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel; - - if (quote_start) { - // Place fold point at start of triple quoted string - lev |= SC_FOLDLEVELHEADERFLAG; - } else if (quote_continue || prevQuote) { - // Add level to rest of lines in the string - lev = lev + 1; - } - - // Skip past any blank lines for next indent level info; we skip also - // comments (all comments, not just those starting in column 0) - // which effectively folds them into surrounding code rather - // than screwing up folding. - - while (!quote && - (lineNext < docLines) && - ((indentNext & SC_FOLDLEVELWHITEFLAG) || - (lineNext <= docLines && IsCommentLine(lineNext, styler)))) { - - lineNext++; - indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL); - } - - const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK; - const int levelBeforeComments = Maximum(indentCurrentLevel,levelAfterComments); - - // Now set all the indent levels on the lines we skipped - // Do this from end to start. Once we encounter one line - // which is indented more than the line after the end of - // the comment-block, use the level of the block before - - Sci_Position skipLine = lineNext; - int skipLevel = levelAfterComments; - - while (--skipLine > lineCurrent) { - int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL); - - if (options.foldCompact) { - if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments) - skipLevel = levelBeforeComments; - - int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; - - styler.SetLevel(skipLine, skipLevel | whiteFlag); - } else { - if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments && - !(skipLineIndent & SC_FOLDLEVELWHITEFLAG) && - !IsCommentLine(skipLine, styler)) - skipLevel = levelBeforeComments; - - styler.SetLevel(skipLine, skipLevel); - } - } - - // Set fold header on non-quote line - if (!quote && !(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) - lev |= SC_FOLDLEVELHEADERFLAG; - } - - // Keep track of triple quote state of previous line - prevQuote = quote; - - // Set fold level for this line and move to next line - styler.SetLevel(lineCurrent, options.foldCompact ? lev : lev & ~SC_FOLDLEVELWHITEFLAG); - indentCurrent = indentNext; - lineCurrent = lineNext; - } - - // NOTE: Cannot set level of last line here because indentCurrent doesn't have - // header flag set; the loop above is crafted to take care of this case! - //styler.SetLevel(lineCurrent, indentCurrent); -} - -LexerModule lmPython(SCLEX_PYTHON, LexerPython::LexerFactoryPython, "python", - pythonWordListDesc); diff --git a/qrenderdoc/3rdparty/scintilla/lexers/LexRust.cxx b/qrenderdoc/3rdparty/scintilla/lexers/LexRust.cxx deleted file mode 100644 index a834e32f4..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexers/LexRust.cxx +++ /dev/null @@ -1,838 +0,0 @@ -/** @file LexRust.cxx - ** Lexer for Rust. - ** - ** Copyright (c) 2013 by SiegeLord - ** Converted to lexer object and added further folding features/properties by "Udo Lechner" - **/ -// Copyright 1998-2005 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "CharacterSet.h" -#include "LexerModule.h" -#include "OptionSet.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static const int NUM_RUST_KEYWORD_LISTS = 7; -static const int MAX_RUST_IDENT_CHARS = 1023; - -static bool IsStreamCommentStyle(int style) { - return style == SCE_RUST_COMMENTBLOCK || - style == SCE_RUST_COMMENTBLOCKDOC; -} - -// Options used for LexerRust -struct OptionsRust { - bool fold; - bool foldSyntaxBased; - bool foldComment; - bool foldCommentMultiline; - bool foldCommentExplicit; - std::string foldExplicitStart; - std::string foldExplicitEnd; - bool foldExplicitAnywhere; - bool foldCompact; - int foldAtElseInt; - bool foldAtElse; - OptionsRust() { - fold = false; - foldSyntaxBased = true; - foldComment = false; - foldCommentMultiline = true; - foldCommentExplicit = true; - foldExplicitStart = ""; - foldExplicitEnd = ""; - foldExplicitAnywhere = false; - foldCompact = true; - foldAtElseInt = -1; - foldAtElse = false; - } -}; - -static const char * const rustWordLists[NUM_RUST_KEYWORD_LISTS + 1] = { - "Primary keywords and identifiers", - "Built in types", - "Other keywords", - "Keywords 4", - "Keywords 5", - "Keywords 6", - "Keywords 7", - 0, - }; - -struct OptionSetRust : public OptionSet { - OptionSetRust() { - DefineProperty("fold", &OptionsRust::fold); - - DefineProperty("fold.comment", &OptionsRust::foldComment); - - DefineProperty("fold.compact", &OptionsRust::foldCompact); - - DefineProperty("fold.at.else", &OptionsRust::foldAtElse); - - DefineProperty("fold.rust.syntax.based", &OptionsRust::foldSyntaxBased, - "Set this property to 0 to disable syntax based folding."); - - DefineProperty("fold.rust.comment.multiline", &OptionsRust::foldCommentMultiline, - "Set this property to 0 to disable folding multi-line comments when fold.comment=1."); - - DefineProperty("fold.rust.comment.explicit", &OptionsRust::foldCommentExplicit, - "Set this property to 0 to disable folding explicit fold points when fold.comment=1."); - - DefineProperty("fold.rust.explicit.start", &OptionsRust::foldExplicitStart, - "The string to use for explicit fold start points, replacing the standard //{."); - - DefineProperty("fold.rust.explicit.end", &OptionsRust::foldExplicitEnd, - "The string to use for explicit fold end points, replacing the standard //}."); - - DefineProperty("fold.rust.explicit.anywhere", &OptionsRust::foldExplicitAnywhere, - "Set this property to 1 to enable explicit fold points anywhere, not just in line comments."); - - DefineProperty("lexer.rust.fold.at.else", &OptionsRust::foldAtElseInt, - "This option enables Rust folding on a \"} else {\" line of an if statement."); - - DefineWordListSets(rustWordLists); - } -}; - -class LexerRust : public ILexer { - WordList keywords[NUM_RUST_KEYWORD_LISTS]; - OptionsRust options; - OptionSetRust osRust; -public: - virtual ~LexerRust() { - } - void SCI_METHOD Release() { - delete this; - } - int SCI_METHOD Version() const { - return lvOriginal; - } - const char * SCI_METHOD PropertyNames() { - return osRust.PropertyNames(); - } - int SCI_METHOD PropertyType(const char *name) { - return osRust.PropertyType(name); - } - const char * SCI_METHOD DescribeProperty(const char *name) { - return osRust.DescribeProperty(name); - } - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); - const char * SCI_METHOD DescribeWordListSets() { - return osRust.DescribeWordListSets(); - } - Sci_Position SCI_METHOD WordListSet(int n, const char *wl); - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess); - void * SCI_METHOD PrivateCall(int, void *) { - return 0; - } - static ILexer *LexerFactoryRust() { - return new LexerRust(); - } -}; - -Sci_Position SCI_METHOD LexerRust::PropertySet(const char *key, const char *val) { - if (osRust.PropertySet(&options, key, val)) { - return 0; - } - return -1; -} - -Sci_Position SCI_METHOD LexerRust::WordListSet(int n, const char *wl) { - Sci_Position firstModification = -1; - if (n < NUM_RUST_KEYWORD_LISTS) { - WordList *wordListN = &keywords[n]; - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - } - } - return firstModification; -} - -static bool IsWhitespace(int c) { - return c == ' ' || c == '\t' || c == '\r' || c == '\n'; -} - -/* This isn't quite right for Unicode identifiers */ -static bool IsIdentifierStart(int ch) { - return (IsASCII(ch) && (isalpha(ch) || ch == '_')) || !IsASCII(ch); -} - -/* This isn't quite right for Unicode identifiers */ -static bool IsIdentifierContinue(int ch) { - return (IsASCII(ch) && (isalnum(ch) || ch == '_')) || !IsASCII(ch); -} - -static void ScanWhitespace(Accessor& styler, Sci_Position& pos, Sci_Position max) { - while (IsWhitespace(styler.SafeGetCharAt(pos, '\0')) && pos < max) { - if (pos == styler.LineEnd(styler.GetLine(pos))) - styler.SetLineState(styler.GetLine(pos), 0); - pos++; - } - styler.ColourTo(pos-1, SCE_RUST_DEFAULT); -} - -static void GrabString(char* s, Accessor& styler, Sci_Position start, Sci_Position len) { - for (Sci_Position ii = 0; ii < len; ii++) - s[ii] = styler[ii + start]; - s[len] = '\0'; -} - -static void ScanIdentifier(Accessor& styler, Sci_Position& pos, WordList *keywords) { - Sci_Position start = pos; - while (IsIdentifierContinue(styler.SafeGetCharAt(pos, '\0'))) - pos++; - - if (styler.SafeGetCharAt(pos, '\0') == '!') { - pos++; - styler.ColourTo(pos - 1, SCE_RUST_MACRO); - } else { - char s[MAX_RUST_IDENT_CHARS + 1]; - int len = pos - start; - len = len > MAX_RUST_IDENT_CHARS ? MAX_RUST_IDENT_CHARS : len; - GrabString(s, styler, start, len); - bool keyword = false; - for (int ii = 0; ii < NUM_RUST_KEYWORD_LISTS; ii++) { - if (keywords[ii].InList(s)) { - styler.ColourTo(pos - 1, SCE_RUST_WORD + ii); - keyword = true; - break; - } - } - if (!keyword) { - styler.ColourTo(pos - 1, SCE_RUST_IDENTIFIER); - } - } -} - -/* Scans a sequence of digits, returning true if it found any. */ -static bool ScanDigits(Accessor& styler, Sci_Position& pos, int base) { - Sci_Position old_pos = pos; - for (;;) { - int c = styler.SafeGetCharAt(pos, '\0'); - if (IsADigit(c, base) || c == '_') - pos++; - else - break; - } - return old_pos != pos; -} - -/* Scans an integer and floating point literals. */ -static void ScanNumber(Accessor& styler, Sci_Position& pos) { - int base = 10; - int c = styler.SafeGetCharAt(pos, '\0'); - int n = styler.SafeGetCharAt(pos + 1, '\0'); - bool error = false; - /* Scan the prefix, thus determining the base. - * 10 is default if there's no prefix. */ - if (c == '0' && n == 'x') { - pos += 2; - base = 16; - } else if (c == '0' && n == 'b') { - pos += 2; - base = 2; - } else if (c == '0' && n == 'o') { - pos += 2; - base = 8; - } - - /* Scan initial digits. The literal is malformed if there are none. */ - error |= !ScanDigits(styler, pos, base); - /* See if there's an integer suffix. We mimic the Rust's lexer - * and munch it even if there was an error above. */ - c = styler.SafeGetCharAt(pos, '\0'); - if (c == 'u' || c == 'i') { - pos++; - c = styler.SafeGetCharAt(pos, '\0'); - n = styler.SafeGetCharAt(pos + 1, '\0'); - if (c == '8' || c == 's') { - pos++; - } else if (c == '1' && n == '6') { - pos += 2; - } else if (c == '3' && n == '2') { - pos += 2; - } else if (c == '6' && n == '4') { - pos += 2; - } else { - error = true; - } - /* See if it's a floating point literal. These literals have to be base 10. - */ - } else if (!error) { - /* If there's a period, it's a floating point literal unless it's - * followed by an identifier (meaning this is a method call, e.g. - * `1.foo()`) or another period, in which case it's a range (e.g. 1..2) - */ - n = styler.SafeGetCharAt(pos + 1, '\0'); - if (c == '.' && !(IsIdentifierStart(n) || n == '.')) { - error |= base != 10; - pos++; - /* It's ok to have no digits after the period. */ - ScanDigits(styler, pos, 10); - } - - /* Look for the exponentiation. */ - c = styler.SafeGetCharAt(pos, '\0'); - if (c == 'e' || c == 'E') { - error |= base != 10; - pos++; - c = styler.SafeGetCharAt(pos, '\0'); - if (c == '-' || c == '+') - pos++; - /* It is invalid to have no digits in the exponent. */ - error |= !ScanDigits(styler, pos, 10); - } - - /* Scan the floating point suffix. */ - c = styler.SafeGetCharAt(pos, '\0'); - if (c == 'f') { - error |= base != 10; - pos++; - c = styler.SafeGetCharAt(pos, '\0'); - n = styler.SafeGetCharAt(pos + 1, '\0'); - if (c == '3' && n == '2') { - pos += 2; - } else if (c == '6' && n == '4') { - pos += 2; - } else { - error = true; - } - } - } - - if (error) - styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); - else - styler.ColourTo(pos - 1, SCE_RUST_NUMBER); -} - -static bool IsOneCharOperator(int c) { - return c == ';' || c == ',' || c == '(' || c == ')' - || c == '{' || c == '}' || c == '[' || c == ']' - || c == '@' || c == '#' || c == '~' || c == '+' - || c == '*' || c == '/' || c == '^' || c == '%' - || c == '.' || c == ':' || c == '!' || c == '<' - || c == '>' || c == '=' || c == '-' || c == '&' - || c == '|' || c == '$' || c == '?'; -} - -static bool IsTwoCharOperator(int c, int n) { - return (c == '.' && n == '.') || (c == ':' && n == ':') - || (c == '!' && n == '=') || (c == '<' && n == '<') - || (c == '<' && n == '=') || (c == '>' && n == '>') - || (c == '>' && n == '=') || (c == '=' && n == '=') - || (c == '=' && n == '>') || (c == '-' && n == '>') - || (c == '&' && n == '&') || (c == '|' && n == '|') - || (c == '-' && n == '=') || (c == '&' && n == '=') - || (c == '|' && n == '=') || (c == '+' && n == '=') - || (c == '*' && n == '=') || (c == '/' && n == '=') - || (c == '^' && n == '=') || (c == '%' && n == '='); -} - -static bool IsThreeCharOperator(int c, int n, int n2) { - return (c == '<' && n == '<' && n2 == '=') - || (c == '>' && n == '>' && n2 == '='); -} - -static bool IsValidCharacterEscape(int c) { - return c == 'n' || c == 'r' || c == 't' || c == '\\' - || c == '\'' || c == '"' || c == '0'; -} - -static bool IsValidStringEscape(int c) { - return IsValidCharacterEscape(c) || c == '\n' || c == '\r'; -} - -static bool ScanNumericEscape(Accessor &styler, Sci_Position& pos, Sci_Position num_digits, bool stop_asap) { - for (;;) { - int c = styler.SafeGetCharAt(pos, '\0'); - if (!IsADigit(c, 16)) - break; - num_digits--; - pos++; - if (num_digits == 0 && stop_asap) - return true; - } - if (num_digits == 0) { - return true; - } else { - return false; - } -} - -/* This is overly permissive for character literals in order to accept UTF-8 encoded - * character literals. */ -static void ScanCharacterLiteralOrLifetime(Accessor &styler, Sci_Position& pos, bool ascii_only) { - pos++; - int c = styler.SafeGetCharAt(pos, '\0'); - int n = styler.SafeGetCharAt(pos + 1, '\0'); - bool done = false; - bool valid_lifetime = !ascii_only && IsIdentifierStart(c); - bool valid_char = true; - bool first = true; - while (!done) { - switch (c) { - case '\\': - done = true; - if (IsValidCharacterEscape(n)) { - pos += 2; - } else if (n == 'x') { - pos += 2; - valid_char = ScanNumericEscape(styler, pos, 2, false); - } else if (n == 'u' && !ascii_only) { - pos += 2; - if (styler.SafeGetCharAt(pos, '\0') != '{') { - // old-style - valid_char = ScanNumericEscape(styler, pos, 4, false); - } else { - int n_digits = 0; - while (IsADigit(styler.SafeGetCharAt(++pos, '\0'), 16) && n_digits++ < 6) { - } - if (n_digits > 0 && styler.SafeGetCharAt(pos, '\0') == '}') - pos++; - else - valid_char = false; - } - } else if (n == 'U' && !ascii_only) { - pos += 2; - valid_char = ScanNumericEscape(styler, pos, 8, false); - } else { - valid_char = false; - } - break; - case '\'': - valid_char = !first; - done = true; - break; - case '\t': - case '\n': - case '\r': - case '\0': - valid_char = false; - done = true; - break; - default: - if (ascii_only && !IsASCII((char)c)) { - done = true; - valid_char = false; - } else if (!IsIdentifierContinue(c) && !first) { - done = true; - } else { - pos++; - } - break; - } - c = styler.SafeGetCharAt(pos, '\0'); - n = styler.SafeGetCharAt(pos + 1, '\0'); - - first = false; - } - if (styler.SafeGetCharAt(pos, '\0') == '\'') { - valid_lifetime = false; - } else { - valid_char = false; - } - if (valid_lifetime) { - styler.ColourTo(pos - 1, SCE_RUST_LIFETIME); - } else if (valid_char) { - pos++; - styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTECHARACTER : SCE_RUST_CHARACTER); - } else { - styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); - } -} - -enum CommentState { - UnknownComment, - DocComment, - NotDocComment -}; - -/* - * The rule for block-doc comments is as follows: /xxN and /x! (where x is an asterisk, N is a non-asterisk) start doc comments. - * Otherwise it's a regular comment. - */ -static void ResumeBlockComment(Accessor &styler, Sci_Position& pos, Sci_Position max, CommentState state, int level) { - int c = styler.SafeGetCharAt(pos, '\0'); - bool maybe_doc_comment = false; - if (c == '*') { - int n = styler.SafeGetCharAt(pos + 1, '\0'); - if (n != '*' && n != '/') { - maybe_doc_comment = true; - } - } else if (c == '!') { - maybe_doc_comment = true; - } - - for (;;) { - int n = styler.SafeGetCharAt(pos + 1, '\0'); - if (pos == styler.LineEnd(styler.GetLine(pos))) - styler.SetLineState(styler.GetLine(pos), level); - if (c == '*') { - pos++; - if (n == '/') { - pos++; - level--; - if (level == 0) { - styler.SetLineState(styler.GetLine(pos), 0); - if (state == DocComment || (state == UnknownComment && maybe_doc_comment)) - styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCKDOC); - else - styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCK); - break; - } - } - } else if (c == '/') { - pos++; - if (n == '*') { - pos++; - level++; - } - } - else { - pos++; - } - if (pos >= max) { - if (state == DocComment || (state == UnknownComment && maybe_doc_comment)) - styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCKDOC); - else - styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCK); - break; - } - c = styler.SafeGetCharAt(pos, '\0'); - } -} - -/* - * The rule for line-doc comments is as follows... ///N and //! (where N is a non slash) start doc comments. - * Otherwise it's a normal line comment. - */ -static void ResumeLineComment(Accessor &styler, Sci_Position& pos, Sci_Position max, CommentState state) { - bool maybe_doc_comment = false; - int c = styler.SafeGetCharAt(pos, '\0'); - if (c == '/') { - if (pos < max) { - pos++; - c = styler.SafeGetCharAt(pos, '\0'); - if (c != '/') { - maybe_doc_comment = true; - } - } - } else if (c == '!') { - maybe_doc_comment = true; - } - - while (pos < max && c != '\n') { - if (pos == styler.LineEnd(styler.GetLine(pos))) - styler.SetLineState(styler.GetLine(pos), 0); - pos++; - c = styler.SafeGetCharAt(pos, '\0'); - } - - if (state == DocComment || (state == UnknownComment && maybe_doc_comment)) - styler.ColourTo(pos - 1, SCE_RUST_COMMENTLINEDOC); - else - styler.ColourTo(pos - 1, SCE_RUST_COMMENTLINE); -} - -static void ScanComments(Accessor &styler, Sci_Position& pos, Sci_Position max) { - pos++; - int c = styler.SafeGetCharAt(pos, '\0'); - pos++; - if (c == '/') - ResumeLineComment(styler, pos, max, UnknownComment); - else if (c == '*') - ResumeBlockComment(styler, pos, max, UnknownComment, 1); -} - -static void ResumeString(Accessor &styler, Sci_Position& pos, Sci_Position max, bool ascii_only) { - int c = styler.SafeGetCharAt(pos, '\0'); - bool error = false; - while (c != '"' && !error) { - if (pos >= max) { - error = true; - break; - } - if (pos == styler.LineEnd(styler.GetLine(pos))) - styler.SetLineState(styler.GetLine(pos), 0); - if (c == '\\') { - int n = styler.SafeGetCharAt(pos + 1, '\0'); - if (IsValidStringEscape(n)) { - pos += 2; - } else if (n == 'x') { - pos += 2; - error = !ScanNumericEscape(styler, pos, 2, true); - } else if (n == 'u' && !ascii_only) { - pos += 2; - if (styler.SafeGetCharAt(pos, '\0') != '{') { - // old-style - error = !ScanNumericEscape(styler, pos, 4, true); - } else { - int n_digits = 0; - while (IsADigit(styler.SafeGetCharAt(++pos, '\0'), 16) && n_digits++ < 6) { - } - if (n_digits > 0 && styler.SafeGetCharAt(pos, '\0') == '}') - pos++; - else - error = true; - } - } else if (n == 'U' && !ascii_only) { - pos += 2; - error = !ScanNumericEscape(styler, pos, 8, true); - } else { - pos += 1; - error = true; - } - } else { - if (ascii_only && !IsASCII((char)c)) - error = true; - else - pos++; - } - c = styler.SafeGetCharAt(pos, '\0'); - } - if (!error) - pos++; - styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRING : SCE_RUST_STRING); -} - -static void ResumeRawString(Accessor &styler, Sci_Position& pos, Sci_Position max, int num_hashes, bool ascii_only) { - for (;;) { - if (pos == styler.LineEnd(styler.GetLine(pos))) - styler.SetLineState(styler.GetLine(pos), num_hashes); - - int c = styler.SafeGetCharAt(pos, '\0'); - if (c == '"') { - pos++; - int trailing_num_hashes = 0; - while (styler.SafeGetCharAt(pos, '\0') == '#' && trailing_num_hashes < num_hashes) { - trailing_num_hashes++; - pos++; - } - if (trailing_num_hashes == num_hashes) { - styler.SetLineState(styler.GetLine(pos), 0); - break; - } - } else if (pos >= max) { - break; - } else { - if (ascii_only && !IsASCII((char)c)) - break; - pos++; - } - } - styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRINGR : SCE_RUST_STRINGR); -} - -static void ScanRawString(Accessor &styler, Sci_Position& pos, Sci_Position max, bool ascii_only) { - pos++; - int num_hashes = 0; - while (styler.SafeGetCharAt(pos, '\0') == '#') { - num_hashes++; - pos++; - } - if (styler.SafeGetCharAt(pos, '\0') != '"') { - styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); - } else { - pos++; - ResumeRawString(styler, pos, max, num_hashes, ascii_only); - } -} - -void SCI_METHOD LexerRust::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - PropSetSimple props; - Accessor styler(pAccess, &props); - Sci_Position pos = startPos; - Sci_Position max = pos + length; - - styler.StartAt(pos); - styler.StartSegment(pos); - - if (initStyle == SCE_RUST_COMMENTBLOCK || initStyle == SCE_RUST_COMMENTBLOCKDOC) { - ResumeBlockComment(styler, pos, max, initStyle == SCE_RUST_COMMENTBLOCKDOC ? DocComment : NotDocComment, styler.GetLineState(styler.GetLine(pos) - 1)); - } else if (initStyle == SCE_RUST_COMMENTLINE || initStyle == SCE_RUST_COMMENTLINEDOC) { - ResumeLineComment(styler, pos, max, initStyle == SCE_RUST_COMMENTLINEDOC ? DocComment : NotDocComment); - } else if (initStyle == SCE_RUST_STRING) { - ResumeString(styler, pos, max, false); - } else if (initStyle == SCE_RUST_BYTESTRING) { - ResumeString(styler, pos, max, true); - } else if (initStyle == SCE_RUST_STRINGR) { - ResumeRawString(styler, pos, max, styler.GetLineState(styler.GetLine(pos) - 1), false); - } else if (initStyle == SCE_RUST_BYTESTRINGR) { - ResumeRawString(styler, pos, max, styler.GetLineState(styler.GetLine(pos) - 1), true); - } - - while (pos < max) { - int c = styler.SafeGetCharAt(pos, '\0'); - int n = styler.SafeGetCharAt(pos + 1, '\0'); - int n2 = styler.SafeGetCharAt(pos + 2, '\0'); - - if (pos == 0 && c == '#' && n == '!' && n2 != '[') { - pos += 2; - ResumeLineComment(styler, pos, max, NotDocComment); - } else if (IsWhitespace(c)) { - ScanWhitespace(styler, pos, max); - } else if (c == '/' && (n == '/' || n == '*')) { - ScanComments(styler, pos, max); - } else if (c == 'r' && (n == '#' || n == '"')) { - ScanRawString(styler, pos, max, false); - } else if (c == 'b' && n == 'r' && (n2 == '#' || n2 == '"')) { - pos++; - ScanRawString(styler, pos, max, true); - } else if (c == 'b' && n == '"') { - pos += 2; - ResumeString(styler, pos, max, true); - } else if (c == 'b' && n == '\'') { - pos++; - ScanCharacterLiteralOrLifetime(styler, pos, true); - } else if (IsIdentifierStart(c)) { - ScanIdentifier(styler, pos, keywords); - } else if (IsADigit(c)) { - ScanNumber(styler, pos); - } else if (IsThreeCharOperator(c, n, n2)) { - pos += 3; - styler.ColourTo(pos - 1, SCE_RUST_OPERATOR); - } else if (IsTwoCharOperator(c, n)) { - pos += 2; - styler.ColourTo(pos - 1, SCE_RUST_OPERATOR); - } else if (IsOneCharOperator(c)) { - pos++; - styler.ColourTo(pos - 1, SCE_RUST_OPERATOR); - } else if (c == '\'') { - ScanCharacterLiteralOrLifetime(styler, pos, false); - } else if (c == '"') { - pos++; - ResumeString(styler, pos, max, false); - } else { - pos++; - styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); - } - } - styler.ColourTo(pos - 1, SCE_RUST_DEFAULT); - styler.Flush(); -} - -void SCI_METHOD LexerRust::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - - if (!options.fold) - return; - - LexAccessor styler(pAccess); - - Sci_PositionU endPos = startPos + length; - int visibleChars = 0; - bool inLineComment = false; - Sci_Position lineCurrent = styler.GetLine(startPos); - int levelCurrent = SC_FOLDLEVELBASE; - if (lineCurrent > 0) - levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; - Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1); - int levelMinCurrent = levelCurrent; - int levelNext = levelCurrent; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); - for (Sci_PositionU i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = i == (lineStartNext-1); - if ((style == SCE_RUST_COMMENTLINE) || (style == SCE_RUST_COMMENTLINEDOC)) - inLineComment = true; - if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style) && !inLineComment) { - if (!IsStreamCommentStyle(stylePrev)) { - levelNext++; - } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { - // Comments don't end at end of line and the next character may be unstyled. - levelNext--; - } - } - if (options.foldComment && options.foldCommentExplicit && ((style == SCE_RUST_COMMENTLINE) || options.foldExplicitAnywhere)) { - if (userDefinedFoldMarkers) { - if (styler.Match(i, options.foldExplicitStart.c_str())) { - levelNext++; - } else if (styler.Match(i, options.foldExplicitEnd.c_str())) { - levelNext--; - } - } else { - if ((ch == '/') && (chNext == '/')) { - char chNext2 = styler.SafeGetCharAt(i + 2); - if (chNext2 == '{') { - levelNext++; - } else if (chNext2 == '}') { - levelNext--; - } - } - } - } - if (options.foldSyntaxBased && (style == SCE_RUST_OPERATOR)) { - if (ch == '{') { - // Measure the minimum before a '{' to allow - // folding on "} else {" - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (ch == '}') { - levelNext--; - } - } - if (!IsASpace(ch)) - visibleChars++; - if (atEOL || (i == endPos-1)) { - int levelUse = levelCurrent; - if (options.foldSyntaxBased && options.foldAtElse) { - levelUse = levelMinCurrent; - } - int lev = levelUse | levelNext << 16; - if (visibleChars == 0 && options.foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if (levelUse < levelNext) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - lineStartNext = styler.LineStart(lineCurrent+1); - levelCurrent = levelNext; - levelMinCurrent = levelCurrent; - if (atEOL && (i == static_cast(styler.Length()-1))) { - // There is an empty line at end of file so give it same level and empty - styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); - } - visibleChars = 0; - inLineComment = false; - } - } -} - -LexerModule lmRust(SCLEX_RUST, LexerRust::LexerFactoryRust, "rust", rustWordLists); diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/Accessor.cxx b/qrenderdoc/3rdparty/scintilla/lexlib/Accessor.cxx deleted file mode 100644 index f8b46ef88..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/Accessor.cxx +++ /dev/null @@ -1,79 +0,0 @@ -// Scintilla source code edit control -/** @file Accessor.cxx - ** Interfaces between Scintilla and lexers. - **/ -// Copyright 1998-2002 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -Accessor::Accessor(IDocument *pAccess_, PropSetSimple *pprops_) : LexAccessor(pAccess_), pprops(pprops_) { -} - -int Accessor::GetPropertyInt(const char *key, int defaultValue) const { - return pprops->GetInt(key, defaultValue); -} - -int Accessor::IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { - Sci_Position end = Length(); - int spaceFlags = 0; - - // Determines the indentation level of the current line and also checks for consistent - // indentation compared to the previous line. - // Indentation is judged consistent when the indentation whitespace of each line lines - // the same or the indentation of one line is a prefix of the other. - - Sci_Position pos = LineStart(line); - char ch = (*this)[pos]; - int indent = 0; - bool inPrevPrefix = line > 0; - Sci_Position posPrev = inPrevPrefix ? LineStart(line-1) : 0; - while ((ch == ' ' || ch == '\t') && (pos < end)) { - if (inPrevPrefix) { - char chPrev = (*this)[posPrev++]; - if (chPrev == ' ' || chPrev == '\t') { - if (chPrev != ch) - spaceFlags |= wsInconsistent; - } else { - inPrevPrefix = false; - } - } - if (ch == ' ') { - spaceFlags |= wsSpace; - indent++; - } else { // Tab - spaceFlags |= wsTab; - if (spaceFlags & wsSpace) - spaceFlags |= wsSpaceTab; - indent = (indent / 8 + 1) * 8; - } - ch = (*this)[++pos]; - } - - *flags = spaceFlags; - indent += SC_FOLDLEVELBASE; - // if completely empty line or the start of a comment... - if ((LineStart(line) == Length()) || (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || - (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos))) - return indent | SC_FOLDLEVELWHITEFLAG; - else - return indent; -} diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/Accessor.h b/qrenderdoc/3rdparty/scintilla/lexlib/Accessor.h deleted file mode 100644 index 00b2a54da..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/Accessor.h +++ /dev/null @@ -1,35 +0,0 @@ -// Scintilla source code edit control -/** @file Accessor.h - ** Interfaces between Scintilla and lexers. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef ACCESSOR_H -#define ACCESSOR_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -enum { wsSpace=1, wsTab=2, wsSpaceTab=4, wsInconsistent=8 }; - -class Accessor; -class WordList; -class PropSetSimple; - -typedef bool (*PFNIsCommentLeader)(Accessor &styler, Sci_Position pos, Sci_Position len); - -class Accessor : public LexAccessor { -public: - PropSetSimple *pprops; - Accessor(IDocument *pAccess_, PropSetSimple *pprops_); - int GetPropertyInt(const char *, int defaultValue=0) const; - int IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/CharacterCategory.cxx b/qrenderdoc/3rdparty/scintilla/lexlib/CharacterCategory.cxx deleted file mode 100644 index 2be46c013..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/CharacterCategory.cxx +++ /dev/null @@ -1,3304 +0,0 @@ -// Scintilla source code edit control -/** @file CharacterCategory.cxx - ** Returns the Unicode general category of a character. - ** Table automatically regenerated by scripts/GenerateCharacterCategory.py - ** Should only be rarely regenerated for new versions of Unicode. - **/ -// Copyright 2013 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include - -#include "StringCopy.h" -#include "CharacterCategory.h" - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -namespace { - // Use an unnamed namespace to protect the declarations from name conflicts - -const int catRanges[] = { -//++Autogenerated -- start of section automatically generated -// Created with Python 3.3.0, Unicode 6.1.0 -25, -1046, -1073, -1171, -1201, -1293, -1326, -1361, -1394, -1425, -1452, -1489, -1544, -1873, -1938, -2033, -2080, -2925, -2961, -2990, -3028, -3051, -3092, -3105, -3949, -3986, -4014, -4050, -4089, -5142, -5169, -5203, -5333, -5361, -5396, -5429, -5444, -5487, -5522, -5562, -5589, -5620, -5653, -5682, -5706, -5780, -5793, -5841, -5908, -5930, -5956, -6000, -6026, -6129, -6144, -6898, -6912, -7137, -7922, -7937, -8192, -8225, -8256, -8289, -8320, -8353, -8384, -8417, -8448, -8481, -8512, -8545, -8576, -8609, -8640, -8673, -8704, -8737, -8768, -8801, -8832, -8865, -8896, -8929, -8960, -8993, -9024, -9057, -9088, -9121, -9152, -9185, -9216, -9249, -9280, -9313, -9344, -9377, -9408, -9441, -9472, -9505, -9536, -9569, -9600, -9633, -9664, -9697, -9728, -9761, -9792, -9825, -9856, -9889, -9920, -9953, -10016, -10049, -10080, -10113, -10144, -10177, -10208, -10241, -10272, -10305, -10336, -10369, -10400, -10433, -10464, -10497, -10560, -10593, -10624, -10657, -10688, -10721, -10752, -10785, -10816, -10849, -10880, -10913, -10944, -10977, -11008, -11041, -11072, -11105, -11136, -11169, -11200, -11233, -11264, -11297, -11328, -11361, -11392, -11425, -11456, -11489, -11520, -11553, -11584, -11617, -11648, -11681, -11712, -11745, -11776, -11809, -11840, -11873, -11904, -11937, -11968, -12001, -12032, -12097, -12128, -12161, -12192, -12225, -12320, -12385, -12416, -12449, -12480, -12545, -12576, -12673, -12736, -12865, -12896, -12961, -12992, -13089, -13184, -13249, -13280, -13345, -13376, -13409, -13440, -13473, -13504, -13569, -13600, -13633, -13696, -13729, -13760, -13825, -13856, -13953, -13984, -14017, -14048, -14113, -14180, -14208, -14241, -14340, -14464, -14498, -14529, -14560, -14594, -14625, -14656, -14690, -14721, -14752, -14785, -14816, -14849, -14880, -14913, -14944, -14977, -15008, -15041, -15072, -15105, -15136, -15169, -15200, -15233, -15296, -15329, -15360, -15393, -15424, -15457, -15488, -15521, -15552, -15585, -15616, -15649, -15680, -15713, -15744, -15777, -15808, -15841, -15904, -15938, -15969, -16000, -16033, -16064, -16161, -16192, -16225, -16256, -16289, -16320, -16353, -16384, -16417, -16448, -16481, -16512, -16545, -16576, -16609, -16640, -16673, -16704, -16737, -16768, -16801, -16832, -16865, -16896, -16929, -16960, -16993, -17024, -17057, -17088, -17121, -17152, -17185, -17216, -17249, -17280, -17313, -17344, -17377, -17408, -17441, -17472, -17505, -17536, -17569, -17600, -17633, -17664, -17697, -17728, -17761, -17792, -17825, -17856, -17889, -17920, -17953, -17984, -18017, -18240, -18305, -18336, -18401, -18464, -18497, -18528, -18657, -18688, -18721, -18752, -18785, -18816, -18849, -18880, -18913, -21124, -21153, -22019, -22612, -22723, -23124, -23555, -23732, -23939, -23988, -24003, -24052, -24581, -28160, -28193, -28224, -28257, -28291, -28340, -28352, -28385, -28445, -28483, -28513, -28625, -28669, -28820, -28864, -28913, -28928, -29053, -29056, -29117, -29120, -29185, -29216, -29789, -29792, -30081, -31200, -31233, -31296, -31393, -31488, -31521, -31552, -31585, -31616, -31649, -31680, -31713, -31744, -31777, -31808, -31841, -31872, -31905, -31936, -31969, -32000, -32033, -32064, -32097, -32128, -32161, -32192, -32225, -32384, -32417, -32466, -32480, -32513, -32544, -32609, -32672, -34305, -35840, -35873, -35904, -35937, -35968, -36001, -36032, -36065, -36096, -36129, -36160, -36193, -36224, -36257, -36288, -36321, -36352, -36385, -36416, -36449, -36480, -36513, -36544, -36577, -36608, -36641, -36672, -36705, -36736, -36769, -36800, -36833, -36864, -36897, -36949, -36965, -37127, -37184, -37217, -37248, -37281, -37312, -37345, -37376, -37409, -37440, -37473, -37504, -37537, -37568, -37601, -37632, -37665, -37696, -37729, -37760, -37793, -37824, -37857, -37888, -37921, -37952, -37985, -38016, -38049, -38080, -38113, -38144, -38177, -38208, -38241, -38272, -38305, -38336, -38369, -38400, -38433, -38464, -38497, -38528, -38561, -38592, -38625, -38656, -38689, -38720, -38753, -38784, -38817, -38848, -38881, -38912, -38977, -39008, -39041, -39072, -39105, -39136, -39169, -39200, -39233, -39264, -39297, -39328, -39361, -39424, -39457, -39488, -39521, -39552, -39585, -39616, -39649, -39680, -39713, -39744, -39777, -39808, -39841, -39872, -39905, -39936, -39969, -40000, -40033, -40064, -40097, -40128, -40161, -40192, -40225, -40256, -40289, -40320, -40353, -40384, -40417, -40448, -40481, -40512, -40545, -40576, -40609, -40640, -40673, -40704, -40737, -40768, -40801, -40832, -40865, -40896, -40929, -40960, -40993, -41024, -41057, -41088, -41121, -41152, -41185, -41216, -41249, -41280, -41313, -41344, -41377, -41408, -41441, -41472, -41505, -41536, -41569, -41600, -41633, -41664, -41697, -41728, -41761, -41792, -41825, -41856, -41889, -41920, -41953, -41984, -42017, -42048, -42081, -42112, -42145, -42176, -42209, -42269, -42528, -43773, -43811, -43857, -44061, -44065, -45341, -45361, -45388, -45437, -45555, -45597, -45605, -47052, -47077, -47121, -47141, -47217, -47237, -47313, -47333, -47389, -47620, -48509, -48644, -48753, -48829, -49178, -49341, -49362, -49457, -49523, -49553, -49621, -49669, -50033, -50077, -50129, -50180, -51203, -51236, -51557, -52232, -52561, -52676, -52741, -52772, -55953, -55972, -56005, -56250, -56277, -56293, -56483, -56549, -56629, -56645, -56772, -56840, -57156, -57269, -57316, -57361, -57821, -57850, -57860, -57893, -57924, -58885, -59773, -59812, -62661, -63012, -63069, -63496, -63812, -64869, -65155, -65237, -65265, -65347, -65405, -65540, -66245, -66371, -66405, -66691, -66725, -66819, -66853, -67037, -67089, -67581, -67588, -68389, -68509, -68561, -68605, -70660, -70717, -70724, -71101, -72837, -73725, -73733, -73830, -73860, -75589, -75622, -75653, -75684, -75718, -75813, -76070, -76197, -76230, -76292, -76325, -76548, -76869, -76945, -77000, -77329, -77347, -77380, -77597, -77604, -77853, -77861, -77894, -77981, -77988, -78269, -78308, -78397, -78436, -79165, -79172, -79421, -79428, -79485, -79556, -79709, -79749, -79780, -79814, -79909, -80061, -80102, -80189, -80230, -80293, -80324, -80381, -80614, -80669, -80772, -80861, -80868, -80965, -81053, -81096, -81412, -81491, -81546, -81749, -81779, -81821, -81957, -82022, -82077, -82084, -82301, -82404, -82493, -82532, -83261, -83268, -83517, -83524, -83613, -83620, -83709, -83716, -83805, -83845, -83901, -83910, -84005, -84093, -84197, -84285, -84325, -84445, -84517, -84573, -84772, -84925, -84932, -84989, -85192, -85509, -85572, -85669, -85725, -86053, -86118, -86173, -86180, -86493, -86500, -86621, -86628, -87357, -87364, -87613, -87620, -87709, -87716, -87901, -87941, -87972, -88006, -88101, -88285, -88293, -88358, -88413, -88422, -88485, -88541, -88580, -88637, -89092, -89157, -89245, -89288, -89617, -89651, -89693, -90149, -90182, -90269, -90276, -90557, -90596, -90685, -90724, -91453, -91460, -91709, -91716, -91805, -91812, -91997, -92037, -92068, -92102, -92133, -92166, -92197, -92349, -92390, -92477, -92518, -92581, -92637, -92869, -92902, -92957, -93060, -93149, -93156, -93253, -93341, -93384, -93717, -93732, -93770, -93981, -94277, -94308, -94365, -94372, -94589, -94660, -94781, -94788, -94941, -95012, -95101, -95108, -95165, -95172, -95261, -95332, -95421, -95492, -95613, -95684, -96093, -96198, -96261, -96294, -96381, -96454, -96573, -96582, -96677, -96733, -96772, -96829, -96998, -97053, -97480, -97802, -97909, -98099, -98133, -98173, -98342, -98461, -98468, -98749, -98756, -98877, -98884, -99645, -99652, -99997, -100004, -100189, -100260, -100293, -100390, -100541, -100549, -100669, -100677, -100829, -101029, -101117, -101124, -101213, -101380, -101445, -101533, -101576, -101917, -102154, -102389, -102429, -102470, -102557, -102564, -102845, -102852, -102973, -102980, -103741, -103748, -104093, -104100, -104285, -104325, -104356, -104390, -104421, -104454, -104637, -104645, -104678, -104765, -104774, -104837, -104925, -105126, -105213, -105412, -105469, -105476, -105541, -105629, -105672, -106013, -106020, -106109, -106566, -106653, -106660, -106941, -106948, -107069, -107076, -108413, -108452, -108486, -108581, -108733, -108742, -108861, -108870, -108965, -108996, -109053, -109286, -109341, -109572, -109637, -109725, -109768, -110090, -110301, -110389, -110404, -110621, -110662, -110749, -110756, -111357, -111428, -112221, -112228, -112541, -112548, -112605, -112644, -112893, -112965, -113021, -113126, -113221, -113341, -113349, -113405, -113414, -113693, -114246, -114321, -114365, -114724, -116261, -116292, -116357, -116605, -116723, -116740, -116931, -116965, -117233, -117256, -117585, -117661, -118820, -118909, -118916, -118973, -119012, -119101, -119108, -119165, -119204, -119261, -119428, -119581, -119588, -119837, -119844, -119965, -119972, -120029, -120036, -120093, -120132, -120221, -120228, -120357, -120388, -120453, -120669, -120677, -120740, -120797, -120836, -121021, -121027, -121085, -121093, -121309, -121352, -121693, -121732, -121885, -122884, -122933, -123025, -123509, -123537, -123573, -123653, -123733, -123912, -124234, -124565, -124581, -124629, -124645, -124693, -124709, -124749, -124782, -124813, -124846, -124870, -124932, -125213, -125220, -126397, -126501, -126950, -126981, -127153, -127173, -127236, -127397, -127773, -127781, -128957, -128981, -129221, -129269, -129469, -129493, -129553, -129717, -129841, -129917, -131076, -132454, -132517, -132646, -132677, -132870, -132901, -132966, -133029, -133092, -133128, -133457, -133636, -133830, -133893, -133956, -134085, -134180, -134214, -134308, -134374, -134596, -134693, -134820, -135237, -135270, -135333, -135398, -135589, -135620, -135654, -135688, -136006, -136101, -136149, -136192, -137437, -137440, -137501, -137632, -137693, -137732, -139121, -139139, -139172, -149821, -149828, -149981, -150020, -150269, -150276, -150333, -150340, -150493, -150532, -151869, -151876, -152029, -152068, -153149, -153156, -153309, -153348, -153597, -153604, -153661, -153668, -153821, -153860, -154365, -154372, -156221, -156228, -156381, -156420, -158589, -158629, -158737, -159018, -159677, -159748, -160277, -160605, -160772, -163517, -163852, -163876, -183729, -183780, -184342, -184356, -185197, -185230, -185277, -185348, -187761, -187849, -187965, -188420, -188861, -188868, -188997, -189117, -189444, -190021, -190129, -190205, -190468, -191045, -191133, -191492, -191933, -191940, -192061, -192069, -192157, -192516, -194181, -194246, -194277, -194502, -194757, -194790, -194853, -195217, -195299, -195345, -195443, -195460, -195493, -195549, -195592, -195933, -196106, -196445, -196625, -196812, -196849, -196965, -197078, -197117, -197128, -197469, -197636, -198755, -198788, -200477, -200708, -202021, -202052, -202109, -202244, -204509, -204804, -205757, -205829, -205926, -206053, -206118, -206237, -206342, -206405, -206438, -206629, -206749, -206869, -206909, -206993, -207048, -207364, -208349, -208388, -208573, -208900, -210333, -210438, -210980, -211206, -211293, -211464, -211786, -211837, -211925, -212996, -213733, -213798, -213917, -213969, -214020, -215718, -215749, -215782, -215813, -216061, -216069, -216102, -216133, -216166, -216229, -216486, -216677, -217021, -217061, -217096, -217437, -217608, -217949, -218129, -218339, -218385, -218589, -221189, -221318, -221348, -222853, -222886, -222917, -223078, -223109, -223142, -223301, -223334, -223396, -223645, -223752, -224081, -224309, -224613, -224917, -225213, -225285, -225350, -225380, -226342, -226373, -226502, -226565, -226630, -226661, -226694, -226756, -226824, -227140, -228549, -228582, -228613, -228678, -228773, -228806, -228837, -228934, -229021, -229265, -229380, -230534, -230789, -231046, -231109, -231197, -231281, -231432, -231773, -231844, -231944, -232260, -233219, -233425, -233501, -235537, -235805, -236037, -236145, -236165, -236582, -236613, -236836, -236965, -236996, -237126, -237189, -237220, -237309, -237569, -238979, -240993, -241411, -241441, -242531, -243717, -244989, -245637, -245760, -245793, -245824, -245857, -245888, -245921, -245952, -245985, -246016, -246049, -246080, -246113, -246144, -246177, -246208, -246241, -246272, -246305, -246336, -246369, -246400, -246433, -246464, -246497, -246528, -246561, -246592, -246625, -246656, -246689, -246720, -246753, -246784, -246817, -246848, -246881, -246912, -246945, -246976, -247009, -247040, -247073, -247104, -247137, -247168, -247201, -247232, -247265, -247296, -247329, -247360, -247393, -247424, -247457, -247488, -247521, -247552, -247585, -247616, -247649, -247680, -247713, -247744, -247777, -247808, -247841, -247872, -247905, -247936, -247969, -248000, -248033, -248064, -248097, -248128, -248161, -248192, -248225, -248256, -248289, -248320, -248353, -248384, -248417, -248448, -248481, -248512, -248545, -248576, -248609, -248640, -248673, -248704, -248737, -248768, -248801, -248832, -248865, -248896, -248929, -248960, -248993, -249024, -249057, -249088, -249121, -249152, -249185, -249216, -249249, -249280, -249313, -249344, -249377, -249408, -249441, -249472, -249505, -249536, -249569, -249600, -249633, -249664, -249697, -249728, -249761, -249792, -249825, -249856, -249889, -249920, -249953, -249984, -250017, -250048, -250081, -250112, -250145, -250176, -250209, -250240, -250273, -250304, -250337, -250368, -250401, -250432, -250465, -250496, -250529, -250816, -250849, -250880, -250913, -250944, -250977, -251008, -251041, -251072, -251105, -251136, -251169, -251200, -251233, -251264, -251297, -251328, -251361, -251392, -251425, -251456, -251489, -251520, -251553, -251584, -251617, -251648, -251681, -251712, -251745, -251776, -251809, -251840, -251873, -251904, -251937, -251968, -252001, -252032, -252065, -252096, -252129, -252160, -252193, -252224, -252257, -252288, -252321, -252352, -252385, -252416, -252449, -252480, -252513, -252544, -252577, -252608, -252641, -252672, -252705, -252736, -252769, -252800, -252833, -252864, -252897, -252928, -252961, -252992, -253025, -253056, -253089, -253120, -253153, -253184, -253217, -253248, -253281, -253312, -253345, -253376, -253409, -253440, -253473, -253504, -253537, -253568, -253601, -253632, -253665, -253696, -253729, -253760, -253793, -253824, -253857, -253888, -253921, -254208, -254465, -254685, -254720, -254941, -254977, -255232, -255489, -255744, -256001, -256221, -256256, -256477, -256513, -256797, -256800, -256861, -256864, -256925, -256928, -256989, -256992, -257025, -257280, -257537, -258013, -258049, -258306, -258561, -258818, -259073, -259330, -259585, -259773, -259777, -259840, -259970, -260020, -260033, -260084, -260161, -260285, -260289, -260352, -260482, -260532, -260609, -260765, -260801, -260864, -261021, -261044, -261121, -261376, -261556, -261661, -261697, -261821, -261825, -261888, -262018, -262068, -262141, -262166, -262522, -262668, -262865, -262927, -262960, -262989, -263023, -263088, -263117, -263151, -263185, -263447, -263480, -263514, -263670, -263697, -263983, -264016, -264049, -264171, -264241, -264338, -264365, -264398, -264433, -264786, -264817, -264843, -264881, -265206, -265242, -265405, -265562, -265738, -265763, -265821, -265866, -266066, -266157, -266190, -266211, -266250, -266578, -266669, -266702, -266749, -266755, -267197, -267283, -268125, -268805, -269223, -269349, -269383, -269477, -269885, -270357, -270400, -270453, -270560, -270613, -270657, -270688, -270785, -270848, -270945, -270997, -271008, -271061, -271122, -271136, -271317, -271488, -271541, -271552, -271605, -271616, -271669, -271680, -271829, -271841, -271872, -272001, -272036, -272161, -272213, -272257, -272320, -272402, -272544, -272577, -272725, -272754, -272789, -272833, -272885, -272906, -273417, -274528, -274561, -274601, -274730, -274781, -274962, -275125, -275282, -275349, -275474, -275509, -275570, -275605, -275666, -275701, -275922, -275957, -276946, -277013, -277074, -277109, -277138, -277173, -278162, -286741, -286994, -287125, -287762, -287829, -288045, -288078, -288117, -290706, -290741, -291698, -292501, -293778, -293973, -294557, -294933, -296189, -296981, -297341, -297994, -299925, -302410, -303125, -308978, -309013, -309298, -309333, -311058, -311317, -314866, -314901, -319517, -319541, -322829, -322862, -322893, -322926, -322957, -322990, -323021, -323054, -323085, -323118, -323149, -323182, -323213, -323246, -323274, -324245, -325650, -325805, -325838, -325874, -326861, -326894, -326925, -326958, -326989, -327022, -327053, -327086, -327117, -327150, -327186, -327701, -335890, -340077, -340110, -340141, -340174, -340205, -340238, -340269, -340302, -340333, -340366, -340397, -340430, -340461, -340494, -340525, -340558, -340589, -340622, -340653, -340686, -340717, -340750, -340786, -342797, -342830, -342861, -342894, -342930, -343949, -343982, -344018, -352277, -353810, -354485, -354546, -354749, -354837, -355165, -360448, -361981, -361985, -363517, -363520, -363553, -363584, -363681, -363744, -363777, -363808, -363841, -363872, -363905, -363936, -364065, -364096, -364129, -364192, -364225, -364419, -364480, -364577, -364608, -364641, -364672, -364705, -364736, -364769, -364800, -364833, -364864, -364897, -364928, -364961, -364992, -365025, -365056, -365089, -365120, -365153, -365184, -365217, -365248, -365281, -365312, -365345, -365376, -365409, -365440, -365473, -365504, -365537, -365568, -365601, -365632, -365665, -365696, -365729, -365760, -365793, -365824, -365857, -365888, -365921, -365952, -365985, -366016, -366049, -366080, -366113, -366144, -366177, -366208, -366241, -366272, -366305, -366336, -366369, -366400, -366433, -366464, -366497, -366528, -366561, -366592, -366625, -366656, -366689, -366720, -366753, -366784, -366817, -366848, -366881, -366912, -366945, -366976, -367009, -367040, -367073, -367104, -367137, -367168, -367201, -367232, -367265, -367296, -367329, -367360, -367393, -367424, -367457, -367488, -367521, -367552, -367585, -367616, -367649, -367680, -367713, -367797, -367968, -368001, -368032, -368065, -368101, -368192, -368225, -368285, -368433, -368554, -368593, -368641, -369885, -369889, -369949, -370081, -370141, -370180, -371997, -372195, -372241, -372285, -372709, -372740, -373501, -373764, -374013, -374020, -374269, -374276, -374525, -374532, -374781, -374788, -375037, -375044, -375293, -375300, -375549, -375556, -375805, -375813, -376849, -376911, -376944, -376975, -377008, -377041, -377135, -377168, -377201, -377231, -377264, -377297, -377580, -377617, -377676, -377713, -377743, -377776, -377809, -377871, -377904, -377933, -377966, -377997, -378030, -378061, -378094, -378125, -378158, -378193, -378339, -378385, -378700, -378781, -380949, -381789, -381813, -384669, -385045, -391901, -392725, -393117, -393238, -393265, -393365, -393379, -393412, -393449, -393485, -393518, -393549, -393582, -393613, -393646, -393677, -393710, -393741, -393774, -393813, -393869, -393902, -393933, -393966, -393997, -394030, -394061, -394094, -394124, -394157, -394190, -394261, -394281, -394565, -394694, -394764, -394787, -394965, -395017, -395107, -395140, -395185, -395221, -395293, -395300, -398077, -398117, -398196, -398243, -398308, -398348, -398372, -401265, -401283, -401380, -401437, -401572, -402909, -402980, -406013, -406037, -406090, -406229, -406532, -407421, -407573, -408733, -409092, -409621, -410621, -410634, -410965, -411914, -412181, -412202, -412693, -413706, -414037, -415274, -415765, -417789, -417813, -425988, -636637, -636949, -638980, -1309117, -1310724, -1311395, -1311428, -1348029, -1348117, -1349885, -1350148, -1351427, -1351633, -1351684, -1360259, -1360305, -1360388, -1360904, -1361220, -1361309, -1361920, -1361953, -1361984, -1362017, -1362048, -1362081, -1362112, -1362145, -1362176, -1362209, -1362240, -1362273, -1362304, -1362337, -1362368, -1362401, -1362432, -1362465, -1362496, -1362529, -1362560, -1362593, -1362624, -1362657, -1362688, -1362721, -1362752, -1362785, -1362816, -1362849, -1362880, -1362913, -1362944, -1362977, -1363008, -1363041, -1363072, -1363105, -1363136, -1363169, -1363200, -1363233, -1363264, -1363297, -1363328, -1363361, -1363396, -1363429, -1363463, -1363569, -1363589, -1363921, -1363939, -1363968, -1364001, -1364032, -1364065, -1364096, -1364129, -1364160, -1364193, -1364224, -1364257, -1364288, -1364321, -1364352, -1364385, -1364416, -1364449, -1364480, -1364513, -1364544, -1364577, -1364608, -1364641, -1364672, -1364705, -1364765, -1364965, -1364996, -1367241, -1367557, -1367633, -1367837, -1368084, -1368803, -1369108, -1369152, -1369185, -1369216, -1369249, -1369280, -1369313, -1369344, -1369377, -1369408, -1369441, -1369472, -1369505, -1369536, -1369569, -1369664, -1369697, -1369728, -1369761, -1369792, -1369825, -1369856, -1369889, -1369920, -1369953, -1369984, -1370017, -1370048, -1370081, -1370112, -1370145, -1370176, -1370209, -1370240, -1370273, -1370304, -1370337, -1370368, -1370401, -1370432, -1370465, -1370496, -1370529, -1370560, -1370593, -1370624, -1370657, -1370688, -1370721, -1370752, -1370785, -1370816, -1370849, -1370880, -1370913, -1370944, -1370977, -1371008, -1371041, -1371072, -1371105, -1371136, -1371169, -1371200, -1371233, -1371264, -1371297, -1371328, -1371361, -1371392, -1371425, -1371456, -1371489, -1371520, -1371553, -1371584, -1371617, -1371651, -1371681, -1371936, -1371969, -1372000, -1372033, -1372064, -1372129, -1372160, -1372193, -1372224, -1372257, -1372288, -1372321, -1372352, -1372385, -1372419, -1372468, -1372512, -1372545, -1372576, -1372609, -1372669, -1372672, -1372705, -1372736, -1372769, -1372829, -1373184, -1373217, -1373248, -1373281, -1373312, -1373345, -1373376, -1373409, -1373440, -1373473, -1373504, -1373565, -1376003, -1376065, -1376100, -1376325, -1376356, -1376453, -1376484, -1376613, -1376644, -1377382, -1377445, -1377510, -1377557, -1377693, -1377802, -1378005, -1378067, -1378101, -1378141, -1378308, -1379985, -1380125, -1380358, -1380420, -1382022, -1382533, -1382589, -1382865, -1382920, -1383261, -1383429, -1384004, -1384209, -1384292, -1384349, -1384456, -1384772, -1385669, -1385937, -1385988, -1386725, -1387078, -1387165, -1387505, -1387524, -1388477, -1388549, -1388646, -1388676, -1390181, -1390214, -1390277, -1390406, -1390469, -1390502, -1390641, -1391069, -1391075, -1391112, -1391453, -1391569, -1391645, -1392644, -1393957, -1394150, -1394213, -1394278, -1394341, -1394429, -1394692, -1394789, -1394820, -1395077, -1395110, -1395165, -1395208, -1395549, -1395601, -1395716, -1396227, -1396260, -1396469, -1396548, -1396582, -1396637, -1396740, -1398277, -1398308, -1398341, -1398436, -1398501, -1398564, -1398725, -1398788, -1398821, -1398852, -1398909, -1399652, -1399715, -1399761, -1399812, -1400166, -1400197, -1400262, -1400337, -1400388, -1400419, -1400486, -1400517, -1400573, -1400868, -1401085, -1401124, -1401341, -1401380, -1401597, -1401860, -1402109, -1402116, -1402365, -1406980, -1408102, -1408165, -1408198, -1408261, -1408294, -1408369, -1408390, -1408421, -1408477, -1408520, -1408861, -1409028, -1766557, -1766916, -1767677, -1767780, -1769373, -1769499, -1835036, -2039812, -2051549, -2051588, -2055005, -2056193, -2056445, -2056801, -2056989, -2057124, -2057157, -2057188, -2057522, -2057540, -2057981, -2057988, -2058173, -2058180, -2058237, -2058244, -2058333, -2058340, -2058429, -2058436, -2061908, -2062429, -2062948, -2074573, -2074606, -2074653, -2075140, -2077213, -2077252, -2079005, -2080260, -2080659, -2080693, -2080733, -2080773, -2081297, -2081517, -2081550, -2081585, -2081629, -2081797, -2082045, -2082321, -2082348, -2082411, -2082477, -2082510, -2082541, -2082574, -2082605, -2082638, -2082669, -2082702, -2082733, -2082766, -2082797, -2082830, -2082861, -2082894, -2082925, -2082958, -2082993, -2083053, -2083086, -2083121, -2083243, -2083345, -2083453, -2083473, -2083596, -2083629, -2083662, -2083693, -2083726, -2083757, -2083790, -2083825, -2083922, -2083948, -2083986, -2084093, -2084113, -2084147, -2084177, -2084253, -2084356, -2084541, -2084548, -2088893, -2088954, -2088989, -2089009, -2089107, -2089137, -2089229, -2089262, -2089297, -2089330, -2089361, -2089388, -2089425, -2089480, -2089809, -2089874, -2089969, -2090016, -2090861, -2090897, -2090926, -2090964, -2090987, -2091028, -2091041, -2091885, -2091922, -2091950, -2091986, -2092013, -2092046, -2092081, -2092109, -2092142, -2092177, -2092228, -2092547, -2092580, -2094019, -2094084, -2095101, -2095172, -2095389, -2095428, -2095645, -2095684, -2095901, -2095940, -2096061, -2096147, -2096210, -2096244, -2096277, -2096307, -2096381, -2096405, -2096434, -2096565, -2096637, -2096954, -2097045, -2097117, -2097156, -2097565, -2097572, -2098429, -2098436, -2099069, -2099076, -2099165, -2099172, -2099677, -2099716, -2100189, -2101252, -2105213, -2105361, -2105469, -2105578, -2107037, -2107125, -2107401, -2109098, -2109237, -2109770, -2109821, -2109973, -2110365, -2112021, -2113445, -2113501, -2117636, -2118589, -2118660, -2120253, -2121732, -2122749, -2122762, -2122909, -2123268, -2123817, -2123844, -2124105, -2124157, -2125828, -2126813, -2126833, -2126852, -2128029, -2128132, -2128401, -2128425, -2128605, -2129920, -2131201, -2132484, -2135005, -2135048, -2135389, -2162692, -2162909, -2162948, -2163005, -2163012, -2164445, -2164452, -2164541, -2164612, -2164669, -2164708, -2165469, -2165489, -2165514, -2165789, -2170884, -2171594, -2171805, -2171889, -2171908, -2172765, -2172913, -2172957, -2174980, -2176797, -2176964, -2177053, -2179076, -2179109, -2179229, -2179237, -2179325, -2179461, -2179588, -2179741, -2179748, -2179869, -2179876, -2180765, -2180869, -2180989, -2181093, -2181130, -2181405, -2181649, -2181949, -2182148, -2183082, -2183153, -2183197, -2187268, -2189021, -2189105, -2189316, -2190045, -2190090, -2190340, -2190973, -2191114, -2191389, -2195460, -2197821, -2214922, -2215933, -2228230, -2228261, -2228294, -2228324, -2230021, -2230513, -2230749, -2230858, -2231496, -2231837, -2232325, -2232390, -2232420, -2233862, -2233957, -2234086, -2234149, -2234225, -2234298, -2234321, -2234461, -2234884, -2235709, -2235912, -2236253, -2236421, -2236516, -2237669, -2237830, -2237861, -2238141, -2238152, -2238481, -2238621, -2240517, -2240582, -2240612, -2242150, -2242245, -2242534, -2242596, -2242737, -2242877, -2243080, -2243421, -2281476, -2282853, -2282886, -2282917, -2282950, -2283013, -2283206, -2283237, -2283293, -2283528, -2283869, -2359300, -2387453, -2392073, -2395261, -2395665, -2395805, -2490372, -2524669, -2949124, -2967357, -3006468, -3008701, -3009028, -3009062, -3010557, -3011045, -3011171, -3011613, -3538948, -3539037, -3801109, -3808989, -3809301, -3810557, -3810613, -3812518, -3812581, -3812693, -3812774, -3812986, -3813221, -3813493, -3813541, -3813781, -3814725, -3814869, -3816413, -3817493, -3819589, -3819701, -3819741, -3825685, -3828477, -3828746, -3829341, -3833856, -3834689, -3835520, -3836353, -3836605, -3836609, -3837184, -3838017, -3838848, -3838909, -3838912, -3839005, -3839040, -3839101, -3839136, -3839229, -3839264, -3839421, -3839424, -3839681, -3839837, -3839841, -3839901, -3839905, -3840157, -3840161, -3840512, -3841345, -3842176, -3842269, -3842272, -3842429, -3842464, -3842749, -3842752, -3843005, -3843009, -3843840, -3843933, -3843936, -3844093, -3844096, -3844285, -3844288, -3844349, -3844416, -3844669, -3844673, -3845504, -3846337, -3847168, -3848001, -3848832, -3849665, -3850496, -3851329, -3852160, -3852993, -3853824, -3854657, -3855581, -3855616, -3856434, -3856449, -3857266, -3857281, -3857472, -3858290, -3858305, -3859122, -3859137, -3859328, -3860146, -3860161, -3860978, -3860993, -3861184, -3862002, -3862017, -3862834, -3862849, -3863040, -3863858, -3863873, -3864690, -3864705, -3864896, -3864929, -3864989, -3865032, -3866653, -4046852, -4047005, -4047012, -4047901, -4047908, -4047997, -4048004, -4048061, -4048100, -4048157, -4048164, -4048509, -4048516, -4048669, -4048676, -4048733, -4048740, -4048797, -4048964, -4049021, -4049124, -4049181, -4049188, -4049245, -4049252, -4049309, -4049316, -4049437, -4049444, -4049533, -4049540, -4049597, -4049636, -4049693, -4049700, -4049757, -4049764, -4049821, -4049828, -4049885, -4049892, -4049949, -4049956, -4050045, -4050052, -4050109, -4050148, -4050301, -4050308, -4050557, -4050564, -4050717, -4050724, -4050877, -4050884, -4050941, -4050948, -4051293, -4051300, -4051869, -4052004, -4052125, -4052132, -4052317, -4052324, -4052893, -4054546, -4054621, -4063253, -4064669, -4064789, -4067997, -4068373, -4068861, -4068917, -4069373, -4069429, -4069917, -4069941, -4070429, -4071434, -4071805, -4071957, -4072957, -4072981, -4074909, -4075029, -4076413, -4078805, -4079741, -4080149, -4081533, -4081685, -4081981, -4082197, -4082269, -4087829, -4088893, -4089365, -4089565, -4089589, -4091837, -4091925, -4092573, -4092949, -4094141, -4094165, -4094333, -4094997, -4095549, -4096021, -4098045, -4098069, -4098109, -4098133, -4103965, -4103989, -4104125, -4104213, -4106205, -4106261, -4106397, -4106773, -4107549, -4112245, -4114493, -4114613, -4114973, -4116501, -4118749, -4120597, -4124317, -4194308, -5561085, -5562372, -5695165, -5695492, -5702621, -6225924, -6243293, -29360186, -29360221, -29361178, -29364253, -29368325, -29376029, -31457308, -33554397, -33554460, -35651549, -//--Autogenerated -- end of section automatically generated -}; - -const int maxUnicode = 0x10ffff; -const int maskCategory = 0x1F; -const int nRanges = ELEMENTS(catRanges); - -} - -// Each element in catRanges is the start of a range of Unicode characters in -// one general category. -// The value is comprised of a 21-bit character value shifted 5 bits and a 5 bit -// category matching the CharacterCategory enumeration. -// Initial version has 3249 entries and adds about 13K to the executable. -// The array is in ascending order so can be searched using binary search. -// Therefore the average call takes log2(3249) = 12 comparisons. -// For speed, it may be useful to make a linear table for the common values, -// possibly for 0..0xff for most Western European text or 0..0xfff for most -// alphabetic languages. - -CharacterCategory CategoriseCharacter(int character) { - if (character < 0 || character > maxUnicode) - return ccCn; - const int baseValue = character * (maskCategory+1) + maskCategory; - const int *placeAfter = std::lower_bound(catRanges, catRanges+nRanges, baseValue); - return static_cast(*(placeAfter-1) & maskCategory); -} - -#ifdef SCI_NAMESPACE -} -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/CharacterCategory.h b/qrenderdoc/3rdparty/scintilla/lexlib/CharacterCategory.h deleted file mode 100644 index c8600504b..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/CharacterCategory.h +++ /dev/null @@ -1,31 +0,0 @@ -// Scintilla source code edit control -/** @file CharacterCategory.h - ** Returns the Unicode general category of a character. - **/ -// Copyright 2013 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CHARACTERCATEGORY_H -#define CHARACTERCATEGORY_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -enum CharacterCategory { - ccLu, ccLl, ccLt, ccLm, ccLo, - ccMn, ccMc, ccMe, - ccNd, ccNl, ccNo, - ccPc, ccPd, ccPs, ccPe, ccPi, ccPf, ccPo, - ccSm, ccSc, ccSk, ccSo, - ccZs, ccZl, ccZp, - ccCc, ccCf, ccCs, ccCo, ccCn -}; - -CharacterCategory CategoriseCharacter(int character); - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/CharacterSet.cxx b/qrenderdoc/3rdparty/scintilla/lexlib/CharacterSet.cxx deleted file mode 100644 index 55602af30..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/CharacterSet.cxx +++ /dev/null @@ -1,61 +0,0 @@ -// Scintilla source code edit control -/** @file CharacterSet.cxx - ** Simple case functions for ASCII. - ** Lexer infrastructure. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "CharacterSet.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -int CompareCaseInsensitive(const char *a, const char *b) { - while (*a && *b) { - if (*a != *b) { - char upperA = static_cast(MakeUpperCase(*a)); - char upperB = static_cast(MakeUpperCase(*b)); - if (upperA != upperB) - return upperA - upperB; - } - a++; - b++; - } - // Either *a or *b is nul - return *a - *b; -} - -int CompareNCaseInsensitive(const char *a, const char *b, size_t len) { - while (*a && *b && len) { - if (*a != *b) { - char upperA = static_cast(MakeUpperCase(*a)); - char upperB = static_cast(MakeUpperCase(*b)); - if (upperA != upperB) - return upperA - upperB; - } - a++; - b++; - len--; - } - if (len == 0) - return 0; - else - // Either *a or *b is nul - return *a - *b; -} - -#ifdef SCI_NAMESPACE -} -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/CharacterSet.h b/qrenderdoc/3rdparty/scintilla/lexlib/CharacterSet.h deleted file mode 100644 index 183fbe421..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/CharacterSet.h +++ /dev/null @@ -1,184 +0,0 @@ -// Scintilla source code edit control -/** @file CharacterSet.h - ** Encapsulates a set of characters. Used to test if a character is within a set. - **/ -// Copyright 2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CHARACTERSET_H -#define CHARACTERSET_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class CharacterSet { - int size; - bool valueAfter; - bool *bset; -public: - enum setBase { - setNone=0, - setLower=1, - setUpper=2, - setDigits=4, - setAlpha=setLower|setUpper, - setAlphaNum=setAlpha|setDigits - }; - CharacterSet(setBase base=setNone, const char *initialSet="", int size_=0x80, bool valueAfter_=false) { - size = size_; - valueAfter = valueAfter_; - bset = new bool[size]; - for (int i=0; i < size; i++) { - bset[i] = false; - } - AddString(initialSet); - if (base & setLower) - AddString("abcdefghijklmnopqrstuvwxyz"); - if (base & setUpper) - AddString("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - if (base & setDigits) - AddString("0123456789"); - } - CharacterSet(const CharacterSet &other) { - size = other.size; - valueAfter = other.valueAfter; - bset = new bool[size]; - for (int i=0; i < size; i++) { - bset[i] = other.bset[i]; - } - } - ~CharacterSet() { - delete []bset; - bset = 0; - size = 0; - } - CharacterSet &operator=(const CharacterSet &other) { - if (this != &other) { - bool *bsetNew = new bool[other.size]; - for (int i=0; i < other.size; i++) { - bsetNew[i] = other.bset[i]; - } - delete []bset; - size = other.size; - valueAfter = other.valueAfter; - bset = bsetNew; - } - return *this; - } - void Add(int val) { - assert(val >= 0); - assert(val < size); - bset[val] = true; - } - void AddString(const char *setToAdd) { - for (const char *cp=setToAdd; *cp; cp++) { - int val = static_cast(*cp); - assert(val >= 0); - assert(val < size); - bset[val] = true; - } - } - bool Contains(int val) const { - assert(val >= 0); - if (val < 0) return false; - return (val < size) ? bset[val] : valueAfter; - } -}; - -// Functions for classifying characters - -inline bool IsASpace(int ch) { - return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); -} - -inline bool IsASpaceOrTab(int ch) { - return (ch == ' ') || (ch == '\t'); -} - -inline bool IsADigit(int ch) { - return (ch >= '0') && (ch <= '9'); -} - -inline bool IsADigit(int ch, int base) { - if (base <= 10) { - return (ch >= '0') && (ch < '0' + base); - } else { - return ((ch >= '0') && (ch <= '9')) || - ((ch >= 'A') && (ch < 'A' + base - 10)) || - ((ch >= 'a') && (ch < 'a' + base - 10)); - } -} - -inline bool IsASCII(int ch) { - return (ch >= 0) && (ch < 0x80); -} - -inline bool IsLowerCase(int ch) { - return (ch >= 'a') && (ch <= 'z'); -} - -inline bool IsUpperCase(int ch) { - return (ch >= 'A') && (ch <= 'Z'); -} - -inline bool IsAlphaNumeric(int ch) { - return - ((ch >= '0') && (ch <= '9')) || - ((ch >= 'a') && (ch <= 'z')) || - ((ch >= 'A') && (ch <= 'Z')); -} - -/** - * Check if a character is a space. - * This is ASCII specific but is safe with chars >= 0x80. - */ -inline bool isspacechar(int ch) { - return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); -} - -inline bool iswordchar(int ch) { - return IsAlphaNumeric(ch) || ch == '.' || ch == '_'; -} - -inline bool iswordstart(int ch) { - return IsAlphaNumeric(ch) || ch == '_'; -} - -inline bool isoperator(int ch) { - if (IsAlphaNumeric(ch)) - return false; - if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || - ch == '(' || ch == ')' || ch == '-' || ch == '+' || - ch == '=' || ch == '|' || ch == '{' || ch == '}' || - ch == '[' || ch == ']' || ch == ':' || ch == ';' || - ch == '<' || ch == '>' || ch == ',' || ch == '/' || - ch == '?' || ch == '!' || ch == '.' || ch == '~') - return true; - return false; -} - -// Simple case functions for ASCII. - -inline int MakeUpperCase(int ch) { - if (ch < 'a' || ch > 'z') - return ch; - else - return static_cast(ch - 'a' + 'A'); -} - -inline int MakeLowerCase(int ch) { - if (ch < 'A' || ch > 'Z') - return ch; - else - return ch - 'A' + 'a'; -} - -int CompareCaseInsensitive(const char *a, const char *b); -int CompareNCaseInsensitive(const char *a, const char *b, size_t len); - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/LexAccessor.h b/qrenderdoc/3rdparty/scintilla/lexlib/LexAccessor.h deleted file mode 100644 index f2cce50bd..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/LexAccessor.h +++ /dev/null @@ -1,204 +0,0 @@ -// Scintilla source code edit control -/** @file LexAccessor.h - ** Interfaces between Scintilla and lexers. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef LEXACCESSOR_H -#define LEXACCESSOR_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -enum EncodingType { enc8bit, encUnicode, encDBCS }; - -class LexAccessor { -private: - IDocument *pAccess; - enum {extremePosition=0x7FFFFFFF}; - /** @a bufferSize is a trade off between time taken to copy the characters - * and retrieval overhead. - * @a slopSize positions the buffer before the desired position - * in case there is some backtracking. */ - enum {bufferSize=4000, slopSize=bufferSize/8}; - char buf[bufferSize+1]; - Sci_Position startPos; - Sci_Position endPos; - int codePage; - enum EncodingType encodingType; - Sci_Position lenDoc; - char styleBuf[bufferSize]; - Sci_Position validLen; - Sci_PositionU startSeg; - Sci_Position startPosStyling; - int documentVersion; - - void Fill(Sci_Position position) { - startPos = position - slopSize; - if (startPos + bufferSize > lenDoc) - startPos = lenDoc - bufferSize; - if (startPos < 0) - startPos = 0; - endPos = startPos + bufferSize; - if (endPos > lenDoc) - endPos = lenDoc; - - pAccess->GetCharRange(buf, startPos, endPos-startPos); - buf[endPos-startPos] = '\0'; - } - -public: - explicit LexAccessor(IDocument *pAccess_) : - pAccess(pAccess_), startPos(extremePosition), endPos(0), - codePage(pAccess->CodePage()), - encodingType(enc8bit), - lenDoc(pAccess->Length()), - validLen(0), - startSeg(0), startPosStyling(0), - documentVersion(pAccess->Version()) { - // Prevent warnings by static analyzers about uninitialized buf and styleBuf. - buf[0] = 0; - styleBuf[0] = 0; - switch (codePage) { - case 65001: - encodingType = encUnicode; - break; - case 932: - case 936: - case 949: - case 950: - case 1361: - encodingType = encDBCS; - } - } - char operator[](Sci_Position position) { - if (position < startPos || position >= endPos) { - Fill(position); - } - return buf[position - startPos]; - } - IDocumentWithLineEnd *MultiByteAccess() const { - if (documentVersion >= dvLineEnd) { - return static_cast(pAccess); - } - return 0; - } - /** Safe version of operator[], returning a defined value for invalid position. */ - char SafeGetCharAt(Sci_Position position, char chDefault=' ') { - if (position < startPos || position >= endPos) { - Fill(position); - if (position < startPos || position >= endPos) { - // Position is outside range of document - return chDefault; - } - } - return buf[position - startPos]; - } - bool IsLeadByte(char ch) const { - return pAccess->IsDBCSLeadByte(ch); - } - EncodingType Encoding() const { - return encodingType; - } - bool Match(Sci_Position pos, const char *s) { - for (int i=0; *s; i++) { - if (*s != SafeGetCharAt(pos+i)) - return false; - s++; - } - return true; - } - char StyleAt(Sci_Position position) const { - return static_cast(pAccess->StyleAt(position)); - } - Sci_Position GetLine(Sci_Position position) const { - return pAccess->LineFromPosition(position); - } - Sci_Position LineStart(Sci_Position line) const { - return pAccess->LineStart(line); - } - Sci_Position LineEnd(Sci_Position line) { - if (documentVersion >= dvLineEnd) { - return (static_cast(pAccess))->LineEnd(line); - } else { - // Old interface means only '\r', '\n' and '\r\n' line ends. - Sci_Position startNext = pAccess->LineStart(line+1); - char chLineEnd = SafeGetCharAt(startNext-1); - if (chLineEnd == '\n' && (SafeGetCharAt(startNext-2) == '\r')) - return startNext - 2; - else - return startNext - 1; - } - } - int LevelAt(Sci_Position line) const { - return pAccess->GetLevel(line); - } - Sci_Position Length() const { - return lenDoc; - } - void Flush() { - if (validLen > 0) { - pAccess->SetStyles(validLen, styleBuf); - startPosStyling += validLen; - validLen = 0; - } - } - int GetLineState(Sci_Position line) const { - return pAccess->GetLineState(line); - } - int SetLineState(Sci_Position line, int state) { - return pAccess->SetLineState(line, state); - } - // Style setting - void StartAt(Sci_PositionU start) { - pAccess->StartStyling(start, '\377'); - startPosStyling = start; - } - Sci_PositionU GetStartSegment() const { - return startSeg; - } - void StartSegment(Sci_PositionU pos) { - startSeg = pos; - } - void ColourTo(Sci_PositionU pos, int chAttr) { - // Only perform styling if non empty range - if (pos != startSeg - 1) { - assert(pos >= startSeg); - if (pos < startSeg) { - return; - } - - if (validLen + (pos - startSeg + 1) >= bufferSize) - Flush(); - if (validLen + (pos - startSeg + 1) >= bufferSize) { - // Too big for buffer so send directly - pAccess->SetStyleFor(pos - startSeg + 1, static_cast(chAttr)); - } else { - for (Sci_PositionU i = startSeg; i <= pos; i++) { - assert((startPosStyling + validLen) < Length()); - styleBuf[validLen++] = static_cast(chAttr); - } - } - } - startSeg = pos+1; - } - void SetLevel(Sci_Position line, int level) { - pAccess->SetLevel(line, level); - } - void IndicatorFill(Sci_Position start, Sci_Position end, int indicator, int value) { - pAccess->DecorationSetCurrentIndicator(indicator); - pAccess->DecorationFillRange(start, value, end - start); - } - - void ChangeLexerState(Sci_Position start, Sci_Position end) { - pAccess->ChangeLexerState(start, end); - } -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/LexerBase.cxx b/qrenderdoc/3rdparty/scintilla/lexlib/LexerBase.cxx deleted file mode 100644 index d887b3c6c..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/LexerBase.cxx +++ /dev/null @@ -1,92 +0,0 @@ -// Scintilla source code edit control -/** @file LexerBase.cxx - ** A simple lexer with no state. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "LexerModule.h" -#include "LexerBase.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -LexerBase::LexerBase() { - for (int wl = 0; wl < numWordLists; wl++) - keyWordLists[wl] = new WordList; - keyWordLists[numWordLists] = 0; -} - -LexerBase::~LexerBase() { - for (int wl = 0; wl < numWordLists; wl++) { - delete keyWordLists[wl]; - keyWordLists[wl] = 0; - } - keyWordLists[numWordLists] = 0; -} - -void SCI_METHOD LexerBase::Release() { - delete this; -} - -int SCI_METHOD LexerBase::Version() const { - return lvOriginal; -} - -const char * SCI_METHOD LexerBase::PropertyNames() { - return ""; -} - -int SCI_METHOD LexerBase::PropertyType(const char *) { - return SC_TYPE_BOOLEAN; -} - -const char * SCI_METHOD LexerBase::DescribeProperty(const char *) { - return ""; -} - -Sci_Position SCI_METHOD LexerBase::PropertySet(const char *key, const char *val) { - const char *valOld = props.Get(key); - if (strcmp(val, valOld) != 0) { - props.Set(key, val); - return 0; - } else { - return -1; - } -} - -const char * SCI_METHOD LexerBase::DescribeWordListSets() { - return ""; -} - -Sci_Position SCI_METHOD LexerBase::WordListSet(int n, const char *wl) { - if (n < numWordLists) { - WordList wlNew; - wlNew.Set(wl); - if (*keyWordLists[n] != wlNew) { - keyWordLists[n]->Set(wl); - return 0; - } - } - return -1; -} - -void * SCI_METHOD LexerBase::PrivateCall(int, void *) { - return 0; -} diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/LexerBase.h b/qrenderdoc/3rdparty/scintilla/lexlib/LexerBase.h deleted file mode 100644 index d8849d2f9..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/LexerBase.h +++ /dev/null @@ -1,41 +0,0 @@ -// Scintilla source code edit control -/** @file LexerBase.h - ** A simple lexer with no state. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef LEXERBASE_H -#define LEXERBASE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -// A simple lexer with no state -class LexerBase : public ILexer { -protected: - PropSetSimple props; - enum {numWordLists=KEYWORDSET_MAX+1}; - WordList *keyWordLists[numWordLists+1]; -public: - LexerBase(); - virtual ~LexerBase(); - void SCI_METHOD Release(); - int SCI_METHOD Version() const; - const char * SCI_METHOD PropertyNames(); - int SCI_METHOD PropertyType(const char *name); - const char * SCI_METHOD DescribeProperty(const char *name); - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); - const char * SCI_METHOD DescribeWordListSets(); - Sci_Position SCI_METHOD WordListSet(int n, const char *wl); - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; - void * SCI_METHOD PrivateCall(int operation, void *pointer); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/LexerModule.cxx b/qrenderdoc/3rdparty/scintilla/lexlib/LexerModule.cxx deleted file mode 100644 index 390bae06e..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/LexerModule.cxx +++ /dev/null @@ -1,111 +0,0 @@ -// Scintilla source code edit control -/** @file LexerModule.cxx - ** Colourise for particular languages. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "LexerModule.h" -#include "LexerBase.h" -#include "LexerSimple.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -LexerModule::LexerModule(int language_, - LexerFunction fnLexer_, - const char *languageName_, - LexerFunction fnFolder_, - const char *const wordListDescriptions_[]) : - language(language_), - fnLexer(fnLexer_), - fnFolder(fnFolder_), - fnFactory(0), - wordListDescriptions(wordListDescriptions_), - languageName(languageName_) { -} - -LexerModule::LexerModule(int language_, - LexerFactoryFunction fnFactory_, - const char *languageName_, - const char * const wordListDescriptions_[]) : - language(language_), - fnLexer(0), - fnFolder(0), - fnFactory(fnFactory_), - wordListDescriptions(wordListDescriptions_), - languageName(languageName_) { -} - -int LexerModule::GetNumWordLists() const { - if (wordListDescriptions == NULL) { - return -1; - } else { - int numWordLists = 0; - - while (wordListDescriptions[numWordLists]) { - ++numWordLists; - } - - return numWordLists; - } -} - -const char *LexerModule::GetWordListDescription(int index) const { - assert(index < GetNumWordLists()); - if (!wordListDescriptions || (index >= GetNumWordLists())) { - return ""; - } else { - return wordListDescriptions[index]; - } -} - -ILexer *LexerModule::Create() const { - if (fnFactory) - return fnFactory(); - else - return new LexerSimple(this); -} - -void LexerModule::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const { - if (fnLexer) - fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler); -} - -void LexerModule::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const { - if (fnFolder) { - Sci_Position lineCurrent = styler.GetLine(startPos); - // Move back one line in case deletion wrecked current line fold state - if (lineCurrent > 0) { - lineCurrent--; - Sci_Position newStartPos = styler.LineStart(lineCurrent); - lengthDoc += startPos - newStartPos; - startPos = newStartPos; - initStyle = 0; - if (startPos > 0) { - initStyle = styler.StyleAt(startPos - 1); - } - } - fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler); - } -} diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/LexerModule.h b/qrenderdoc/3rdparty/scintilla/lexlib/LexerModule.h deleted file mode 100644 index a561cf151..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/LexerModule.h +++ /dev/null @@ -1,82 +0,0 @@ -// Scintilla source code edit control -/** @file LexerModule.h - ** Colourise for particular languages. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef LEXERMODULE_H -#define LEXERMODULE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class Accessor; -class WordList; - -typedef void (*LexerFunction)(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler); -typedef ILexer *(*LexerFactoryFunction)(); - -/** - * A LexerModule is responsible for lexing and folding a particular language. - * The class maintains a list of LexerModules which can be searched to find a - * module appropriate to a particular language. - */ -class LexerModule { -protected: - int language; - LexerFunction fnLexer; - LexerFunction fnFolder; - LexerFactoryFunction fnFactory; - const char * const * wordListDescriptions; - -public: - const char *languageName; - LexerModule(int language_, - LexerFunction fnLexer_, - const char *languageName_=0, - LexerFunction fnFolder_=0, - const char * const wordListDescriptions_[] = NULL); - LexerModule(int language_, - LexerFactoryFunction fnFactory_, - const char *languageName_, - const char * const wordListDescriptions_[] = NULL); - virtual ~LexerModule() { - } - int GetLanguage() const { return language; } - - // -1 is returned if no WordList information is available - int GetNumWordLists() const; - const char *GetWordListDescription(int index) const; - - ILexer *Create() const; - - virtual void Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) const; - virtual void Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) const; - - friend class Catalogue; -}; - -inline int Maximum(int a, int b) { - return (a > b) ? a : b; -} - -// Shut up annoying Visual C++ warnings: -#ifdef _MSC_VER -#pragma warning(disable: 4244 4456 4457) -#endif - -// Turn off shadow warnings for lexers as may be maintained by others -#if defined(__GNUC__) -#pragma GCC diagnostic ignored "-Wshadow" -#endif - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/LexerNoExceptions.cxx b/qrenderdoc/3rdparty/scintilla/lexlib/LexerNoExceptions.cxx deleted file mode 100644 index 30c291bcb..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/LexerNoExceptions.cxx +++ /dev/null @@ -1,68 +0,0 @@ -// Scintilla source code edit control -/** @file LexerNoExceptions.cxx - ** A simple lexer with no state which does not throw exceptions so can be used in an external lexer. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "LexerModule.h" -#include "LexerBase.h" -#include "LexerNoExceptions.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -Sci_Position SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) { - try { - return LexerBase::PropertySet(key, val); - } catch (...) { - // Should not throw into caller as may be compiled with different compiler or options - } - return -1; -} - -Sci_Position SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) { - try { - return LexerBase::WordListSet(n, wl); - } catch (...) { - // Should not throw into caller as may be compiled with different compiler or options - } - return -1; -} - -void SCI_METHOD LexerNoExceptions::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - try { - Accessor astyler(pAccess, &props); - Lexer(startPos, length, initStyle, pAccess, astyler); - astyler.Flush(); - } catch (...) { - // Should not throw into caller as may be compiled with different compiler or options - pAccess->SetErrorStatus(SC_STATUS_FAILURE); - } -} -void SCI_METHOD LexerNoExceptions::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - try { - Accessor astyler(pAccess, &props); - Folder(startPos, length, initStyle, pAccess, astyler); - astyler.Flush(); - } catch (...) { - // Should not throw into caller as may be compiled with different compiler or options - pAccess->SetErrorStatus(SC_STATUS_FAILURE); - } -} diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/LexerNoExceptions.h b/qrenderdoc/3rdparty/scintilla/lexlib/LexerNoExceptions.h deleted file mode 100644 index ba24a8eb7..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/LexerNoExceptions.h +++ /dev/null @@ -1,32 +0,0 @@ -// Scintilla source code edit control -/** @file LexerNoExceptions.h - ** A simple lexer with no state. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef LEXERNOEXCEPTIONS_H -#define LEXERNOEXCEPTIONS_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -// A simple lexer with no state -class LexerNoExceptions : public LexerBase { -public: - // TODO Also need to prevent exceptions in constructor and destructor - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); - Sci_Position SCI_METHOD WordListSet(int n, const char *wl); - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *); - - virtual void Lexer(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; - virtual void Folder(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/LexerSimple.cxx b/qrenderdoc/3rdparty/scintilla/lexlib/LexerSimple.cxx deleted file mode 100644 index 437c96f78..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/LexerSimple.cxx +++ /dev/null @@ -1,57 +0,0 @@ -// Scintilla source code edit control -/** @file LexerSimple.cxx - ** A simple lexer with no state. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "LexerModule.h" -#include "LexerBase.h" -#include "LexerSimple.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -LexerSimple::LexerSimple(const LexerModule *module_) : module(module_) { - for (int wl = 0; wl < module->GetNumWordLists(); wl++) { - if (!wordLists.empty()) - wordLists += "\n"; - wordLists += module->GetWordListDescription(wl); - } -} - -const char * SCI_METHOD LexerSimple::DescribeWordListSets() { - return wordLists.c_str(); -} - -void SCI_METHOD LexerSimple::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { - Accessor astyler(pAccess, &props); - module->Lex(startPos, lengthDoc, initStyle, keyWordLists, astyler); - astyler.Flush(); -} - -void SCI_METHOD LexerSimple::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { - if (props.GetInt("fold")) { - Accessor astyler(pAccess, &props); - module->Fold(startPos, lengthDoc, initStyle, keyWordLists, astyler); - astyler.Flush(); - } -} diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/LexerSimple.h b/qrenderdoc/3rdparty/scintilla/lexlib/LexerSimple.h deleted file mode 100644 index a88c409cb..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/LexerSimple.h +++ /dev/null @@ -1,30 +0,0 @@ -// Scintilla source code edit control -/** @file LexerSimple.h - ** A simple lexer with no state. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef LEXERSIMPLE_H -#define LEXERSIMPLE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -// A simple lexer with no state -class LexerSimple : public LexerBase { - const LexerModule *module; - std::string wordLists; -public: - explicit LexerSimple(const LexerModule *module_); - const char * SCI_METHOD DescribeWordListSets(); - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/OptionSet.h b/qrenderdoc/3rdparty/scintilla/lexlib/OptionSet.h deleted file mode 100644 index 2935a2089..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/OptionSet.h +++ /dev/null @@ -1,142 +0,0 @@ -// Scintilla source code edit control -/** @file OptionSet.h - ** Manage descriptive information about an options struct for a lexer. - ** Hold the names, positions, and descriptions of boolean, integer and string options and - ** allow setting options and retrieving metadata about the options. - **/ -// Copyright 2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef OPTIONSET_H -#define OPTIONSET_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -template -class OptionSet { - typedef T Target; - typedef bool T::*plcob; - typedef int T::*plcoi; - typedef std::string T::*plcos; - struct Option { - int opType; - union { - plcob pb; - plcoi pi; - plcos ps; - }; - std::string description; - Option() : - opType(SC_TYPE_BOOLEAN), pb(0), description("") { - } - Option(plcob pb_, std::string description_="") : - opType(SC_TYPE_BOOLEAN), pb(pb_), description(description_) { - } - Option(plcoi pi_, std::string description_) : - opType(SC_TYPE_INTEGER), pi(pi_), description(description_) { - } - Option(plcos ps_, std::string description_) : - opType(SC_TYPE_STRING), ps(ps_), description(description_) { - } - bool Set(T *base, const char *val) const { - switch (opType) { - case SC_TYPE_BOOLEAN: { - bool option = atoi(val) != 0; - if ((*base).*pb != option) { - (*base).*pb = option; - return true; - } - break; - } - case SC_TYPE_INTEGER: { - int option = atoi(val); - if ((*base).*pi != option) { - (*base).*pi = option; - return true; - } - break; - } - case SC_TYPE_STRING: { - if ((*base).*ps != val) { - (*base).*ps = val; - return true; - } - break; - } - } - return false; - } - }; - typedef std::map OptionMap; - OptionMap nameToDef; - std::string names; - std::string wordLists; - - void AppendName(const char *name) { - if (!names.empty()) - names += "\n"; - names += name; - } -public: - virtual ~OptionSet() { - } - void DefineProperty(const char *name, plcob pb, std::string description="") { - nameToDef[name] = Option(pb, description); - AppendName(name); - } - void DefineProperty(const char *name, plcoi pi, std::string description="") { - nameToDef[name] = Option(pi, description); - AppendName(name); - } - void DefineProperty(const char *name, plcos ps, std::string description="") { - nameToDef[name] = Option(ps, description); - AppendName(name); - } - const char *PropertyNames() const { - return names.c_str(); - } - int PropertyType(const char *name) { - typename OptionMap::iterator it = nameToDef.find(name); - if (it != nameToDef.end()) { - return it->second.opType; - } - return SC_TYPE_BOOLEAN; - } - const char *DescribeProperty(const char *name) { - typename OptionMap::iterator it = nameToDef.find(name); - if (it != nameToDef.end()) { - return it->second.description.c_str(); - } - return ""; - } - - bool PropertySet(T *base, const char *name, const char *val) { - typename OptionMap::iterator it = nameToDef.find(name); - if (it != nameToDef.end()) { - return it->second.Set(base, val); - } - return false; - } - - void DefineWordListSets(const char * const wordListDescriptions[]) { - if (wordListDescriptions) { - for (size_t wl = 0; wordListDescriptions[wl]; wl++) { - if (!wordLists.empty()) - wordLists += "\n"; - wordLists += wordListDescriptions[wl]; - } - } - } - - const char *DescribeWordListSets() const { - return wordLists.c_str(); - } -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/PropSetSimple.cxx b/qrenderdoc/3rdparty/scintilla/lexlib/PropSetSimple.cxx deleted file mode 100644 index 6592d70eb..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/PropSetSimple.cxx +++ /dev/null @@ -1,156 +0,0 @@ -// SciTE - Scintilla based Text Editor -/** @file PropSetSimple.cxx - ** A Java style properties file module. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -// Maintain a dictionary of properties - -#include -#include -#include - -#include -#include - -#include "PropSetSimple.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -typedef std::map mapss; - -PropSetSimple::PropSetSimple() { - mapss *props = new mapss; - impl = static_cast(props); -} - -PropSetSimple::~PropSetSimple() { - mapss *props = static_cast(impl); - delete props; - impl = 0; -} - -void PropSetSimple::Set(const char *key, const char *val, int lenKey, int lenVal) { - mapss *props = static_cast(impl); - if (!*key) // Empty keys are not supported - return; - if (lenKey == -1) - lenKey = static_cast(strlen(key)); - if (lenVal == -1) - lenVal = static_cast(strlen(val)); - (*props)[std::string(key, lenKey)] = std::string(val, lenVal); -} - -static bool IsASpaceCharacter(unsigned int ch) { - return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); -} - -void PropSetSimple::Set(const char *keyVal) { - while (IsASpaceCharacter(*keyVal)) - keyVal++; - const char *endVal = keyVal; - while (*endVal && (*endVal != '\n')) - endVal++; - const char *eqAt = strchr(keyVal, '='); - if (eqAt) { - Set(keyVal, eqAt + 1, static_cast(eqAt-keyVal), - static_cast(endVal - eqAt - 1)); - } else if (*keyVal) { // No '=' so assume '=1' - Set(keyVal, "1", static_cast(endVal-keyVal), 1); - } -} - -void PropSetSimple::SetMultiple(const char *s) { - const char *eol = strchr(s, '\n'); - while (eol) { - Set(s); - s = eol + 1; - eol = strchr(s, '\n'); - } - Set(s); -} - -const char *PropSetSimple::Get(const char *key) const { - mapss *props = static_cast(impl); - mapss::const_iterator keyPos = props->find(std::string(key)); - if (keyPos != props->end()) { - return keyPos->second.c_str(); - } else { - return ""; - } -} - -// There is some inconsistency between GetExpanded("foo") and Expand("$(foo)"). -// A solution is to keep a stack of variables that have been expanded, so that -// recursive expansions can be skipped. For now I'll just use the C++ stack -// for that, through a recursive function and a simple chain of pointers. - -struct VarChain { - VarChain(const char *var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {} - - bool contains(const char *testVar) const { - return (var && (0 == strcmp(var, testVar))) - || (link && link->contains(testVar)); - } - - const char *var; - const VarChain *link; -}; - -static int ExpandAllInPlace(const PropSetSimple &props, std::string &withVars, int maxExpands, const VarChain &blankVars) { - size_t varStart = withVars.find("$("); - while ((varStart != std::string::npos) && (maxExpands > 0)) { - size_t varEnd = withVars.find(")", varStart+2); - if (varEnd == std::string::npos) { - break; - } - - // For consistency, when we see '$(ab$(cde))', expand the inner variable first, - // regardless whether there is actually a degenerate variable named 'ab$(cde'. - size_t innerVarStart = withVars.find("$(", varStart+2); - while ((innerVarStart != std::string::npos) && (innerVarStart > varStart) && (innerVarStart < varEnd)) { - varStart = innerVarStart; - innerVarStart = withVars.find("$(", varStart+2); - } - - std::string var(withVars.c_str(), varStart + 2, varEnd - varStart - 2); - std::string val = props.Get(var.c_str()); - - if (blankVars.contains(var.c_str())) { - val = ""; // treat blankVar as an empty string (e.g. to block self-reference) - } - - if (--maxExpands >= 0) { - maxExpands = ExpandAllInPlace(props, val, maxExpands, VarChain(var.c_str(), &blankVars)); - } - - withVars.erase(varStart, varEnd-varStart+1); - withVars.insert(varStart, val.c_str(), val.length()); - - varStart = withVars.find("$("); - } - - return maxExpands; -} - -int PropSetSimple::GetExpanded(const char *key, char *result) const { - std::string val = Get(key); - ExpandAllInPlace(*this, val, 100, VarChain(key)); - const int n = static_cast(val.size()); - if (result) { - memcpy(result, val.c_str(), n+1); - } - return n; // Not including NUL -} - -int PropSetSimple::GetInt(const char *key, int defaultValue) const { - std::string val = Get(key); - ExpandAllInPlace(*this, val, 100, VarChain(key)); - if (!val.empty()) { - return atoi(val.c_str()); - } - return defaultValue; -} diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/PropSetSimple.h b/qrenderdoc/3rdparty/scintilla/lexlib/PropSetSimple.h deleted file mode 100644 index 8ca741f03..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/PropSetSimple.h +++ /dev/null @@ -1,32 +0,0 @@ -// Scintilla source code edit control -/** @file PropSetSimple.h - ** A basic string to string map. - **/ -// Copyright 1998-2009 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef PROPSETSIMPLE_H -#define PROPSETSIMPLE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class PropSetSimple { - void *impl; - void Set(const char *keyVal); -public: - PropSetSimple(); - virtual ~PropSetSimple(); - void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1); - void SetMultiple(const char *); - const char *Get(const char *key) const; - int GetExpanded(const char *key, char *result) const; - int GetInt(const char *key, int defaultValue=0) const; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/SparseState.h b/qrenderdoc/3rdparty/scintilla/lexlib/SparseState.h deleted file mode 100644 index e767d6710..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/SparseState.h +++ /dev/null @@ -1,110 +0,0 @@ -// Scintilla source code edit control -/** @file SparseState.h - ** Hold lexer state that may change rarely. - ** This is often per-line state such as whether a particular type of section has been entered. - ** A state continues until it is changed. - **/ -// Copyright 2011 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef SPARSESTATE_H -#define SPARSESTATE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -template -class SparseState { - struct State { - int position; - T value; - State(int position_, T value_) : position(position_), value(value_) { - } - inline bool operator<(const State &other) const { - return position < other.position; - } - inline bool operator==(const State &other) const { - return (position == other.position) && (value == other.value); - } - }; - int positionFirst; - typedef std::vector stateVector; - stateVector states; - - typename stateVector::iterator Find(int position) { - State searchValue(position, T()); - return std::lower_bound(states.begin(), states.end(), searchValue); - } - -public: - explicit SparseState(int positionFirst_=-1) { - positionFirst = positionFirst_; - } - void Set(int position, T value) { - Delete(position); - if (states.empty() || (value != states[states.size()-1].value)) { - states.push_back(State(position, value)); - } - } - T ValueAt(int position) { - if (states.empty()) - return T(); - if (position < states[0].position) - return T(); - typename stateVector::iterator low = Find(position); - if (low == states.end()) { - return states[states.size()-1].value; - } else { - if (low->position > position) { - --low; - } - return low->value; - } - } - bool Delete(int position) { - typename stateVector::iterator low = Find(position); - if (low != states.end()) { - states.erase(low, states.end()); - return true; - } - return false; - } - size_t size() const { - return states.size(); - } - - // Returns true if Merge caused a significant change - bool Merge(const SparseState &other, int ignoreAfter) { - // Changes caused beyond ignoreAfter are not significant - Delete(ignoreAfter+1); - - bool different = true; - bool changed = false; - typename stateVector::iterator low = Find(other.positionFirst); - if (static_cast(states.end() - low) == other.states.size()) { - // Same number in other as after positionFirst in this - different = !std::equal(low, states.end(), other.states.begin()); - } - if (different) { - if (low != states.end()) { - states.erase(low, states.end()); - changed = true; - } - typename stateVector::const_iterator startOther = other.states.begin(); - if (!states.empty() && !other.states.empty() && states.back().value == startOther->value) - ++startOther; - if (startOther != other.states.end()) { - states.insert(states.end(), startOther, other.states.end()); - changed = true; - } - } - return changed; - } -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/StringCopy.h b/qrenderdoc/3rdparty/scintilla/lexlib/StringCopy.h deleted file mode 100644 index 1812b4e35..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/StringCopy.h +++ /dev/null @@ -1,36 +0,0 @@ -// Scintilla source code edit control -/** @file StringCopy.h - ** Safe string copy function which always NUL terminates. - ** ELEMENTS macro for determining array sizes. - **/ -// Copyright 2013 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef STRINGCOPY_H -#define STRINGCOPY_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -// Safer version of string copy functions like strcpy, wcsncpy, etc. -// Instantiate over fixed length strings of both char and wchar_t. -// May truncate if source doesn't fit into dest with room for NUL. - -template -void StringCopy(T (&dest)[count], const T* source) { - for (size_t i=0; i -// This file is in the public domain. - -#include -#include -#include -#include -#include - -#include "ILexer.h" - -#include "LexAccessor.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "CharacterSet.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -bool StyleContext::MatchIgnoreCase(const char *s) { - if (MakeLowerCase(ch) != static_cast(*s)) - return false; - s++; - if (MakeLowerCase(chNext) != static_cast(*s)) - return false; - s++; - for (int n = 2; *s; n++) { - if (static_cast(*s) != - MakeLowerCase(static_cast(styler.SafeGetCharAt(currentPos + n, 0)))) - return false; - s++; - } - return true; -} - -static void getRange(Sci_PositionU start, - Sci_PositionU end, - LexAccessor &styler, - char *s, - Sci_PositionU len) { - Sci_PositionU i = 0; - while ((i < end - start + 1) && (i < len-1)) { - s[i] = styler[start + i]; - i++; - } - s[i] = '\0'; -} - -void StyleContext::GetCurrent(char *s, Sci_PositionU len) { - getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len); -} - -static void getRangeLowered(Sci_PositionU start, - Sci_PositionU end, - LexAccessor &styler, - char *s, - Sci_PositionU len) { - Sci_PositionU i = 0; - while ((i < end - start + 1) && (i < len-1)) { - s[i] = static_cast(tolower(styler[start + i])); - i++; - } - s[i] = '\0'; -} - -void StyleContext::GetCurrentLowered(char *s, Sci_PositionU len) { - getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len); -} diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/StyleContext.h b/qrenderdoc/3rdparty/scintilla/lexlib/StyleContext.h deleted file mode 100644 index 6cbda358e..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/StyleContext.h +++ /dev/null @@ -1,210 +0,0 @@ -// Scintilla source code edit control -/** @file StyleContext.h - ** Lexer infrastructure. - **/ -// Copyright 1998-2004 by Neil Hodgson -// This file is in the public domain. - -#ifndef STYLECONTEXT_H -#define STYLECONTEXT_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -// All languages handled so far can treat all characters >= 0x80 as one class -// which just continues the current token or starts an identifier if in default. -// DBCS treated specially as the second character can be < 0x80 and hence -// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80 -class StyleContext { - LexAccessor &styler; - IDocumentWithLineEnd *multiByteAccess; - Sci_PositionU endPos; - Sci_PositionU lengthDocument; - - // Used for optimizing GetRelativeCharacter - Sci_PositionU posRelative; - Sci_PositionU currentPosLastRelative; - Sci_Position offsetRelative; - - StyleContext &operator=(const StyleContext &); - - void GetNextChar() { - if (multiByteAccess) { - chNext = multiByteAccess->GetCharacterAndWidth(currentPos+width, &widthNext); - } else { - chNext = static_cast(styler.SafeGetCharAt(currentPos+width, 0)); - widthNext = 1; - } - // End of line determined from line end position, allowing CR, LF, - // CRLF and Unicode line ends as set by document. - if (currentLine < lineDocEnd) - atLineEnd = static_cast(currentPos) >= (lineStartNext-1); - else // Last line - atLineEnd = static_cast(currentPos) >= lineStartNext; - } - -public: - Sci_PositionU currentPos; - Sci_Position currentLine; - Sci_Position lineDocEnd; - Sci_Position lineStartNext; - bool atLineStart; - bool atLineEnd; - int state; - int chPrev; - int ch; - Sci_Position width; - int chNext; - Sci_Position widthNext; - - StyleContext(Sci_PositionU startPos, Sci_PositionU length, - int initStyle, LexAccessor &styler_, char chMask='\377') : - styler(styler_), - multiByteAccess(0), - endPos(startPos + length), - posRelative(0), - currentPosLastRelative(0x7FFFFFFF), - offsetRelative(0), - currentPos(startPos), - currentLine(-1), - lineStartNext(-1), - atLineEnd(false), - state(initStyle & chMask), // Mask off all bits which aren't in the chMask. - chPrev(0), - ch(0), - width(0), - chNext(0), - widthNext(1) { - if (styler.Encoding() != enc8bit) { - multiByteAccess = styler.MultiByteAccess(); - } - styler.StartAt(startPos /*, chMask*/); - styler.StartSegment(startPos); - currentLine = styler.GetLine(startPos); - lineStartNext = styler.LineStart(currentLine+1); - lengthDocument = static_cast(styler.Length()); - if (endPos == lengthDocument) - endPos++; - lineDocEnd = styler.GetLine(lengthDocument); - atLineStart = static_cast(styler.LineStart(currentLine)) == startPos; - - // Variable width is now 0 so GetNextChar gets the char at currentPos into chNext/widthNext - width = 0; - GetNextChar(); - ch = chNext; - width = widthNext; - - GetNextChar(); - } - void Complete() { - styler.ColourTo(currentPos - ((currentPos > lengthDocument) ? 2 : 1), state); - styler.Flush(); - } - bool More() const { - return currentPos < endPos; - } - void Forward() { - if (currentPos < endPos) { - atLineStart = atLineEnd; - if (atLineStart) { - currentLine++; - lineStartNext = styler.LineStart(currentLine+1); - } - chPrev = ch; - currentPos += width; - ch = chNext; - width = widthNext; - GetNextChar(); - } else { - atLineStart = false; - chPrev = ' '; - ch = ' '; - chNext = ' '; - atLineEnd = true; - } - } - void Forward(Sci_Position nb) { - for (Sci_Position i = 0; i < nb; i++) { - Forward(); - } - } - void ForwardBytes(Sci_Position nb) { - Sci_PositionU forwardPos = currentPos + nb; - while (forwardPos > currentPos) { - Forward(); - } - } - void ChangeState(int state_) { - state = state_; - } - void SetState(int state_) { - styler.ColourTo(currentPos - ((currentPos > lengthDocument) ? 2 : 1), state); - state = state_; - } - void ForwardSetState(int state_) { - Forward(); - styler.ColourTo(currentPos - ((currentPos > lengthDocument) ? 2 : 1), state); - state = state_; - } - Sci_Position LengthCurrent() const { - return currentPos - styler.GetStartSegment(); - } - int GetRelative(Sci_Position n) { - return static_cast(styler.SafeGetCharAt(currentPos+n, 0)); - } - int GetRelativeCharacter(Sci_Position n) { - if (n == 0) - return ch; - if (multiByteAccess) { - if ((currentPosLastRelative != currentPos) || - ((n > 0) && ((offsetRelative < 0) || (n < offsetRelative))) || - ((n < 0) && ((offsetRelative > 0) || (n > offsetRelative)))) { - posRelative = currentPos; - offsetRelative = 0; - } - Sci_Position diffRelative = n - offsetRelative; - Sci_Position posNew = multiByteAccess->GetRelativePosition(posRelative, diffRelative); - int chReturn = multiByteAccess->GetCharacterAndWidth(posNew, 0); - posRelative = posNew; - currentPosLastRelative = currentPos; - offsetRelative = n; - return chReturn; - } else { - // fast version for single byte encodings - return static_cast(styler.SafeGetCharAt(currentPos + n, 0)); - } - } - bool Match(char ch0) const { - return ch == static_cast(ch0); - } - bool Match(char ch0, char ch1) const { - return (ch == static_cast(ch0)) && (chNext == static_cast(ch1)); - } - bool Match(const char *s) { - if (ch != static_cast(*s)) - return false; - s++; - if (!*s) - return true; - if (chNext != static_cast(*s)) - return false; - s++; - for (int n=2; *s; n++) { - if (*s != styler.SafeGetCharAt(currentPos+n, 0)) - return false; - s++; - } - return true; - } - // Non-inline - bool MatchIgnoreCase(const char *s); - void GetCurrent(char *s, Sci_PositionU len); - void GetCurrentLowered(char *s, Sci_PositionU len); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/SubStyles.h b/qrenderdoc/3rdparty/scintilla/lexlib/SubStyles.h deleted file mode 100644 index f5b15e9cf..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/SubStyles.h +++ /dev/null @@ -1,178 +0,0 @@ -// Scintilla source code edit control -/** @file SubStyles.h - ** Manage substyles for a lexer. - **/ -// Copyright 2012 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef SUBSTYLES_H -#define SUBSTYLES_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class WordClassifier { - int baseStyle; - int firstStyle; - int lenStyles; - std::map wordToStyle; - -public: - - explicit WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) { - } - - void Allocate(int firstStyle_, int lenStyles_) { - firstStyle = firstStyle_; - lenStyles = lenStyles_; - wordToStyle.clear(); - } - - int Base() const { - return baseStyle; - } - - int Start() const { - return firstStyle; - } - - int Length() const { - return lenStyles; - } - - void Clear() { - firstStyle = 0; - lenStyles = 0; - wordToStyle.clear(); - } - - int ValueFor(const std::string &s) const { - std::map::const_iterator it = wordToStyle.find(s); - if (it != wordToStyle.end()) - return it->second; - else - return -1; - } - - bool IncludesStyle(int style) const { - return (style >= firstStyle) && (style < (firstStyle + lenStyles)); - } - - void SetIdentifiers(int style, const char *identifiers) { - while (*identifiers) { - const char *cpSpace = identifiers; - while (*cpSpace && !(*cpSpace == ' ' || *cpSpace == '\t' || *cpSpace == '\r' || *cpSpace == '\n')) - cpSpace++; - if (cpSpace > identifiers) { - std::string word(identifiers, cpSpace - identifiers); - wordToStyle[word] = style; - } - identifiers = cpSpace; - if (*identifiers) - identifiers++; - } - } -}; - -class SubStyles { - int classifications; - const char *baseStyles; - int styleFirst; - int stylesAvailable; - int secondaryDistance; - int allocated; - std::vector classifiers; - - int BlockFromBaseStyle(int baseStyle) const { - for (int b=0; b < classifications; b++) { - if (baseStyle == baseStyles[b]) - return b; - } - return -1; - } - - int BlockFromStyle(int style) const { - int b = 0; - for (std::vector::const_iterator it=classifiers.begin(); it != classifiers.end(); ++it) { - if (it->IncludesStyle(style)) - return b; - b++; - } - return -1; - } - -public: - - SubStyles(const char *baseStyles_, int styleFirst_, int stylesAvailable_, int secondaryDistance_) : - classifications(0), - baseStyles(baseStyles_), - styleFirst(styleFirst_), - stylesAvailable(stylesAvailable_), - secondaryDistance(secondaryDistance_), - allocated(0) { - while (baseStyles[classifications]) { - classifiers.push_back(WordClassifier(baseStyles[classifications])); - classifications++; - } - } - - int Allocate(int styleBase, int numberStyles) { - int block = BlockFromBaseStyle(styleBase); - if (block >= 0) { - if ((allocated + numberStyles) > stylesAvailable) - return -1; - int startBlock = styleFirst + allocated; - allocated += numberStyles; - classifiers[block].Allocate(startBlock, numberStyles); - return startBlock; - } else { - return -1; - } - } - - int Start(int styleBase) { - int block = BlockFromBaseStyle(styleBase); - return (block >= 0) ? classifiers[block].Start() : -1; - } - - int Length(int styleBase) { - int block = BlockFromBaseStyle(styleBase); - return (block >= 0) ? classifiers[block].Length() : 0; - } - - int BaseStyle(int subStyle) const { - int block = BlockFromStyle(subStyle); - if (block >= 0) - return classifiers[block].Base(); - else - return subStyle; - } - - int DistanceToSecondaryStyles() const { - return secondaryDistance; - } - - void SetIdentifiers(int style, const char *identifiers) { - int block = BlockFromStyle(style); - if (block >= 0) - classifiers[block].SetIdentifiers(style, identifiers); - } - - void Free() { - allocated = 0; - for (std::vector::iterator it=classifiers.begin(); it != classifiers.end(); ++it) - it->Clear(); - } - - const WordClassifier &Classifier(int baseStyle) const { - const int block = BlockFromBaseStyle(baseStyle); - return classifiers[block >= 0 ? block : 0]; - } -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/WordList.cxx b/qrenderdoc/3rdparty/scintilla/lexlib/WordList.cxx deleted file mode 100644 index b8662916c..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/WordList.cxx +++ /dev/null @@ -1,302 +0,0 @@ -// Scintilla source code edit control -/** @file WordList.cxx - ** Hold a list of words. - **/ -// Copyright 1998-2002 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include - -#include "StringCopy.h" -#include "WordList.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -/** - * Creates an array that points into each word in the string and puts \0 terminators - * after each word. - */ -static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) { - int prev = '\n'; - int words = 0; - // For rapid determination of whether a character is a separator, build - // a look up table. - bool wordSeparator[256]; - for (int i=0; i<256; i++) { - wordSeparator[i] = false; - } - wordSeparator[static_cast('\r')] = true; - wordSeparator[static_cast('\n')] = true; - if (!onlyLineEnds) { - wordSeparator[static_cast(' ')] = true; - wordSeparator[static_cast('\t')] = true; - } - for (int j = 0; wordlist[j]; j++) { - int curr = static_cast(wordlist[j]); - if (!wordSeparator[curr] && wordSeparator[prev]) - words++; - prev = curr; - } - char **keywords = new char *[words + 1]; - int wordsStore = 0; - const size_t slen = strlen(wordlist); - if (words) { - prev = '\0'; - for (size_t k = 0; k < slen; k++) { - if (!wordSeparator[static_cast(wordlist[k])]) { - if (!prev) { - keywords[wordsStore] = &wordlist[k]; - wordsStore++; - } - } else { - wordlist[k] = '\0'; - } - prev = wordlist[k]; - } - } - keywords[wordsStore] = &wordlist[slen]; - *len = wordsStore; - return keywords; -} - -WordList::WordList(bool onlyLineEnds_) : - words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) { - // Prevent warnings by static analyzers about uninitialized starts. - starts[0] = -1; -} - -WordList::~WordList() { - Clear(); -} - -WordList::operator bool() const { - return len ? true : false; -} - -bool WordList::operator!=(const WordList &other) const { - if (len != other.len) - return true; - for (int i=0; i(a), *static_cast(b)); -} - -static void SortWordList(char **words, unsigned int len) { - qsort(reinterpret_cast(words), len, sizeof(*words), cmpWords); -} - -#endif - -void WordList::Set(const char *s) { - Clear(); - const size_t lenS = strlen(s) + 1; - list = new char[lenS]; - memcpy(list, s, lenS); - words = ArrayFromWordList(list, &len, onlyLineEnds); -#ifdef _MSC_VER - std::sort(words, words + len, cmpWords); -#else - SortWordList(words, len); -#endif - for (unsigned int k = 0; k < ELEMENTS(starts); k++) - starts[k] = -1; - for (int l = len - 1; l >= 0; l--) { - unsigned char indexChar = words[l][0]; - starts[indexChar] = l; - } -} - -/** Check whether a string is in the list. - * List elements are either exact matches or prefixes. - * Prefix elements start with '^' and match all strings that start with the rest of the element - * so '^GTK_' matches 'GTK_X', 'GTK_MAJOR_VERSION', and 'GTK_'. - */ -bool WordList::InList(const char *s) const { - if (0 == words) - return false; - unsigned char firstChar = s[0]; - int j = starts[firstChar]; - if (j >= 0) { - while (static_cast(words[j][0]) == firstChar) { - if (s[1] == words[j][1]) { - const char *a = words[j] + 1; - const char *b = s + 1; - while (*a && *a == *b) { - a++; - b++; - } - if (!*a && !*b) - return true; - } - j++; - } - } - j = starts[static_cast('^')]; - if (j >= 0) { - while (words[j][0] == '^') { - const char *a = words[j] + 1; - const char *b = s; - while (*a && *a == *b) { - a++; - b++; - } - if (!*a) - return true; - j++; - } - } - return false; -} - -/** similar to InList, but word s can be a substring of keyword. - * eg. the keyword define is defined as def~ine. This means the word must start - * with def to be a keyword, but also defi, defin and define are valid. - * The marker is ~ in this case. - */ -bool WordList::InListAbbreviated(const char *s, const char marker) const { - if (0 == words) - return false; - unsigned char firstChar = s[0]; - int j = starts[firstChar]; - if (j >= 0) { - while (static_cast(words[j][0]) == firstChar) { - bool isSubword = false; - int start = 1; - if (words[j][1] == marker) { - isSubword = true; - start++; - } - if (s[1] == words[j][start]) { - const char *a = words[j] + start; - const char *b = s + 1; - while (*a && *a == *b) { - a++; - if (*a == marker) { - isSubword = true; - a++; - } - b++; - } - if ((!*a || isSubword) && !*b) - return true; - } - j++; - } - } - j = starts[static_cast('^')]; - if (j >= 0) { - while (words[j][0] == '^') { - const char *a = words[j] + 1; - const char *b = s; - while (*a && *a == *b) { - a++; - b++; - } - if (!*a) - return true; - j++; - } - } - return false; -} - -/** similar to InListAbbreviated, but word s can be a abridged version of a keyword. -* eg. the keyword is defined as "after.~:". This means the word must have a prefix (begins with) of -* "after." and suffix (ends with) of ":" to be a keyword, Hence "after.field:" , "after.form.item:" are valid. -* Similarly "~.is.valid" keyword is suffix only... hence "field.is.valid" , "form.is.valid" are valid. -* The marker is ~ in this case. -* No multiple markers check is done and wont work. -*/ -bool WordList::InListAbridged(const char *s, const char marker) const { - if (0 == words) - return false; - unsigned char firstChar = s[0]; - int j = starts[firstChar]; - if (j >= 0) { - while (static_cast(words[j][0]) == firstChar) { - const char *a = words[j]; - const char *b = s; - while (*a && *a == *b) { - a++; - if (*a == marker) { - a++; - const size_t suffixLengthA = strlen(a); - const size_t suffixLengthB = strlen(b); - if (suffixLengthA >= suffixLengthB) - break; - b = b + suffixLengthB - suffixLengthA - 1; - } - b++; - } - if (!*a && !*b) - return true; - j++; - } - } - - j = starts[static_cast(marker)]; - if (j >= 0) { - while (words[j][0] == marker) { - const char *a = words[j] + 1; - const char *b = s; - const size_t suffixLengthA = strlen(a); - const size_t suffixLengthB = strlen(b); - if (suffixLengthA > suffixLengthB) { - j++; - continue; - } - b = b + suffixLengthB - suffixLengthA; - - while (*a && *a == *b) { - a++; - b++; - } - if (!*a && !*b) - return true; - j++; - } - } - - return false; -} - -const char *WordList::WordAt(int n) const { - return words[n]; -} - diff --git a/qrenderdoc/3rdparty/scintilla/lexlib/WordList.h b/qrenderdoc/3rdparty/scintilla/lexlib/WordList.h deleted file mode 100644 index b1f8c85b2..000000000 --- a/qrenderdoc/3rdparty/scintilla/lexlib/WordList.h +++ /dev/null @@ -1,42 +0,0 @@ -// Scintilla source code edit control -/** @file WordList.h - ** Hold a list of words. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef WORDLIST_H -#define WORDLIST_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class WordList { - // Each word contains at least one character - a empty word acts as sentinel at the end. - char **words; - char *list; - int len; - bool onlyLineEnds; ///< Delimited by any white space or only line ends - int starts[256]; -public: - explicit WordList(bool onlyLineEnds_ = false); - ~WordList(); - operator bool() const; - bool operator!=(const WordList &other) const; - int Length() const; - void Clear(); - void Set(const char *s); - bool InList(const char *s) const; - bool InListAbbreviated(const char *s, const char marker) const; - bool InListAbridged(const char *s, const char marker) const; - const char *WordAt(int n) const; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/qt/README b/qrenderdoc/3rdparty/scintilla/qt/README deleted file mode 100644 index e6d490fb6..000000000 --- a/qrenderdoc/3rdparty/scintilla/qt/README +++ /dev/null @@ -1,36 +0,0 @@ -README for building of Scintilla on Qt - -There are three different Scintilla libraries that can be produced: - - ScintillaEditBase -A basic widget callable from C++ which is small and can be used just as is -or with higher level functionality added. - - ScintillaEdit -A more complete C++ widget with a method for every Scintilla API and a -secondary API allowing direct access to document objects. - - ScintillaEditPy -A Python callable version of ScintillaEdit using the PySide bindings. - - Building a library - -ScintillaEditBase can be built without performing any generation steps. -The ScintillaEditBase/ScintillaEditBase.pro project can be loaded into -Qt Creator and the "Build All" command performed. -Alternatively, run "qmake" to build make files and then use the platform -make to build. Most commonly, use "make" on Unix and "nmake" -on Windows. - -ScintillaEdit requires a generation command be run first. From the -ScintillaEdit directory: - -python WidgetGen.py - -After the generation command has run, the ScintillaEdit.h and -ScintillaEdit.cpp files will have been populated with the Scintilla API -methods. -To build, use Qt Creator or qmake and make as for ScintillaEditBase. - -ScintillaEditPy is more complex and instructions are found in -ScintillaEditPy/README. diff --git a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaDocument.cpp b/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaDocument.cpp deleted file mode 100644 index fd9f3e995..000000000 --- a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaDocument.cpp +++ /dev/null @@ -1,305 +0,0 @@ -// ScintillaDocument.cpp -// Wrapper for Scintilla document object so it can be manipulated independently. -// Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware - -#include -#include -#include - -#include "ScintillaDocument.h" - -#include "Platform.h" - -#include "ILexer.h" -#include "Scintilla.h" - -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" -#include "CellBuffer.h" -#include "KeyMap.h" -#include "Indicator.h" -#include "XPM.h" -#include "LineMarker.h" -#include "Style.h" -#include "ViewStyle.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "CaseFolder.h" -#include "Document.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -class WatcherHelper : public DocWatcher { - ScintillaDocument *owner; -public: - explicit WatcherHelper(ScintillaDocument *owner_); - virtual ~WatcherHelper(); - - void NotifyModifyAttempt(Document *doc, void *userData); - void NotifySavePoint(Document *doc, void *userData, bool atSavePoint); - void NotifyModified(Document *doc, DocModification mh, void *userData); - void NotifyDeleted(Document *doc, void *userData); - void NotifyStyleNeeded(Document *doc, void *userData, int endPos); - void NotifyLexerChanged(Document *doc, void *userData); - void NotifyErrorOccurred(Document *doc, void *userData, int status); -}; - -WatcherHelper::WatcherHelper(ScintillaDocument *owner_) : owner(owner_) { -} - -WatcherHelper::~WatcherHelper() { -} - -void WatcherHelper::NotifyModifyAttempt(Document *, void *) { - owner->emit_modify_attempt(); -} - -void WatcherHelper::NotifySavePoint(Document *, void *, bool atSavePoint) { - owner->emit_save_point(atSavePoint); -} - -void WatcherHelper::NotifyModified(Document *, DocModification mh, void *) { - int length = mh.length; - if (!mh.text) - length = 0; - QByteArray ba = QByteArray::fromRawData(mh.text, length); - owner->emit_modified(mh.position, mh.modificationType, ba, length, - mh.linesAdded, mh.line, mh.foldLevelNow, mh.foldLevelPrev); -} - -void WatcherHelper::NotifyDeleted(Document *, void *) { -} - -void WatcherHelper::NotifyStyleNeeded(Document *, void *, int endPos) { - owner->emit_style_needed(endPos); -} - -void WatcherHelper::NotifyLexerChanged(Document *, void *) { - owner->emit_lexer_changed(); -} - -void WatcherHelper::NotifyErrorOccurred(Document *, void *, int status) { - owner->emit_error_occurred(status); -} - -ScintillaDocument::ScintillaDocument(QObject *parent, void *pdoc_) : - QObject(parent), pdoc(pdoc_), docWatcher(0) { - if (!pdoc) { - pdoc = new Document(); - } - docWatcher = new WatcherHelper(this); - (static_cast(pdoc))->AddRef(); - (static_cast(pdoc))->AddWatcher(docWatcher, pdoc); -} - -ScintillaDocument::~ScintillaDocument() { - Document *doc = static_cast(pdoc); - if (doc) { - doc->RemoveWatcher(docWatcher, doc); - doc->Release(); - } - pdoc = NULL; - delete docWatcher; - docWatcher = NULL; -} - -void *ScintillaDocument::pointer() { - return pdoc; -} - -int ScintillaDocument::line_from_position(int pos) { - return (static_cast(pdoc))->LineFromPosition(pos); -} - -bool ScintillaDocument::is_cr_lf(int pos) { - return (static_cast(pdoc))->IsCrLf(pos); -} - -bool ScintillaDocument::delete_chars(int pos, int len) { - return (static_cast(pdoc))->DeleteChars(pos, len); -} - -int ScintillaDocument::undo() { - return (static_cast(pdoc))->Undo(); -} - -int ScintillaDocument::redo() { - return (static_cast(pdoc))->Redo(); -} - -bool ScintillaDocument::can_undo() { - return (static_cast(pdoc))->CanUndo(); -} - -bool ScintillaDocument::can_redo() { - return (static_cast(pdoc))->CanRedo(); -} - -void ScintillaDocument::delete_undo_history() { - (static_cast(pdoc))->DeleteUndoHistory(); -} - -bool ScintillaDocument::set_undo_collection(bool collect_undo) { - return (static_cast(pdoc))->SetUndoCollection(collect_undo); -} - -bool ScintillaDocument::is_collecting_undo() { - return (static_cast(pdoc))->IsCollectingUndo(); -} - -void ScintillaDocument::begin_undo_action() { - (static_cast(pdoc))->BeginUndoAction(); -} - -void ScintillaDocument::end_undo_action() { - (static_cast(pdoc))->EndUndoAction(); -} - -void ScintillaDocument::set_save_point() { - (static_cast(pdoc))->SetSavePoint(); -} - -bool ScintillaDocument::is_save_point() { - return (static_cast(pdoc))->IsSavePoint(); -} - -void ScintillaDocument::set_read_only(bool read_only) { - (static_cast(pdoc))->SetReadOnly(read_only); -} - -bool ScintillaDocument::is_read_only() { - return (static_cast(pdoc))->IsReadOnly(); -} - -void ScintillaDocument::insert_string(int position, QByteArray &str) { - (static_cast(pdoc))->InsertString(position, str.data(), str.size()); -} - -QByteArray ScintillaDocument::get_char_range(int position, int length) { - Document *doc = static_cast(pdoc); - - if (position < 0 || length <= 0 || position + length > doc->Length()) - return QByteArray(); - - QByteArray ba(length, '\0'); - doc->GetCharRange(ba.data(), position, length); - return ba; -} - -char ScintillaDocument::style_at(int position) { - return (static_cast(pdoc))->StyleAt(position); -} - -int ScintillaDocument::line_start(int lineno) { - return (static_cast(pdoc))->LineStart(lineno); -} - -int ScintillaDocument::line_end(int lineno) { - return (static_cast(pdoc))->LineEnd(lineno); -} - -int ScintillaDocument::line_end_position(int pos) { - return (static_cast(pdoc))->LineEndPosition(pos); -} - -int ScintillaDocument::length() { - return (static_cast(pdoc))->Length(); -} - -int ScintillaDocument::lines_total() { - return (static_cast(pdoc))->LinesTotal(); -} - -void ScintillaDocument::start_styling(int position, char flags) { - (static_cast(pdoc))->StartStyling(position, flags); -} - -bool ScintillaDocument::set_style_for(int length, char style) { - return (static_cast(pdoc))->SetStyleFor(length, style); -} - -int ScintillaDocument::get_end_styled() { - return (static_cast(pdoc))->GetEndStyled(); -} - -void ScintillaDocument::ensure_styled_to(int position) { - (static_cast(pdoc))->EnsureStyledTo(position); -} - -void ScintillaDocument::set_current_indicator(int indic) { - (static_cast(pdoc))->decorations.SetCurrentIndicator(indic); -} - -void ScintillaDocument::decoration_fill_range(int position, int value, int fillLength) { - (static_cast(pdoc))->DecorationFillRange(position, value, fillLength); -} - -int ScintillaDocument::decorations_value_at(int indic, int position) { - return (static_cast(pdoc))->decorations.ValueAt(indic, position); -} - -int ScintillaDocument::decorations_start(int indic, int position) { - return (static_cast(pdoc))->decorations.Start(indic, position); -} - -int ScintillaDocument::decorations_end(int indic, int position) { - return (static_cast(pdoc))->decorations.End(indic, position); -} - -int ScintillaDocument::get_code_page() { - return (static_cast(pdoc))->CodePage(); -} - -void ScintillaDocument::set_code_page(int code_page) { - (static_cast(pdoc))->dbcsCodePage = code_page; -} - -int ScintillaDocument::get_eol_mode() { - return (static_cast(pdoc))->eolMode; -} - -void ScintillaDocument::set_eol_mode(int eol_mode) { - (static_cast(pdoc))->eolMode = eol_mode; -} - -int ScintillaDocument::move_position_outside_char(int pos, int move_dir, bool check_line_end) { - return (static_cast(pdoc))->MovePositionOutsideChar(pos, move_dir, check_line_end); -} - -int ScintillaDocument::get_character(int pos) { - return (static_cast(pdoc))->GetCharacterAndWidth(pos, NULL); -} - -// Signal emitters - -void ScintillaDocument::emit_modify_attempt() { - emit modify_attempt(); -} - -void ScintillaDocument::emit_save_point(bool atSavePoint) { - emit save_point(atSavePoint); -} - -void ScintillaDocument::emit_modified(int position, int modification_type, const QByteArray& text, int length, - int linesAdded, int line, int foldLevelNow, int foldLevelPrev) { - emit modified(position, modification_type, text, length, - linesAdded, line, foldLevelNow, foldLevelPrev); -} - -void ScintillaDocument::emit_style_needed(int pos) { - emit style_needed(pos); -} - -void ScintillaDocument::emit_lexer_changed() { - emit lexer_changed(); -} - -void ScintillaDocument::emit_error_occurred(int status) { - emit error_occurred(status); -} - diff --git a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaDocument.h b/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaDocument.h deleted file mode 100644 index 510127f94..000000000 --- a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaDocument.h +++ /dev/null @@ -1,109 +0,0 @@ -// ScintillaDocument.h -// Wrapper for Scintilla document object so it can be manipulated independently. -// Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware - -#ifndef SCINTILLADOCUMENT_H -#define SCINTILLADOCUMENT_H - -#include - -class WatcherHelper; - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -#ifndef EXPORT_IMPORT_API -#ifdef WIN32 -#ifdef MAKING_LIBRARY -#define EXPORT_IMPORT_API __declspec(dllexport) -#else -// Defining dllimport upsets moc -#define EXPORT_IMPORT_API __declspec(dllimport) -//#define EXPORT_IMPORT_API -#endif -#else -#define EXPORT_IMPORT_API -#endif -#endif - -class EXPORT_IMPORT_API ScintillaDocument : public QObject -{ - Q_OBJECT - - void *pdoc; - WatcherHelper *docWatcher; - -public: - explicit ScintillaDocument(QObject *parent = 0, void *pdoc_=0); - virtual ~ScintillaDocument(); - void *pointer(); - - int line_from_position(int pos); - bool is_cr_lf(int pos); - bool delete_chars(int pos, int len); - int undo(); - int redo(); - bool can_undo(); - bool can_redo(); - void delete_undo_history(); - bool set_undo_collection(bool collect_undo); - bool is_collecting_undo(); - void begin_undo_action(); - void end_undo_action(); - void set_save_point(); - bool is_save_point(); - void set_read_only(bool read_only); - bool is_read_only(); - void insert_string(int position, QByteArray &str); - QByteArray get_char_range(int position, int length); - char style_at(int position); - int line_start(int lineno); - int line_end(int lineno); - int line_end_position(int pos); - int length(); - int lines_total(); - void start_styling(int position, char flags); - bool set_style_for(int length, char style); - int get_end_styled(); - void ensure_styled_to(int position); - void set_current_indicator(int indic); - void decoration_fill_range(int position, int value, int fillLength); - int decorations_value_at(int indic, int position); - int decorations_start(int indic, int position); - int decorations_end(int indic, int position); - int get_code_page(); - void set_code_page(int code_page); - int get_eol_mode(); - void set_eol_mode(int eol_mode); - int move_position_outside_char(int pos, int move_dir, bool check_line_end); - - int get_character(int pos); // Calls GetCharacterAndWidth(pos, NULL) - -private: - void emit_modify_attempt(); - void emit_save_point(bool atSavePoint); - void emit_modified(int position, int modification_type, const QByteArray& text, int length, - int linesAdded, int line, int foldLevelNow, int foldLevelPrev); - void emit_style_needed(int pos); - void emit_lexer_changed(); - void emit_error_occurred(int status); - -signals: - void modify_attempt(); - void save_point(bool atSavePoint); - void modified(int position, int modification_type, const QByteArray& text, int length, - int linesAdded, int line, int foldLevelNow, int foldLevelPrev); - void style_needed(int pos); - void lexer_changed(); - void error_occurred(int status); - - friend class ::WatcherHelper; - -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif // SCINTILLADOCUMENT_H diff --git a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaEdit.cpp b/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaEdit.cpp deleted file mode 100644 index c325be048..000000000 --- a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaEdit.cpp +++ /dev/null @@ -1,2840 +0,0 @@ -// ScintillaEdit.cpp -// Extended version of ScintillaEditBase with a method for each API -// Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware - -#include "ScintillaEdit.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -ScintillaEdit::ScintillaEdit(QWidget *parent) : ScintillaEditBase(parent) { -} - -ScintillaEdit::~ScintillaEdit() { -} - -QByteArray ScintillaEdit::TextReturner(int message, uptr_t wParam) const { - int length = send(message, wParam, 0); - QByteArray ba(length, '\0'); - send(message, wParam, (sptr_t)ba.data()); - // Remove extra NULs - if (ba.size() > 0 && ba.at(ba.size()-1) == 0) - ba.chop(1); - return ba; -} - -QPairScintillaEdit::find_text(int flags, const char *text, int cpMin, int cpMax) { - struct Sci_TextToFind ft = {{0, 0}, 0, {0, 0}}; - ft.chrg.cpMin = cpMin; - ft.chrg.cpMax = cpMax; - ft.chrgText.cpMin = cpMin; - ft.chrgText.cpMax = cpMax; - ft.lpstrText = const_cast(text); - - int start = send(SCI_FINDTEXT, flags, (uptr_t) (&ft)); - - return QPair(start, ft.chrgText.cpMax); -} - -QByteArray ScintillaEdit::get_text_range(int start, int end) { - if (start > end) - start = end; - - int length = end-start; - QByteArray ba(length+1, '\0'); - struct Sci_TextRange tr = {{start, end}, ba.data()}; - - send(SCI_GETTEXTRANGE, 0, (sptr_t)&tr); - ba.chop(1); // Remove extra NUL - - return ba; -} - -ScintillaDocument *ScintillaEdit::get_doc() { - return new ScintillaDocument(0, (void *)send(SCI_GETDOCPOINTER, 0, 0)); -} - -void ScintillaEdit::set_doc(ScintillaDocument *pdoc_) { - send(SCI_SETDOCPOINTER, 0, (sptr_t)(pdoc_->pointer())); -} - -long ScintillaEdit::format_range(bool draw, QPaintDevice* target, QPaintDevice* measure, - const QRect& print_rect, const QRect& page_rect, - long range_start, long range_end) -{ - Sci_RangeToFormat to_format; - - to_format.hdc = target; - to_format.hdcTarget = measure; - - to_format.rc.left = print_rect.left(); - to_format.rc.top = print_rect.top(); - to_format.rc.right = print_rect.right(); - to_format.rc.bottom = print_rect.bottom(); - - to_format.rcPage.left = page_rect.left(); - to_format.rcPage.top = page_rect.top(); - to_format.rcPage.right = page_rect.right(); - to_format.rcPage.bottom = page_rect.bottom(); - - to_format.chrg.cpMin = range_start; - to_format.chrg.cpMax = range_end; - - return send(SCI_FORMATRANGE, draw, reinterpret_cast(&to_format)); -} - -/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ -void ScintillaEdit::addText(sptr_t length, const char * text) { - send(SCI_ADDTEXT, length, (sptr_t)text); -} - -void ScintillaEdit::addStyledText(sptr_t length, const char * c) { - send(SCI_ADDSTYLEDTEXT, length, (sptr_t)c); -} - -void ScintillaEdit::insertText(sptr_t pos, const char * text) { - send(SCI_INSERTTEXT, pos, (sptr_t)text); -} - -void ScintillaEdit::changeInsertion(sptr_t length, const char * text) { - send(SCI_CHANGEINSERTION, length, (sptr_t)text); -} - -void ScintillaEdit::clearAll() { - send(SCI_CLEARALL, 0, 0); -} - -void ScintillaEdit::deleteRange(sptr_t start, sptr_t lengthDelete) { - send(SCI_DELETERANGE, start, lengthDelete); -} - -void ScintillaEdit::clearDocumentStyle() { - send(SCI_CLEARDOCUMENTSTYLE, 0, 0); -} - -sptr_t ScintillaEdit::length() const { - return send(SCI_GETLENGTH, 0, 0); -} - -sptr_t ScintillaEdit::charAt(sptr_t pos) const { - return send(SCI_GETCHARAT, pos, 0); -} - -sptr_t ScintillaEdit::currentPos() const { - return send(SCI_GETCURRENTPOS, 0, 0); -} - -sptr_t ScintillaEdit::anchor() const { - return send(SCI_GETANCHOR, 0, 0); -} - -sptr_t ScintillaEdit::styleAt(sptr_t pos) const { - return send(SCI_GETSTYLEAT, pos, 0); -} - -void ScintillaEdit::redo() { - send(SCI_REDO, 0, 0); -} - -void ScintillaEdit::setUndoCollection(bool collectUndo) { - send(SCI_SETUNDOCOLLECTION, collectUndo, 0); -} - -void ScintillaEdit::selectAll() { - send(SCI_SELECTALL, 0, 0); -} - -void ScintillaEdit::setSavePoint() { - send(SCI_SETSAVEPOINT, 0, 0); -} - -bool ScintillaEdit::canRedo() { - return send(SCI_CANREDO, 0, 0); -} - -sptr_t ScintillaEdit::markerLineFromHandle(sptr_t markerHandle) { - return send(SCI_MARKERLINEFROMHANDLE, markerHandle, 0); -} - -void ScintillaEdit::markerDeleteHandle(sptr_t markerHandle) { - send(SCI_MARKERDELETEHANDLE, markerHandle, 0); -} - -bool ScintillaEdit::undoCollection() const { - return send(SCI_GETUNDOCOLLECTION, 0, 0); -} - -sptr_t ScintillaEdit::viewWS() const { - return send(SCI_GETVIEWWS, 0, 0); -} - -void ScintillaEdit::setViewWS(sptr_t viewWS) { - send(SCI_SETVIEWWS, viewWS, 0); -} - -sptr_t ScintillaEdit::tabDrawMode() const { - return send(SCI_GETTABDRAWMODE, 0, 0); -} - -void ScintillaEdit::setTabDrawMode(sptr_t tabDrawMode) { - send(SCI_SETTABDRAWMODE, tabDrawMode, 0); -} - -sptr_t ScintillaEdit::positionFromPoint(sptr_t x, sptr_t y) { - return send(SCI_POSITIONFROMPOINT, x, y); -} - -sptr_t ScintillaEdit::positionFromPointClose(sptr_t x, sptr_t y) { - return send(SCI_POSITIONFROMPOINTCLOSE, x, y); -} - -void ScintillaEdit::gotoLine(sptr_t line) { - send(SCI_GOTOLINE, line, 0); -} - -void ScintillaEdit::gotoPos(sptr_t caret) { - send(SCI_GOTOPOS, caret, 0); -} - -void ScintillaEdit::setAnchor(sptr_t anchor) { - send(SCI_SETANCHOR, anchor, 0); -} - -QByteArray ScintillaEdit::getCurLine(sptr_t length) { - return TextReturner(SCI_GETCURLINE, length); -} - -sptr_t ScintillaEdit::endStyled() const { - return send(SCI_GETENDSTYLED, 0, 0); -} - -void ScintillaEdit::convertEOLs(sptr_t eolMode) { - send(SCI_CONVERTEOLS, eolMode, 0); -} - -sptr_t ScintillaEdit::eOLMode() const { - return send(SCI_GETEOLMODE, 0, 0); -} - -void ScintillaEdit::setEOLMode(sptr_t eolMode) { - send(SCI_SETEOLMODE, eolMode, 0); -} - -void ScintillaEdit::startStyling(sptr_t start, sptr_t unused) { - send(SCI_STARTSTYLING, start, unused); -} - -void ScintillaEdit::setStyling(sptr_t length, sptr_t style) { - send(SCI_SETSTYLING, length, style); -} - -bool ScintillaEdit::bufferedDraw() const { - return send(SCI_GETBUFFEREDDRAW, 0, 0); -} - -void ScintillaEdit::setBufferedDraw(bool buffered) { - send(SCI_SETBUFFEREDDRAW, buffered, 0); -} - -void ScintillaEdit::setTabWidth(sptr_t tabWidth) { - send(SCI_SETTABWIDTH, tabWidth, 0); -} - -sptr_t ScintillaEdit::tabWidth() const { - return send(SCI_GETTABWIDTH, 0, 0); -} - -void ScintillaEdit::clearTabStops(sptr_t line) { - send(SCI_CLEARTABSTOPS, line, 0); -} - -void ScintillaEdit::addTabStop(sptr_t line, sptr_t x) { - send(SCI_ADDTABSTOP, line, x); -} - -sptr_t ScintillaEdit::getNextTabStop(sptr_t line, sptr_t x) { - return send(SCI_GETNEXTTABSTOP, line, x); -} - -void ScintillaEdit::setCodePage(sptr_t codePage) { - send(SCI_SETCODEPAGE, codePage, 0); -} - -sptr_t ScintillaEdit::iMEInteraction() const { - return send(SCI_GETIMEINTERACTION, 0, 0); -} - -void ScintillaEdit::setIMEInteraction(sptr_t imeInteraction) { - send(SCI_SETIMEINTERACTION, imeInteraction, 0); -} - -void ScintillaEdit::markerDefine(sptr_t markerNumber, sptr_t markerSymbol) { - send(SCI_MARKERDEFINE, markerNumber, markerSymbol); -} - -void ScintillaEdit::markerSetFore(sptr_t markerNumber, sptr_t fore) { - send(SCI_MARKERSETFORE, markerNumber, fore); -} - -void ScintillaEdit::markerSetBack(sptr_t markerNumber, sptr_t back) { - send(SCI_MARKERSETBACK, markerNumber, back); -} - -void ScintillaEdit::markerSetBackSelected(sptr_t markerNumber, sptr_t back) { - send(SCI_MARKERSETBACKSELECTED, markerNumber, back); -} - -void ScintillaEdit::markerEnableHighlight(bool enabled) { - send(SCI_MARKERENABLEHIGHLIGHT, enabled, 0); -} - -sptr_t ScintillaEdit::markerAdd(sptr_t line, sptr_t markerNumber) { - return send(SCI_MARKERADD, line, markerNumber); -} - -void ScintillaEdit::markerDelete(sptr_t line, sptr_t markerNumber) { - send(SCI_MARKERDELETE, line, markerNumber); -} - -void ScintillaEdit::markerDeleteAll(sptr_t markerNumber) { - send(SCI_MARKERDELETEALL, markerNumber, 0); -} - -sptr_t ScintillaEdit::markerGet(sptr_t line) { - return send(SCI_MARKERGET, line, 0); -} - -sptr_t ScintillaEdit::markerNext(sptr_t lineStart, sptr_t markerMask) { - return send(SCI_MARKERNEXT, lineStart, markerMask); -} - -sptr_t ScintillaEdit::markerPrevious(sptr_t lineStart, sptr_t markerMask) { - return send(SCI_MARKERPREVIOUS, lineStart, markerMask); -} - -void ScintillaEdit::markerDefinePixmap(sptr_t markerNumber, const char * pixmap) { - send(SCI_MARKERDEFINEPIXMAP, markerNumber, (sptr_t)pixmap); -} - -void ScintillaEdit::markerAddSet(sptr_t line, sptr_t markerSet) { - send(SCI_MARKERADDSET, line, markerSet); -} - -void ScintillaEdit::markerSetAlpha(sptr_t markerNumber, sptr_t alpha) { - send(SCI_MARKERSETALPHA, markerNumber, alpha); -} - -void ScintillaEdit::setMarginTypeN(sptr_t margin, sptr_t marginType) { - send(SCI_SETMARGINTYPEN, margin, marginType); -} - -sptr_t ScintillaEdit::marginTypeN(sptr_t margin) const { - return send(SCI_GETMARGINTYPEN, margin, 0); -} - -void ScintillaEdit::setMarginWidthN(sptr_t margin, sptr_t pixelWidth) { - send(SCI_SETMARGINWIDTHN, margin, pixelWidth); -} - -sptr_t ScintillaEdit::marginWidthN(sptr_t margin) const { - return send(SCI_GETMARGINWIDTHN, margin, 0); -} - -void ScintillaEdit::setMarginMaskN(sptr_t margin, sptr_t mask) { - send(SCI_SETMARGINMASKN, margin, mask); -} - -sptr_t ScintillaEdit::marginMaskN(sptr_t margin) const { - return send(SCI_GETMARGINMASKN, margin, 0); -} - -void ScintillaEdit::setMarginSensitiveN(sptr_t margin, bool sensitive) { - send(SCI_SETMARGINSENSITIVEN, margin, sensitive); -} - -bool ScintillaEdit::marginSensitiveN(sptr_t margin) const { - return send(SCI_GETMARGINSENSITIVEN, margin, 0); -} - -void ScintillaEdit::setMarginCursorN(sptr_t margin, sptr_t cursor) { - send(SCI_SETMARGINCURSORN, margin, cursor); -} - -sptr_t ScintillaEdit::marginCursorN(sptr_t margin) const { - return send(SCI_GETMARGINCURSORN, margin, 0); -} - -void ScintillaEdit::setMarginBackN(sptr_t margin, sptr_t back) { - send(SCI_SETMARGINBACKN, margin, back); -} - -sptr_t ScintillaEdit::marginBackN(sptr_t margin) const { - return send(SCI_GETMARGINBACKN, margin, 0); -} - -void ScintillaEdit::setMargins(sptr_t margins) { - send(SCI_SETMARGINS, margins, 0); -} - -sptr_t ScintillaEdit::margins() const { - return send(SCI_GETMARGINS, 0, 0); -} - -void ScintillaEdit::styleClearAll() { - send(SCI_STYLECLEARALL, 0, 0); -} - -void ScintillaEdit::styleSetFore(sptr_t style, sptr_t fore) { - send(SCI_STYLESETFORE, style, fore); -} - -void ScintillaEdit::styleSetBack(sptr_t style, sptr_t back) { - send(SCI_STYLESETBACK, style, back); -} - -void ScintillaEdit::styleSetBold(sptr_t style, bool bold) { - send(SCI_STYLESETBOLD, style, bold); -} - -void ScintillaEdit::styleSetItalic(sptr_t style, bool italic) { - send(SCI_STYLESETITALIC, style, italic); -} - -void ScintillaEdit::styleSetSize(sptr_t style, sptr_t sizePoints) { - send(SCI_STYLESETSIZE, style, sizePoints); -} - -void ScintillaEdit::styleSetFont(sptr_t style, const char * fontName) { - send(SCI_STYLESETFONT, style, (sptr_t)fontName); -} - -void ScintillaEdit::styleSetEOLFilled(sptr_t style, bool eolFilled) { - send(SCI_STYLESETEOLFILLED, style, eolFilled); -} - -void ScintillaEdit::styleResetDefault() { - send(SCI_STYLERESETDEFAULT, 0, 0); -} - -void ScintillaEdit::styleSetUnderline(sptr_t style, bool underline) { - send(SCI_STYLESETUNDERLINE, style, underline); -} - -sptr_t ScintillaEdit::styleFore(sptr_t style) const { - return send(SCI_STYLEGETFORE, style, 0); -} - -sptr_t ScintillaEdit::styleBack(sptr_t style) const { - return send(SCI_STYLEGETBACK, style, 0); -} - -bool ScintillaEdit::styleBold(sptr_t style) const { - return send(SCI_STYLEGETBOLD, style, 0); -} - -bool ScintillaEdit::styleItalic(sptr_t style) const { - return send(SCI_STYLEGETITALIC, style, 0); -} - -sptr_t ScintillaEdit::styleSize(sptr_t style) const { - return send(SCI_STYLEGETSIZE, style, 0); -} - -QByteArray ScintillaEdit::styleFont(sptr_t style) const { - return TextReturner(SCI_STYLEGETFONT, style); -} - -bool ScintillaEdit::styleEOLFilled(sptr_t style) const { - return send(SCI_STYLEGETEOLFILLED, style, 0); -} - -bool ScintillaEdit::styleUnderline(sptr_t style) const { - return send(SCI_STYLEGETUNDERLINE, style, 0); -} - -sptr_t ScintillaEdit::styleCase(sptr_t style) const { - return send(SCI_STYLEGETCASE, style, 0); -} - -sptr_t ScintillaEdit::styleCharacterSet(sptr_t style) const { - return send(SCI_STYLEGETCHARACTERSET, style, 0); -} - -bool ScintillaEdit::styleVisible(sptr_t style) const { - return send(SCI_STYLEGETVISIBLE, style, 0); -} - -bool ScintillaEdit::styleChangeable(sptr_t style) const { - return send(SCI_STYLEGETCHANGEABLE, style, 0); -} - -bool ScintillaEdit::styleHotSpot(sptr_t style) const { - return send(SCI_STYLEGETHOTSPOT, style, 0); -} - -void ScintillaEdit::styleSetCase(sptr_t style, sptr_t caseVisible) { - send(SCI_STYLESETCASE, style, caseVisible); -} - -void ScintillaEdit::styleSetSizeFractional(sptr_t style, sptr_t sizeHundredthPoints) { - send(SCI_STYLESETSIZEFRACTIONAL, style, sizeHundredthPoints); -} - -sptr_t ScintillaEdit::styleSizeFractional(sptr_t style) const { - return send(SCI_STYLEGETSIZEFRACTIONAL, style, 0); -} - -void ScintillaEdit::styleSetWeight(sptr_t style, sptr_t weight) { - send(SCI_STYLESETWEIGHT, style, weight); -} - -sptr_t ScintillaEdit::styleWeight(sptr_t style) const { - return send(SCI_STYLEGETWEIGHT, style, 0); -} - -void ScintillaEdit::styleSetCharacterSet(sptr_t style, sptr_t characterSet) { - send(SCI_STYLESETCHARACTERSET, style, characterSet); -} - -void ScintillaEdit::styleSetHotSpot(sptr_t style, bool hotspot) { - send(SCI_STYLESETHOTSPOT, style, hotspot); -} - -void ScintillaEdit::setSelFore(bool useSetting, sptr_t fore) { - send(SCI_SETSELFORE, useSetting, fore); -} - -void ScintillaEdit::setSelBack(bool useSetting, sptr_t back) { - send(SCI_SETSELBACK, useSetting, back); -} - -sptr_t ScintillaEdit::selAlpha() const { - return send(SCI_GETSELALPHA, 0, 0); -} - -void ScintillaEdit::setSelAlpha(sptr_t alpha) { - send(SCI_SETSELALPHA, alpha, 0); -} - -bool ScintillaEdit::selEOLFilled() const { - return send(SCI_GETSELEOLFILLED, 0, 0); -} - -void ScintillaEdit::setSelEOLFilled(bool filled) { - send(SCI_SETSELEOLFILLED, filled, 0); -} - -void ScintillaEdit::setCaretFore(sptr_t fore) { - send(SCI_SETCARETFORE, fore, 0); -} - -void ScintillaEdit::assignCmdKey(sptr_t keyDefinition, sptr_t sciCommand) { - send(SCI_ASSIGNCMDKEY, keyDefinition, sciCommand); -} - -void ScintillaEdit::clearCmdKey(sptr_t keyDefinition) { - send(SCI_CLEARCMDKEY, keyDefinition, 0); -} - -void ScintillaEdit::clearAllCmdKeys() { - send(SCI_CLEARALLCMDKEYS, 0, 0); -} - -void ScintillaEdit::setStylingEx(sptr_t length, const char * styles) { - send(SCI_SETSTYLINGEX, length, (sptr_t)styles); -} - -void ScintillaEdit::styleSetVisible(sptr_t style, bool visible) { - send(SCI_STYLESETVISIBLE, style, visible); -} - -sptr_t ScintillaEdit::caretPeriod() const { - return send(SCI_GETCARETPERIOD, 0, 0); -} - -void ScintillaEdit::setCaretPeriod(sptr_t periodMilliseconds) { - send(SCI_SETCARETPERIOD, periodMilliseconds, 0); -} - -void ScintillaEdit::setWordChars(const char * characters) { - send(SCI_SETWORDCHARS, 0, (sptr_t)characters); -} - -QByteArray ScintillaEdit::wordChars() const { - return TextReturner(SCI_GETWORDCHARS, 0); -} - -void ScintillaEdit::beginUndoAction() { - send(SCI_BEGINUNDOACTION, 0, 0); -} - -void ScintillaEdit::endUndoAction() { - send(SCI_ENDUNDOACTION, 0, 0); -} - -void ScintillaEdit::indicSetStyle(sptr_t indicator, sptr_t indicatorStyle) { - send(SCI_INDICSETSTYLE, indicator, indicatorStyle); -} - -sptr_t ScintillaEdit::indicStyle(sptr_t indicator) const { - return send(SCI_INDICGETSTYLE, indicator, 0); -} - -void ScintillaEdit::indicSetFore(sptr_t indicator, sptr_t fore) { - send(SCI_INDICSETFORE, indicator, fore); -} - -sptr_t ScintillaEdit::indicFore(sptr_t indicator) const { - return send(SCI_INDICGETFORE, indicator, 0); -} - -void ScintillaEdit::indicSetUnder(sptr_t indicator, bool under) { - send(SCI_INDICSETUNDER, indicator, under); -} - -bool ScintillaEdit::indicUnder(sptr_t indicator) const { - return send(SCI_INDICGETUNDER, indicator, 0); -} - -void ScintillaEdit::indicSetHoverStyle(sptr_t indicator, sptr_t indicatorStyle) { - send(SCI_INDICSETHOVERSTYLE, indicator, indicatorStyle); -} - -sptr_t ScintillaEdit::indicHoverStyle(sptr_t indicator) const { - return send(SCI_INDICGETHOVERSTYLE, indicator, 0); -} - -void ScintillaEdit::indicSetHoverFore(sptr_t indicator, sptr_t fore) { - send(SCI_INDICSETHOVERFORE, indicator, fore); -} - -sptr_t ScintillaEdit::indicHoverFore(sptr_t indicator) const { - return send(SCI_INDICGETHOVERFORE, indicator, 0); -} - -void ScintillaEdit::indicSetFlags(sptr_t indicator, sptr_t flags) { - send(SCI_INDICSETFLAGS, indicator, flags); -} - -sptr_t ScintillaEdit::indicFlags(sptr_t indicator) const { - return send(SCI_INDICGETFLAGS, indicator, 0); -} - -void ScintillaEdit::setWhitespaceFore(bool useSetting, sptr_t fore) { - send(SCI_SETWHITESPACEFORE, useSetting, fore); -} - -void ScintillaEdit::setWhitespaceBack(bool useSetting, sptr_t back) { - send(SCI_SETWHITESPACEBACK, useSetting, back); -} - -void ScintillaEdit::setWhitespaceSize(sptr_t size) { - send(SCI_SETWHITESPACESIZE, size, 0); -} - -sptr_t ScintillaEdit::whitespaceSize() const { - return send(SCI_GETWHITESPACESIZE, 0, 0); -} - -void ScintillaEdit::setStyleBits(sptr_t bits) { - send(SCI_SETSTYLEBITS, bits, 0); -} - -sptr_t ScintillaEdit::styleBits() const { - return send(SCI_GETSTYLEBITS, 0, 0); -} - -void ScintillaEdit::setLineState(sptr_t line, sptr_t state) { - send(SCI_SETLINESTATE, line, state); -} - -sptr_t ScintillaEdit::lineState(sptr_t line) const { - return send(SCI_GETLINESTATE, line, 0); -} - -sptr_t ScintillaEdit::maxLineState() const { - return send(SCI_GETMAXLINESTATE, 0, 0); -} - -bool ScintillaEdit::caretLineVisible() const { - return send(SCI_GETCARETLINEVISIBLE, 0, 0); -} - -void ScintillaEdit::setCaretLineVisible(bool show) { - send(SCI_SETCARETLINEVISIBLE, show, 0); -} - -sptr_t ScintillaEdit::caretLineBack() const { - return send(SCI_GETCARETLINEBACK, 0, 0); -} - -void ScintillaEdit::setCaretLineBack(sptr_t back) { - send(SCI_SETCARETLINEBACK, back, 0); -} - -void ScintillaEdit::styleSetChangeable(sptr_t style, bool changeable) { - send(SCI_STYLESETCHANGEABLE, style, changeable); -} - -void ScintillaEdit::autoCShow(sptr_t lengthEntered, const char * itemList) { - send(SCI_AUTOCSHOW, lengthEntered, (sptr_t)itemList); -} - -void ScintillaEdit::autoCCancel() { - send(SCI_AUTOCCANCEL, 0, 0); -} - -bool ScintillaEdit::autoCActive() { - return send(SCI_AUTOCACTIVE, 0, 0); -} - -sptr_t ScintillaEdit::autoCPosStart() { - return send(SCI_AUTOCPOSSTART, 0, 0); -} - -void ScintillaEdit::autoCComplete() { - send(SCI_AUTOCCOMPLETE, 0, 0); -} - -void ScintillaEdit::autoCStops(const char * characterSet) { - send(SCI_AUTOCSTOPS, 0, (sptr_t)characterSet); -} - -void ScintillaEdit::autoCSetSeparator(sptr_t separatorCharacter) { - send(SCI_AUTOCSETSEPARATOR, separatorCharacter, 0); -} - -sptr_t ScintillaEdit::autoCSeparator() const { - return send(SCI_AUTOCGETSEPARATOR, 0, 0); -} - -void ScintillaEdit::autoCSelect(const char * select) { - send(SCI_AUTOCSELECT, 0, (sptr_t)select); -} - -void ScintillaEdit::autoCSetCancelAtStart(bool cancel) { - send(SCI_AUTOCSETCANCELATSTART, cancel, 0); -} - -bool ScintillaEdit::autoCCancelAtStart() const { - return send(SCI_AUTOCGETCANCELATSTART, 0, 0); -} - -void ScintillaEdit::autoCSetFillUps(const char * characterSet) { - send(SCI_AUTOCSETFILLUPS, 0, (sptr_t)characterSet); -} - -void ScintillaEdit::autoCSetChooseSingle(bool chooseSingle) { - send(SCI_AUTOCSETCHOOSESINGLE, chooseSingle, 0); -} - -bool ScintillaEdit::autoCChooseSingle() const { - return send(SCI_AUTOCGETCHOOSESINGLE, 0, 0); -} - -void ScintillaEdit::autoCSetIgnoreCase(bool ignoreCase) { - send(SCI_AUTOCSETIGNORECASE, ignoreCase, 0); -} - -bool ScintillaEdit::autoCIgnoreCase() const { - return send(SCI_AUTOCGETIGNORECASE, 0, 0); -} - -void ScintillaEdit::userListShow(sptr_t listType, const char * itemList) { - send(SCI_USERLISTSHOW, listType, (sptr_t)itemList); -} - -void ScintillaEdit::autoCSetAutoHide(bool autoHide) { - send(SCI_AUTOCSETAUTOHIDE, autoHide, 0); -} - -bool ScintillaEdit::autoCAutoHide() const { - return send(SCI_AUTOCGETAUTOHIDE, 0, 0); -} - -void ScintillaEdit::autoCSetDropRestOfWord(bool dropRestOfWord) { - send(SCI_AUTOCSETDROPRESTOFWORD, dropRestOfWord, 0); -} - -bool ScintillaEdit::autoCDropRestOfWord() const { - return send(SCI_AUTOCGETDROPRESTOFWORD, 0, 0); -} - -void ScintillaEdit::registerImage(sptr_t type, const char * xpmData) { - send(SCI_REGISTERIMAGE, type, (sptr_t)xpmData); -} - -void ScintillaEdit::clearRegisteredImages() { - send(SCI_CLEARREGISTEREDIMAGES, 0, 0); -} - -sptr_t ScintillaEdit::autoCTypeSeparator() const { - return send(SCI_AUTOCGETTYPESEPARATOR, 0, 0); -} - -void ScintillaEdit::autoCSetTypeSeparator(sptr_t separatorCharacter) { - send(SCI_AUTOCSETTYPESEPARATOR, separatorCharacter, 0); -} - -void ScintillaEdit::autoCSetMaxWidth(sptr_t characterCount) { - send(SCI_AUTOCSETMAXWIDTH, characterCount, 0); -} - -sptr_t ScintillaEdit::autoCMaxWidth() const { - return send(SCI_AUTOCGETMAXWIDTH, 0, 0); -} - -void ScintillaEdit::autoCSetMaxHeight(sptr_t rowCount) { - send(SCI_AUTOCSETMAXHEIGHT, rowCount, 0); -} - -sptr_t ScintillaEdit::autoCMaxHeight() const { - return send(SCI_AUTOCGETMAXHEIGHT, 0, 0); -} - -void ScintillaEdit::setIndent(sptr_t indentSize) { - send(SCI_SETINDENT, indentSize, 0); -} - -sptr_t ScintillaEdit::indent() const { - return send(SCI_GETINDENT, 0, 0); -} - -void ScintillaEdit::setUseTabs(bool useTabs) { - send(SCI_SETUSETABS, useTabs, 0); -} - -bool ScintillaEdit::useTabs() const { - return send(SCI_GETUSETABS, 0, 0); -} - -void ScintillaEdit::setLineIndentation(sptr_t line, sptr_t indentation) { - send(SCI_SETLINEINDENTATION, line, indentation); -} - -sptr_t ScintillaEdit::lineIndentation(sptr_t line) const { - return send(SCI_GETLINEINDENTATION, line, 0); -} - -sptr_t ScintillaEdit::lineIndentPosition(sptr_t line) const { - return send(SCI_GETLINEINDENTPOSITION, line, 0); -} - -sptr_t ScintillaEdit::column(sptr_t pos) const { - return send(SCI_GETCOLUMN, pos, 0); -} - -sptr_t ScintillaEdit::countCharacters(sptr_t start, sptr_t end) { - return send(SCI_COUNTCHARACTERS, start, end); -} - -void ScintillaEdit::setHScrollBar(bool visible) { - send(SCI_SETHSCROLLBAR, visible, 0); -} - -bool ScintillaEdit::hScrollBar() const { - return send(SCI_GETHSCROLLBAR, 0, 0); -} - -void ScintillaEdit::setIndentationGuides(sptr_t indentView) { - send(SCI_SETINDENTATIONGUIDES, indentView, 0); -} - -sptr_t ScintillaEdit::indentationGuides() const { - return send(SCI_GETINDENTATIONGUIDES, 0, 0); -} - -void ScintillaEdit::setHighlightGuide(sptr_t column) { - send(SCI_SETHIGHLIGHTGUIDE, column, 0); -} - -sptr_t ScintillaEdit::highlightGuide() const { - return send(SCI_GETHIGHLIGHTGUIDE, 0, 0); -} - -sptr_t ScintillaEdit::lineEndPosition(sptr_t line) const { - return send(SCI_GETLINEENDPOSITION, line, 0); -} - -sptr_t ScintillaEdit::codePage() const { - return send(SCI_GETCODEPAGE, 0, 0); -} - -sptr_t ScintillaEdit::caretFore() const { - return send(SCI_GETCARETFORE, 0, 0); -} - -bool ScintillaEdit::readOnly() const { - return send(SCI_GETREADONLY, 0, 0); -} - -void ScintillaEdit::setCurrentPos(sptr_t caret) { - send(SCI_SETCURRENTPOS, caret, 0); -} - -void ScintillaEdit::setSelectionStart(sptr_t anchor) { - send(SCI_SETSELECTIONSTART, anchor, 0); -} - -sptr_t ScintillaEdit::selectionStart() const { - return send(SCI_GETSELECTIONSTART, 0, 0); -} - -void ScintillaEdit::setSelectionEnd(sptr_t caret) { - send(SCI_SETSELECTIONEND, caret, 0); -} - -sptr_t ScintillaEdit::selectionEnd() const { - return send(SCI_GETSELECTIONEND, 0, 0); -} - -void ScintillaEdit::setEmptySelection(sptr_t caret) { - send(SCI_SETEMPTYSELECTION, caret, 0); -} - -void ScintillaEdit::setPrintMagnification(sptr_t magnification) { - send(SCI_SETPRINTMAGNIFICATION, magnification, 0); -} - -sptr_t ScintillaEdit::printMagnification() const { - return send(SCI_GETPRINTMAGNIFICATION, 0, 0); -} - -void ScintillaEdit::setPrintColourMode(sptr_t mode) { - send(SCI_SETPRINTCOLOURMODE, mode, 0); -} - -sptr_t ScintillaEdit::printColourMode() const { - return send(SCI_GETPRINTCOLOURMODE, 0, 0); -} - -sptr_t ScintillaEdit::firstVisibleLine() const { - return send(SCI_GETFIRSTVISIBLELINE, 0, 0); -} - -QByteArray ScintillaEdit::getLine(sptr_t line) { - return TextReturner(SCI_GETLINE, line); -} - -sptr_t ScintillaEdit::lineCount() const { - return send(SCI_GETLINECOUNT, 0, 0); -} - -void ScintillaEdit::setMarginLeft(sptr_t pixelWidth) { - send(SCI_SETMARGINLEFT, 0, pixelWidth); -} - -sptr_t ScintillaEdit::marginLeft() const { - return send(SCI_GETMARGINLEFT, 0, 0); -} - -void ScintillaEdit::setMarginRight(sptr_t pixelWidth) { - send(SCI_SETMARGINRIGHT, 0, pixelWidth); -} - -sptr_t ScintillaEdit::marginRight() const { - return send(SCI_GETMARGINRIGHT, 0, 0); -} - -bool ScintillaEdit::modify() const { - return send(SCI_GETMODIFY, 0, 0); -} - -void ScintillaEdit::setSel(sptr_t anchor, sptr_t caret) { - send(SCI_SETSEL, anchor, caret); -} - -QByteArray ScintillaEdit::getSelText() { - return TextReturner(SCI_GETSELTEXT, 0); -} - -void ScintillaEdit::hideSelection(bool hide) { - send(SCI_HIDESELECTION, hide, 0); -} - -sptr_t ScintillaEdit::pointXFromPosition(sptr_t pos) { - return send(SCI_POINTXFROMPOSITION, 0, pos); -} - -sptr_t ScintillaEdit::pointYFromPosition(sptr_t pos) { - return send(SCI_POINTYFROMPOSITION, 0, pos); -} - -sptr_t ScintillaEdit::lineFromPosition(sptr_t pos) { - return send(SCI_LINEFROMPOSITION, pos, 0); -} - -sptr_t ScintillaEdit::positionFromLine(sptr_t line) { - return send(SCI_POSITIONFROMLINE, line, 0); -} - -void ScintillaEdit::lineScroll(sptr_t columns, sptr_t lines) { - send(SCI_LINESCROLL, columns, lines); -} - -void ScintillaEdit::scrollCaret() { - send(SCI_SCROLLCARET, 0, 0); -} - -void ScintillaEdit::scrollRange(sptr_t secondary, sptr_t primary) { - send(SCI_SCROLLRANGE, secondary, primary); -} - -void ScintillaEdit::replaceSel(const char * text) { - send(SCI_REPLACESEL, 0, (sptr_t)text); -} - -void ScintillaEdit::setReadOnly(bool readOnly) { - send(SCI_SETREADONLY, readOnly, 0); -} - -void ScintillaEdit::null() { - send(SCI_NULL, 0, 0); -} - -bool ScintillaEdit::canPaste() { - return send(SCI_CANPASTE, 0, 0); -} - -bool ScintillaEdit::canUndo() { - return send(SCI_CANUNDO, 0, 0); -} - -void ScintillaEdit::emptyUndoBuffer() { - send(SCI_EMPTYUNDOBUFFER, 0, 0); -} - -void ScintillaEdit::undo() { - send(SCI_UNDO, 0, 0); -} - -void ScintillaEdit::cut() { - send(SCI_CUT, 0, 0); -} - -void ScintillaEdit::copy() { - send(SCI_COPY, 0, 0); -} - -void ScintillaEdit::paste() { - send(SCI_PASTE, 0, 0); -} - -void ScintillaEdit::clear() { - send(SCI_CLEAR, 0, 0); -} - -void ScintillaEdit::setText(const char * text) { - send(SCI_SETTEXT, 0, (sptr_t)text); -} - -QByteArray ScintillaEdit::getText(sptr_t length) { - return TextReturner(SCI_GETTEXT, length); -} - -sptr_t ScintillaEdit::textLength() const { - return send(SCI_GETTEXTLENGTH, 0, 0); -} - -sptr_t ScintillaEdit::directFunction() const { - return send(SCI_GETDIRECTFUNCTION, 0, 0); -} - -sptr_t ScintillaEdit::directPointer() const { - return send(SCI_GETDIRECTPOINTER, 0, 0); -} - -void ScintillaEdit::setOvertype(bool overType) { - send(SCI_SETOVERTYPE, overType, 0); -} - -bool ScintillaEdit::overtype() const { - return send(SCI_GETOVERTYPE, 0, 0); -} - -void ScintillaEdit::setCaretWidth(sptr_t pixelWidth) { - send(SCI_SETCARETWIDTH, pixelWidth, 0); -} - -sptr_t ScintillaEdit::caretWidth() const { - return send(SCI_GETCARETWIDTH, 0, 0); -} - -void ScintillaEdit::setTargetStart(sptr_t start) { - send(SCI_SETTARGETSTART, start, 0); -} - -sptr_t ScintillaEdit::targetStart() const { - return send(SCI_GETTARGETSTART, 0, 0); -} - -void ScintillaEdit::setTargetEnd(sptr_t end) { - send(SCI_SETTARGETEND, end, 0); -} - -sptr_t ScintillaEdit::targetEnd() const { - return send(SCI_GETTARGETEND, 0, 0); -} - -void ScintillaEdit::setTargetRange(sptr_t start, sptr_t end) { - send(SCI_SETTARGETRANGE, start, end); -} - -QByteArray ScintillaEdit::targetText() const { - return TextReturner(SCI_GETTARGETTEXT, 0); -} - -void ScintillaEdit::targetFromSelection() { - send(SCI_TARGETFROMSELECTION, 0, 0); -} - -void ScintillaEdit::targetWholeDocument() { - send(SCI_TARGETWHOLEDOCUMENT, 0, 0); -} - -sptr_t ScintillaEdit::replaceTarget(sptr_t length, const char * text) { - return send(SCI_REPLACETARGET, length, (sptr_t)text); -} - -sptr_t ScintillaEdit::replaceTargetRE(sptr_t length, const char * text) { - return send(SCI_REPLACETARGETRE, length, (sptr_t)text); -} - -sptr_t ScintillaEdit::searchInTarget(sptr_t length, const char * text) { - return send(SCI_SEARCHINTARGET, length, (sptr_t)text); -} - -void ScintillaEdit::setSearchFlags(sptr_t searchFlags) { - send(SCI_SETSEARCHFLAGS, searchFlags, 0); -} - -sptr_t ScintillaEdit::searchFlags() const { - return send(SCI_GETSEARCHFLAGS, 0, 0); -} - -void ScintillaEdit::callTipShow(sptr_t pos, const char * definition) { - send(SCI_CALLTIPSHOW, pos, (sptr_t)definition); -} - -void ScintillaEdit::callTipCancel() { - send(SCI_CALLTIPCANCEL, 0, 0); -} - -bool ScintillaEdit::callTipActive() { - return send(SCI_CALLTIPACTIVE, 0, 0); -} - -sptr_t ScintillaEdit::callTipPosStart() { - return send(SCI_CALLTIPPOSSTART, 0, 0); -} - -void ScintillaEdit::callTipSetPosStart(sptr_t posStart) { - send(SCI_CALLTIPSETPOSSTART, posStart, 0); -} - -void ScintillaEdit::callTipSetHlt(sptr_t highlightStart, sptr_t highlightEnd) { - send(SCI_CALLTIPSETHLT, highlightStart, highlightEnd); -} - -void ScintillaEdit::callTipSetBack(sptr_t back) { - send(SCI_CALLTIPSETBACK, back, 0); -} - -void ScintillaEdit::callTipSetFore(sptr_t fore) { - send(SCI_CALLTIPSETFORE, fore, 0); -} - -void ScintillaEdit::callTipSetForeHlt(sptr_t fore) { - send(SCI_CALLTIPSETFOREHLT, fore, 0); -} - -void ScintillaEdit::callTipUseStyle(sptr_t tabSize) { - send(SCI_CALLTIPUSESTYLE, tabSize, 0); -} - -void ScintillaEdit::callTipSetPosition(bool above) { - send(SCI_CALLTIPSETPOSITION, above, 0); -} - -sptr_t ScintillaEdit::visibleFromDocLine(sptr_t docLine) { - return send(SCI_VISIBLEFROMDOCLINE, docLine, 0); -} - -sptr_t ScintillaEdit::docLineFromVisible(sptr_t displayLine) { - return send(SCI_DOCLINEFROMVISIBLE, displayLine, 0); -} - -sptr_t ScintillaEdit::wrapCount(sptr_t docLine) { - return send(SCI_WRAPCOUNT, docLine, 0); -} - -void ScintillaEdit::setFoldLevel(sptr_t line, sptr_t level) { - send(SCI_SETFOLDLEVEL, line, level); -} - -sptr_t ScintillaEdit::foldLevel(sptr_t line) const { - return send(SCI_GETFOLDLEVEL, line, 0); -} - -sptr_t ScintillaEdit::lastChild(sptr_t line, sptr_t level) const { - return send(SCI_GETLASTCHILD, line, level); -} - -sptr_t ScintillaEdit::foldParent(sptr_t line) const { - return send(SCI_GETFOLDPARENT, line, 0); -} - -void ScintillaEdit::showLines(sptr_t lineStart, sptr_t lineEnd) { - send(SCI_SHOWLINES, lineStart, lineEnd); -} - -void ScintillaEdit::hideLines(sptr_t lineStart, sptr_t lineEnd) { - send(SCI_HIDELINES, lineStart, lineEnd); -} - -bool ScintillaEdit::lineVisible(sptr_t line) const { - return send(SCI_GETLINEVISIBLE, line, 0); -} - -bool ScintillaEdit::allLinesVisible() const { - return send(SCI_GETALLLINESVISIBLE, 0, 0); -} - -void ScintillaEdit::setFoldExpanded(sptr_t line, bool expanded) { - send(SCI_SETFOLDEXPANDED, line, expanded); -} - -bool ScintillaEdit::foldExpanded(sptr_t line) const { - return send(SCI_GETFOLDEXPANDED, line, 0); -} - -void ScintillaEdit::toggleFold(sptr_t line) { - send(SCI_TOGGLEFOLD, line, 0); -} - -void ScintillaEdit::toggleFoldShowText(sptr_t line, const char * text) { - send(SCI_TOGGLEFOLDSHOWTEXT, line, (sptr_t)text); -} - -void ScintillaEdit::foldDisplayTextSetStyle(sptr_t style) { - send(SCI_FOLDDISPLAYTEXTSETSTYLE, style, 0); -} - -void ScintillaEdit::foldLine(sptr_t line, sptr_t action) { - send(SCI_FOLDLINE, line, action); -} - -void ScintillaEdit::foldChildren(sptr_t line, sptr_t action) { - send(SCI_FOLDCHILDREN, line, action); -} - -void ScintillaEdit::expandChildren(sptr_t line, sptr_t level) { - send(SCI_EXPANDCHILDREN, line, level); -} - -void ScintillaEdit::foldAll(sptr_t action) { - send(SCI_FOLDALL, action, 0); -} - -void ScintillaEdit::ensureVisible(sptr_t line) { - send(SCI_ENSUREVISIBLE, line, 0); -} - -void ScintillaEdit::setAutomaticFold(sptr_t automaticFold) { - send(SCI_SETAUTOMATICFOLD, automaticFold, 0); -} - -sptr_t ScintillaEdit::automaticFold() const { - return send(SCI_GETAUTOMATICFOLD, 0, 0); -} - -void ScintillaEdit::setFoldFlags(sptr_t flags) { - send(SCI_SETFOLDFLAGS, flags, 0); -} - -void ScintillaEdit::ensureVisibleEnforcePolicy(sptr_t line) { - send(SCI_ENSUREVISIBLEENFORCEPOLICY, line, 0); -} - -void ScintillaEdit::setTabIndents(bool tabIndents) { - send(SCI_SETTABINDENTS, tabIndents, 0); -} - -bool ScintillaEdit::tabIndents() const { - return send(SCI_GETTABINDENTS, 0, 0); -} - -void ScintillaEdit::setBackSpaceUnIndents(bool bsUnIndents) { - send(SCI_SETBACKSPACEUNINDENTS, bsUnIndents, 0); -} - -bool ScintillaEdit::backSpaceUnIndents() const { - return send(SCI_GETBACKSPACEUNINDENTS, 0, 0); -} - -void ScintillaEdit::setMouseDwellTime(sptr_t periodMilliseconds) { - send(SCI_SETMOUSEDWELLTIME, periodMilliseconds, 0); -} - -sptr_t ScintillaEdit::mouseDwellTime() const { - return send(SCI_GETMOUSEDWELLTIME, 0, 0); -} - -sptr_t ScintillaEdit::wordStartPosition(sptr_t pos, bool onlyWordCharacters) { - return send(SCI_WORDSTARTPOSITION, pos, onlyWordCharacters); -} - -sptr_t ScintillaEdit::wordEndPosition(sptr_t pos, bool onlyWordCharacters) { - return send(SCI_WORDENDPOSITION, pos, onlyWordCharacters); -} - -bool ScintillaEdit::isRangeWord(sptr_t start, sptr_t end) { - return send(SCI_ISRANGEWORD, start, end); -} - -void ScintillaEdit::setIdleStyling(sptr_t idleStyling) { - send(SCI_SETIDLESTYLING, idleStyling, 0); -} - -sptr_t ScintillaEdit::idleStyling() const { - return send(SCI_GETIDLESTYLING, 0, 0); -} - -void ScintillaEdit::setWrapMode(sptr_t wrapMode) { - send(SCI_SETWRAPMODE, wrapMode, 0); -} - -sptr_t ScintillaEdit::wrapMode() const { - return send(SCI_GETWRAPMODE, 0, 0); -} - -void ScintillaEdit::setWrapVisualFlags(sptr_t wrapVisualFlags) { - send(SCI_SETWRAPVISUALFLAGS, wrapVisualFlags, 0); -} - -sptr_t ScintillaEdit::wrapVisualFlags() const { - return send(SCI_GETWRAPVISUALFLAGS, 0, 0); -} - -void ScintillaEdit::setWrapVisualFlagsLocation(sptr_t wrapVisualFlagsLocation) { - send(SCI_SETWRAPVISUALFLAGSLOCATION, wrapVisualFlagsLocation, 0); -} - -sptr_t ScintillaEdit::wrapVisualFlagsLocation() const { - return send(SCI_GETWRAPVISUALFLAGSLOCATION, 0, 0); -} - -void ScintillaEdit::setWrapStartIndent(sptr_t indent) { - send(SCI_SETWRAPSTARTINDENT, indent, 0); -} - -sptr_t ScintillaEdit::wrapStartIndent() const { - return send(SCI_GETWRAPSTARTINDENT, 0, 0); -} - -void ScintillaEdit::setWrapIndentMode(sptr_t wrapIndentMode) { - send(SCI_SETWRAPINDENTMODE, wrapIndentMode, 0); -} - -sptr_t ScintillaEdit::wrapIndentMode() const { - return send(SCI_GETWRAPINDENTMODE, 0, 0); -} - -void ScintillaEdit::setLayoutCache(sptr_t cacheMode) { - send(SCI_SETLAYOUTCACHE, cacheMode, 0); -} - -sptr_t ScintillaEdit::layoutCache() const { - return send(SCI_GETLAYOUTCACHE, 0, 0); -} - -void ScintillaEdit::setScrollWidth(sptr_t pixelWidth) { - send(SCI_SETSCROLLWIDTH, pixelWidth, 0); -} - -sptr_t ScintillaEdit::scrollWidth() const { - return send(SCI_GETSCROLLWIDTH, 0, 0); -} - -void ScintillaEdit::setScrollWidthTracking(bool tracking) { - send(SCI_SETSCROLLWIDTHTRACKING, tracking, 0); -} - -bool ScintillaEdit::scrollWidthTracking() const { - return send(SCI_GETSCROLLWIDTHTRACKING, 0, 0); -} - -sptr_t ScintillaEdit::textWidth(sptr_t style, const char * text) { - return send(SCI_TEXTWIDTH, style, (sptr_t)text); -} - -void ScintillaEdit::setEndAtLastLine(bool endAtLastLine) { - send(SCI_SETENDATLASTLINE, endAtLastLine, 0); -} - -bool ScintillaEdit::endAtLastLine() const { - return send(SCI_GETENDATLASTLINE, 0, 0); -} - -sptr_t ScintillaEdit::textHeight(sptr_t line) { - return send(SCI_TEXTHEIGHT, line, 0); -} - -void ScintillaEdit::setVScrollBar(bool visible) { - send(SCI_SETVSCROLLBAR, visible, 0); -} - -bool ScintillaEdit::vScrollBar() const { - return send(SCI_GETVSCROLLBAR, 0, 0); -} - -void ScintillaEdit::appendText(sptr_t length, const char * text) { - send(SCI_APPENDTEXT, length, (sptr_t)text); -} - -bool ScintillaEdit::twoPhaseDraw() const { - return send(SCI_GETTWOPHASEDRAW, 0, 0); -} - -void ScintillaEdit::setTwoPhaseDraw(bool twoPhase) { - send(SCI_SETTWOPHASEDRAW, twoPhase, 0); -} - -sptr_t ScintillaEdit::phasesDraw() const { - return send(SCI_GETPHASESDRAW, 0, 0); -} - -void ScintillaEdit::setPhasesDraw(sptr_t phases) { - send(SCI_SETPHASESDRAW, phases, 0); -} - -void ScintillaEdit::setFontQuality(sptr_t fontQuality) { - send(SCI_SETFONTQUALITY, fontQuality, 0); -} - -sptr_t ScintillaEdit::fontQuality() const { - return send(SCI_GETFONTQUALITY, 0, 0); -} - -void ScintillaEdit::setFirstVisibleLine(sptr_t displayLine) { - send(SCI_SETFIRSTVISIBLELINE, displayLine, 0); -} - -void ScintillaEdit::setMultiPaste(sptr_t multiPaste) { - send(SCI_SETMULTIPASTE, multiPaste, 0); -} - -sptr_t ScintillaEdit::multiPaste() const { - return send(SCI_GETMULTIPASTE, 0, 0); -} - -QByteArray ScintillaEdit::tag(sptr_t tagNumber) const { - return TextReturner(SCI_GETTAG, tagNumber); -} - -void ScintillaEdit::linesJoin() { - send(SCI_LINESJOIN, 0, 0); -} - -void ScintillaEdit::linesSplit(sptr_t pixelWidth) { - send(SCI_LINESSPLIT, pixelWidth, 0); -} - -void ScintillaEdit::setFoldMarginColour(bool useSetting, sptr_t back) { - send(SCI_SETFOLDMARGINCOLOUR, useSetting, back); -} - -void ScintillaEdit::setFoldMarginHiColour(bool useSetting, sptr_t fore) { - send(SCI_SETFOLDMARGINHICOLOUR, useSetting, fore); -} - -void ScintillaEdit::lineDown() { - send(SCI_LINEDOWN, 0, 0); -} - -void ScintillaEdit::lineDownExtend() { - send(SCI_LINEDOWNEXTEND, 0, 0); -} - -void ScintillaEdit::lineUp() { - send(SCI_LINEUP, 0, 0); -} - -void ScintillaEdit::lineUpExtend() { - send(SCI_LINEUPEXTEND, 0, 0); -} - -void ScintillaEdit::charLeft() { - send(SCI_CHARLEFT, 0, 0); -} - -void ScintillaEdit::charLeftExtend() { - send(SCI_CHARLEFTEXTEND, 0, 0); -} - -void ScintillaEdit::charRight() { - send(SCI_CHARRIGHT, 0, 0); -} - -void ScintillaEdit::charRightExtend() { - send(SCI_CHARRIGHTEXTEND, 0, 0); -} - -void ScintillaEdit::wordLeft() { - send(SCI_WORDLEFT, 0, 0); -} - -void ScintillaEdit::wordLeftExtend() { - send(SCI_WORDLEFTEXTEND, 0, 0); -} - -void ScintillaEdit::wordRight() { - send(SCI_WORDRIGHT, 0, 0); -} - -void ScintillaEdit::wordRightExtend() { - send(SCI_WORDRIGHTEXTEND, 0, 0); -} - -void ScintillaEdit::home() { - send(SCI_HOME, 0, 0); -} - -void ScintillaEdit::homeExtend() { - send(SCI_HOMEEXTEND, 0, 0); -} - -void ScintillaEdit::lineEnd() { - send(SCI_LINEEND, 0, 0); -} - -void ScintillaEdit::lineEndExtend() { - send(SCI_LINEENDEXTEND, 0, 0); -} - -void ScintillaEdit::documentStart() { - send(SCI_DOCUMENTSTART, 0, 0); -} - -void ScintillaEdit::documentStartExtend() { - send(SCI_DOCUMENTSTARTEXTEND, 0, 0); -} - -void ScintillaEdit::documentEnd() { - send(SCI_DOCUMENTEND, 0, 0); -} - -void ScintillaEdit::documentEndExtend() { - send(SCI_DOCUMENTENDEXTEND, 0, 0); -} - -void ScintillaEdit::pageUp() { - send(SCI_PAGEUP, 0, 0); -} - -void ScintillaEdit::pageUpExtend() { - send(SCI_PAGEUPEXTEND, 0, 0); -} - -void ScintillaEdit::pageDown() { - send(SCI_PAGEDOWN, 0, 0); -} - -void ScintillaEdit::pageDownExtend() { - send(SCI_PAGEDOWNEXTEND, 0, 0); -} - -void ScintillaEdit::editToggleOvertype() { - send(SCI_EDITTOGGLEOVERTYPE, 0, 0); -} - -void ScintillaEdit::cancel() { - send(SCI_CANCEL, 0, 0); -} - -void ScintillaEdit::deleteBack() { - send(SCI_DELETEBACK, 0, 0); -} - -void ScintillaEdit::tab() { - send(SCI_TAB, 0, 0); -} - -void ScintillaEdit::backTab() { - send(SCI_BACKTAB, 0, 0); -} - -void ScintillaEdit::newLine() { - send(SCI_NEWLINE, 0, 0); -} - -void ScintillaEdit::formFeed() { - send(SCI_FORMFEED, 0, 0); -} - -void ScintillaEdit::vCHome() { - send(SCI_VCHOME, 0, 0); -} - -void ScintillaEdit::vCHomeExtend() { - send(SCI_VCHOMEEXTEND, 0, 0); -} - -void ScintillaEdit::zoomIn() { - send(SCI_ZOOMIN, 0, 0); -} - -void ScintillaEdit::zoomOut() { - send(SCI_ZOOMOUT, 0, 0); -} - -void ScintillaEdit::delWordLeft() { - send(SCI_DELWORDLEFT, 0, 0); -} - -void ScintillaEdit::delWordRight() { - send(SCI_DELWORDRIGHT, 0, 0); -} - -void ScintillaEdit::delWordRightEnd() { - send(SCI_DELWORDRIGHTEND, 0, 0); -} - -void ScintillaEdit::lineCut() { - send(SCI_LINECUT, 0, 0); -} - -void ScintillaEdit::lineDelete() { - send(SCI_LINEDELETE, 0, 0); -} - -void ScintillaEdit::lineTranspose() { - send(SCI_LINETRANSPOSE, 0, 0); -} - -void ScintillaEdit::lineDuplicate() { - send(SCI_LINEDUPLICATE, 0, 0); -} - -void ScintillaEdit::lowerCase() { - send(SCI_LOWERCASE, 0, 0); -} - -void ScintillaEdit::upperCase() { - send(SCI_UPPERCASE, 0, 0); -} - -void ScintillaEdit::lineScrollDown() { - send(SCI_LINESCROLLDOWN, 0, 0); -} - -void ScintillaEdit::lineScrollUp() { - send(SCI_LINESCROLLUP, 0, 0); -} - -void ScintillaEdit::deleteBackNotLine() { - send(SCI_DELETEBACKNOTLINE, 0, 0); -} - -void ScintillaEdit::homeDisplay() { - send(SCI_HOMEDISPLAY, 0, 0); -} - -void ScintillaEdit::homeDisplayExtend() { - send(SCI_HOMEDISPLAYEXTEND, 0, 0); -} - -void ScintillaEdit::lineEndDisplay() { - send(SCI_LINEENDDISPLAY, 0, 0); -} - -void ScintillaEdit::lineEndDisplayExtend() { - send(SCI_LINEENDDISPLAYEXTEND, 0, 0); -} - -void ScintillaEdit::homeWrap() { - send(SCI_HOMEWRAP, 0, 0); -} - -void ScintillaEdit::homeWrapExtend() { - send(SCI_HOMEWRAPEXTEND, 0, 0); -} - -void ScintillaEdit::lineEndWrap() { - send(SCI_LINEENDWRAP, 0, 0); -} - -void ScintillaEdit::lineEndWrapExtend() { - send(SCI_LINEENDWRAPEXTEND, 0, 0); -} - -void ScintillaEdit::vCHomeWrap() { - send(SCI_VCHOMEWRAP, 0, 0); -} - -void ScintillaEdit::vCHomeWrapExtend() { - send(SCI_VCHOMEWRAPEXTEND, 0, 0); -} - -void ScintillaEdit::lineCopy() { - send(SCI_LINECOPY, 0, 0); -} - -void ScintillaEdit::moveCaretInsideView() { - send(SCI_MOVECARETINSIDEVIEW, 0, 0); -} - -sptr_t ScintillaEdit::lineLength(sptr_t line) { - return send(SCI_LINELENGTH, line, 0); -} - -void ScintillaEdit::braceHighlight(sptr_t posA, sptr_t posB) { - send(SCI_BRACEHIGHLIGHT, posA, posB); -} - -void ScintillaEdit::braceHighlightIndicator(bool useSetting, sptr_t indicator) { - send(SCI_BRACEHIGHLIGHTINDICATOR, useSetting, indicator); -} - -void ScintillaEdit::braceBadLight(sptr_t pos) { - send(SCI_BRACEBADLIGHT, pos, 0); -} - -void ScintillaEdit::braceBadLightIndicator(bool useSetting, sptr_t indicator) { - send(SCI_BRACEBADLIGHTINDICATOR, useSetting, indicator); -} - -sptr_t ScintillaEdit::braceMatch(sptr_t pos, sptr_t maxReStyle) { - return send(SCI_BRACEMATCH, pos, maxReStyle); -} - -bool ScintillaEdit::viewEOL() const { - return send(SCI_GETVIEWEOL, 0, 0); -} - -void ScintillaEdit::setViewEOL(bool visible) { - send(SCI_SETVIEWEOL, visible, 0); -} - -sptr_t ScintillaEdit::docPointer() const { - return send(SCI_GETDOCPOINTER, 0, 0); -} - -void ScintillaEdit::setDocPointer(sptr_t doc) { - send(SCI_SETDOCPOINTER, 0, doc); -} - -void ScintillaEdit::setModEventMask(sptr_t eventMask) { - send(SCI_SETMODEVENTMASK, eventMask, 0); -} - -sptr_t ScintillaEdit::edgeColumn() const { - return send(SCI_GETEDGECOLUMN, 0, 0); -} - -void ScintillaEdit::setEdgeColumn(sptr_t column) { - send(SCI_SETEDGECOLUMN, column, 0); -} - -sptr_t ScintillaEdit::edgeMode() const { - return send(SCI_GETEDGEMODE, 0, 0); -} - -void ScintillaEdit::setEdgeMode(sptr_t edgeMode) { - send(SCI_SETEDGEMODE, edgeMode, 0); -} - -sptr_t ScintillaEdit::edgeColour() const { - return send(SCI_GETEDGECOLOUR, 0, 0); -} - -void ScintillaEdit::setEdgeColour(sptr_t edgeColour) { - send(SCI_SETEDGECOLOUR, edgeColour, 0); -} - -void ScintillaEdit::multiEdgeAddLine(sptr_t column, sptr_t edgeColour) { - send(SCI_MULTIEDGEADDLINE, column, edgeColour); -} - -void ScintillaEdit::multiEdgeClearAll() { - send(SCI_MULTIEDGECLEARALL, 0, 0); -} - -void ScintillaEdit::searchAnchor() { - send(SCI_SEARCHANCHOR, 0, 0); -} - -sptr_t ScintillaEdit::searchNext(sptr_t searchFlags, const char * text) { - return send(SCI_SEARCHNEXT, searchFlags, (sptr_t)text); -} - -sptr_t ScintillaEdit::searchPrev(sptr_t searchFlags, const char * text) { - return send(SCI_SEARCHPREV, searchFlags, (sptr_t)text); -} - -sptr_t ScintillaEdit::linesOnScreen() const { - return send(SCI_LINESONSCREEN, 0, 0); -} - -void ScintillaEdit::usePopUp(sptr_t popUpMode) { - send(SCI_USEPOPUP, popUpMode, 0); -} - -bool ScintillaEdit::selectionIsRectangle() const { - return send(SCI_SELECTIONISRECTANGLE, 0, 0); -} - -void ScintillaEdit::setZoom(sptr_t zoomInPoints) { - send(SCI_SETZOOM, zoomInPoints, 0); -} - -sptr_t ScintillaEdit::zoom() const { - return send(SCI_GETZOOM, 0, 0); -} - -sptr_t ScintillaEdit::createDocument() { - return send(SCI_CREATEDOCUMENT, 0, 0); -} - -void ScintillaEdit::addRefDocument(sptr_t doc) { - send(SCI_ADDREFDOCUMENT, 0, doc); -} - -void ScintillaEdit::releaseDocument(sptr_t doc) { - send(SCI_RELEASEDOCUMENT, 0, doc); -} - -sptr_t ScintillaEdit::modEventMask() const { - return send(SCI_GETMODEVENTMASK, 0, 0); -} - -void ScintillaEdit::setFocus(bool focus) { - send(SCI_SETFOCUS, focus, 0); -} - -bool ScintillaEdit::focus() const { - return send(SCI_GETFOCUS, 0, 0); -} - -void ScintillaEdit::setStatus(sptr_t status) { - send(SCI_SETSTATUS, status, 0); -} - -sptr_t ScintillaEdit::status() const { - return send(SCI_GETSTATUS, 0, 0); -} - -void ScintillaEdit::setMouseDownCaptures(bool captures) { - send(SCI_SETMOUSEDOWNCAPTURES, captures, 0); -} - -bool ScintillaEdit::mouseDownCaptures() const { - return send(SCI_GETMOUSEDOWNCAPTURES, 0, 0); -} - -void ScintillaEdit::setMouseWheelCaptures(bool captures) { - send(SCI_SETMOUSEWHEELCAPTURES, captures, 0); -} - -bool ScintillaEdit::mouseWheelCaptures() const { - return send(SCI_GETMOUSEWHEELCAPTURES, 0, 0); -} - -void ScintillaEdit::setCursor(sptr_t cursorType) { - send(SCI_SETCURSOR, cursorType, 0); -} - -sptr_t ScintillaEdit::cursor() const { - return send(SCI_GETCURSOR, 0, 0); -} - -void ScintillaEdit::setControlCharSymbol(sptr_t symbol) { - send(SCI_SETCONTROLCHARSYMBOL, symbol, 0); -} - -sptr_t ScintillaEdit::controlCharSymbol() const { - return send(SCI_GETCONTROLCHARSYMBOL, 0, 0); -} - -void ScintillaEdit::wordPartLeft() { - send(SCI_WORDPARTLEFT, 0, 0); -} - -void ScintillaEdit::wordPartLeftExtend() { - send(SCI_WORDPARTLEFTEXTEND, 0, 0); -} - -void ScintillaEdit::wordPartRight() { - send(SCI_WORDPARTRIGHT, 0, 0); -} - -void ScintillaEdit::wordPartRightExtend() { - send(SCI_WORDPARTRIGHTEXTEND, 0, 0); -} - -void ScintillaEdit::setVisiblePolicy(sptr_t visiblePolicy, sptr_t visibleSlop) { - send(SCI_SETVISIBLEPOLICY, visiblePolicy, visibleSlop); -} - -void ScintillaEdit::delLineLeft() { - send(SCI_DELLINELEFT, 0, 0); -} - -void ScintillaEdit::delLineRight() { - send(SCI_DELLINERIGHT, 0, 0); -} - -void ScintillaEdit::setXOffset(sptr_t xOffset) { - send(SCI_SETXOFFSET, xOffset, 0); -} - -sptr_t ScintillaEdit::xOffset() const { - return send(SCI_GETXOFFSET, 0, 0); -} - -void ScintillaEdit::chooseCaretX() { - send(SCI_CHOOSECARETX, 0, 0); -} - -void ScintillaEdit::grabFocus() { - send(SCI_GRABFOCUS, 0, 0); -} - -void ScintillaEdit::setXCaretPolicy(sptr_t caretPolicy, sptr_t caretSlop) { - send(SCI_SETXCARETPOLICY, caretPolicy, caretSlop); -} - -void ScintillaEdit::setYCaretPolicy(sptr_t caretPolicy, sptr_t caretSlop) { - send(SCI_SETYCARETPOLICY, caretPolicy, caretSlop); -} - -void ScintillaEdit::setPrintWrapMode(sptr_t wrapMode) { - send(SCI_SETPRINTWRAPMODE, wrapMode, 0); -} - -sptr_t ScintillaEdit::printWrapMode() const { - return send(SCI_GETPRINTWRAPMODE, 0, 0); -} - -void ScintillaEdit::setHotspotActiveFore(bool useSetting, sptr_t fore) { - send(SCI_SETHOTSPOTACTIVEFORE, useSetting, fore); -} - -sptr_t ScintillaEdit::hotspotActiveFore() const { - return send(SCI_GETHOTSPOTACTIVEFORE, 0, 0); -} - -void ScintillaEdit::setHotspotActiveBack(bool useSetting, sptr_t back) { - send(SCI_SETHOTSPOTACTIVEBACK, useSetting, back); -} - -sptr_t ScintillaEdit::hotspotActiveBack() const { - return send(SCI_GETHOTSPOTACTIVEBACK, 0, 0); -} - -void ScintillaEdit::setHotspotActiveUnderline(bool underline) { - send(SCI_SETHOTSPOTACTIVEUNDERLINE, underline, 0); -} - -bool ScintillaEdit::hotspotActiveUnderline() const { - return send(SCI_GETHOTSPOTACTIVEUNDERLINE, 0, 0); -} - -void ScintillaEdit::setHotspotSingleLine(bool singleLine) { - send(SCI_SETHOTSPOTSINGLELINE, singleLine, 0); -} - -bool ScintillaEdit::hotspotSingleLine() const { - return send(SCI_GETHOTSPOTSINGLELINE, 0, 0); -} - -void ScintillaEdit::paraDown() { - send(SCI_PARADOWN, 0, 0); -} - -void ScintillaEdit::paraDownExtend() { - send(SCI_PARADOWNEXTEND, 0, 0); -} - -void ScintillaEdit::paraUp() { - send(SCI_PARAUP, 0, 0); -} - -void ScintillaEdit::paraUpExtend() { - send(SCI_PARAUPEXTEND, 0, 0); -} - -sptr_t ScintillaEdit::positionBefore(sptr_t pos) { - return send(SCI_POSITIONBEFORE, pos, 0); -} - -sptr_t ScintillaEdit::positionAfter(sptr_t pos) { - return send(SCI_POSITIONAFTER, pos, 0); -} - -sptr_t ScintillaEdit::positionRelative(sptr_t pos, sptr_t relative) { - return send(SCI_POSITIONRELATIVE, pos, relative); -} - -void ScintillaEdit::copyRange(sptr_t start, sptr_t end) { - send(SCI_COPYRANGE, start, end); -} - -void ScintillaEdit::copyText(sptr_t length, const char * text) { - send(SCI_COPYTEXT, length, (sptr_t)text); -} - -void ScintillaEdit::setSelectionMode(sptr_t selectionMode) { - send(SCI_SETSELECTIONMODE, selectionMode, 0); -} - -sptr_t ScintillaEdit::selectionMode() const { - return send(SCI_GETSELECTIONMODE, 0, 0); -} - -sptr_t ScintillaEdit::getLineSelStartPosition(sptr_t line) { - return send(SCI_GETLINESELSTARTPOSITION, line, 0); -} - -sptr_t ScintillaEdit::getLineSelEndPosition(sptr_t line) { - return send(SCI_GETLINESELENDPOSITION, line, 0); -} - -void ScintillaEdit::lineDownRectExtend() { - send(SCI_LINEDOWNRECTEXTEND, 0, 0); -} - -void ScintillaEdit::lineUpRectExtend() { - send(SCI_LINEUPRECTEXTEND, 0, 0); -} - -void ScintillaEdit::charLeftRectExtend() { - send(SCI_CHARLEFTRECTEXTEND, 0, 0); -} - -void ScintillaEdit::charRightRectExtend() { - send(SCI_CHARRIGHTRECTEXTEND, 0, 0); -} - -void ScintillaEdit::homeRectExtend() { - send(SCI_HOMERECTEXTEND, 0, 0); -} - -void ScintillaEdit::vCHomeRectExtend() { - send(SCI_VCHOMERECTEXTEND, 0, 0); -} - -void ScintillaEdit::lineEndRectExtend() { - send(SCI_LINEENDRECTEXTEND, 0, 0); -} - -void ScintillaEdit::pageUpRectExtend() { - send(SCI_PAGEUPRECTEXTEND, 0, 0); -} - -void ScintillaEdit::pageDownRectExtend() { - send(SCI_PAGEDOWNRECTEXTEND, 0, 0); -} - -void ScintillaEdit::stutteredPageUp() { - send(SCI_STUTTEREDPAGEUP, 0, 0); -} - -void ScintillaEdit::stutteredPageUpExtend() { - send(SCI_STUTTEREDPAGEUPEXTEND, 0, 0); -} - -void ScintillaEdit::stutteredPageDown() { - send(SCI_STUTTEREDPAGEDOWN, 0, 0); -} - -void ScintillaEdit::stutteredPageDownExtend() { - send(SCI_STUTTEREDPAGEDOWNEXTEND, 0, 0); -} - -void ScintillaEdit::wordLeftEnd() { - send(SCI_WORDLEFTEND, 0, 0); -} - -void ScintillaEdit::wordLeftEndExtend() { - send(SCI_WORDLEFTENDEXTEND, 0, 0); -} - -void ScintillaEdit::wordRightEnd() { - send(SCI_WORDRIGHTEND, 0, 0); -} - -void ScintillaEdit::wordRightEndExtend() { - send(SCI_WORDRIGHTENDEXTEND, 0, 0); -} - -void ScintillaEdit::setWhitespaceChars(const char * characters) { - send(SCI_SETWHITESPACECHARS, 0, (sptr_t)characters); -} - -QByteArray ScintillaEdit::whitespaceChars() const { - return TextReturner(SCI_GETWHITESPACECHARS, 0); -} - -void ScintillaEdit::setPunctuationChars(const char * characters) { - send(SCI_SETPUNCTUATIONCHARS, 0, (sptr_t)characters); -} - -QByteArray ScintillaEdit::punctuationChars() const { - return TextReturner(SCI_GETPUNCTUATIONCHARS, 0); -} - -void ScintillaEdit::setCharsDefault() { - send(SCI_SETCHARSDEFAULT, 0, 0); -} - -sptr_t ScintillaEdit::autoCCurrent() const { - return send(SCI_AUTOCGETCURRENT, 0, 0); -} - -QByteArray ScintillaEdit::autoCCurrentText() const { - return TextReturner(SCI_AUTOCGETCURRENTTEXT, 0); -} - -void ScintillaEdit::autoCSetCaseInsensitiveBehaviour(sptr_t behaviour) { - send(SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR, behaviour, 0); -} - -sptr_t ScintillaEdit::autoCCaseInsensitiveBehaviour() const { - return send(SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR, 0, 0); -} - -void ScintillaEdit::autoCSetMulti(sptr_t multi) { - send(SCI_AUTOCSETMULTI, multi, 0); -} - -sptr_t ScintillaEdit::autoCMulti() const { - return send(SCI_AUTOCGETMULTI, 0, 0); -} - -void ScintillaEdit::autoCSetOrder(sptr_t order) { - send(SCI_AUTOCSETORDER, order, 0); -} - -sptr_t ScintillaEdit::autoCOrder() const { - return send(SCI_AUTOCGETORDER, 0, 0); -} - -void ScintillaEdit::allocate(sptr_t bytes) { - send(SCI_ALLOCATE, bytes, 0); -} - -QByteArray ScintillaEdit::targetAsUTF8() { - return TextReturner(SCI_TARGETASUTF8, 0); -} - -void ScintillaEdit::setLengthForEncode(sptr_t bytes) { - send(SCI_SETLENGTHFORENCODE, bytes, 0); -} - -QByteArray ScintillaEdit::encodedFromUTF8(const char * utf8) { - return TextReturner(SCI_ENCODEDFROMUTF8, (sptr_t)utf8); -} - -sptr_t ScintillaEdit::findColumn(sptr_t line, sptr_t column) { - return send(SCI_FINDCOLUMN, line, column); -} - -sptr_t ScintillaEdit::caretSticky() const { - return send(SCI_GETCARETSTICKY, 0, 0); -} - -void ScintillaEdit::setCaretSticky(sptr_t useCaretStickyBehaviour) { - send(SCI_SETCARETSTICKY, useCaretStickyBehaviour, 0); -} - -void ScintillaEdit::toggleCaretSticky() { - send(SCI_TOGGLECARETSTICKY, 0, 0); -} - -void ScintillaEdit::setPasteConvertEndings(bool convert) { - send(SCI_SETPASTECONVERTENDINGS, convert, 0); -} - -bool ScintillaEdit::pasteConvertEndings() const { - return send(SCI_GETPASTECONVERTENDINGS, 0, 0); -} - -void ScintillaEdit::selectionDuplicate() { - send(SCI_SELECTIONDUPLICATE, 0, 0); -} - -void ScintillaEdit::setCaretLineBackAlpha(sptr_t alpha) { - send(SCI_SETCARETLINEBACKALPHA, alpha, 0); -} - -sptr_t ScintillaEdit::caretLineBackAlpha() const { - return send(SCI_GETCARETLINEBACKALPHA, 0, 0); -} - -void ScintillaEdit::setCaretStyle(sptr_t caretStyle) { - send(SCI_SETCARETSTYLE, caretStyle, 0); -} - -sptr_t ScintillaEdit::caretStyle() const { - return send(SCI_GETCARETSTYLE, 0, 0); -} - -void ScintillaEdit::setIndicatorCurrent(sptr_t indicator) { - send(SCI_SETINDICATORCURRENT, indicator, 0); -} - -sptr_t ScintillaEdit::indicatorCurrent() const { - return send(SCI_GETINDICATORCURRENT, 0, 0); -} - -void ScintillaEdit::setIndicatorValue(sptr_t value) { - send(SCI_SETINDICATORVALUE, value, 0); -} - -sptr_t ScintillaEdit::indicatorValue() const { - return send(SCI_GETINDICATORVALUE, 0, 0); -} - -void ScintillaEdit::indicatorFillRange(sptr_t start, sptr_t lengthFill) { - send(SCI_INDICATORFILLRANGE, start, lengthFill); -} - -void ScintillaEdit::indicatorClearRange(sptr_t start, sptr_t lengthClear) { - send(SCI_INDICATORCLEARRANGE, start, lengthClear); -} - -sptr_t ScintillaEdit::indicatorAllOnFor(sptr_t pos) { - return send(SCI_INDICATORALLONFOR, pos, 0); -} - -sptr_t ScintillaEdit::indicatorValueAt(sptr_t indicator, sptr_t pos) { - return send(SCI_INDICATORVALUEAT, indicator, pos); -} - -sptr_t ScintillaEdit::indicatorStart(sptr_t indicator, sptr_t pos) { - return send(SCI_INDICATORSTART, indicator, pos); -} - -sptr_t ScintillaEdit::indicatorEnd(sptr_t indicator, sptr_t pos) { - return send(SCI_INDICATOREND, indicator, pos); -} - -void ScintillaEdit::setPositionCache(sptr_t size) { - send(SCI_SETPOSITIONCACHE, size, 0); -} - -sptr_t ScintillaEdit::positionCache() const { - return send(SCI_GETPOSITIONCACHE, 0, 0); -} - -void ScintillaEdit::copyAllowLine() { - send(SCI_COPYALLOWLINE, 0, 0); -} - -sptr_t ScintillaEdit::characterPointer() const { - return send(SCI_GETCHARACTERPOINTER, 0, 0); -} - -sptr_t ScintillaEdit::rangePointer(sptr_t start, sptr_t lengthRange) const { - return send(SCI_GETRANGEPOINTER, start, lengthRange); -} - -sptr_t ScintillaEdit::gapPosition() const { - return send(SCI_GETGAPPOSITION, 0, 0); -} - -void ScintillaEdit::indicSetAlpha(sptr_t indicator, sptr_t alpha) { - send(SCI_INDICSETALPHA, indicator, alpha); -} - -sptr_t ScintillaEdit::indicAlpha(sptr_t indicator) const { - return send(SCI_INDICGETALPHA, indicator, 0); -} - -void ScintillaEdit::indicSetOutlineAlpha(sptr_t indicator, sptr_t alpha) { - send(SCI_INDICSETOUTLINEALPHA, indicator, alpha); -} - -sptr_t ScintillaEdit::indicOutlineAlpha(sptr_t indicator) const { - return send(SCI_INDICGETOUTLINEALPHA, indicator, 0); -} - -void ScintillaEdit::setExtraAscent(sptr_t extraAscent) { - send(SCI_SETEXTRAASCENT, extraAscent, 0); -} - -sptr_t ScintillaEdit::extraAscent() const { - return send(SCI_GETEXTRAASCENT, 0, 0); -} - -void ScintillaEdit::setExtraDescent(sptr_t extraDescent) { - send(SCI_SETEXTRADESCENT, extraDescent, 0); -} - -sptr_t ScintillaEdit::extraDescent() const { - return send(SCI_GETEXTRADESCENT, 0, 0); -} - -sptr_t ScintillaEdit::markerSymbolDefined(sptr_t markerNumber) { - return send(SCI_MARKERSYMBOLDEFINED, markerNumber, 0); -} - -void ScintillaEdit::marginSetText(sptr_t line, const char * text) { - send(SCI_MARGINSETTEXT, line, (sptr_t)text); -} - -QByteArray ScintillaEdit::marginText(sptr_t line) const { - return TextReturner(SCI_MARGINGETTEXT, line); -} - -void ScintillaEdit::marginSetStyle(sptr_t line, sptr_t style) { - send(SCI_MARGINSETSTYLE, line, style); -} - -sptr_t ScintillaEdit::marginStyle(sptr_t line) const { - return send(SCI_MARGINGETSTYLE, line, 0); -} - -void ScintillaEdit::marginSetStyles(sptr_t line, const char * styles) { - send(SCI_MARGINSETSTYLES, line, (sptr_t)styles); -} - -QByteArray ScintillaEdit::marginStyles(sptr_t line) const { - return TextReturner(SCI_MARGINGETSTYLES, line); -} - -void ScintillaEdit::marginTextClearAll() { - send(SCI_MARGINTEXTCLEARALL, 0, 0); -} - -void ScintillaEdit::marginSetStyleOffset(sptr_t style) { - send(SCI_MARGINSETSTYLEOFFSET, style, 0); -} - -sptr_t ScintillaEdit::marginStyleOffset() const { - return send(SCI_MARGINGETSTYLEOFFSET, 0, 0); -} - -void ScintillaEdit::setMarginOptions(sptr_t marginOptions) { - send(SCI_SETMARGINOPTIONS, marginOptions, 0); -} - -sptr_t ScintillaEdit::marginOptions() const { - return send(SCI_GETMARGINOPTIONS, 0, 0); -} - -void ScintillaEdit::annotationSetText(sptr_t line, const char * text) { - send(SCI_ANNOTATIONSETTEXT, line, (sptr_t)text); -} - -QByteArray ScintillaEdit::annotationText(sptr_t line) const { - return TextReturner(SCI_ANNOTATIONGETTEXT, line); -} - -void ScintillaEdit::annotationSetStyle(sptr_t line, sptr_t style) { - send(SCI_ANNOTATIONSETSTYLE, line, style); -} - -sptr_t ScintillaEdit::annotationStyle(sptr_t line) const { - return send(SCI_ANNOTATIONGETSTYLE, line, 0); -} - -void ScintillaEdit::annotationSetStyles(sptr_t line, const char * styles) { - send(SCI_ANNOTATIONSETSTYLES, line, (sptr_t)styles); -} - -QByteArray ScintillaEdit::annotationStyles(sptr_t line) const { - return TextReturner(SCI_ANNOTATIONGETSTYLES, line); -} - -sptr_t ScintillaEdit::annotationLines(sptr_t line) const { - return send(SCI_ANNOTATIONGETLINES, line, 0); -} - -void ScintillaEdit::annotationClearAll() { - send(SCI_ANNOTATIONCLEARALL, 0, 0); -} - -void ScintillaEdit::annotationSetVisible(sptr_t visible) { - send(SCI_ANNOTATIONSETVISIBLE, visible, 0); -} - -sptr_t ScintillaEdit::annotationVisible() const { - return send(SCI_ANNOTATIONGETVISIBLE, 0, 0); -} - -void ScintillaEdit::annotationSetStyleOffset(sptr_t style) { - send(SCI_ANNOTATIONSETSTYLEOFFSET, style, 0); -} - -sptr_t ScintillaEdit::annotationStyleOffset() const { - return send(SCI_ANNOTATIONGETSTYLEOFFSET, 0, 0); -} - -void ScintillaEdit::releaseAllExtendedStyles() { - send(SCI_RELEASEALLEXTENDEDSTYLES, 0, 0); -} - -sptr_t ScintillaEdit::allocateExtendedStyles(sptr_t numberStyles) { - return send(SCI_ALLOCATEEXTENDEDSTYLES, numberStyles, 0); -} - -void ScintillaEdit::addUndoAction(sptr_t token, sptr_t flags) { - send(SCI_ADDUNDOACTION, token, flags); -} - -sptr_t ScintillaEdit::charPositionFromPoint(sptr_t x, sptr_t y) { - return send(SCI_CHARPOSITIONFROMPOINT, x, y); -} - -sptr_t ScintillaEdit::charPositionFromPointClose(sptr_t x, sptr_t y) { - return send(SCI_CHARPOSITIONFROMPOINTCLOSE, x, y); -} - -void ScintillaEdit::setMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch) { - send(SCI_SETMOUSESELECTIONRECTANGULARSWITCH, mouseSelectionRectangularSwitch, 0); -} - -bool ScintillaEdit::mouseSelectionRectangularSwitch() const { - return send(SCI_GETMOUSESELECTIONRECTANGULARSWITCH, 0, 0); -} - -void ScintillaEdit::setMultipleSelection(bool multipleSelection) { - send(SCI_SETMULTIPLESELECTION, multipleSelection, 0); -} - -bool ScintillaEdit::multipleSelection() const { - return send(SCI_GETMULTIPLESELECTION, 0, 0); -} - -void ScintillaEdit::setAdditionalSelectionTyping(bool additionalSelectionTyping) { - send(SCI_SETADDITIONALSELECTIONTYPING, additionalSelectionTyping, 0); -} - -bool ScintillaEdit::additionalSelectionTyping() const { - return send(SCI_GETADDITIONALSELECTIONTYPING, 0, 0); -} - -void ScintillaEdit::setAdditionalCaretsBlink(bool additionalCaretsBlink) { - send(SCI_SETADDITIONALCARETSBLINK, additionalCaretsBlink, 0); -} - -bool ScintillaEdit::additionalCaretsBlink() const { - return send(SCI_GETADDITIONALCARETSBLINK, 0, 0); -} - -void ScintillaEdit::setAdditionalCaretsVisible(bool additionalCaretsVisible) { - send(SCI_SETADDITIONALCARETSVISIBLE, additionalCaretsVisible, 0); -} - -bool ScintillaEdit::additionalCaretsVisible() const { - return send(SCI_GETADDITIONALCARETSVISIBLE, 0, 0); -} - -sptr_t ScintillaEdit::selections() const { - return send(SCI_GETSELECTIONS, 0, 0); -} - -bool ScintillaEdit::selectionEmpty() const { - return send(SCI_GETSELECTIONEMPTY, 0, 0); -} - -void ScintillaEdit::clearSelections() { - send(SCI_CLEARSELECTIONS, 0, 0); -} - -sptr_t ScintillaEdit::setSelection(sptr_t caret, sptr_t anchor) { - return send(SCI_SETSELECTION, caret, anchor); -} - -sptr_t ScintillaEdit::addSelection(sptr_t caret, sptr_t anchor) { - return send(SCI_ADDSELECTION, caret, anchor); -} - -void ScintillaEdit::dropSelectionN(sptr_t selection) { - send(SCI_DROPSELECTIONN, selection, 0); -} - -void ScintillaEdit::setMainSelection(sptr_t selection) { - send(SCI_SETMAINSELECTION, selection, 0); -} - -sptr_t ScintillaEdit::mainSelection() const { - return send(SCI_GETMAINSELECTION, 0, 0); -} - -void ScintillaEdit::setSelectionNCaret(sptr_t selection, sptr_t caret) { - send(SCI_SETSELECTIONNCARET, selection, caret); -} - -sptr_t ScintillaEdit::selectionNCaret(sptr_t selection) const { - return send(SCI_GETSELECTIONNCARET, selection, 0); -} - -void ScintillaEdit::setSelectionNAnchor(sptr_t selection, sptr_t anchor) { - send(SCI_SETSELECTIONNANCHOR, selection, anchor); -} - -sptr_t ScintillaEdit::selectionNAnchor(sptr_t selection) const { - return send(SCI_GETSELECTIONNANCHOR, selection, 0); -} - -void ScintillaEdit::setSelectionNCaretVirtualSpace(sptr_t selection, sptr_t space) { - send(SCI_SETSELECTIONNCARETVIRTUALSPACE, selection, space); -} - -sptr_t ScintillaEdit::selectionNCaretVirtualSpace(sptr_t selection) const { - return send(SCI_GETSELECTIONNCARETVIRTUALSPACE, selection, 0); -} - -void ScintillaEdit::setSelectionNAnchorVirtualSpace(sptr_t selection, sptr_t space) { - send(SCI_SETSELECTIONNANCHORVIRTUALSPACE, selection, space); -} - -sptr_t ScintillaEdit::selectionNAnchorVirtualSpace(sptr_t selection) const { - return send(SCI_GETSELECTIONNANCHORVIRTUALSPACE, selection, 0); -} - -void ScintillaEdit::setSelectionNStart(sptr_t selection, sptr_t anchor) { - send(SCI_SETSELECTIONNSTART, selection, anchor); -} - -sptr_t ScintillaEdit::selectionNStart(sptr_t selection) const { - return send(SCI_GETSELECTIONNSTART, selection, 0); -} - -void ScintillaEdit::setSelectionNEnd(sptr_t selection, sptr_t caret) { - send(SCI_SETSELECTIONNEND, selection, caret); -} - -sptr_t ScintillaEdit::selectionNEnd(sptr_t selection) const { - return send(SCI_GETSELECTIONNEND, selection, 0); -} - -void ScintillaEdit::setRectangularSelectionCaret(sptr_t caret) { - send(SCI_SETRECTANGULARSELECTIONCARET, caret, 0); -} - -sptr_t ScintillaEdit::rectangularSelectionCaret() const { - return send(SCI_GETRECTANGULARSELECTIONCARET, 0, 0); -} - -void ScintillaEdit::setRectangularSelectionAnchor(sptr_t anchor) { - send(SCI_SETRECTANGULARSELECTIONANCHOR, anchor, 0); -} - -sptr_t ScintillaEdit::rectangularSelectionAnchor() const { - return send(SCI_GETRECTANGULARSELECTIONANCHOR, 0, 0); -} - -void ScintillaEdit::setRectangularSelectionCaretVirtualSpace(sptr_t space) { - send(SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE, space, 0); -} - -sptr_t ScintillaEdit::rectangularSelectionCaretVirtualSpace() const { - return send(SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE, 0, 0); -} - -void ScintillaEdit::setRectangularSelectionAnchorVirtualSpace(sptr_t space) { - send(SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE, space, 0); -} - -sptr_t ScintillaEdit::rectangularSelectionAnchorVirtualSpace() const { - return send(SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE, 0, 0); -} - -void ScintillaEdit::setVirtualSpaceOptions(sptr_t virtualSpaceOptions) { - send(SCI_SETVIRTUALSPACEOPTIONS, virtualSpaceOptions, 0); -} - -sptr_t ScintillaEdit::virtualSpaceOptions() const { - return send(SCI_GETVIRTUALSPACEOPTIONS, 0, 0); -} - -void ScintillaEdit::setRectangularSelectionModifier(sptr_t modifier) { - send(SCI_SETRECTANGULARSELECTIONMODIFIER, modifier, 0); -} - -sptr_t ScintillaEdit::rectangularSelectionModifier() const { - return send(SCI_GETRECTANGULARSELECTIONMODIFIER, 0, 0); -} - -void ScintillaEdit::setAdditionalSelFore(sptr_t fore) { - send(SCI_SETADDITIONALSELFORE, fore, 0); -} - -void ScintillaEdit::setAdditionalSelBack(sptr_t back) { - send(SCI_SETADDITIONALSELBACK, back, 0); -} - -void ScintillaEdit::setAdditionalSelAlpha(sptr_t alpha) { - send(SCI_SETADDITIONALSELALPHA, alpha, 0); -} - -sptr_t ScintillaEdit::additionalSelAlpha() const { - return send(SCI_GETADDITIONALSELALPHA, 0, 0); -} - -void ScintillaEdit::setAdditionalCaretFore(sptr_t fore) { - send(SCI_SETADDITIONALCARETFORE, fore, 0); -} - -sptr_t ScintillaEdit::additionalCaretFore() const { - return send(SCI_GETADDITIONALCARETFORE, 0, 0); -} - -void ScintillaEdit::rotateSelection() { - send(SCI_ROTATESELECTION, 0, 0); -} - -void ScintillaEdit::swapMainAnchorCaret() { - send(SCI_SWAPMAINANCHORCARET, 0, 0); -} - -void ScintillaEdit::multipleSelectAddNext() { - send(SCI_MULTIPLESELECTADDNEXT, 0, 0); -} - -void ScintillaEdit::multipleSelectAddEach() { - send(SCI_MULTIPLESELECTADDEACH, 0, 0); -} - -sptr_t ScintillaEdit::changeLexerState(sptr_t start, sptr_t end) { - return send(SCI_CHANGELEXERSTATE, start, end); -} - -sptr_t ScintillaEdit::contractedFoldNext(sptr_t lineStart) { - return send(SCI_CONTRACTEDFOLDNEXT, lineStart, 0); -} - -void ScintillaEdit::verticalCentreCaret() { - send(SCI_VERTICALCENTRECARET, 0, 0); -} - -void ScintillaEdit::moveSelectedLinesUp() { - send(SCI_MOVESELECTEDLINESUP, 0, 0); -} - -void ScintillaEdit::moveSelectedLinesDown() { - send(SCI_MOVESELECTEDLINESDOWN, 0, 0); -} - -void ScintillaEdit::setIdentifier(sptr_t identifier) { - send(SCI_SETIDENTIFIER, identifier, 0); -} - -sptr_t ScintillaEdit::identifier() const { - return send(SCI_GETIDENTIFIER, 0, 0); -} - -void ScintillaEdit::rGBAImageSetWidth(sptr_t width) { - send(SCI_RGBAIMAGESETWIDTH, width, 0); -} - -void ScintillaEdit::rGBAImageSetHeight(sptr_t height) { - send(SCI_RGBAIMAGESETHEIGHT, height, 0); -} - -void ScintillaEdit::rGBAImageSetScale(sptr_t scalePercent) { - send(SCI_RGBAIMAGESETSCALE, scalePercent, 0); -} - -void ScintillaEdit::markerDefineRGBAImage(sptr_t markerNumber, const char * pixels) { - send(SCI_MARKERDEFINERGBAIMAGE, markerNumber, (sptr_t)pixels); -} - -void ScintillaEdit::registerRGBAImage(sptr_t type, const char * pixels) { - send(SCI_REGISTERRGBAIMAGE, type, (sptr_t)pixels); -} - -void ScintillaEdit::scrollToStart() { - send(SCI_SCROLLTOSTART, 0, 0); -} - -void ScintillaEdit::scrollToEnd() { - send(SCI_SCROLLTOEND, 0, 0); -} - -void ScintillaEdit::setTechnology(sptr_t technology) { - send(SCI_SETTECHNOLOGY, technology, 0); -} - -sptr_t ScintillaEdit::technology() const { - return send(SCI_GETTECHNOLOGY, 0, 0); -} - -sptr_t ScintillaEdit::createLoader(sptr_t bytes) { - return send(SCI_CREATELOADER, bytes, 0); -} - -void ScintillaEdit::findIndicatorShow(sptr_t start, sptr_t end) { - send(SCI_FINDINDICATORSHOW, start, end); -} - -void ScintillaEdit::findIndicatorFlash(sptr_t start, sptr_t end) { - send(SCI_FINDINDICATORFLASH, start, end); -} - -void ScintillaEdit::findIndicatorHide() { - send(SCI_FINDINDICATORHIDE, 0, 0); -} - -void ScintillaEdit::vCHomeDisplay() { - send(SCI_VCHOMEDISPLAY, 0, 0); -} - -void ScintillaEdit::vCHomeDisplayExtend() { - send(SCI_VCHOMEDISPLAYEXTEND, 0, 0); -} - -bool ScintillaEdit::caretLineVisibleAlways() const { - return send(SCI_GETCARETLINEVISIBLEALWAYS, 0, 0); -} - -void ScintillaEdit::setCaretLineVisibleAlways(bool alwaysVisible) { - send(SCI_SETCARETLINEVISIBLEALWAYS, alwaysVisible, 0); -} - -void ScintillaEdit::setLineEndTypesAllowed(sptr_t lineEndBitSet) { - send(SCI_SETLINEENDTYPESALLOWED, lineEndBitSet, 0); -} - -sptr_t ScintillaEdit::lineEndTypesAllowed() const { - return send(SCI_GETLINEENDTYPESALLOWED, 0, 0); -} - -sptr_t ScintillaEdit::lineEndTypesActive() const { - return send(SCI_GETLINEENDTYPESACTIVE, 0, 0); -} - -void ScintillaEdit::setRepresentation(const char * encodedCharacter, const char * representation) { - send(SCI_SETREPRESENTATION, (sptr_t)encodedCharacter, (sptr_t)representation); -} - -QByteArray ScintillaEdit::representation(const char * encodedCharacter) const { - return TextReturner(SCI_GETREPRESENTATION, (sptr_t)encodedCharacter); -} - -void ScintillaEdit::clearRepresentation(const char * encodedCharacter) { - send(SCI_CLEARREPRESENTATION, (sptr_t)encodedCharacter, 0); -} - -void ScintillaEdit::startRecord() { - send(SCI_STARTRECORD, 0, 0); -} - -void ScintillaEdit::stopRecord() { - send(SCI_STOPRECORD, 0, 0); -} - -void ScintillaEdit::setLexer(sptr_t lexer) { - send(SCI_SETLEXER, lexer, 0); -} - -sptr_t ScintillaEdit::lexer() const { - return send(SCI_GETLEXER, 0, 0); -} - -void ScintillaEdit::colourise(sptr_t start, sptr_t end) { - send(SCI_COLOURISE, start, end); -} - -void ScintillaEdit::setProperty(const char * key, const char * value) { - send(SCI_SETPROPERTY, (sptr_t)key, (sptr_t)value); -} - -void ScintillaEdit::setKeyWords(sptr_t keyWordSet, const char * keyWords) { - send(SCI_SETKEYWORDS, keyWordSet, (sptr_t)keyWords); -} - -void ScintillaEdit::setLexerLanguage(const char * language) { - send(SCI_SETLEXERLANGUAGE, 0, (sptr_t)language); -} - -void ScintillaEdit::loadLexerLibrary(const char * path) { - send(SCI_LOADLEXERLIBRARY, 0, (sptr_t)path); -} - -QByteArray ScintillaEdit::property(const char * key) const { - return TextReturner(SCI_GETPROPERTY, (sptr_t)key); -} - -QByteArray ScintillaEdit::propertyExpanded(const char * key) const { - return TextReturner(SCI_GETPROPERTYEXPANDED, (sptr_t)key); -} - -sptr_t ScintillaEdit::propertyInt(const char * key, sptr_t defaultValue) const { - return send(SCI_GETPROPERTYINT, (sptr_t)key, defaultValue); -} - -sptr_t ScintillaEdit::styleBitsNeeded() const { - return send(SCI_GETSTYLEBITSNEEDED, 0, 0); -} - -QByteArray ScintillaEdit::lexerLanguage() const { - return TextReturner(SCI_GETLEXERLANGUAGE, 0); -} - -sptr_t ScintillaEdit::privateLexerCall(sptr_t operation, sptr_t pointer) { - return send(SCI_PRIVATELEXERCALL, operation, pointer); -} - -QByteArray ScintillaEdit::propertyNames() { - return TextReturner(SCI_PROPERTYNAMES, 0); -} - -sptr_t ScintillaEdit::propertyType(const char * name) { - return send(SCI_PROPERTYTYPE, (sptr_t)name, 0); -} - -QByteArray ScintillaEdit::describeProperty(const char * name) { - return TextReturner(SCI_DESCRIBEPROPERTY, (sptr_t)name); -} - -QByteArray ScintillaEdit::describeKeyWordSets() { - return TextReturner(SCI_DESCRIBEKEYWORDSETS, 0); -} - -sptr_t ScintillaEdit::lineEndTypesSupported() const { - return send(SCI_GETLINEENDTYPESSUPPORTED, 0, 0); -} - -sptr_t ScintillaEdit::allocateSubStyles(sptr_t styleBase, sptr_t numberStyles) { - return send(SCI_ALLOCATESUBSTYLES, styleBase, numberStyles); -} - -sptr_t ScintillaEdit::subStylesStart(sptr_t styleBase) const { - return send(SCI_GETSUBSTYLESSTART, styleBase, 0); -} - -sptr_t ScintillaEdit::subStylesLength(sptr_t styleBase) const { - return send(SCI_GETSUBSTYLESLENGTH, styleBase, 0); -} - -sptr_t ScintillaEdit::styleFromSubStyle(sptr_t subStyle) const { - return send(SCI_GETSTYLEFROMSUBSTYLE, subStyle, 0); -} - -sptr_t ScintillaEdit::primaryStyleFromStyle(sptr_t style) const { - return send(SCI_GETPRIMARYSTYLEFROMSTYLE, style, 0); -} - -void ScintillaEdit::freeSubStyles() { - send(SCI_FREESUBSTYLES, 0, 0); -} - -void ScintillaEdit::setIdentifiers(sptr_t style, const char * identifiers) { - send(SCI_SETIDENTIFIERS, style, (sptr_t)identifiers); -} - -sptr_t ScintillaEdit::distanceToSecondaryStyles() const { - return send(SCI_DISTANCETOSECONDARYSTYLES, 0, 0); -} - -QByteArray ScintillaEdit::subStyleBases() const { - return TextReturner(SCI_GETSUBSTYLEBASES, 0); -} - -/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ diff --git a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaEdit.h b/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaEdit.h deleted file mode 100644 index 56d2cfe46..000000000 --- a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEdit/ScintillaEdit.h +++ /dev/null @@ -1,766 +0,0 @@ -// ScintillaEdit.h -// Extended version of ScintillaEditBase with a method for each API -// Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware - -#ifndef SCINTILLAEDIT_H -#define SCINTILLAEDIT_H - -#include - -#include "ScintillaEditBase.h" -#include "ScintillaDocument.h" - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -#ifndef EXPORT_IMPORT_API -#ifdef WIN32 -#ifdef MAKING_LIBRARY -#define EXPORT_IMPORT_API __declspec(dllexport) -#else -// Defining dllimport upsets moc -#define EXPORT_IMPORT_API __declspec(dllimport) -//#define EXPORT_IMPORT_API -#endif -#else -#define EXPORT_IMPORT_API -#endif -#endif - -class EXPORT_IMPORT_API ScintillaEdit : public ScintillaEditBase { - Q_OBJECT - -public: - ScintillaEdit(QWidget *parent = 0); - virtual ~ScintillaEdit(); - - QByteArray TextReturner(int message, uptr_t wParam) const; - - QPairfind_text(int flags, const char *text, int cpMin, int cpMax); - QByteArray get_text_range(int start, int end); - ScintillaDocument *get_doc(); - void set_doc(ScintillaDocument *pdoc_); - - // Same as previous two methods but with Qt style names - QPairfindText(int flags, const char *text, int cpMin, int cpMax) { - return find_text(flags, text, cpMin, cpMax); - } - - QByteArray textRange(int start, int end) { - return get_text_range(start, end); - } - - // Exposing the FORMATRANGE api with both underscore & qt style names - long format_range(bool draw, QPaintDevice* target, QPaintDevice* measure, - const QRect& print_rect, const QRect& page_rect, - long range_start, long range_end); - long formatRange(bool draw, QPaintDevice* target, QPaintDevice* measure, - const QRect& print_rect, const QRect& page_rect, - long range_start, long range_end) { - return format_range(draw, target, measure, print_rect, page_rect, - range_start, range_end); - } - -/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ - void addText(sptr_t length, const char * text); - void addStyledText(sptr_t length, const char * c); - void insertText(sptr_t pos, const char * text); - void changeInsertion(sptr_t length, const char * text); - void clearAll(); - void deleteRange(sptr_t start, sptr_t lengthDelete); - void clearDocumentStyle(); - sptr_t length() const; - sptr_t charAt(sptr_t pos) const; - sptr_t currentPos() const; - sptr_t anchor() const; - sptr_t styleAt(sptr_t pos) const; - void redo(); - void setUndoCollection(bool collectUndo); - void selectAll(); - void setSavePoint(); - bool canRedo(); - sptr_t markerLineFromHandle(sptr_t markerHandle); - void markerDeleteHandle(sptr_t markerHandle); - bool undoCollection() const; - sptr_t viewWS() const; - void setViewWS(sptr_t viewWS); - sptr_t tabDrawMode() const; - void setTabDrawMode(sptr_t tabDrawMode); - sptr_t positionFromPoint(sptr_t x, sptr_t y); - sptr_t positionFromPointClose(sptr_t x, sptr_t y); - void gotoLine(sptr_t line); - void gotoPos(sptr_t caret); - void setAnchor(sptr_t anchor); - QByteArray getCurLine(sptr_t length); - sptr_t endStyled() const; - void convertEOLs(sptr_t eolMode); - sptr_t eOLMode() const; - void setEOLMode(sptr_t eolMode); - void startStyling(sptr_t start, sptr_t unused); - void setStyling(sptr_t length, sptr_t style); - bool bufferedDraw() const; - void setBufferedDraw(bool buffered); - void setTabWidth(sptr_t tabWidth); - sptr_t tabWidth() const; - void clearTabStops(sptr_t line); - void addTabStop(sptr_t line, sptr_t x); - sptr_t getNextTabStop(sptr_t line, sptr_t x); - void setCodePage(sptr_t codePage); - sptr_t iMEInteraction() const; - void setIMEInteraction(sptr_t imeInteraction); - void markerDefine(sptr_t markerNumber, sptr_t markerSymbol); - void markerSetFore(sptr_t markerNumber, sptr_t fore); - void markerSetBack(sptr_t markerNumber, sptr_t back); - void markerSetBackSelected(sptr_t markerNumber, sptr_t back); - void markerEnableHighlight(bool enabled); - sptr_t markerAdd(sptr_t line, sptr_t markerNumber); - void markerDelete(sptr_t line, sptr_t markerNumber); - void markerDeleteAll(sptr_t markerNumber); - sptr_t markerGet(sptr_t line); - sptr_t markerNext(sptr_t lineStart, sptr_t markerMask); - sptr_t markerPrevious(sptr_t lineStart, sptr_t markerMask); - void markerDefinePixmap(sptr_t markerNumber, const char * pixmap); - void markerAddSet(sptr_t line, sptr_t markerSet); - void markerSetAlpha(sptr_t markerNumber, sptr_t alpha); - void setMarginTypeN(sptr_t margin, sptr_t marginType); - sptr_t marginTypeN(sptr_t margin) const; - void setMarginWidthN(sptr_t margin, sptr_t pixelWidth); - sptr_t marginWidthN(sptr_t margin) const; - void setMarginMaskN(sptr_t margin, sptr_t mask); - sptr_t marginMaskN(sptr_t margin) const; - void setMarginSensitiveN(sptr_t margin, bool sensitive); - bool marginSensitiveN(sptr_t margin) const; - void setMarginCursorN(sptr_t margin, sptr_t cursor); - sptr_t marginCursorN(sptr_t margin) const; - void setMarginBackN(sptr_t margin, sptr_t back); - sptr_t marginBackN(sptr_t margin) const; - void setMargins(sptr_t margins); - sptr_t margins() const; - void styleClearAll(); - void styleSetFore(sptr_t style, sptr_t fore); - void styleSetBack(sptr_t style, sptr_t back); - void styleSetBold(sptr_t style, bool bold); - void styleSetItalic(sptr_t style, bool italic); - void styleSetSize(sptr_t style, sptr_t sizePoints); - void styleSetFont(sptr_t style, const char * fontName); - void styleSetEOLFilled(sptr_t style, bool eolFilled); - void styleResetDefault(); - void styleSetUnderline(sptr_t style, bool underline); - sptr_t styleFore(sptr_t style) const; - sptr_t styleBack(sptr_t style) const; - bool styleBold(sptr_t style) const; - bool styleItalic(sptr_t style) const; - sptr_t styleSize(sptr_t style) const; - QByteArray styleFont(sptr_t style) const; - bool styleEOLFilled(sptr_t style) const; - bool styleUnderline(sptr_t style) const; - sptr_t styleCase(sptr_t style) const; - sptr_t styleCharacterSet(sptr_t style) const; - bool styleVisible(sptr_t style) const; - bool styleChangeable(sptr_t style) const; - bool styleHotSpot(sptr_t style) const; - void styleSetCase(sptr_t style, sptr_t caseVisible); - void styleSetSizeFractional(sptr_t style, sptr_t sizeHundredthPoints); - sptr_t styleSizeFractional(sptr_t style) const; - void styleSetWeight(sptr_t style, sptr_t weight); - sptr_t styleWeight(sptr_t style) const; - void styleSetCharacterSet(sptr_t style, sptr_t characterSet); - void styleSetHotSpot(sptr_t style, bool hotspot); - void setSelFore(bool useSetting, sptr_t fore); - void setSelBack(bool useSetting, sptr_t back); - sptr_t selAlpha() const; - void setSelAlpha(sptr_t alpha); - bool selEOLFilled() const; - void setSelEOLFilled(bool filled); - void setCaretFore(sptr_t fore); - void assignCmdKey(sptr_t keyDefinition, sptr_t sciCommand); - void clearCmdKey(sptr_t keyDefinition); - void clearAllCmdKeys(); - void setStylingEx(sptr_t length, const char * styles); - void styleSetVisible(sptr_t style, bool visible); - sptr_t caretPeriod() const; - void setCaretPeriod(sptr_t periodMilliseconds); - void setWordChars(const char * characters); - QByteArray wordChars() const; - void beginUndoAction(); - void endUndoAction(); - void indicSetStyle(sptr_t indicator, sptr_t indicatorStyle); - sptr_t indicStyle(sptr_t indicator) const; - void indicSetFore(sptr_t indicator, sptr_t fore); - sptr_t indicFore(sptr_t indicator) const; - void indicSetUnder(sptr_t indicator, bool under); - bool indicUnder(sptr_t indicator) const; - void indicSetHoverStyle(sptr_t indicator, sptr_t indicatorStyle); - sptr_t indicHoverStyle(sptr_t indicator) const; - void indicSetHoverFore(sptr_t indicator, sptr_t fore); - sptr_t indicHoverFore(sptr_t indicator) const; - void indicSetFlags(sptr_t indicator, sptr_t flags); - sptr_t indicFlags(sptr_t indicator) const; - void setWhitespaceFore(bool useSetting, sptr_t fore); - void setWhitespaceBack(bool useSetting, sptr_t back); - void setWhitespaceSize(sptr_t size); - sptr_t whitespaceSize() const; - void setStyleBits(sptr_t bits); - sptr_t styleBits() const; - void setLineState(sptr_t line, sptr_t state); - sptr_t lineState(sptr_t line) const; - sptr_t maxLineState() const; - bool caretLineVisible() const; - void setCaretLineVisible(bool show); - sptr_t caretLineBack() const; - void setCaretLineBack(sptr_t back); - void styleSetChangeable(sptr_t style, bool changeable); - void autoCShow(sptr_t lengthEntered, const char * itemList); - void autoCCancel(); - bool autoCActive(); - sptr_t autoCPosStart(); - void autoCComplete(); - void autoCStops(const char * characterSet); - void autoCSetSeparator(sptr_t separatorCharacter); - sptr_t autoCSeparator() const; - void autoCSelect(const char * select); - void autoCSetCancelAtStart(bool cancel); - bool autoCCancelAtStart() const; - void autoCSetFillUps(const char * characterSet); - void autoCSetChooseSingle(bool chooseSingle); - bool autoCChooseSingle() const; - void autoCSetIgnoreCase(bool ignoreCase); - bool autoCIgnoreCase() const; - void userListShow(sptr_t listType, const char * itemList); - void autoCSetAutoHide(bool autoHide); - bool autoCAutoHide() const; - void autoCSetDropRestOfWord(bool dropRestOfWord); - bool autoCDropRestOfWord() const; - void registerImage(sptr_t type, const char * xpmData); - void clearRegisteredImages(); - sptr_t autoCTypeSeparator() const; - void autoCSetTypeSeparator(sptr_t separatorCharacter); - void autoCSetMaxWidth(sptr_t characterCount); - sptr_t autoCMaxWidth() const; - void autoCSetMaxHeight(sptr_t rowCount); - sptr_t autoCMaxHeight() const; - void setIndent(sptr_t indentSize); - sptr_t indent() const; - void setUseTabs(bool useTabs); - bool useTabs() const; - void setLineIndentation(sptr_t line, sptr_t indentation); - sptr_t lineIndentation(sptr_t line) const; - sptr_t lineIndentPosition(sptr_t line) const; - sptr_t column(sptr_t pos) const; - sptr_t countCharacters(sptr_t start, sptr_t end); - void setHScrollBar(bool visible); - bool hScrollBar() const; - void setIndentationGuides(sptr_t indentView); - sptr_t indentationGuides() const; - void setHighlightGuide(sptr_t column); - sptr_t highlightGuide() const; - sptr_t lineEndPosition(sptr_t line) const; - sptr_t codePage() const; - sptr_t caretFore() const; - bool readOnly() const; - void setCurrentPos(sptr_t caret); - void setSelectionStart(sptr_t anchor); - sptr_t selectionStart() const; - void setSelectionEnd(sptr_t caret); - sptr_t selectionEnd() const; - void setEmptySelection(sptr_t caret); - void setPrintMagnification(sptr_t magnification); - sptr_t printMagnification() const; - void setPrintColourMode(sptr_t mode); - sptr_t printColourMode() const; - sptr_t firstVisibleLine() const; - QByteArray getLine(sptr_t line); - sptr_t lineCount() const; - void setMarginLeft(sptr_t pixelWidth); - sptr_t marginLeft() const; - void setMarginRight(sptr_t pixelWidth); - sptr_t marginRight() const; - bool modify() const; - void setSel(sptr_t anchor, sptr_t caret); - QByteArray getSelText(); - void hideSelection(bool hide); - sptr_t pointXFromPosition(sptr_t pos); - sptr_t pointYFromPosition(sptr_t pos); - sptr_t lineFromPosition(sptr_t pos); - sptr_t positionFromLine(sptr_t line); - void lineScroll(sptr_t columns, sptr_t lines); - void scrollCaret(); - void scrollRange(sptr_t secondary, sptr_t primary); - void replaceSel(const char * text); - void setReadOnly(bool readOnly); - void null(); - bool canPaste(); - bool canUndo(); - void emptyUndoBuffer(); - void undo(); - void cut(); - void copy(); - void paste(); - void clear(); - void setText(const char * text); - QByteArray getText(sptr_t length); - sptr_t textLength() const; - sptr_t directFunction() const; - sptr_t directPointer() const; - void setOvertype(bool overType); - bool overtype() const; - void setCaretWidth(sptr_t pixelWidth); - sptr_t caretWidth() const; - void setTargetStart(sptr_t start); - sptr_t targetStart() const; - void setTargetEnd(sptr_t end); - sptr_t targetEnd() const; - void setTargetRange(sptr_t start, sptr_t end); - QByteArray targetText() const; - void targetFromSelection(); - void targetWholeDocument(); - sptr_t replaceTarget(sptr_t length, const char * text); - sptr_t replaceTargetRE(sptr_t length, const char * text); - sptr_t searchInTarget(sptr_t length, const char * text); - void setSearchFlags(sptr_t searchFlags); - sptr_t searchFlags() const; - void callTipShow(sptr_t pos, const char * definition); - void callTipCancel(); - bool callTipActive(); - sptr_t callTipPosStart(); - void callTipSetPosStart(sptr_t posStart); - void callTipSetHlt(sptr_t highlightStart, sptr_t highlightEnd); - void callTipSetBack(sptr_t back); - void callTipSetFore(sptr_t fore); - void callTipSetForeHlt(sptr_t fore); - void callTipUseStyle(sptr_t tabSize); - void callTipSetPosition(bool above); - sptr_t visibleFromDocLine(sptr_t docLine); - sptr_t docLineFromVisible(sptr_t displayLine); - sptr_t wrapCount(sptr_t docLine); - void setFoldLevel(sptr_t line, sptr_t level); - sptr_t foldLevel(sptr_t line) const; - sptr_t lastChild(sptr_t line, sptr_t level) const; - sptr_t foldParent(sptr_t line) const; - void showLines(sptr_t lineStart, sptr_t lineEnd); - void hideLines(sptr_t lineStart, sptr_t lineEnd); - bool lineVisible(sptr_t line) const; - bool allLinesVisible() const; - void setFoldExpanded(sptr_t line, bool expanded); - bool foldExpanded(sptr_t line) const; - void toggleFold(sptr_t line); - void toggleFoldShowText(sptr_t line, const char * text); - void foldDisplayTextSetStyle(sptr_t style); - void foldLine(sptr_t line, sptr_t action); - void foldChildren(sptr_t line, sptr_t action); - void expandChildren(sptr_t line, sptr_t level); - void foldAll(sptr_t action); - void ensureVisible(sptr_t line); - void setAutomaticFold(sptr_t automaticFold); - sptr_t automaticFold() const; - void setFoldFlags(sptr_t flags); - void ensureVisibleEnforcePolicy(sptr_t line); - void setTabIndents(bool tabIndents); - bool tabIndents() const; - void setBackSpaceUnIndents(bool bsUnIndents); - bool backSpaceUnIndents() const; - void setMouseDwellTime(sptr_t periodMilliseconds); - sptr_t mouseDwellTime() const; - sptr_t wordStartPosition(sptr_t pos, bool onlyWordCharacters); - sptr_t wordEndPosition(sptr_t pos, bool onlyWordCharacters); - bool isRangeWord(sptr_t start, sptr_t end); - void setIdleStyling(sptr_t idleStyling); - sptr_t idleStyling() const; - void setWrapMode(sptr_t wrapMode); - sptr_t wrapMode() const; - void setWrapVisualFlags(sptr_t wrapVisualFlags); - sptr_t wrapVisualFlags() const; - void setWrapVisualFlagsLocation(sptr_t wrapVisualFlagsLocation); - sptr_t wrapVisualFlagsLocation() const; - void setWrapStartIndent(sptr_t indent); - sptr_t wrapStartIndent() const; - void setWrapIndentMode(sptr_t wrapIndentMode); - sptr_t wrapIndentMode() const; - void setLayoutCache(sptr_t cacheMode); - sptr_t layoutCache() const; - void setScrollWidth(sptr_t pixelWidth); - sptr_t scrollWidth() const; - void setScrollWidthTracking(bool tracking); - bool scrollWidthTracking() const; - sptr_t textWidth(sptr_t style, const char * text); - void setEndAtLastLine(bool endAtLastLine); - bool endAtLastLine() const; - sptr_t textHeight(sptr_t line); - void setVScrollBar(bool visible); - bool vScrollBar() const; - void appendText(sptr_t length, const char * text); - bool twoPhaseDraw() const; - void setTwoPhaseDraw(bool twoPhase); - sptr_t phasesDraw() const; - void setPhasesDraw(sptr_t phases); - void setFontQuality(sptr_t fontQuality); - sptr_t fontQuality() const; - void setFirstVisibleLine(sptr_t displayLine); - void setMultiPaste(sptr_t multiPaste); - sptr_t multiPaste() const; - QByteArray tag(sptr_t tagNumber) const; - void linesJoin(); - void linesSplit(sptr_t pixelWidth); - void setFoldMarginColour(bool useSetting, sptr_t back); - void setFoldMarginHiColour(bool useSetting, sptr_t fore); - void lineDown(); - void lineDownExtend(); - void lineUp(); - void lineUpExtend(); - void charLeft(); - void charLeftExtend(); - void charRight(); - void charRightExtend(); - void wordLeft(); - void wordLeftExtend(); - void wordRight(); - void wordRightExtend(); - void home(); - void homeExtend(); - void lineEnd(); - void lineEndExtend(); - void documentStart(); - void documentStartExtend(); - void documentEnd(); - void documentEndExtend(); - void pageUp(); - void pageUpExtend(); - void pageDown(); - void pageDownExtend(); - void editToggleOvertype(); - void cancel(); - void deleteBack(); - void tab(); - void backTab(); - void newLine(); - void formFeed(); - void vCHome(); - void vCHomeExtend(); - void zoomIn(); - void zoomOut(); - void delWordLeft(); - void delWordRight(); - void delWordRightEnd(); - void lineCut(); - void lineDelete(); - void lineTranspose(); - void lineDuplicate(); - void lowerCase(); - void upperCase(); - void lineScrollDown(); - void lineScrollUp(); - void deleteBackNotLine(); - void homeDisplay(); - void homeDisplayExtend(); - void lineEndDisplay(); - void lineEndDisplayExtend(); - void homeWrap(); - void homeWrapExtend(); - void lineEndWrap(); - void lineEndWrapExtend(); - void vCHomeWrap(); - void vCHomeWrapExtend(); - void lineCopy(); - void moveCaretInsideView(); - sptr_t lineLength(sptr_t line); - void braceHighlight(sptr_t posA, sptr_t posB); - void braceHighlightIndicator(bool useSetting, sptr_t indicator); - void braceBadLight(sptr_t pos); - void braceBadLightIndicator(bool useSetting, sptr_t indicator); - sptr_t braceMatch(sptr_t pos, sptr_t maxReStyle); - bool viewEOL() const; - void setViewEOL(bool visible); - sptr_t docPointer() const; - void setDocPointer(sptr_t doc); - void setModEventMask(sptr_t eventMask); - sptr_t edgeColumn() const; - void setEdgeColumn(sptr_t column); - sptr_t edgeMode() const; - void setEdgeMode(sptr_t edgeMode); - sptr_t edgeColour() const; - void setEdgeColour(sptr_t edgeColour); - void multiEdgeAddLine(sptr_t column, sptr_t edgeColour); - void multiEdgeClearAll(); - void searchAnchor(); - sptr_t searchNext(sptr_t searchFlags, const char * text); - sptr_t searchPrev(sptr_t searchFlags, const char * text); - sptr_t linesOnScreen() const; - void usePopUp(sptr_t popUpMode); - bool selectionIsRectangle() const; - void setZoom(sptr_t zoomInPoints); - sptr_t zoom() const; - sptr_t createDocument(); - void addRefDocument(sptr_t doc); - void releaseDocument(sptr_t doc); - sptr_t modEventMask() const; - void setFocus(bool focus); - bool focus() const; - void setStatus(sptr_t status); - sptr_t status() const; - void setMouseDownCaptures(bool captures); - bool mouseDownCaptures() const; - void setMouseWheelCaptures(bool captures); - bool mouseWheelCaptures() const; - void setCursor(sptr_t cursorType); - sptr_t cursor() const; - void setControlCharSymbol(sptr_t symbol); - sptr_t controlCharSymbol() const; - void wordPartLeft(); - void wordPartLeftExtend(); - void wordPartRight(); - void wordPartRightExtend(); - void setVisiblePolicy(sptr_t visiblePolicy, sptr_t visibleSlop); - void delLineLeft(); - void delLineRight(); - void setXOffset(sptr_t xOffset); - sptr_t xOffset() const; - void chooseCaretX(); - void grabFocus(); - void setXCaretPolicy(sptr_t caretPolicy, sptr_t caretSlop); - void setYCaretPolicy(sptr_t caretPolicy, sptr_t caretSlop); - void setPrintWrapMode(sptr_t wrapMode); - sptr_t printWrapMode() const; - void setHotspotActiveFore(bool useSetting, sptr_t fore); - sptr_t hotspotActiveFore() const; - void setHotspotActiveBack(bool useSetting, sptr_t back); - sptr_t hotspotActiveBack() const; - void setHotspotActiveUnderline(bool underline); - bool hotspotActiveUnderline() const; - void setHotspotSingleLine(bool singleLine); - bool hotspotSingleLine() const; - void paraDown(); - void paraDownExtend(); - void paraUp(); - void paraUpExtend(); - sptr_t positionBefore(sptr_t pos); - sptr_t positionAfter(sptr_t pos); - sptr_t positionRelative(sptr_t pos, sptr_t relative); - void copyRange(sptr_t start, sptr_t end); - void copyText(sptr_t length, const char * text); - void setSelectionMode(sptr_t selectionMode); - sptr_t selectionMode() const; - sptr_t getLineSelStartPosition(sptr_t line); - sptr_t getLineSelEndPosition(sptr_t line); - void lineDownRectExtend(); - void lineUpRectExtend(); - void charLeftRectExtend(); - void charRightRectExtend(); - void homeRectExtend(); - void vCHomeRectExtend(); - void lineEndRectExtend(); - void pageUpRectExtend(); - void pageDownRectExtend(); - void stutteredPageUp(); - void stutteredPageUpExtend(); - void stutteredPageDown(); - void stutteredPageDownExtend(); - void wordLeftEnd(); - void wordLeftEndExtend(); - void wordRightEnd(); - void wordRightEndExtend(); - void setWhitespaceChars(const char * characters); - QByteArray whitespaceChars() const; - void setPunctuationChars(const char * characters); - QByteArray punctuationChars() const; - void setCharsDefault(); - sptr_t autoCCurrent() const; - QByteArray autoCCurrentText() const; - void autoCSetCaseInsensitiveBehaviour(sptr_t behaviour); - sptr_t autoCCaseInsensitiveBehaviour() const; - void autoCSetMulti(sptr_t multi); - sptr_t autoCMulti() const; - void autoCSetOrder(sptr_t order); - sptr_t autoCOrder() const; - void allocate(sptr_t bytes); - QByteArray targetAsUTF8(); - void setLengthForEncode(sptr_t bytes); - QByteArray encodedFromUTF8(const char * utf8); - sptr_t findColumn(sptr_t line, sptr_t column); - sptr_t caretSticky() const; - void setCaretSticky(sptr_t useCaretStickyBehaviour); - void toggleCaretSticky(); - void setPasteConvertEndings(bool convert); - bool pasteConvertEndings() const; - void selectionDuplicate(); - void setCaretLineBackAlpha(sptr_t alpha); - sptr_t caretLineBackAlpha() const; - void setCaretStyle(sptr_t caretStyle); - sptr_t caretStyle() const; - void setIndicatorCurrent(sptr_t indicator); - sptr_t indicatorCurrent() const; - void setIndicatorValue(sptr_t value); - sptr_t indicatorValue() const; - void indicatorFillRange(sptr_t start, sptr_t lengthFill); - void indicatorClearRange(sptr_t start, sptr_t lengthClear); - sptr_t indicatorAllOnFor(sptr_t pos); - sptr_t indicatorValueAt(sptr_t indicator, sptr_t pos); - sptr_t indicatorStart(sptr_t indicator, sptr_t pos); - sptr_t indicatorEnd(sptr_t indicator, sptr_t pos); - void setPositionCache(sptr_t size); - sptr_t positionCache() const; - void copyAllowLine(); - sptr_t characterPointer() const; - sptr_t rangePointer(sptr_t start, sptr_t lengthRange) const; - sptr_t gapPosition() const; - void indicSetAlpha(sptr_t indicator, sptr_t alpha); - sptr_t indicAlpha(sptr_t indicator) const; - void indicSetOutlineAlpha(sptr_t indicator, sptr_t alpha); - sptr_t indicOutlineAlpha(sptr_t indicator) const; - void setExtraAscent(sptr_t extraAscent); - sptr_t extraAscent() const; - void setExtraDescent(sptr_t extraDescent); - sptr_t extraDescent() const; - sptr_t markerSymbolDefined(sptr_t markerNumber); - void marginSetText(sptr_t line, const char * text); - QByteArray marginText(sptr_t line) const; - void marginSetStyle(sptr_t line, sptr_t style); - sptr_t marginStyle(sptr_t line) const; - void marginSetStyles(sptr_t line, const char * styles); - QByteArray marginStyles(sptr_t line) const; - void marginTextClearAll(); - void marginSetStyleOffset(sptr_t style); - sptr_t marginStyleOffset() const; - void setMarginOptions(sptr_t marginOptions); - sptr_t marginOptions() const; - void annotationSetText(sptr_t line, const char * text); - QByteArray annotationText(sptr_t line) const; - void annotationSetStyle(sptr_t line, sptr_t style); - sptr_t annotationStyle(sptr_t line) const; - void annotationSetStyles(sptr_t line, const char * styles); - QByteArray annotationStyles(sptr_t line) const; - sptr_t annotationLines(sptr_t line) const; - void annotationClearAll(); - void annotationSetVisible(sptr_t visible); - sptr_t annotationVisible() const; - void annotationSetStyleOffset(sptr_t style); - sptr_t annotationStyleOffset() const; - void releaseAllExtendedStyles(); - sptr_t allocateExtendedStyles(sptr_t numberStyles); - void addUndoAction(sptr_t token, sptr_t flags); - sptr_t charPositionFromPoint(sptr_t x, sptr_t y); - sptr_t charPositionFromPointClose(sptr_t x, sptr_t y); - void setMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch); - bool mouseSelectionRectangularSwitch() const; - void setMultipleSelection(bool multipleSelection); - bool multipleSelection() const; - void setAdditionalSelectionTyping(bool additionalSelectionTyping); - bool additionalSelectionTyping() const; - void setAdditionalCaretsBlink(bool additionalCaretsBlink); - bool additionalCaretsBlink() const; - void setAdditionalCaretsVisible(bool additionalCaretsVisible); - bool additionalCaretsVisible() const; - sptr_t selections() const; - bool selectionEmpty() const; - void clearSelections(); - sptr_t setSelection(sptr_t caret, sptr_t anchor); - sptr_t addSelection(sptr_t caret, sptr_t anchor); - void dropSelectionN(sptr_t selection); - void setMainSelection(sptr_t selection); - sptr_t mainSelection() const; - void setSelectionNCaret(sptr_t selection, sptr_t caret); - sptr_t selectionNCaret(sptr_t selection) const; - void setSelectionNAnchor(sptr_t selection, sptr_t anchor); - sptr_t selectionNAnchor(sptr_t selection) const; - void setSelectionNCaretVirtualSpace(sptr_t selection, sptr_t space); - sptr_t selectionNCaretVirtualSpace(sptr_t selection) const; - void setSelectionNAnchorVirtualSpace(sptr_t selection, sptr_t space); - sptr_t selectionNAnchorVirtualSpace(sptr_t selection) const; - void setSelectionNStart(sptr_t selection, sptr_t anchor); - sptr_t selectionNStart(sptr_t selection) const; - void setSelectionNEnd(sptr_t selection, sptr_t caret); - sptr_t selectionNEnd(sptr_t selection) const; - void setRectangularSelectionCaret(sptr_t caret); - sptr_t rectangularSelectionCaret() const; - void setRectangularSelectionAnchor(sptr_t anchor); - sptr_t rectangularSelectionAnchor() const; - void setRectangularSelectionCaretVirtualSpace(sptr_t space); - sptr_t rectangularSelectionCaretVirtualSpace() const; - void setRectangularSelectionAnchorVirtualSpace(sptr_t space); - sptr_t rectangularSelectionAnchorVirtualSpace() const; - void setVirtualSpaceOptions(sptr_t virtualSpaceOptions); - sptr_t virtualSpaceOptions() const; - void setRectangularSelectionModifier(sptr_t modifier); - sptr_t rectangularSelectionModifier() const; - void setAdditionalSelFore(sptr_t fore); - void setAdditionalSelBack(sptr_t back); - void setAdditionalSelAlpha(sptr_t alpha); - sptr_t additionalSelAlpha() const; - void setAdditionalCaretFore(sptr_t fore); - sptr_t additionalCaretFore() const; - void rotateSelection(); - void swapMainAnchorCaret(); - void multipleSelectAddNext(); - void multipleSelectAddEach(); - sptr_t changeLexerState(sptr_t start, sptr_t end); - sptr_t contractedFoldNext(sptr_t lineStart); - void verticalCentreCaret(); - void moveSelectedLinesUp(); - void moveSelectedLinesDown(); - void setIdentifier(sptr_t identifier); - sptr_t identifier() const; - void rGBAImageSetWidth(sptr_t width); - void rGBAImageSetHeight(sptr_t height); - void rGBAImageSetScale(sptr_t scalePercent); - void markerDefineRGBAImage(sptr_t markerNumber, const char * pixels); - void registerRGBAImage(sptr_t type, const char * pixels); - void scrollToStart(); - void scrollToEnd(); - void setTechnology(sptr_t technology); - sptr_t technology() const; - sptr_t createLoader(sptr_t bytes); - void findIndicatorShow(sptr_t start, sptr_t end); - void findIndicatorFlash(sptr_t start, sptr_t end); - void findIndicatorHide(); - void vCHomeDisplay(); - void vCHomeDisplayExtend(); - bool caretLineVisibleAlways() const; - void setCaretLineVisibleAlways(bool alwaysVisible); - void setLineEndTypesAllowed(sptr_t lineEndBitSet); - sptr_t lineEndTypesAllowed() const; - sptr_t lineEndTypesActive() const; - void setRepresentation(const char * encodedCharacter, const char * representation); - QByteArray representation(const char * encodedCharacter) const; - void clearRepresentation(const char * encodedCharacter); - void startRecord(); - void stopRecord(); - void setLexer(sptr_t lexer); - sptr_t lexer() const; - void colourise(sptr_t start, sptr_t end); - void setProperty(const char * key, const char * value); - void setKeyWords(sptr_t keyWordSet, const char * keyWords); - void setLexerLanguage(const char * language); - void loadLexerLibrary(const char * path); - QByteArray property(const char * key) const; - QByteArray propertyExpanded(const char * key) const; - sptr_t propertyInt(const char * key, sptr_t defaultValue) const; - sptr_t styleBitsNeeded() const; - QByteArray lexerLanguage() const; - sptr_t privateLexerCall(sptr_t operation, sptr_t pointer); - QByteArray propertyNames(); - sptr_t propertyType(const char * name); - QByteArray describeProperty(const char * name); - QByteArray describeKeyWordSets(); - sptr_t lineEndTypesSupported() const; - sptr_t allocateSubStyles(sptr_t styleBase, sptr_t numberStyles); - sptr_t subStylesStart(sptr_t styleBase) const; - sptr_t subStylesLength(sptr_t styleBase) const; - sptr_t styleFromSubStyle(sptr_t subStyle) const; - sptr_t primaryStyleFromStyle(sptr_t style) const; - void freeSubStyles(); - void setIdentifiers(sptr_t style, const char * identifiers); - sptr_t distanceToSecondaryStyles() const; - QByteArray subStyleBases() const; -/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ - -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#if defined(__GNUC__) -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif - -#endif /* SCINTILLAEDIT_H */ diff --git a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/PlatQt.cpp b/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/PlatQt.cpp deleted file mode 100644 index cfc8b9837..000000000 --- a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/PlatQt.cpp +++ /dev/null @@ -1,1339 +0,0 @@ -// -// Copyright (c) 1990-2011, Scientific Toolworks, Inc. -// -// The License.txt file describes the conditions under which this software may be distributed. -// -// Author: Jason Haslam -// -// Additions Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware -// Scintilla platform layer for Qt - -#include "PlatQt.h" -#include "Scintilla.h" -#include "FontQuality.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -//---------------------------------------------------------------------- - -// Convert from a Scintilla characterSet value to a Qt codec name. -const char *CharacterSetID(int characterSet) -{ - switch (characterSet) { - //case SC_CHARSET_ANSI: - // return ""; - case SC_CHARSET_DEFAULT: - return "ISO 8859-1"; - case SC_CHARSET_BALTIC: - return "ISO 8859-13"; - case SC_CHARSET_CHINESEBIG5: - return "Big5"; - case SC_CHARSET_EASTEUROPE: - return "ISO 8859-2"; - case SC_CHARSET_GB2312: - return "GB18030-0"; - case SC_CHARSET_GREEK: - return "ISO 8859-7"; - case SC_CHARSET_HANGUL: - return "CP949"; - case SC_CHARSET_MAC: - return "Apple Roman"; - //case SC_CHARSET_OEM: - // return "ASCII"; - case SC_CHARSET_RUSSIAN: - return "KOI8-R"; - case SC_CHARSET_CYRILLIC: - return "Windows-1251"; - case SC_CHARSET_SHIFTJIS: - return "Shift-JIS"; - //case SC_CHARSET_SYMBOL: - // return ""; - case SC_CHARSET_TURKISH: - return "ISO 8859-9"; - //case SC_CHARSET_JOHAB: - // return "CP1361"; - case SC_CHARSET_HEBREW: - return "ISO 8859-8"; - case SC_CHARSET_ARABIC: - return "ISO 8859-6"; - case SC_CHARSET_VIETNAMESE: - return "Windows-1258"; - case SC_CHARSET_THAI: - return "TIS-620"; - case SC_CHARSET_8859_15: - return "ISO 8859-15"; - default: - return "ISO 8859-1"; - } -} - -class FontAndCharacterSet { -public: - int characterSet; - QFont *pfont; - FontAndCharacterSet(int characterSet_, QFont *pfont): - characterSet(characterSet_), pfont(pfont) { - } - ~FontAndCharacterSet() { - delete pfont; - pfont = 0; - } -}; - -static int FontCharacterSet(Font &f) -{ - return reinterpret_cast(f.GetID())->characterSet; -} - -static QFont *FontPointer(Font &f) -{ - return reinterpret_cast(f.GetID())->pfont; -} - -Font::Font() : fid(0) {} - -Font::~Font() -{ - delete reinterpret_cast(fid); - fid = 0; -} - -static QFont::StyleStrategy ChooseStrategy(int eff) -{ - switch (eff) { - case SC_EFF_QUALITY_DEFAULT: return QFont::PreferDefault; - case SC_EFF_QUALITY_NON_ANTIALIASED: return QFont::NoAntialias; - case SC_EFF_QUALITY_ANTIALIASED: return QFont::PreferAntialias; - case SC_EFF_QUALITY_LCD_OPTIMIZED: return QFont::PreferAntialias; - default: return QFont::PreferDefault; - } -} - -void Font::Create(const FontParameters &fp) -{ - Release(); - - QFont *font = new QFont; - font->setStyleStrategy(ChooseStrategy(fp.extraFontFlag)); - font->setFamily(QString::fromUtf8(fp.faceName)); - font->setPointSize(fp.size); - font->setBold(fp.weight > 500); - font->setItalic(fp.italic); - - fid = new FontAndCharacterSet(fp.characterSet, font); -} - -void Font::Release() -{ - if (fid) - delete reinterpret_cast(fid); - - fid = 0; -} - - -SurfaceImpl::SurfaceImpl() -: device(0), painter(0), deviceOwned(false), painterOwned(false), x(0), y(0), - unicodeMode(false), codePage(0), codecName(0), codec(0) -{} - -SurfaceImpl::~SurfaceImpl() -{ - Release(); -} - -void SurfaceImpl::Init(WindowID wid) -{ - Release(); - device = static_cast(wid); -} - -void SurfaceImpl::Init(SurfaceID sid, WindowID /*wid*/) -{ - Release(); - device = static_cast(sid); -} - -void SurfaceImpl::InitPixMap(int width, - int height, - Surface *surface, - WindowID /*wid*/) -{ - Release(); - if (width < 1) width = 1; - if (height < 1) height = 1; - deviceOwned = true; - device = new QPixmap(width, height); - SurfaceImpl *psurfOther = static_cast(surface); - SetUnicodeMode(psurfOther->unicodeMode); - SetDBCSMode(psurfOther->codePage); -} - -void SurfaceImpl::Release() -{ - if (painterOwned && painter) { - delete painter; - } - - if (deviceOwned && device) { - delete device; - } - - device = 0; - painter = 0; - deviceOwned = false; - painterOwned = false; -} - -bool SurfaceImpl::Initialised() -{ - return device != 0; -} - -void SurfaceImpl::PenColour(ColourDesired fore) -{ - QPen penOutline(QColorFromCA(fore)); - penOutline.setCapStyle(Qt::FlatCap); - GetPainter()->setPen(penOutline); -} - -void SurfaceImpl::BrushColour(ColourDesired back) -{ - GetPainter()->setBrush(QBrush(QColorFromCA(back))); -} - -void SurfaceImpl::SetCodec(Font &font) -{ - if (font.GetID()) { - const char *csid = "UTF-8"; - if (!unicodeMode) - csid = CharacterSetID(FontCharacterSet(font)); - if (csid != codecName) { - codecName = csid; - codec = QTextCodec::codecForName(csid); - } - } -} - -void SurfaceImpl::SetFont(Font &font) -{ - if (font.GetID()) { - GetPainter()->setFont(*FontPointer(font)); - SetCodec(font); - } -} - -int SurfaceImpl::LogPixelsY() -{ - return device->logicalDpiY(); -} - -int SurfaceImpl::DeviceHeightFont(int points) -{ - return points; -} - -void SurfaceImpl::MoveTo(int x_, int y_) -{ - x = x_; - y = y_; -} - -void SurfaceImpl::LineTo(int x_, int y_) -{ - QLineF line(x, y, x_, y_); - GetPainter()->drawLine(line); - x = x_; - y = y_; -} - -void SurfaceImpl::Polygon(Point *pts, - int npts, - ColourDesired fore, - ColourDesired back) -{ - PenColour(fore); - BrushColour(back); - - QPoint *qpts = new QPoint[npts]; - for (int i = 0; i < npts; i++) { - qpts[i] = QPoint(pts[i].x, pts[i].y); - } - - GetPainter()->drawPolygon(qpts, npts); - delete [] qpts; -} - -void SurfaceImpl::RectangleDraw(PRectangle rc, - ColourDesired fore, - ColourDesired back) -{ - PenColour(fore); - BrushColour(back); - QRectF rect(rc.left, rc.top, rc.Width() - 1, rc.Height() - 1); - GetPainter()->drawRect(rect); -} - -void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) -{ - GetPainter()->fillRect(QRectFFromPRect(rc), QColorFromCA(back)); -} - -void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) -{ - // Tile pattern over rectangle - SurfaceImpl *surface = static_cast(&surfacePattern); - // Currently assumes 8x8 pattern - int widthPat = 8; - int heightPat = 8; - for (int xTile = rc.left; xTile < rc.right; xTile += widthPat) { - int widthx = (xTile + widthPat > rc.right) ? rc.right - xTile : widthPat; - for (int yTile = rc.top; yTile < rc.bottom; yTile += heightPat) { - int heighty = (yTile + heightPat > rc.bottom) ? rc.bottom - yTile : heightPat; - QRect source(0, 0, widthx, heighty); - QRect target(xTile, yTile, widthx, heighty); - QPixmap *pixmap = static_cast(surface->GetPaintDevice()); - GetPainter()->drawPixmap(target, *pixmap, source); - } - } -} - -void SurfaceImpl::RoundedRectangle(PRectangle rc, - ColourDesired fore, - ColourDesired back) -{ - PenColour(fore); - BrushColour(back); - GetPainter()->drawRoundRect(QRectFFromPRect(rc)); -} - -void SurfaceImpl::AlphaRectangle(PRectangle rc, - int cornerSize, - ColourDesired fill, - int alphaFill, - ColourDesired outline, - int alphaOutline, - int /*flags*/) -{ - QColor qOutline = QColorFromCA(outline); - qOutline.setAlpha(alphaOutline); - GetPainter()->setPen(QPen(qOutline)); - - QColor qFill = QColorFromCA(fill); - qFill.setAlpha(alphaFill); - GetPainter()->setBrush(QBrush(qFill)); - - // A radius of 1 shows no curve so add 1 - qreal radius = cornerSize+1; - QRectF rect(rc.left, rc.top, rc.Width() - 1, rc.Height() - 1); - GetPainter()->drawRoundedRect(rect, radius, radius); -} - -static std::vector ImageByteSwapped(int width, int height, const unsigned char *pixelsImage) -{ - // Input is RGBA, but Format_ARGB32 is BGRA, so swap the red bytes and blue bytes - size_t bytes = width * height * 4; - std::vector imageBytes(pixelsImage, pixelsImage+bytes); - for (size_t i=0; i imageBytes = ImageByteSwapped(width, height, pixelsImage); - QImage image(&imageBytes[0], width, height, QImage::Format_ARGB32); - QPoint pt(rc.left, rc.top); - GetPainter()->drawImage(pt, image); -} - -void SurfaceImpl::Ellipse(PRectangle rc, - ColourDesired fore, - ColourDesired back) -{ - PenColour(fore); - BrushColour(back); - GetPainter()->drawEllipse(QRectFFromPRect(rc)); -} - -void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) -{ - SurfaceImpl *source = static_cast(&surfaceSource); - QPixmap *pixmap = static_cast(source->GetPaintDevice()); - - GetPainter()->drawPixmap(rc.left, rc.top, *pixmap, from.x, from.y, -1, -1); -} - -void SurfaceImpl::DrawTextNoClip(PRectangle rc, - Font &font, - XYPOSITION ybase, - const char *s, - int len, - ColourDesired fore, - ColourDesired back) -{ - SetFont(font); - PenColour(fore); - - GetPainter()->setBackground(QColorFromCA(back)); - GetPainter()->setBackgroundMode(Qt::OpaqueMode); - QString su = codec->toUnicode(s, len); - GetPainter()->drawText(QPointF(rc.left, ybase), su); -} - -void SurfaceImpl::DrawTextClipped(PRectangle rc, - Font &font, - XYPOSITION ybase, - const char *s, - int len, - ColourDesired fore, - ColourDesired back) -{ - SetClip(rc); - DrawTextNoClip(rc, font, ybase, s, len, fore, back); - GetPainter()->setClipping(false); -} - -void SurfaceImpl::DrawTextTransparent(PRectangle rc, - Font &font, - XYPOSITION ybase, - const char *s, - int len, - ColourDesired fore) -{ - SetFont(font); - PenColour(fore); - - GetPainter()->setBackgroundMode(Qt::TransparentMode); - QString su = codec->toUnicode(s, len); - GetPainter()->drawText(QPointF(rc.left, ybase), su); -} - -void SurfaceImpl::SetClip(PRectangle rc) -{ - GetPainter()->setClipRect(QRectFFromPRect(rc)); -} - -static size_t utf8LengthFromLead(unsigned char uch) -{ - if (uch >= (0x80 + 0x40 + 0x20 + 0x10)) { - return 4; - } else if (uch >= (0x80 + 0x40 + 0x20)) { - return 3; - } else if (uch >= (0x80)) { - return 2; - } else { - return 1; - } -} - -void SurfaceImpl::MeasureWidths(Font &font, - const char *s, - int len, - XYPOSITION *positions) -{ - if (!font.GetID()) - return; - SetCodec(font); - QString su = codec->toUnicode(s, len); - QTextLayout tlay(su, *FontPointer(font), GetPaintDevice()); - tlay.beginLayout(); - QTextLine tl = tlay.createLine(); - tlay.endLayout(); - if (unicodeMode) { - int fit = su.size(); - int ui=0; - const unsigned char *us = reinterpret_cast(s); - int i=0; - while (ui 0) - lastPos = positions[i-1]; - while (itoUnicode(s, len); - return metrics.width(string); -} - -XYPOSITION SurfaceImpl::WidthChar(Font &font, char ch) -{ - QFontMetricsF metrics(*FontPointer(font), device); - return metrics.width(QChar::fromLatin1(ch)); -} - -XYPOSITION SurfaceImpl::Ascent(Font &font) -{ - QFontMetricsF metrics(*FontPointer(font), device); - return metrics.ascent(); -} - -XYPOSITION SurfaceImpl::Descent(Font &font) -{ - QFontMetricsF metrics(*FontPointer(font), device); - // Qt returns 1 less than true descent - // See: QFontEngineWin::descent which says: - // ### we subtract 1 to even out the historical +1 in QFontMetrics's - // ### height=asc+desc+1 equation. Fix in Qt5. - return metrics.descent() + 1; -} - -XYPOSITION SurfaceImpl::InternalLeading(Font & /* font */) -{ - return 0; -} - -XYPOSITION SurfaceImpl::ExternalLeading(Font &font) -{ - QFontMetricsF metrics(*FontPointer(font), device); - return metrics.leading(); -} - -XYPOSITION SurfaceImpl::Height(Font &font) -{ - QFontMetricsF metrics(*FontPointer(font), device); - return metrics.height(); -} - -XYPOSITION SurfaceImpl::AverageCharWidth(Font &font) -{ - QFontMetricsF metrics(*FontPointer(font), device); - return metrics.averageCharWidth(); -} - -void SurfaceImpl::FlushCachedState() -{ - if (device->paintingActive()) { - GetPainter()->setPen(QPen()); - GetPainter()->setBrush(QBrush()); - } -} - -void SurfaceImpl::SetUnicodeMode(bool unicodeMode_) -{ - unicodeMode=unicodeMode_; -} - -void SurfaceImpl::SetDBCSMode(int codePage_) -{ - codePage = codePage_; -} - -QPaintDevice *SurfaceImpl::GetPaintDevice() -{ - return device; -} - -QPainter *SurfaceImpl::GetPainter() -{ - Q_ASSERT(device); - - if (painter == 0) { - if (device->paintingActive()) { - painter = device->paintEngine()->painter(); - } else { - painterOwned = true; - painter = new QPainter(device); - } - - // Set text antialiasing unconditionally. - // The font's style strategy will override. - painter->setRenderHint(QPainter::TextAntialiasing, true); - } - - return painter; -} - -Surface *Surface::Allocate(int) -{ - return new SurfaceImpl; -} - - -//---------------------------------------------------------------------- - -namespace { -QWidget *window(WindowID wid) -{ - return static_cast(wid); -} -} - -Window::~Window() {} - -void Window::Destroy() -{ - if (wid) - delete window(wid); - - wid = 0; -} - -bool Window::HasFocus() -{ - return wid ? window(wid)->hasFocus() : false; -} - -PRectangle Window::GetPosition() -{ - // Before any size allocated pretend its 1000 wide so not scrolled - return wid ? PRectFromQRect(window(wid)->frameGeometry()) : PRectangle(0, 0, 1000, 1000); -} - -void Window::SetPosition(PRectangle rc) -{ - if (wid) - window(wid)->setGeometry(QRectFromPRect(rc)); -} - -void Window::SetPositionRelative(PRectangle rc, Window relativeTo) -{ - QPoint oPos = window(relativeTo.wid)->mapToGlobal(QPoint(0,0)); - int ox = oPos.x(); - int oy = oPos.y(); - ox += rc.left; - oy += rc.top; - - QDesktopWidget *desktop = QApplication::desktop(); - QRect rectDesk = desktop->availableGeometry(QPoint(ox, oy)); - /* do some corrections to fit into screen */ - int sizex = rc.right - rc.left; - int sizey = rc.bottom - rc.top; - int screenWidth = rectDesk.width(); - if (ox < rectDesk.x()) - ox = rectDesk.x(); - if (sizex > screenWidth) - ox = rectDesk.x(); /* the best we can do */ - else if (ox + sizex > rectDesk.right()) - ox = rectDesk.right() - sizex; - if (oy + sizey > rectDesk.bottom()) - oy = rectDesk.bottom() - sizey; - - Q_ASSERT(wid); - window(wid)->move(ox, oy); - window(wid)->resize(sizex, sizey); -} - -PRectangle Window::GetClientPosition() -{ - // The client position is the window position - return GetPosition(); -} - -void Window::Show(bool show) -{ - if (wid) - window(wid)->setVisible(show); -} - -void Window::InvalidateAll() -{ - if (wid) - window(wid)->update(); -} - -void Window::InvalidateRectangle(PRectangle rc) -{ - if (wid) - window(wid)->update(QRectFromPRect(rc)); -} - -void Window::SetFont(Font &font) -{ - if (wid) - window(wid)->setFont(*FontPointer(font)); -} - -void Window::SetCursor(Cursor curs) -{ - if (wid) { - Qt::CursorShape shape; - - switch (curs) { - case cursorText: shape = Qt::IBeamCursor; break; - case cursorArrow: shape = Qt::ArrowCursor; break; - case cursorUp: shape = Qt::UpArrowCursor; break; - case cursorWait: shape = Qt::WaitCursor; break; - case cursorHoriz: shape = Qt::SizeHorCursor; break; - case cursorVert: shape = Qt::SizeVerCursor; break; - case cursorHand: shape = Qt::PointingHandCursor; break; - default: shape = Qt::ArrowCursor; break; - } - - QCursor cursor = QCursor(shape); - - if (curs != cursorLast) { - window(wid)->setCursor(cursor); - cursorLast = curs; - } - } -} - -void Window::SetTitle(const char *s) -{ - if (wid) - window(wid)->setWindowTitle(QString::fromUtf8(s)); -} - -/* Returns rectangle of monitor pt is on, both rect and pt are in Window's - window coordinates */ -PRectangle Window::GetMonitorRect(Point pt) -{ - QPoint originGlobal = window(wid)->mapToGlobal(QPoint(0, 0)); - QPoint posGlobal = window(wid)->mapToGlobal(QPoint(pt.x, pt.y)); - QDesktopWidget *desktop = QApplication::desktop(); - QRect rectScreen = desktop->availableGeometry(posGlobal); - rectScreen.translate(-originGlobal.x(), -originGlobal.y()); - return PRectangle(rectScreen.left(), rectScreen.top(), - rectScreen.right(), rectScreen.bottom()); -} - - -//---------------------------------------------------------------------- - -class ListBoxImpl : public ListBox { -public: - ListBoxImpl(); - ~ListBoxImpl(); - - virtual void SetFont(Font &font); - virtual void Create(Window &parent, int ctrlID, Point location, - int lineHeight, bool unicodeMode, int technology); - virtual void SetAverageCharWidth(int width); - virtual void SetVisibleRows(int rows); - virtual int GetVisibleRows() const; - virtual PRectangle GetDesiredRect(); - virtual int CaretFromEdge(); - virtual void Clear(); - virtual void Append(char *s, int type = -1); - virtual int Length(); - virtual void Select(int n); - virtual int GetSelection(); - virtual int Find(const char *prefix); - virtual void GetValue(int n, char *value, int len); - virtual void RegisterImage(int type, const char *xpmData); - virtual void RegisterRGBAImage(int type, int width, int height, - const unsigned char *pixelsImage); - virtual void RegisterQPixmapImage(int type, const QPixmap& pm); - virtual void ClearRegisteredImages(); - virtual void SetDoubleClickAction(CallBackAction action, void *data); - virtual void SetList(const char *list, char separator, char typesep); -private: - bool unicodeMode; - int visibleRows; - QMap images; -}; - -class ListWidget : public QListWidget { -public: - explicit ListWidget(QWidget *parent); - virtual ~ListWidget(); - - void setDoubleClickAction(CallBackAction action, void *data); - -protected: - virtual void mouseDoubleClickEvent(QMouseEvent *event); - virtual QStyleOptionViewItem viewOptions() const; - -private: - CallBackAction doubleClickAction; - void *doubleClickActionData; -}; - - -ListBoxImpl::ListBoxImpl() -: unicodeMode(false), visibleRows(5) -{} - -ListBoxImpl::~ListBoxImpl() {} - -void ListBoxImpl::Create(Window &parent, - int /*ctrlID*/, - Point location, - int /*lineHeight*/, - bool unicodeMode_, - int) -{ - unicodeMode = unicodeMode_; - - QWidget *qparent = static_cast(parent.GetID()); - ListWidget *list = new ListWidget(qparent); - -#if defined(Q_OS_WIN) - // On Windows, Qt::ToolTip causes a crash when the list is clicked on - // so Qt::Tool is used. - list->setParent(0, Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - | Qt::WindowDoesNotAcceptFocus -#endif - ); -#else - // On OS X, Qt::Tool takes focus so main window loses focus so - // keyboard stops working. Qt::ToolTip works but its only really - // documented for tooltips. - // On Linux / X this setting allows clicking on list items. - list->setParent(0, Qt::ToolTip | Qt::FramelessWindowHint); -#endif - list->setAttribute(Qt::WA_ShowWithoutActivating); - list->setFocusPolicy(Qt::NoFocus); - list->setUniformItemSizes(true); - list->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - list->move(location.x, location.y); - - int maxIconWidth = 0; - int maxIconHeight = 0; - foreach (QPixmap im, images) { - if (maxIconWidth < im.width()) - maxIconWidth = im.width(); - if (maxIconHeight < im.height()) - maxIconHeight = im.height(); - } - list->setIconSize(QSize(maxIconWidth, maxIconHeight)); - - wid = list; -} - -void ListBoxImpl::SetFont(Font &font) -{ - ListWidget *list = static_cast(wid); - list->setFont(*FontPointer(font)); -} - -void ListBoxImpl::SetAverageCharWidth(int /*width*/) {} - -void ListBoxImpl::SetVisibleRows(int rows) -{ - visibleRows = rows; -} - -int ListBoxImpl::GetVisibleRows() const -{ - return visibleRows; -} - -PRectangle ListBoxImpl::GetDesiredRect() -{ - ListWidget *list = static_cast(wid); - - int rows = Length(); - if (rows == 0 || rows > visibleRows) { - rows = visibleRows; - } - int rowHeight = list->sizeHintForRow(0); - int height = (rows * rowHeight) + (2 * list->frameWidth()); - - QStyle *style = QApplication::style(); - int width = list->sizeHintForColumn(0) + (2 * list->frameWidth()); - if (Length() > rows) { - width += style->pixelMetric(QStyle::PM_ScrollBarExtent); - } - - return PRectangle(0, 0, width, height); -} - -int ListBoxImpl::CaretFromEdge() -{ - ListWidget *list = static_cast(wid); - - int maxIconWidth = 0; - foreach (QPixmap im, images) { - if (maxIconWidth < im.width()) - maxIconWidth = im.width(); - } - - int extra; - // The 12 is from trial and error on OS X and the 7 - // is from trial and error on Windows - there may be - // a better programmatic way to find any padding factors. -#ifdef Q_OS_DARWIN - extra = 12; -#else - extra = 7; -#endif - return maxIconWidth + (2 * list->frameWidth()) + extra; -} - -void ListBoxImpl::Clear() -{ - ListWidget *list = static_cast(wid); - list->clear(); -} - -void ListBoxImpl::Append(char *s, int type) -{ - ListWidget *list = static_cast(wid); - - QString str = unicodeMode ? QString::fromUtf8(s) : QString::fromLocal8Bit(s); - QIcon icon; - if (type >= 0) { - Q_ASSERT(images.contains(type)); - icon = images.value(type); - } - new QListWidgetItem(icon, str, list); -} - -int ListBoxImpl::Length() -{ - ListWidget *list = static_cast(wid); - return list->count(); -} - -void ListBoxImpl::Select(int n) -{ - ListWidget *list = static_cast(wid); - QModelIndex index = list->model()->index(n, 0); - if (index.isValid()) { - QRect row_rect = list->visualRect(index); - if (!list->viewport()->rect().contains(row_rect)) { - list->scrollTo(index, QAbstractItemView::PositionAtTop); - } - } - list->setCurrentRow(n); -} - -int ListBoxImpl::GetSelection() -{ - ListWidget *list = static_cast(wid); - return list->currentRow(); -} - -int ListBoxImpl::Find(const char *prefix) -{ - ListWidget *list = static_cast(wid); - QString sPrefix = unicodeMode ? QString::fromUtf8(prefix) : QString::fromLocal8Bit(prefix); - QList ms = list->findItems(sPrefix, Qt::MatchStartsWith); - - int result = -1; - if (!ms.isEmpty()) { - result = list->row(ms.first()); - } - - return result; -} - -void ListBoxImpl::GetValue(int n, char *value, int len) -{ - ListWidget *list = static_cast(wid); - QListWidgetItem *item = list->item(n); - QString str = item->data(Qt::DisplayRole).toString(); - QByteArray bytes = unicodeMode ? str.toUtf8() : str.toLocal8Bit(); - - strncpy(value, bytes.constData(), len); - value[len-1] = '\0'; -} - -void ListBoxImpl::RegisterQPixmapImage(int type, const QPixmap& pm) -{ - images[type] = pm; - - ListWidget *list = static_cast(wid); - if (list != NULL) { - QSize iconSize = list->iconSize(); - if (pm.width() > iconSize.width() || pm.height() > iconSize.height()) - list->setIconSize(QSize(qMax(pm.width(), iconSize.width()), - qMax(pm.height(), iconSize.height()))); - } - -} - -void ListBoxImpl::RegisterImage(int type, const char *xpmData) -{ - RegisterQPixmapImage(type, QPixmap(reinterpret_cast(xpmData))); -} - -void ListBoxImpl::RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) -{ - std::vector imageBytes = ImageByteSwapped(width, height, pixelsImage); - QImage image(&imageBytes[0], width, height, QImage::Format_ARGB32); - RegisterQPixmapImage(type, QPixmap::fromImage(image)); -} - -void ListBoxImpl::ClearRegisteredImages() -{ - images.clear(); - - ListWidget *list = static_cast(wid); - if (list != NULL) - list->setIconSize(QSize(0, 0)); -} - -void ListBoxImpl::SetDoubleClickAction(CallBackAction action, void *data) -{ - ListWidget *list = static_cast(wid); - list->setDoubleClickAction(action, data); -} - -void ListBoxImpl::SetList(const char *list, char separator, char typesep) -{ - // This method is *not* platform dependent. - // It is borrowed from the GTK implementation. - Clear(); - size_t count = strlen(list) + 1; - std::vector words(list, list+count); - char *startword = &words[0]; - char *numword = NULL; - int i = 0; - for (; words[i]; i++) { - if (words[i] == separator) { - words[i] = '\0'; - if (numword) - *numword = '\0'; - Append(startword, numword?atoi(numword + 1):-1); - startword = &words[0] + i + 1; - numword = NULL; - } else if (words[i] == typesep) { - numword = &words[0] + i; - } - } - if (startword) { - if (numword) - *numword = '\0'; - Append(startword, numword?atoi(numword + 1):-1); - } -} - -ListBox::ListBox() {} - -ListBox::~ListBox() {} - -ListBox *ListBox::Allocate() -{ - return new ListBoxImpl(); -} - -ListWidget::ListWidget(QWidget *parent) -: QListWidget(parent), doubleClickAction(0), doubleClickActionData(0) -{} - -ListWidget::~ListWidget() {} - -void ListWidget::setDoubleClickAction(CallBackAction action, void *data) -{ - doubleClickAction = action; - doubleClickActionData = data; -} - -void ListWidget::mouseDoubleClickEvent(QMouseEvent * /* event */) -{ - if (doubleClickAction != 0) { - doubleClickAction(doubleClickActionData); - } -} - -QStyleOptionViewItem ListWidget::viewOptions() const -{ - QStyleOptionViewItem result = QListWidget::viewOptions(); - result.state |= QStyle::State_Active; - return result; -} - -//---------------------------------------------------------------------- - -Menu::Menu() : mid(0) {} - -void Menu::CreatePopUp() -{ - Destroy(); - mid = new QMenu(); -} - -void Menu::Destroy() -{ - if (mid) { - QMenu *menu = static_cast(mid); - delete menu; - } - mid = 0; -} - -void Menu::Show(Point pt, Window & /*w*/) -{ - QMenu *menu = static_cast(mid); - menu->exec(QPoint(pt.x, pt.y)); - Destroy(); -} - -//---------------------------------------------------------------------- - -class DynamicLibraryImpl : public DynamicLibrary { -protected: - QLibrary *lib; -public: - explicit DynamicLibraryImpl(const char *modulePath) { - QString path = QString::fromUtf8(modulePath); - lib = new QLibrary(path); - } - - virtual ~DynamicLibraryImpl() { - if (lib) - lib->unload(); - lib = 0; - } - - virtual Function FindFunction(const char *name) { - if (lib) { - // C++ standard doesn't like casts between function pointers and void pointers so use a union - union { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) - QFunctionPointer fp; -#else - void *fp; -#endif - Function f; - } fnConv; - fnConv.fp = lib->resolve(name); - return fnConv.f; - } - return NULL; - } - - virtual bool IsValid() { - return lib != NULL; - } -}; - -DynamicLibrary *DynamicLibrary::Load(const char *modulePath) -{ - return static_cast(new DynamicLibraryImpl(modulePath)); -} - -ColourDesired Platform::Chrome() -{ - QColor c(Qt::gray); - return ColourDesired(c.red(), c.green(), c.blue()); -} - -ColourDesired Platform::ChromeHighlight() -{ - QColor c(Qt::lightGray); - return ColourDesired(c.red(), c.green(), c.blue()); -} - -const char *Platform::DefaultFont() -{ - static char fontNameDefault[200] = ""; - if (!fontNameDefault[0]) { - QFont font = QApplication::font(); - strcpy(fontNameDefault, font.family().toUtf8()); - } - return fontNameDefault; -} - -int Platform::DefaultFontSize() -{ - QFont font = QApplication::font(); - return font.pointSize(); -} - -unsigned int Platform::DoubleClickTime() -{ - return QApplication::doubleClickInterval(); -} - -bool Platform::MouseButtonBounce() -{ - return false; -} - -bool Platform::IsKeyDown(int /*key*/) -{ - return false; -} - -long Platform::SendScintilla(WindowID /*w*/, - unsigned int /*msg*/, - unsigned long /*wParam*/, - long /*lParam*/) -{ - return 0; -} - -long Platform::SendScintillaPointer(WindowID /*w*/, - unsigned int /*msg*/, - unsigned long /*wParam*/, - void * /*lParam*/) -{ - return 0; -} - -int Platform::Minimum(int a, int b) -{ - return qMin(a, b); -} - -int Platform::Maximum(int a, int b) -{ - return qMax(a, b); -} - -int Platform::Clamp(int val, int minVal, int maxVal) -{ - return qBound(minVal, val, maxVal); -} - -void Platform::DebugDisplay(const char *s) -{ - qWarning("Scintilla: %s", s); -} - -void Platform::DebugPrintf(const char *format, ...) -{ - char buffer[2000]; - va_list pArguments; - va_start(pArguments, format); - vsprintf(buffer, format, pArguments); - va_end(pArguments); - Platform::DebugDisplay(buffer); -} - -bool Platform::ShowAssertionPopUps(bool /*assertionPopUps*/) -{ - return false; -} - -void Platform::Assert(const char *c, const char *file, int line) -{ - char buffer[2000]; - sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line); - if (Platform::ShowAssertionPopUps(false)) { - QMessageBox mb(QStringLiteral("Assertion Failure"), QString::fromUtf8(buffer), QMessageBox::NoIcon, - QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); - mb.exec(); - } else { - strcat(buffer, "\n"); - Platform::DebugDisplay(buffer); - } -} - - -bool Platform::IsDBCSLeadByte(int codePage, char ch) -{ - // Byte ranges found in Wikipedia articles with relevant search strings in each case - unsigned char uch = static_cast(ch); - switch (codePage) { - case 932: - // Shift_jis - return ((uch >= 0x81) && (uch <= 0x9F)) || - ((uch >= 0xE0) && (uch <= 0xEF)); - case 936: - // GBK - return (uch >= 0x81) && (uch <= 0xFE); - case 949: - // Korean Wansung KS C-5601-1987 - return (uch >= 0x81) && (uch <= 0xFE); - case 950: - // Big5 - return (uch >= 0x81) && (uch <= 0xFE); - case 1361: - // Korean Johab KS C-5601-1992 - return - ((uch >= 0x84) && (uch <= 0xD3)) || - ((uch >= 0xD8) && (uch <= 0xDE)) || - ((uch >= 0xE0) && (uch <= 0xF9)); - } - return false; -} - -int Platform::DBCSCharLength(int codePage, const char *s) -{ - if (codePage == 932 || codePage == 936 || codePage == 949 || - codePage == 950 || codePage == 1361) { - return IsDBCSLeadByte(codePage, s[0]) ? 2 : 1; - } else { - return 1; - } -} - -int Platform::DBCSCharMaxLength() -{ - return 2; -} - - -//---------------------------------------------------------------------- - -static QElapsedTimer timer; - -ElapsedTime::ElapsedTime() : bigBit(0), littleBit(0) -{ - if (!timer.isValid()) { - timer.start(); - } - qint64 ns64Now = timer.nsecsElapsed(); - bigBit = static_cast(ns64Now >> 32); - littleBit = static_cast(ns64Now & 0xFFFFFFFF); -} - -double ElapsedTime::Duration(bool reset) -{ - qint64 ns64Now = timer.nsecsElapsed(); - qint64 ns64Start = (static_cast(static_cast(bigBit)) << 32) + static_cast(littleBit); - double result = ns64Now - ns64Start; - if (reset) { - bigBit = static_cast(ns64Now >> 32); - littleBit = static_cast(ns64Now & 0xFFFFFFFF); - } - return result / 1000000000.0; // 1 billion nanoseconds in a second -} - -#ifdef SCI_NAMESPACE -} -#endif diff --git a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/PlatQt.h b/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/PlatQt.h deleted file mode 100644 index be35d818b..000000000 --- a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/PlatQt.h +++ /dev/null @@ -1,132 +0,0 @@ -// -// Copyright (c) 1990-2011, Scientific Toolworks, Inc. -// -// The License.txt file describes the conditions under which this software may be distributed. -// -// Author: Jason Haslam -// -// Additions Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware -// Scintilla platform layer for Qt - -#ifndef PLATQT_H -#define PLATQT_H - -#include "Platform.h" - -#include -#include -#include - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -const char *CharacterSetID(int characterSet); - -inline QColor QColorFromCA(ColourDesired ca) -{ - long c = ca.AsLong(); - return QColor(c & 0xff, (c >> 8) & 0xff, (c >> 16) & 0xff); -} - -inline QRect QRectFromPRect(PRectangle pr) -{ - return QRect(pr.left, pr.top, pr.Width(), pr.Height()); -} - -inline QRectF QRectFFromPRect(PRectangle pr) -{ - return QRectF(pr.left, pr.top, pr.Width(), pr.Height()); -} - -inline PRectangle PRectFromQRect(QRect qr) -{ - return PRectangle(qr.x(), qr.y(), qr.x() + qr.width(), qr.y() + qr.height()); -} - -inline Point PointFromQPoint(QPoint qp) -{ - return Point(qp.x(), qp.y()); -} - -class SurfaceImpl : public Surface { -private: - QPaintDevice *device; - QPainter *painter; - bool deviceOwned; - bool painterOwned; - float x, y; - bool unicodeMode; - int codePage; - const char *codecName; - QTextCodec *codec; - -public: - SurfaceImpl(); - virtual ~SurfaceImpl(); - - virtual void Init(WindowID wid); - virtual void Init(SurfaceID sid, WindowID wid); - virtual void InitPixMap(int width, int height, - Surface *surface, WindowID wid); - - virtual void Release(); - virtual bool Initialised(); - virtual void PenColour(ColourDesired fore); - virtual int LogPixelsY(); - virtual int DeviceHeightFont(int points); - virtual void MoveTo(int x, int y); - virtual void LineTo(int x, int y); - virtual void Polygon(Point *pts, int npts, ColourDesired fore, - ColourDesired back); - virtual void RectangleDraw(PRectangle rc, ColourDesired fore, - ColourDesired back); - virtual void FillRectangle(PRectangle rc, ColourDesired back); - virtual void FillRectangle(PRectangle rc, Surface &surfacePattern); - virtual void RoundedRectangle(PRectangle rc, ColourDesired fore, - ColourDesired back); - virtual void AlphaRectangle(PRectangle rc, int corner, ColourDesired fill, - int alphaFill, ColourDesired outline, int alphaOutline, int flags); - virtual void DrawRGBAImage(PRectangle rc, int width, int height, - const unsigned char *pixelsImage); - virtual void Ellipse(PRectangle rc, ColourDesired fore, - ColourDesired back); - virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource); - - virtual void DrawTextNoClip(PRectangle rc, Font &font, XYPOSITION ybase, - const char *s, int len, ColourDesired fore, ColourDesired back); - virtual void DrawTextClipped(PRectangle rc, Font &font, XYPOSITION ybase, - const char *s, int len, ColourDesired fore, ColourDesired back); - virtual void DrawTextTransparent(PRectangle rc, Font &font, XYPOSITION ybase, - const char *s, int len, ColourDesired fore); - virtual void MeasureWidths(Font &font, const char *s, int len, - XYPOSITION *positions); - virtual XYPOSITION WidthText(Font &font, const char *s, int len); - virtual XYPOSITION WidthChar(Font &font, char ch); - virtual XYPOSITION Ascent(Font &font); - virtual XYPOSITION Descent(Font &font); - virtual XYPOSITION InternalLeading(Font &font); - virtual XYPOSITION ExternalLeading(Font &font); - virtual XYPOSITION Height(Font &font); - virtual XYPOSITION AverageCharWidth(Font &font); - - virtual void SetClip(PRectangle rc); - virtual void FlushCachedState(); - - virtual void SetUnicodeMode(bool unicodeMode); - virtual void SetDBCSMode(int codePage); - - void BrushColour(ColourDesired back); - void SetCodec(Font &font); - void SetFont(Font &font); - - QPaintDevice *GetPaintDevice(); - void SetPainter(QPainter *painter); - QPainter *GetPainter(); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaEditBase.cpp b/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaEditBase.cpp deleted file mode 100644 index 03ecb4fdc..000000000 --- a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaEditBase.cpp +++ /dev/null @@ -1,793 +0,0 @@ -// -// Copyright (c) 1990-2011, Scientific Toolworks, Inc. -// -// The License.txt file describes the conditions under which this software may be distributed. -// -// Author: Jason Haslam -// -// Additions Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware -// ScintillaEditBase.cpp - Qt widget that wraps ScintillaQt and provides events and scrolling - -#include "ScintillaEditBase.h" -#include "ScintillaQt.h" -#include "PlatQt.h" - -#include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -#include -#endif -#include -#include -#include -#include - -#define INDIC_INPUTMETHOD 24 - -#define MAXLENINPUTIME 200 -#define SC_INDICATOR_INPUT INDIC_IME -#define SC_INDICATOR_TARGET INDIC_IME+1 -#define SC_INDICATOR_CONVERTED INDIC_IME+2 -#define SC_INDICATOR_UNKNOWN INDIC_IME_MAX - -// Q_WS_MAC and Q_WS_X11 aren't defined in Qt5 -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#ifdef Q_OS_MAC -#define Q_WS_MAC 1 -#endif - -#if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) -#define Q_WS_X11 1 -#endif -#endif // QT_VERSION >= 5.0.0 - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -ScintillaEditBase::ScintillaEditBase(QWidget *parent) -: QAbstractScrollArea(parent), sqt(0), preeditPos(-1), wheelDelta(0) -{ - sqt = new ScintillaQt(this); - - time.start(); - - // Set Qt defaults. - setAcceptDrops(true); - setMouseTracking(true); - setAutoFillBackground(false); - setFrameStyle(QFrame::NoFrame); - setFocusPolicy(Qt::StrongFocus); - setAttribute(Qt::WA_StaticContents); - viewport()->setAutoFillBackground(false); - setAttribute(Qt::WA_KeyCompression); - setAttribute(Qt::WA_InputMethodEnabled); - - sqt->vs.indicators[SC_INDICATOR_UNKNOWN] = Indicator(INDIC_HIDDEN, ColourDesired(0, 0, 0xff)); - sqt->vs.indicators[SC_INDICATOR_INPUT] = Indicator(INDIC_DOTS, ColourDesired(0, 0, 0xff)); - sqt->vs.indicators[SC_INDICATOR_CONVERTED] = Indicator(INDIC_COMPOSITIONTHICK, ColourDesired(0, 0, 0xff)); - sqt->vs.indicators[SC_INDICATOR_TARGET] = Indicator(INDIC_STRAIGHTBOX, ColourDesired(0, 0, 0xff)); - - connect(sqt, SIGNAL(notifyParent(SCNotification)), - this, SLOT(notifyParent(SCNotification))); - - // Connect scroll bars. - connect(verticalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(scrollVertical(int))); - connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(scrollHorizontal(int))); - - // Connect pass-through signals. - connect(sqt, SIGNAL(horizontalRangeChanged(int,int)), - this, SIGNAL(horizontalRangeChanged(int,int))); - connect(sqt, SIGNAL(verticalRangeChanged(int,int)), - this, SIGNAL(verticalRangeChanged(int,int))); - connect(sqt, SIGNAL(horizontalScrolled(int)), - this, SIGNAL(horizontalScrolled(int))); - connect(sqt, SIGNAL(verticalScrolled(int)), - this, SIGNAL(verticalScrolled(int))); - - connect(sqt, SIGNAL(notifyChange()), - this, SIGNAL(notifyChange())); - - connect(sqt, SIGNAL(command(uptr_t, sptr_t)), - this, SLOT(event_command(uptr_t, sptr_t))); - - connect(sqt, SIGNAL(aboutToCopy(QMimeData *)), - this, SIGNAL(aboutToCopy(QMimeData *))); -} - -ScintillaEditBase::~ScintillaEditBase() {} - -sptr_t ScintillaEditBase::send( - unsigned int iMessage, - uptr_t wParam, - sptr_t lParam) const -{ - return sqt->WndProc(iMessage, wParam, lParam); -} - -sptr_t ScintillaEditBase::sends( - unsigned int iMessage, - uptr_t wParam, - const char *s) const -{ - return sqt->WndProc(iMessage, wParam, (sptr_t)s); -} - -void ScintillaEditBase::scrollHorizontal(int value) -{ - sqt->HorizontalScrollTo(value); -} - -void ScintillaEditBase::scrollVertical(int value) -{ - sqt->ScrollTo(value); -} - -bool ScintillaEditBase::event(QEvent *event) -{ - bool result = false; - - if (event->type() == QEvent::KeyPress) { - // Circumvent the tab focus convention. - keyPressEvent(static_cast(event)); - result = event->isAccepted(); - } else if (event->type() == QEvent::Show) { - setMouseTracking(true); - result = QAbstractScrollArea::event(event); - } else if (event->type() == QEvent::Hide) { - setMouseTracking(false); - result = QAbstractScrollArea::event(event); - } else { - result = QAbstractScrollArea::event(event); - } - - return result; -} - -void ScintillaEditBase::paintEvent(QPaintEvent *event) -{ - sqt->PartialPaint(PRectFromQRect(event->rect())); -} - -void ScintillaEditBase::wheelEvent(QWheelEvent *event) -{ - if (event->orientation() == Qt::Horizontal) { - if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) - event->ignore(); - else - QAbstractScrollArea::wheelEvent(event); - } else { - if (QApplication::keyboardModifiers() & Qt::ControlModifier) { - // Zoom! We play with the font sizes in the styles. - // Number of steps/line is ignored, we just care if sizing up or down - if (event->delta() > 0) { - sqt->KeyCommand(SCI_ZOOMIN); - } else { - sqt->KeyCommand(SCI_ZOOMOUT); - } - } else { - // Ignore wheel events when the scroll bars are disabled. - if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) { - event->ignore(); - } else { - // Scroll - QAbstractScrollArea::wheelEvent(event); - } - } - } -} - -void ScintillaEditBase::focusInEvent(QFocusEvent *event) -{ - sqt->SetFocusState(true); - emit updateUi(); - - QAbstractScrollArea::focusInEvent(event); -} - -void ScintillaEditBase::focusOutEvent(QFocusEvent *event) -{ - sqt->SetFocusState(false); - - QAbstractScrollArea::focusOutEvent(event); -} - -void ScintillaEditBase::resizeEvent(QResizeEvent *) -{ - sqt->ChangeSize(); - emit resized(); -} - -void ScintillaEditBase::keyPressEvent(QKeyEvent *event) -{ - // All keystrokes containing the meta modifier are - // assumed to be shortcuts not handled by scintilla. - if (QApplication::keyboardModifiers() & Qt::MetaModifier) { - QAbstractScrollArea::keyPressEvent(event); - emit keyPressed(event); - return; - } - - int key = 0; - switch (event->key()) { - case Qt::Key_Down: key = SCK_DOWN; break; - case Qt::Key_Up: key = SCK_UP; break; - case Qt::Key_Left: key = SCK_LEFT; break; - case Qt::Key_Right: key = SCK_RIGHT; break; - case Qt::Key_Home: key = SCK_HOME; break; - case Qt::Key_End: key = SCK_END; break; - case Qt::Key_PageUp: key = SCK_PRIOR; break; - case Qt::Key_PageDown: key = SCK_NEXT; break; - case Qt::Key_Delete: key = SCK_DELETE; break; - case Qt::Key_Insert: key = SCK_INSERT; break; - case Qt::Key_Escape: key = SCK_ESCAPE; break; - case Qt::Key_Backspace: key = SCK_BACK; break; - case Qt::Key_Plus: key = SCK_ADD; break; - case Qt::Key_Minus: key = SCK_SUBTRACT; break; - case Qt::Key_Backtab: // fall through - case Qt::Key_Tab: key = SCK_TAB; break; - case Qt::Key_Enter: // fall through - case Qt::Key_Return: key = SCK_RETURN; break; - case Qt::Key_Control: key = 0; break; - case Qt::Key_Alt: key = 0; break; - case Qt::Key_Shift: key = 0; break; - case Qt::Key_Meta: key = 0; break; - default: key = event->key(); break; - } - - bool shift = QApplication::keyboardModifiers() & Qt::ShiftModifier; - bool ctrl = QApplication::keyboardModifiers() & Qt::ControlModifier; - bool alt = QApplication::keyboardModifiers() & Qt::AltModifier; - - bool consumed = false; - bool added = sqt->KeyDown(key, shift, ctrl, alt, &consumed) != 0; - if (!consumed) - consumed = added; - - if (!consumed) { - // Don't insert text if the control key was pressed unless - // it was pressed in conjunction with alt for AltGr emulation. - bool input = (!ctrl || alt); - - // Additionally, on non-mac platforms, don't insert text - // if the alt key was pressed unless control is also present. - // On mac alt can be used to insert special characters. -#ifndef Q_WS_MAC - input &= (!alt || ctrl); -#endif - - QString text = event->text(); - if (input && !text.isEmpty() && text[0].isPrint()) { - QByteArray utext = sqt->BytesForDocument(text); - sqt->AddCharUTF(utext.data(), utext.size()); - } else { - event->ignore(); - } - } - - emit keyPressed(event); -} - -#ifdef Q_WS_X11 -static int modifierTranslated(int sciModifier) -{ - switch (sciModifier) { - case SCMOD_SHIFT: - return Qt::ShiftModifier; - case SCMOD_CTRL: - return Qt::ControlModifier; - case SCMOD_ALT: - return Qt::AltModifier; - case SCMOD_SUPER: - return Qt::MetaModifier; - default: - return 0; - } -} -#endif - -void ScintillaEditBase::mousePressEvent(QMouseEvent *event) -{ - Point pos = PointFromQPoint(event->pos()); - - emit buttonPressed(event); - - if (event->button() == Qt::MidButton && - QApplication::clipboard()->supportsSelection()) { - SelectionPosition selPos = sqt->SPositionFromLocation( - pos, false, false, sqt->UserVirtualSpace()); - sqt->sel.Clear(); - sqt->SetSelection(selPos, selPos); - sqt->PasteFromMode(QClipboard::Selection); - return; - } - - if (event->button() == Qt::LeftButton) { - bool shift = QApplication::keyboardModifiers() & Qt::ShiftModifier; - bool ctrl = QApplication::keyboardModifiers() & Qt::ControlModifier; -#ifdef Q_WS_X11 - // On X allow choice of rectangular modifier since most window - // managers grab alt + click for moving windows. - bool alt = QApplication::keyboardModifiers() & modifierTranslated(sqt->rectangularSelectionModifier); -#else - bool alt = QApplication::keyboardModifiers() & Qt::AltModifier; -#endif - - sqt->ButtonDown(pos, time.elapsed(), shift, ctrl, alt); - } - - if (event->button() == Qt::RightButton) { - bool shift = QApplication::keyboardModifiers() & Qt::ShiftModifier; - bool ctrl = QApplication::keyboardModifiers() & Qt::ControlModifier; - bool alt = QApplication::keyboardModifiers() & Qt::AltModifier; - - sqt->RightButtonDownWithModifiers(pos, time.elapsed(), ScintillaQt::ModifierFlags(shift, ctrl, alt)); - } -} - -void ScintillaEditBase::mouseReleaseEvent(QMouseEvent *event) -{ - Point point = PointFromQPoint(event->pos()); - bool ctrl = QApplication::keyboardModifiers() & Qt::ControlModifier; - if (event->button() == Qt::LeftButton) - sqt->ButtonUp(point, time.elapsed(), ctrl); - - int pos = send(SCI_POSITIONFROMPOINT, point.x, point.y); - int line = send(SCI_LINEFROMPOSITION, pos); - int modifiers = QApplication::keyboardModifiers(); - - emit textAreaClicked(line, modifiers); - emit buttonReleased(event); -} - -void ScintillaEditBase::mouseDoubleClickEvent(QMouseEvent *event) -{ - // Scintilla does its own double-click detection. - mousePressEvent(event); -} - -void ScintillaEditBase::mouseMoveEvent(QMouseEvent *event) -{ - Point pos = PointFromQPoint(event->pos()); - - bool shift = QApplication::keyboardModifiers() & Qt::ShiftModifier; - bool ctrl = QApplication::keyboardModifiers() & Qt::ControlModifier; -#ifdef Q_WS_X11 - // On X allow choice of rectangular modifier since most window - // managers grab alt + click for moving windows. - bool alt = QApplication::keyboardModifiers() & modifierTranslated(sqt->rectangularSelectionModifier); -#else - bool alt = QApplication::keyboardModifiers() & Qt::AltModifier; -#endif - - int modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | (alt ? SCI_ALT : 0); - - sqt->ButtonMoveWithModifiers(pos, modifiers); -} - -void ScintillaEditBase::contextMenuEvent(QContextMenuEvent *event) -{ - Point pos = PointFromQPoint(event->globalPos()); - Point pt = PointFromQPoint(event->pos()); - if (!sqt->PointInSelection(pt)) { - sqt->SetEmptySelection(sqt->PositionFromLocation(pt)); - } - if (sqt->ShouldDisplayPopup(pt)) { - sqt->ContextMenu(pos); - } -} - -void ScintillaEditBase::dragEnterEvent(QDragEnterEvent *event) -{ - if (event->mimeData()->hasText()) { - event->acceptProposedAction(); - - Point point = PointFromQPoint(event->pos()); - sqt->DragEnter(point); - } else { - event->ignore(); - } -} - -void ScintillaEditBase::dragLeaveEvent(QDragLeaveEvent * /* event */) -{ - sqt->DragLeave(); -} - -void ScintillaEditBase::dragMoveEvent(QDragMoveEvent *event) -{ - if (event->mimeData()->hasText()) { - event->acceptProposedAction(); - - Point point = PointFromQPoint(event->pos()); - sqt->DragMove(point); - } else { - event->ignore(); - } -} - -void ScintillaEditBase::dropEvent(QDropEvent *event) -{ - if (event->mimeData()->hasText()) { - event->acceptProposedAction(); - - Point point = PointFromQPoint(event->pos()); - bool move = (event->source() == this && - event->proposedAction() == Qt::MoveAction); - sqt->Drop(point, event->mimeData(), move); - } else { - event->ignore(); - } -} - -bool ScintillaEditBase::IsHangul(const QChar qchar) -{ - int unicode = (int)qchar.unicode(); - // Korean character ranges used for preedit chars. - // http://www.programminginkorean.com/programming/hangul-in-unicode/ - const bool HangulJamo = (0x1100 <= unicode && unicode <= 0x11FF); - const bool HangulCompatibleJamo = (0x3130 <= unicode && unicode <= 0x318F); - const bool HangulJamoExtendedA = (0xA960 <= unicode && unicode <= 0xA97F); - const bool HangulJamoExtendedB = (0xD7B0 <= unicode && unicode <= 0xD7FF); - const bool HangulSyllable = (0xAC00 <= unicode && unicode <= 0xD7A3); - return HangulJamo || HangulCompatibleJamo || HangulSyllable || - HangulJamoExtendedA || HangulJamoExtendedB; -} - -void ScintillaEditBase::MoveImeCarets(int offset) -{ - // Move carets relatively by bytes - for (size_t r=0; r < sqt->sel.Count(); r++) { - int positionInsert = sqt->sel.Range(r).Start().Position(); - sqt->sel.Range(r).caret.SetPosition(positionInsert + offset); - sqt->sel.Range(r).anchor.SetPosition(positionInsert + offset); - } -} - -void ScintillaEditBase::DrawImeIndicator(int indicator, int len) -{ - // Emulate the visual style of IME characters with indicators. - // Draw an indicator on the character before caret by the character bytes of len - // so it should be called after AddCharUTF(). - // It does not affect caret positions. - if (indicator < 8 || indicator > INDIC_MAX) { - return; - } - sqt->pdoc->decorations.SetCurrentIndicator(indicator); - for (size_t r=0; r< sqt-> sel.Count(); r++) { - int positionInsert = sqt->sel.Range(r).Start().Position(); - sqt->pdoc->DecorationFillRange(positionInsert - len, 1, len); - } -} - -static int GetImeCaretPos(QInputMethodEvent *event) -{ - foreach (QInputMethodEvent::Attribute attr, event->attributes()) { - if (attr.type == QInputMethodEvent::Cursor) - return attr.start; - } - return 0; -} - -static std::vector MapImeIndicators(QInputMethodEvent *event) -{ - std::vector imeIndicator(event->preeditString().size(), SC_INDICATOR_UNKNOWN); - foreach (QInputMethodEvent::Attribute attr, event->attributes()) { - if (attr.type == QInputMethodEvent::TextFormat) { - QTextFormat format = attr.value.value(); - QTextCharFormat charFormat = format.toCharFormat(); - - int indicator = SC_INDICATOR_UNKNOWN; - switch (charFormat.underlineStyle()) { - case QTextCharFormat::NoUnderline: // win32, linux - indicator = SC_INDICATOR_TARGET; - break; - case QTextCharFormat::SingleUnderline: // osx - case QTextCharFormat::DashUnderline: // win32, linux - indicator = SC_INDICATOR_INPUT; - break; - case QTextCharFormat::DotLine: - case QTextCharFormat::DashDotLine: - case QTextCharFormat::WaveUnderline: - case QTextCharFormat::SpellCheckUnderline: - indicator = SC_INDICATOR_CONVERTED; - break; - - default: - indicator = SC_INDICATOR_UNKNOWN; - } - - if (format.hasProperty(QTextFormat::BackgroundBrush)) // win32, linux - indicator = SC_INDICATOR_TARGET; - -#ifdef Q_OS_OSX - if (charFormat.underlineStyle() == QTextCharFormat::SingleUnderline) { - QColor uc = charFormat.underlineColor(); - if (uc.lightness() < 2) { // osx - indicator = SC_INDICATOR_TARGET; - } - } -#endif - - for (int i = attr.start; i < attr.start+attr.length; i++) { - imeIndicator[i] = indicator; - } - } - } - return imeIndicator; -} - -void ScintillaEditBase::inputMethodEvent(QInputMethodEvent *event) -{ - // Copy & paste by johnsonj with a lot of helps of Neil - // Great thanks for my forerunners, jiniya and BLUEnLIVE - - if (sqt->pdoc->IsReadOnly() || sqt->SelectionContainsProtected()) { - // Here, a canceling and/or completing composition function is needed. - return; - } - - if (sqt->pdoc->TentativeActive()) { - sqt->pdoc->TentativeUndo(); - } else { - // No tentative undo means start of this composition so - // Fill in any virtual spaces. - sqt->ClearBeforeTentativeStart(); - } - - sqt->view.imeCaretBlockOverride = false; - - if (!event->commitString().isEmpty()) { - const QString commitStr = event->commitString(); - const unsigned int commitStrLen = commitStr.length(); - - for (unsigned int i = 0; i < commitStrLen;) { - const unsigned int ucWidth = commitStr.at(i).isHighSurrogate() ? 2 : 1; - const QString oneCharUTF16 = commitStr.mid(i, ucWidth); - const QByteArray oneChar = sqt->BytesForDocument(oneCharUTF16); - const int oneCharLen = oneChar.length(); - - sqt->AddCharUTF(oneChar.data(), oneCharLen); - i += ucWidth; - } - - } else if (!event->preeditString().isEmpty()) { - const QString preeditStr = event->preeditString(); - const unsigned int preeditStrLen = preeditStr.length(); - if ((preeditStrLen == 0) || (preeditStrLen > MAXLENINPUTIME)) { - sqt->ShowCaretAtCurrentPosition(); - return; - } - - sqt->pdoc->TentativeStart(); // TentativeActive() from now on. - - std::vector imeIndicator = MapImeIndicators(event); - - const bool recording = sqt->recordingMacro; - sqt->recordingMacro = false; - for (unsigned int i = 0; i < preeditStrLen;) { - const unsigned int ucWidth = preeditStr.at(i).isHighSurrogate() ? 2 : 1; - const QString oneCharUTF16 = preeditStr.mid(i, ucWidth); - const QByteArray oneChar = sqt->BytesForDocument(oneCharUTF16); - const int oneCharLen = oneChar.length(); - - sqt->AddCharUTF(oneChar.data(), oneCharLen); - - DrawImeIndicator(imeIndicator[i], oneCharLen); - i += ucWidth; - } - sqt->recordingMacro = recording; - - // Move IME carets. - int imeCaretPos = GetImeCaretPos(event); - int imeEndToImeCaretU16 = imeCaretPos - preeditStrLen; - int imeCaretPosDoc = sqt->pdoc->GetRelativePositionUTF16(sqt->CurrentPosition(), imeEndToImeCaretU16); - - MoveImeCarets(- sqt->CurrentPosition() + imeCaretPosDoc); - - if (IsHangul(preeditStr.at(0))) { -#ifndef Q_OS_WIN - if (imeCaretPos > 0) { - int oneCharBefore = sqt->pdoc->GetRelativePosition(sqt->CurrentPosition(), -1); - MoveImeCarets(- sqt->CurrentPosition() + oneCharBefore); - } -#endif - sqt->view.imeCaretBlockOverride = true; - } - - // Set candidate box position for Qt::ImMicroFocus. - preeditPos = sqt->CurrentPosition(); - sqt->EnsureCaretVisible(); - updateMicroFocus(); - } - sqt->ShowCaretAtCurrentPosition(); -} - -QVariant ScintillaEditBase::inputMethodQuery(Qt::InputMethodQuery query) const -{ - int pos = send(SCI_GETCURRENTPOS); - int line = send(SCI_LINEFROMPOSITION, pos); - - switch (query) { - case Qt::ImMicroFocus: - { - int startPos = (preeditPos >= 0) ? preeditPos : pos; - Point pt = sqt->LocationFromPosition(startPos); - int width = send(SCI_GETCARETWIDTH); - int height = send(SCI_TEXTHEIGHT, line); - return QRect(pt.x, pt.y, width, height); - } - - case Qt::ImFont: - { - char fontName[64]; - int style = send(SCI_GETSTYLEAT, pos); - int len = send(SCI_STYLEGETFONT, style, (sptr_t)fontName); - int size = send(SCI_STYLEGETSIZE, style); - bool italic = send(SCI_STYLEGETITALIC, style); - int weight = send(SCI_STYLEGETBOLD, style) ? QFont::Bold : -1; - return QFont(QString::fromUtf8(fontName, len), size, weight, italic); - } - - case Qt::ImCursorPosition: - { - int paraStart = sqt->pdoc->ParaUp(pos); - return pos - paraStart; - } - - case Qt::ImSurroundingText: - { - int paraStart = sqt->pdoc->ParaUp(pos); - int paraEnd = sqt->pdoc->ParaDown(pos); - QVarLengthArray buffer(paraEnd - paraStart + 1); - - Sci_CharacterRange charRange; - charRange.cpMin = paraStart; - charRange.cpMax = paraEnd; - - Sci_TextRange textRange; - textRange.chrg = charRange; - textRange.lpstrText = buffer.data(); - - send(SCI_GETTEXTRANGE, 0, (sptr_t)&textRange); - - return sqt->StringFromDocument(buffer.constData()); - } - - case Qt::ImCurrentSelection: - { - QVarLengthArray buffer(send(SCI_GETSELTEXT)); - send(SCI_GETSELTEXT, 0, (sptr_t)buffer.data()); - - return sqt->StringFromDocument(buffer.constData()); - } - - default: - return QVariant(); - } -} - -void ScintillaEditBase::notifyParent(SCNotification scn) -{ - emit notify(&scn); - switch (scn.nmhdr.code) { - case SCN_STYLENEEDED: - emit styleNeeded(scn.position); - break; - - case SCN_CHARADDED: - emit charAdded(scn.ch); - break; - - case SCN_SAVEPOINTREACHED: - emit savePointChanged(false); - break; - - case SCN_SAVEPOINTLEFT: - emit savePointChanged(true); - break; - - case SCN_MODIFYATTEMPTRO: - emit modifyAttemptReadOnly(); - break; - - case SCN_KEY: - emit key(scn.ch); - break; - - case SCN_DOUBLECLICK: - emit doubleClick(scn.position, scn.line); - break; - - case SCN_UPDATEUI: - emit updateUi(); - break; - - case SCN_MODIFIED: - { - bool added = scn.modificationType & SC_MOD_INSERTTEXT; - bool deleted = scn.modificationType & SC_MOD_DELETETEXT; - - int length = send(SCI_GETTEXTLENGTH); - bool firstLineAdded = (added && length == 1) || - (deleted && length == 0); - - if (scn.linesAdded != 0) { - emit linesAdded(scn.linesAdded); - } else if (firstLineAdded) { - emit linesAdded(added ? 1 : -1); - } - - const QByteArray bytes = QByteArray::fromRawData(scn.text, scn.length); - emit modified(scn.modificationType, scn.position, scn.length, - scn.linesAdded, bytes, scn.line, - scn.foldLevelNow, scn.foldLevelPrev); - break; - } - - case SCN_MACRORECORD: - emit macroRecord(scn.message, scn.wParam, scn.lParam); - break; - - case SCN_MARGINCLICK: - emit marginClicked(scn.position, scn.modifiers, scn.margin); - break; - - case SCN_NEEDSHOWN: - emit needShown(scn.position, scn.length); - break; - - case SCN_PAINTED: - emit painted(); - break; - - case SCN_USERLISTSELECTION: - emit userListSelection(); - break; - - case SCN_URIDROPPED: - emit uriDropped(); - break; - - case SCN_DWELLSTART: - emit dwellStart(scn.x, scn.y); - break; - - case SCN_DWELLEND: - emit dwellEnd(scn.x, scn.y); - break; - - case SCN_ZOOM: - emit zoom(send(SCI_GETZOOM)); - break; - - case SCN_HOTSPOTCLICK: - emit hotSpotClick(scn.position, scn.modifiers); - break; - - case SCN_HOTSPOTDOUBLECLICK: - emit hotSpotDoubleClick(scn.position, scn.modifiers); - break; - - case SCN_CALLTIPCLICK: - emit callTipClick(); - break; - - case SCN_AUTOCSELECTION: - emit autoCompleteSelection(scn.lParam, QString::fromUtf8(scn.text)); - break; - - case SCN_AUTOCCANCELLED: - emit autoCompleteCancelled(); - break; - - default: - return; - } -} - -void ScintillaEditBase::event_command(uptr_t wParam, sptr_t lParam) -{ - emit command(wParam, lParam); -} diff --git a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaEditBase.h b/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaEditBase.h deleted file mode 100644 index 7c52e5690..000000000 --- a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaEditBase.h +++ /dev/null @@ -1,156 +0,0 @@ -// -// Copyright (c) 1990-2011, Scientific Toolworks, Inc. -// -// The License.txt file describes the conditions under which this software may be distributed. -// -// Author: Jason Haslam -// -// Additions Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware -// ScintillaWidget.h - Qt widget that wraps ScintillaQt and provides events and scrolling - - -#ifndef SCINTILLAEDITBASE_H -#define SCINTILLAEDITBASE_H - -#include "Platform.h" -#include "Scintilla.h" - -#include -#include -#include - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class ScintillaQt; -class SurfaceImpl; -struct SCNotification; - -#ifdef WIN32 -#ifdef MAKING_LIBRARY -#define EXPORT_IMPORT_API __declspec(dllexport) -#else -// Defining dllimport upsets moc -#define EXPORT_IMPORT_API __declspec(dllimport) -//#define EXPORT_IMPORT_API -#endif -#else -#define EXPORT_IMPORT_API -#endif - -class EXPORT_IMPORT_API ScintillaEditBase : public QAbstractScrollArea { - Q_OBJECT - -public: - explicit ScintillaEditBase(QWidget *parent = 0); - virtual ~ScintillaEditBase(); - - virtual sptr_t send( - unsigned int iMessage, - uptr_t wParam = 0, - sptr_t lParam = 0) const; - - virtual sptr_t sends( - unsigned int iMessage, - uptr_t wParam = 0, - const char *s = 0) const; - -public slots: - // Scroll events coming from GUI to be sent to Scintilla. - void scrollHorizontal(int value); - void scrollVertical(int value); - - // Emit Scintilla notifications as signals. - void notifyParent(SCNotification scn); - void event_command(uptr_t wParam, sptr_t lParam); - -signals: - void horizontalScrolled(int value); - void verticalScrolled(int value); - void horizontalRangeChanged(int max, int page); - void verticalRangeChanged(int max, int page); - void notifyChange(); - void linesAdded(int linesAdded); - - // Clients can use this hook to add additional - // formats (e.g. rich text) to the MIME data. - void aboutToCopy(QMimeData *data); - - // Scintilla Notifications - void styleNeeded(int position); - void charAdded(int ch); - void savePointChanged(bool dirty); - void modifyAttemptReadOnly(); - void key(int key); - void doubleClick(int position, int line); - void updateUi(); - void modified(int type, int position, int length, int linesAdded, - const QByteArray &text, int line, int foldNow, int foldPrev); - void macroRecord(int message, uptr_t wParam, sptr_t lParam); - void marginClicked(int position, int modifiers, int margin); - void textAreaClicked(int line, int modifiers); - void needShown(int position, int length); - void painted(); - void userListSelection(); // Wants some args. - void uriDropped(); // Wants some args. - void dwellStart(int x, int y); - void dwellEnd(int x, int y); - void zoom(int zoom); - void hotSpotClick(int position, int modifiers); - void hotSpotDoubleClick(int position, int modifiers); - void callTipClick(); - void autoCompleteSelection(int position, const QString &text); - void autoCompleteCancelled(); - - // Base notifications for compatibility with other Scintilla implementations - void notify(SCNotification *pscn); - void command(uptr_t wParam, sptr_t lParam); - - // GUI event notifications needed under Qt - void buttonPressed(QMouseEvent *event); - void buttonReleased(QMouseEvent *event); - void keyPressed(QKeyEvent *event); - void resized(); - -protected: - virtual bool event(QEvent *event); - virtual void paintEvent(QPaintEvent *event); - virtual void wheelEvent(QWheelEvent *event); - virtual void focusInEvent(QFocusEvent *event); - virtual void focusOutEvent(QFocusEvent *event); - virtual void resizeEvent(QResizeEvent *event); - virtual void keyPressEvent(QKeyEvent *event); - virtual void mousePressEvent(QMouseEvent *event); - virtual void mouseReleaseEvent(QMouseEvent *event); - virtual void mouseDoubleClickEvent(QMouseEvent *event); - virtual void mouseMoveEvent(QMouseEvent *event); - virtual void contextMenuEvent(QContextMenuEvent *event); - virtual void dragEnterEvent(QDragEnterEvent *event); - virtual void dragLeaveEvent(QDragLeaveEvent *event); - virtual void dragMoveEvent(QDragMoveEvent *event); - virtual void dropEvent(QDropEvent *event); - virtual void inputMethodEvent(QInputMethodEvent *event); - virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; - virtual void scrollContentsBy(int, int) {} - -private: - ScintillaQt *sqt; - - QTime time; - - int preeditPos; - QString preeditString; - - int wheelDelta; - - static bool IsHangul(const QChar qchar); - void MoveImeCarets(int offset); - void DrawImeIndicator(int indicator, int len); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif /* SCINTILLAEDITBASE_H */ diff --git a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaQt.cpp b/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaQt.cpp deleted file mode 100644 index b872b1363..000000000 --- a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaQt.cpp +++ /dev/null @@ -1,766 +0,0 @@ -// -// Copyright (c) 1990-2011, Scientific Toolworks, Inc. -// -// The License.txt file describes the conditions under which this software may be distributed. -// -// Author: Jason Haslam -// -// Additions Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware -// ScintillaQt.cpp - Qt specific subclass of ScintillaBase - -#include "PlatQt.h" -#include "ScintillaQt.h" -#ifdef SCI_LEXER -#include "LexerModule.h" -#include "ExternalLexer.h" -#endif - -#include -#include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) -#include -#endif -#include -#include -#include -#include -#include - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - - -ScintillaQt::ScintillaQt(QAbstractScrollArea *parent) -: QObject(parent), scrollArea(parent), vMax(0), hMax(0), vPage(0), hPage(0), - haveMouseCapture(false), dragWasDropped(false) -{ - - wMain = scrollArea->viewport(); - - imeInteraction = imeInline; - - // On OS X drawing text into a pixmap moves it around 1 pixel to - // the right compared to drawing it directly onto a window. - // Buffered drawing turned off by default to avoid this. - WndProc(SCI_SETBUFFEREDDRAW, false, 0); - - Initialise(); - - for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast(tr + 1)) { - timers[tr] = 0; - } -} - -ScintillaQt::~ScintillaQt() -{ - for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast(tr + 1)) { - FineTickerCancel(tr); - } - SetIdle(false); -} - -void ScintillaQt::execCommand(QAction *action) -{ - int command = action->data().toInt(); - Command(command); -} - -#if defined(Q_OS_WIN) -static const QString sMSDEVColumnSelect(QStringLiteral("MSDEVColumnSelect")); -static const QString sWrappedMSDEVColumnSelect(QStringLiteral("application/x-qt-windows-mime;value=\"MSDEVColumnSelect\"")); -#elif defined(Q_OS_MAC) -static const QString sScintillaRecPboardType(QStringLiteral("com.scintilla.utf16-plain-text.rectangular")); -static const QString sScintillaRecMimeType(QStringLiteral("text/x-scintilla.utf16-plain-text.rectangular")); -#else -// Linux -static const QString sMimeRectangularMarker(QStringLiteral("text/x-rectangular-marker")); -#endif - -#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - -class ScintillaRectangularMime : public QMacPasteboardMime { -public: - ScintillaRectangularMime() : QMacPasteboardMime(MIME_ALL) { - } - - QString convertorName() { - return QString("ScintillaRectangularMime"); - } - - bool canConvert(const QString &mime, QString flav) { - return mimeFor(flav) == mime; - } - - QString mimeFor(QString flav) { - if (flav == sScintillaRecPboardType) - return sScintillaRecMimeType; - return QString(); - } - - QString flavorFor(const QString &mime) { - if (mime == sScintillaRecMimeType) - return sScintillaRecPboardType; - return QString(); - } - - QVariant convertToMime(const QString & /* mime */, QList data, QString /* flav */) { - QByteArray all; - foreach (QByteArray i, data) { - all += i; - } - return QVariant(all); - } - - QList convertFromMime(const QString & /* mime */, QVariant data, QString /* flav */) { - QByteArray a = data.toByteArray(); - QList l; - l.append(a); - return l; - } - -}; - -// The Mime object registers itself but only want one for all Scintilla instances. -// Should delete at exit to help memory leak detection but that would be extra work -// and, since the clipboard exists after last Scintilla instance, may be complex. -static ScintillaRectangularMime *singletonMime = 0; - -#endif - -void ScintillaQt::Initialise() -{ -#if defined(Q_OS_WIN) || defined(Q_OS_MAC) - rectangularSelectionModifier = SCMOD_ALT; -#else - rectangularSelectionModifier = SCMOD_CTRL; -#endif - -#if defined(Q_OS_MAC) && QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - if (!singletonMime) { - singletonMime = new ScintillaRectangularMime(); - - QStringList slTypes(sScintillaRecPboardType); - qRegisterDraggedTypes(slTypes); - } -#endif - - connect(QApplication::clipboard(), SIGNAL(selectionChanged()), - this, SLOT(SelectionChanged())); -} - -void ScintillaQt::Finalise() -{ - for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast(tr + 1)) { - FineTickerCancel(tr); - } - ScintillaBase::Finalise(); -} - -void ScintillaQt::SelectionChanged() -{ - bool nowPrimary = QApplication::clipboard()->ownsSelection(); - if (nowPrimary != primarySelection) { - primarySelection = nowPrimary; - Redraw(); - } -} - -bool ScintillaQt::DragThreshold(Point ptStart, Point ptNow) -{ - int xMove = std::abs(ptStart.x - ptNow.x); - int yMove = std::abs(ptStart.y - ptNow.y); - return (xMove > QApplication::startDragDistance()) || - (yMove > QApplication::startDragDistance()); -} - -static QString StringFromSelectedText(const SelectionText &selectedText) -{ - if (selectedText.codePage == SC_CP_UTF8) { - return QString::fromUtf8(selectedText.Data(), static_cast(selectedText.Length())); - } else { - QTextCodec *codec = QTextCodec::codecForName( - CharacterSetID(selectedText.characterSet)); - return codec->toUnicode(selectedText.Data(), static_cast(selectedText.Length())); - } -} - -static void AddRectangularToMime(QMimeData *mimeData, QString su) -{ -#if defined(Q_OS_WIN) - // Add an empty marker - mimeData->setData(sMSDEVColumnSelect, QByteArray()); -#elif defined(Q_OS_MAC) - // OS X gets marker + data to work with other implementations. - // Don't understand how this works but it does - the - // clipboard format is supposed to be UTF-16, not UTF-8. - mimeData->setData(sScintillaRecMimeType, su.toUtf8()); -#else - Q_UNUSED(su); - // Linux - // Add an empty marker - mimeData->setData(sMimeRectangularMarker, QByteArray()); -#endif -} - -static bool IsRectangularInMime(const QMimeData *mimeData) -{ - QStringList formats = mimeData->formats(); - for (int i = 0; i < formats.size(); ++i) { -#if defined(Q_OS_WIN) - // Windows rectangular markers - // If rectangular copies made by this application, see base name. - if (formats[i] == sMSDEVColumnSelect) - return true; - // Otherwise see wrapped name. - if (formats[i] == sWrappedMSDEVColumnSelect) - return true; -#elif defined(Q_OS_MAC) - if (formats[i] == sScintillaRecMimeType) - return true; -#else - // Linux - if (formats[i] == sMimeRectangularMarker) - return true; -#endif - } - return false; -} - -bool ScintillaQt::ValidCodePage(int codePage) const -{ - return codePage == 0 - || codePage == SC_CP_UTF8 - || codePage == 932 - || codePage == 936 - || codePage == 949 - || codePage == 950 - || codePage == 1361; -} - - -void ScintillaQt::ScrollText(int linesToMove) -{ - int dy = vs.lineHeight * (linesToMove); - scrollArea->viewport()->scroll(0, dy); -} - -void ScintillaQt::SetVerticalScrollPos() -{ - scrollArea->verticalScrollBar()->setValue(topLine); - emit verticalScrolled(topLine); -} - -void ScintillaQt::SetHorizontalScrollPos() -{ - scrollArea->horizontalScrollBar()->setValue(xOffset); - emit horizontalScrolled(xOffset); -} - -bool ScintillaQt::ModifyScrollBars(int nMax, int nPage) -{ - bool modified = false; - - int vNewPage = nPage; - int vNewMax = nMax - vNewPage + 1; - if (vMax != vNewMax || vPage != vNewPage) { - vMax = vNewMax; - vPage = vNewPage; - modified = true; - - scrollArea->verticalScrollBar()->setMaximum(vMax); - scrollArea->verticalScrollBar()->setPageStep(vPage); - emit verticalRangeChanged(vMax, vPage); - } - - int hNewPage = GetTextRectangle().Width(); - int hNewMax = (scrollWidth > hNewPage) ? scrollWidth - hNewPage : 0; - int charWidth = vs.styles[STYLE_DEFAULT].aveCharWidth; - if (hMax != hNewMax || hPage != hNewPage || - scrollArea->horizontalScrollBar()->singleStep() != charWidth) { - hMax = hNewMax; - hPage = hNewPage; - modified = true; - - scrollArea->horizontalScrollBar()->setMaximum(hMax); - scrollArea->horizontalScrollBar()->setPageStep(hPage); - scrollArea->horizontalScrollBar()->setSingleStep(charWidth); - emit horizontalRangeChanged(hMax, hPage); - } - - return modified; -} - -void ScintillaQt::ReconfigureScrollBars() -{ - if (verticalScrollBarVisible) { - scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - } else { - scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - } - - if (horizontalScrollBarVisible && !Wrapping()) { - scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); - } else { - scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - } -} - -void ScintillaQt::CopyToModeClipboard(const SelectionText &selectedText, QClipboard::Mode clipboardMode_) -{ - QClipboard *clipboard = QApplication::clipboard(); - clipboard->clear(clipboardMode_); - QString su = StringFromSelectedText(selectedText); - QMimeData *mimeData = new QMimeData(); - mimeData->setText(su); - if (selectedText.rectangular) { - AddRectangularToMime(mimeData, su); - } - - // Allow client code to add additional data (e.g rich text). - emit aboutToCopy(mimeData); - - clipboard->setMimeData(mimeData, clipboardMode_); -} - -void ScintillaQt::Copy() -{ - if (!sel.Empty()) { - SelectionText st; - CopySelectionRange(&st); - CopyToClipboard(st); - } -} - -void ScintillaQt::CopyToClipboard(const SelectionText &selectedText) -{ - CopyToModeClipboard(selectedText, QClipboard::Clipboard); -} - -void ScintillaQt::PasteFromMode(QClipboard::Mode clipboardMode_) -{ - QClipboard *clipboard = QApplication::clipboard(); - const QMimeData *mimeData = clipboard->mimeData(clipboardMode_); - bool isRectangular = IsRectangularInMime(mimeData); - QString text = clipboard->text(clipboardMode_); - QByteArray utext = BytesForDocument(text); - std::string dest(utext.constData(), utext.length()); - SelectionText selText; - selText.Copy(dest, pdoc->dbcsCodePage, CharacterSetOfDocument(), isRectangular, false); - - UndoGroup ug(pdoc); - ClearSelection(multiPasteMode == SC_MULTIPASTE_EACH); - InsertPasteShape(selText.Data(), static_cast(selText.Length()), - selText.rectangular ? pasteRectangular : pasteStream); - EnsureCaretVisible(); -} - -void ScintillaQt::Paste() -{ - PasteFromMode(QClipboard::Clipboard); -} - -void ScintillaQt::ClaimSelection() -{ - if (QApplication::clipboard()->supportsSelection()) { - // X Windows has a 'primary selection' as well as the clipboard. - // Whenever the user selects some text, we become the primary selection - if (!sel.Empty()) { - primarySelection = true; - SelectionText st; - CopySelectionRange(&st); - CopyToModeClipboard(st, QClipboard::Selection); - } else { - primarySelection = false; - } - } -} - -void ScintillaQt::NotifyChange() -{ - emit notifyChange(); - emit command( - Platform::LongFromTwoShorts(GetCtrlID(), SCEN_CHANGE), - reinterpret_cast(wMain.GetID())); -} - -void ScintillaQt::NotifyFocus(bool focus) -{ - emit command( - Platform::LongFromTwoShorts - (GetCtrlID(), focus ? SCEN_SETFOCUS : SCEN_KILLFOCUS), - reinterpret_cast(wMain.GetID())); - - Editor::NotifyFocus(focus); -} - -void ScintillaQt::NotifyParent(SCNotification scn) -{ - scn.nmhdr.hwndFrom = wMain.GetID(); - scn.nmhdr.idFrom = GetCtrlID(); - emit notifyParent(scn); -} - -/** -* Report that this Editor subclass has a working implementation of FineTickerStart. -*/ -bool ScintillaQt::FineTickerAvailable() -{ - return true; -} - -bool ScintillaQt::FineTickerRunning(TickReason reason) -{ - return timers[reason] != 0; -} - -void ScintillaQt::FineTickerStart(TickReason reason, int millis, int /* tolerance */) -{ - FineTickerCancel(reason); - timers[reason] = startTimer(millis); -} - -void ScintillaQt::FineTickerCancel(TickReason reason) -{ - if (timers[reason]) { - killTimer(timers[reason]); - timers[reason] = 0; - } -} - -void ScintillaQt::onIdle() -{ - bool continueIdling = Idle(); - if (!continueIdling) { - SetIdle(false); - } -} - -bool ScintillaQt::SetIdle(bool on) -{ - QTimer *qIdle; - if (on) { - // Start idler, if it's not running. - if (!idler.state) { - idler.state = true; - qIdle = new QTimer; - connect(qIdle, SIGNAL(timeout()), this, SLOT(onIdle())); - qIdle->start(0); - idler.idlerID = qIdle; - } - } else { - // Stop idler, if it's running - if (idler.state) { - idler.state = false; - qIdle = static_cast(idler.idlerID); - qIdle->stop(); - disconnect(qIdle, SIGNAL(timeout()), 0, 0); - delete qIdle; - idler.idlerID = 0; - } - } - return true; -} - -int ScintillaQt::CharacterSetOfDocument() const -{ - return vs.styles[STYLE_DEFAULT].characterSet; -} - -const char *ScintillaQt::CharacterSetIDOfDocument() const -{ - return CharacterSetID(CharacterSetOfDocument()); -} - -QString ScintillaQt::StringFromDocument(const char *s) const -{ - if (IsUnicodeMode()) { - return QString::fromUtf8(s); - } else { - QTextCodec *codec = QTextCodec::codecForName( - CharacterSetID(CharacterSetOfDocument())); - return codec->toUnicode(s); - } -} - -QByteArray ScintillaQt::BytesForDocument(const QString &text) const -{ - if (IsUnicodeMode()) { - return text.toUtf8(); - } else { - QTextCodec *codec = QTextCodec::codecForName( - CharacterSetID(CharacterSetOfDocument())); - return codec->fromUnicode(text); - } -} - - -class CaseFolderDBCS : public CaseFolderTable { - QTextCodec *codec; -public: - explicit CaseFolderDBCS(QTextCodec *codec_) : codec(codec_) { - StandardASCII(); - } - virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { - if ((lenMixed == 1) && (sizeFolded > 0)) { - folded[0] = mapping[static_cast(mixed[0])]; - return 1; - } else if (codec) { - QString su = codec->toUnicode(mixed, static_cast(lenMixed)); - QString suFolded = su.toCaseFolded(); - QByteArray bytesFolded = codec->fromUnicode(suFolded); - - if (bytesFolded.length() < static_cast(sizeFolded)) { - memcpy(folded, bytesFolded, bytesFolded.length()); - return bytesFolded.length(); - } - } - // Something failed so return a single NUL byte - folded[0] = '\0'; - return 1; - } -}; - -CaseFolder *ScintillaQt::CaseFolderForEncoding() -{ - if (pdoc->dbcsCodePage == SC_CP_UTF8) { - return new CaseFolderUnicode(); - } else { - const char *charSetBuffer = CharacterSetIDOfDocument(); - if (charSetBuffer) { - if (pdoc->dbcsCodePage == 0) { - CaseFolderTable *pcf = new CaseFolderTable(); - pcf->StandardASCII(); - QTextCodec *codec = QTextCodec::codecForName(charSetBuffer); - // Only for single byte encodings - for (int i=0x80; i<0x100; i++) { - char sCharacter[2] = "A"; - sCharacter[0] = i; - QString su = codec->toUnicode(sCharacter, 1); - QString suFolded = su.toCaseFolded(); - QByteArray bytesFolded = codec->fromUnicode(suFolded); - if (bytesFolded.length() == 1) { - pcf->SetTranslation(sCharacter[0], bytesFolded[0]); - } - } - return pcf; - } else { - return new CaseFolderDBCS(QTextCodec::codecForName(charSetBuffer)); - } - } - return 0; - } -} - -std::string ScintillaQt::CaseMapString(const std::string &s, int caseMapping) -{ - if ((s.size() == 0) || (caseMapping == cmSame)) - return s; - - if (IsUnicodeMode()) { - std::string retMapped(s.length() * maxExpansionCaseConversion, 0); - size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(), - (caseMapping == cmUpper) ? CaseConversionUpper : CaseConversionLower); - retMapped.resize(lenMapped); - return retMapped; - } - - QTextCodec *codec = QTextCodec::codecForName(CharacterSetIDOfDocument()); - QString text = codec->toUnicode(s.c_str(), static_cast(s.length())); - - if (caseMapping == cmUpper) { - text = text.toUpper(); - } else { - text = text.toLower(); - } - - QByteArray bytes = BytesForDocument(text); - return std::string(bytes.data(), bytes.length()); -} - -void ScintillaQt::SetMouseCapture(bool on) -{ - // This is handled automatically by Qt - if (mouseDownCaptures) { - haveMouseCapture = on; - } -} - -bool ScintillaQt::HaveMouseCapture() -{ - return haveMouseCapture; -} - -void ScintillaQt::StartDrag() -{ - inDragDrop = ddDragging; - dropWentOutside = true; - if (drag.Length()) { - QMimeData *mimeData = new QMimeData; - QString sText = StringFromSelectedText(drag); - mimeData->setText(sText); - if (drag.rectangular) { - AddRectangularToMime(mimeData, sText); - } - // This QDrag is not freed as that causes a crash on Linux - QDrag *dragon = new QDrag(scrollArea); - dragon->setMimeData(mimeData); - - Qt::DropAction dropAction = dragon->exec(Qt::CopyAction|Qt::MoveAction); - if ((dropAction == Qt::MoveAction) && dropWentOutside) { - // Remove dragged out text - ClearSelection(); - } - } - inDragDrop = ddNone; - SetDragPosition(SelectionPosition(invalidPosition)); -} - -void ScintillaQt::CreateCallTipWindow(PRectangle rc) -{ - - if (!ct.wCallTip.Created()) { - QWidget *pCallTip = new QWidget(0, Qt::ToolTip); - ct.wCallTip = pCallTip; - pCallTip->move(rc.left, rc.top); - pCallTip->resize(rc.Width(), rc.Height()); - } -} - -void ScintillaQt::AddToPopUp(const char *label, - int cmd, - bool enabled) -{ - QMenu *menu = static_cast(popup.GetID()); - QString text = QString::fromLatin1(label); - - if (text.isEmpty()) { - menu->addSeparator(); - } else { - QAction *action = menu->addAction(text); - action->setData(cmd); - action->setEnabled(enabled); - } - - // Make sure the menu's signal is connected only once. - menu->disconnect(); - connect(menu, SIGNAL(triggered(QAction *)), - this, SLOT(execCommand(QAction *))); -} - -sptr_t ScintillaQt::WndProc(unsigned int message, uptr_t wParam, sptr_t lParam) -{ - try { - switch (message) { - - case SCI_SETIMEINTERACTION: - // Only inline IME supported on Qt - break; - - case SCI_GRABFOCUS: - scrollArea->setFocus(Qt::OtherFocusReason); - break; - - case SCI_GETDIRECTFUNCTION: - return reinterpret_cast(DirectFunction); - - case SCI_GETDIRECTPOINTER: - return reinterpret_cast(this); - -#ifdef SCI_LEXER - case SCI_LOADLEXERLIBRARY: - LexerManager::GetInstance()->Load(reinterpret_cast(lParam)); - break; -#endif - - default: - return ScintillaBase::WndProc(message, wParam, lParam); - } - } catch (std::bad_alloc &) { - errorStatus = SC_STATUS_BADALLOC; - } catch (...) { - errorStatus = SC_STATUS_FAILURE; - } - return 0l; -} - -sptr_t ScintillaQt::DefWndProc(unsigned int, uptr_t, sptr_t) -{ - return 0; -} - -sptr_t ScintillaQt::DirectFunction( - sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam) -{ - return reinterpret_cast(ptr)->WndProc(iMessage, wParam, lParam); -} - -// Additions to merge in Scientific Toolworks widget structure - -void ScintillaQt::PartialPaint(const PRectangle &rect) -{ - rcPaint = rect; - paintState = painting; - PRectangle rcClient = GetClientRectangle(); - paintingAllText = rcPaint.Contains(rcClient); - - AutoSurface surface(this); - Paint(surface, rcPaint); - surface->Release(); - - if (paintState == paintAbandoned) { - // FIXME: Failure to paint the requested rectangle in each - // paint event causes flicker on some platforms (Mac?) - // Paint rect immediately. - paintState = painting; - paintingAllText = true; - - AutoSurface surface(this); - Paint(surface, rcPaint); - surface->Release(); - - // Queue a full repaint. - scrollArea->viewport()->update(); - } - - paintState = notPainting; -} - -void ScintillaQt::DragEnter(const Point &point) -{ - SetDragPosition(SPositionFromLocation(point, - false, false, UserVirtualSpace())); -} - -void ScintillaQt::DragMove(const Point &point) -{ - SetDragPosition(SPositionFromLocation(point, - false, false, UserVirtualSpace())); -} - -void ScintillaQt::DragLeave() -{ - SetDragPosition(SelectionPosition(invalidPosition)); -} - -void ScintillaQt::Drop(const Point &point, const QMimeData *data, bool move) -{ - QString text = data->text(); - bool rectangular = IsRectangularInMime(data); - QByteArray bytes = BytesForDocument(text); - int len = bytes.length(); - - SelectionPosition movePos = SPositionFromLocation(point, - false, false, UserVirtualSpace()); - - DropAt(movePos, bytes, len, move, rectangular); -} - -void ScintillaQt::timerEvent(QTimerEvent *event) -{ - for (TickReason tr=tickCaret; tr<=tickDwell; tr = static_cast(tr+1)) { - if (timers[tr] == event->timerId()) { - TickFor(tr); - } - } -} diff --git a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaQt.h b/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaQt.h deleted file mode 100644 index 6db30bdec..000000000 --- a/qrenderdoc/3rdparty/scintilla/qt/ScintillaEditBase/ScintillaQt.h +++ /dev/null @@ -1,172 +0,0 @@ -// -// Copyright (c) 1990-2011, Scientific Toolworks, Inc. -// -// The License.txt file describes the conditions under which this software may be distributed. -// -// Author: Jason Haslam -// -// Additions Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware -// ScintillaQt.h - Qt specific subclass of ScintillaBase - -#ifndef SCINTILLAQT_H -#define SCINTILLAQT_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Scintilla.h" -#include "Platform.h" -#include "ILexer.h" -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" -#include "CellBuffer.h" -#include "CallTip.h" -#include "KeyMap.h" -#include "Indicator.h" -#include "XPM.h" -#include "LineMarker.h" -#include "Style.h" -#include "AutoComplete.h" -#include "ViewStyle.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "CaseFolder.h" -#include "Document.h" -#include "Selection.h" -#include "PositionCache.h" -#include "EditModel.h" -#include "MarginView.h" -#include "EditView.h" -#include "Editor.h" -#include "ScintillaBase.h" -#include "CaseConvert.h" - -#ifdef SCI_LEXER -#include "SciLexer.h" -#include "PropSetSimple.h" -#endif - -#include -#include -#include -#include -#include - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class ScintillaQt : public QObject, public ScintillaBase { - Q_OBJECT - -public: - explicit ScintillaQt(QAbstractScrollArea *parent); - virtual ~ScintillaQt(); - -signals: - void horizontalScrolled(int value); - void verticalScrolled(int value); - void horizontalRangeChanged(int max, int page); - void verticalRangeChanged(int max, int page); - - void notifyParent(SCNotification scn); - void notifyChange(); - - // Clients can use this hook to add additional - // formats (e.g. rich text) to the MIME data. - void aboutToCopy(QMimeData *data); - - void command(uptr_t wParam, sptr_t lParam); - -private slots: - void onIdle(); - void execCommand(QAction *action); - void SelectionChanged(); - -private: - virtual void Initialise(); - virtual void Finalise(); - virtual bool DragThreshold(Point ptStart, Point ptNow); - virtual bool ValidCodePage(int codePage) const; - -private: - virtual void ScrollText(int linesToMove); - virtual void SetVerticalScrollPos(); - virtual void SetHorizontalScrollPos(); - virtual bool ModifyScrollBars(int nMax, int nPage); - virtual void ReconfigureScrollBars(); - void CopyToModeClipboard(const SelectionText &selectedText, QClipboard::Mode clipboardMode_); - virtual void Copy(); - virtual void CopyToClipboard(const SelectionText &selectedText); - void PasteFromMode(QClipboard::Mode clipboardMode_); - virtual void Paste(); - virtual void ClaimSelection(); - virtual void NotifyChange(); - virtual void NotifyFocus(bool focus); - virtual void NotifyParent(SCNotification scn); - int timers[tickDwell+1]; - virtual bool FineTickerAvailable(); - virtual bool FineTickerRunning(TickReason reason); - virtual void FineTickerStart(TickReason reason, int millis, int tolerance); - virtual void FineTickerCancel(TickReason reason); - virtual bool SetIdle(bool on); - virtual void SetMouseCapture(bool on); - virtual bool HaveMouseCapture(); - virtual void StartDrag(); - int CharacterSetOfDocument() const; - const char *CharacterSetIDOfDocument() const; - QString StringFromDocument(const char *s) const; - QByteArray BytesForDocument(const QString &text) const; - virtual CaseFolder *CaseFolderForEncoding(); - virtual std::string CaseMapString(const std::string &s, int caseMapping); - - virtual void CreateCallTipWindow(PRectangle rc); - virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true); - virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - - static sptr_t DirectFunction(sptr_t ptr, - unsigned int iMessage, uptr_t wParam, sptr_t lParam); - -protected: - - void PartialPaint(const PRectangle &rect); - - void DragEnter(const Point &point); - void DragMove(const Point &point); - void DragLeave(); - void Drop(const Point &point, const QMimeData *data, bool move); - - void timerEvent(QTimerEvent *event); - -private: - QAbstractScrollArea *scrollArea; - - int vMax, hMax; // Scroll bar maximums. - int vPage, hPage; // Scroll bar page sizes. - - bool haveMouseCapture; - bool dragWasDropped; - int rectangularSelectionModifier; - - friend class ScintillaEditBase; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif // SCINTILLAQT_H diff --git a/qrenderdoc/3rdparty/scintilla/src/AutoComplete.cxx b/qrenderdoc/3rdparty/scintilla/src/AutoComplete.cxx deleted file mode 100644 index 3f3570283..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/AutoComplete.cxx +++ /dev/null @@ -1,296 +0,0 @@ -// Scintilla source code edit control -/** @file AutoComplete.cxx - ** Defines the auto completion list box. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "CharacterSet.h" -#include "Position.h" -#include "AutoComplete.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -AutoComplete::AutoComplete() : - active(false), - separator(' '), - typesep('?'), - ignoreCase(false), - chooseSingle(false), - lb(0), - posStart(0), - startLen(0), - cancelAtStartPos(true), - autoHide(true), - dropRestOfWord(false), - ignoreCaseBehaviour(SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE), - widthLBDefault(100), - heightLBDefault(100), - autoSort(SC_ORDER_PRESORTED) { - lb = ListBox::Allocate(); -} - -AutoComplete::~AutoComplete() { - if (lb) { - lb->Destroy(); - delete lb; - lb = 0; - } -} - -bool AutoComplete::Active() const { - return active; -} - -void AutoComplete::Start(Window &parent, int ctrlID, - int position, Point location, int startLen_, - int lineHeight, bool unicodeMode, int technology) { - if (active) { - Cancel(); - } - lb->Create(parent, ctrlID, location, lineHeight, unicodeMode, technology); - lb->Clear(); - active = true; - startLen = startLen_; - posStart = position; -} - -void AutoComplete::SetStopChars(const char *stopChars_) { - stopChars = stopChars_; -} - -bool AutoComplete::IsStopChar(char ch) { - return ch && (stopChars.find(ch) != std::string::npos); -} - -void AutoComplete::SetFillUpChars(const char *fillUpChars_) { - fillUpChars = fillUpChars_; -} - -bool AutoComplete::IsFillUpChar(char ch) { - return ch && (fillUpChars.find(ch) != std::string::npos); -} - -void AutoComplete::SetSeparator(char separator_) { - separator = separator_; -} - -char AutoComplete::GetSeparator() const { - return separator; -} - -void AutoComplete::SetTypesep(char separator_) { - typesep = separator_; -} - -char AutoComplete::GetTypesep() const { - return typesep; -} - -struct Sorter { - AutoComplete *ac; - const char *list; - std::vector indices; - - Sorter(AutoComplete *ac_, const char *list_) : ac(ac_), list(list_) { - int i = 0; - while (list[i]) { - indices.push_back(i); // word start - while (list[i] != ac->GetTypesep() && list[i] != ac->GetSeparator() && list[i]) - ++i; - indices.push_back(i); // word end - if (list[i] == ac->GetTypesep()) { - while (list[i] != ac->GetSeparator() && list[i]) - ++i; - } - if (list[i] == ac->GetSeparator()) { - ++i; - // preserve trailing separator as blank entry - if (!list[i]) { - indices.push_back(i); - indices.push_back(i); - } - } - } - indices.push_back(i); // index of last position - } - - bool operator()(int a, int b) { - int lenA = indices[a * 2 + 1] - indices[a * 2]; - int lenB = indices[b * 2 + 1] - indices[b * 2]; - int len = std::min(lenA, lenB); - int cmp; - if (ac->ignoreCase) - cmp = CompareNCaseInsensitive(list + indices[a * 2], list + indices[b * 2], len); - else - cmp = strncmp(list + indices[a * 2], list + indices[b * 2], len); - if (cmp == 0) - cmp = lenA - lenB; - return cmp < 0; - } -}; - -void AutoComplete::SetList(const char *list) { - if (autoSort == SC_ORDER_PRESORTED) { - lb->SetList(list, separator, typesep); - sortMatrix.clear(); - for (int i = 0; i < lb->Length(); ++i) - sortMatrix.push_back(i); - return; - } - - Sorter IndexSort(this, list); - sortMatrix.clear(); - for (int i = 0; i < (int)IndexSort.indices.size() / 2; ++i) - sortMatrix.push_back(i); - std::sort(sortMatrix.begin(), sortMatrix.end(), IndexSort); - if (autoSort == SC_ORDER_CUSTOM || sortMatrix.size() < 2) { - lb->SetList(list, separator, typesep); - PLATFORM_ASSERT(lb->Length() == static_cast(sortMatrix.size())); - return; - } - - std::string sortedList; - char item[maxItemLen]; - for (size_t i = 0; i < sortMatrix.size(); ++i) { - int wordLen = IndexSort.indices[sortMatrix[i] * 2 + 2] - IndexSort.indices[sortMatrix[i] * 2]; - if (wordLen > maxItemLen-2) - wordLen = maxItemLen - 2; - memcpy(item, list + IndexSort.indices[sortMatrix[i] * 2], wordLen); - if ((i+1) == sortMatrix.size()) { - // Last item so remove separator if present - if ((wordLen > 0) && (item[wordLen-1] == separator)) - wordLen--; - } else { - // Item before last needs a separator - if ((wordLen == 0) || (item[wordLen-1] != separator)) { - item[wordLen] = separator; - wordLen++; - } - } - item[wordLen] = '\0'; - sortedList += item; - } - for (int i = 0; i < (int)sortMatrix.size(); ++i) - sortMatrix[i] = i; - lb->SetList(sortedList.c_str(), separator, typesep); -} - -int AutoComplete::GetSelection() const { - return lb->GetSelection(); -} - -std::string AutoComplete::GetValue(int item) const { - char value[maxItemLen]; - lb->GetValue(item, value, sizeof(value)); - return std::string(value); -} - -void AutoComplete::Show(bool show) { - lb->Show(show); - if (show) - lb->Select(0); -} - -void AutoComplete::Cancel() { - if (lb->Created()) { - lb->Clear(); - lb->Destroy(); - active = false; - } -} - - -void AutoComplete::Move(int delta) { - int count = lb->Length(); - int current = lb->GetSelection(); - current += delta; - if (current >= count) - current = count - 1; - if (current < 0) - current = 0; - lb->Select(current); -} - -void AutoComplete::Select(const char *word) { - size_t lenWord = strlen(word); - int location = -1; - int start = 0; // lower bound of the api array block to search - int end = lb->Length() - 1; // upper bound of the api array block to search - while ((start <= end) && (location == -1)) { // Binary searching loop - int pivot = (start + end) / 2; - char item[maxItemLen]; - lb->GetValue(sortMatrix[pivot], item, maxItemLen); - int cond; - if (ignoreCase) - cond = CompareNCaseInsensitive(word, item, lenWord); - else - cond = strncmp(word, item, lenWord); - if (!cond) { - // Find first match - while (pivot > start) { - lb->GetValue(sortMatrix[pivot-1], item, maxItemLen); - if (ignoreCase) - cond = CompareNCaseInsensitive(word, item, lenWord); - else - cond = strncmp(word, item, lenWord); - if (0 != cond) - break; - --pivot; - } - location = pivot; - if (ignoreCase - && ignoreCaseBehaviour == SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE) { - // Check for exact-case match - for (; pivot <= end; pivot++) { - lb->GetValue(sortMatrix[pivot], item, maxItemLen); - if (!strncmp(word, item, lenWord)) { - location = pivot; - break; - } - if (CompareNCaseInsensitive(word, item, lenWord)) - break; - } - } - } else if (cond < 0) { - end = pivot - 1; - } else if (cond > 0) { - start = pivot + 1; - } - } - if (location == -1) { - if (autoHide) - Cancel(); - else - lb->Select(-1); - } else { - if (autoSort == SC_ORDER_CUSTOM) { - // Check for a logically earlier match - char item[maxItemLen]; - for (int i = location + 1; i <= end; ++i) { - lb->GetValue(sortMatrix[i], item, maxItemLen); - if (CompareNCaseInsensitive(word, item, lenWord)) - break; - if (sortMatrix[i] < sortMatrix[location] && !strncmp(word, item, lenWord)) - location = i; - } - } - lb->Select(sortMatrix[location]); - } -} - diff --git a/qrenderdoc/3rdparty/scintilla/src/AutoComplete.h b/qrenderdoc/3rdparty/scintilla/src/AutoComplete.h deleted file mode 100644 index c35fa1a0e..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/AutoComplete.h +++ /dev/null @@ -1,95 +0,0 @@ -// Scintilla source code edit control -/** @file AutoComplete.h - ** Defines the auto completion list box. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef AUTOCOMPLETE_H -#define AUTOCOMPLETE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class AutoComplete { - bool active; - std::string stopChars; - std::string fillUpChars; - char separator; - char typesep; // Type seperator - enum { maxItemLen=1000 }; - std::vector sortMatrix; - -public: - - bool ignoreCase; - bool chooseSingle; - ListBox *lb; - int posStart; - int startLen; - /// Should autocompletion be canceled if editor's currentPos <= startPos? - bool cancelAtStartPos; - bool autoHide; - bool dropRestOfWord; - unsigned int ignoreCaseBehaviour; - int widthLBDefault; - int heightLBDefault; - /** SC_ORDER_PRESORTED: Assume the list is presorted; selection will fail if it is not alphabetical
- * SC_ORDER_PERFORMSORT: Sort the list alphabetically; start up performance cost for sorting
- * SC_ORDER_CUSTOM: Handle non-alphabetical entries; start up performance cost for generating a sorted lookup table - */ - int autoSort; - - AutoComplete(); - ~AutoComplete(); - - /// Is the auto completion list displayed? - bool Active() const; - - /// Display the auto completion list positioned to be near a character position - void Start(Window &parent, int ctrlID, int position, Point location, - int startLen_, int lineHeight, bool unicodeMode, int technology); - - /// The stop chars are characters which, when typed, cause the auto completion list to disappear - void SetStopChars(const char *stopChars_); - bool IsStopChar(char ch); - - /// The fillup chars are characters which, when typed, fill up the selected word - void SetFillUpChars(const char *fillUpChars_); - bool IsFillUpChar(char ch); - - /// The separator character is used when interpreting the list in SetList - void SetSeparator(char separator_); - char GetSeparator() const; - - /// The typesep character is used for separating the word from the type - void SetTypesep(char separator_); - char GetTypesep() const; - - /// The list string contains a sequence of words separated by the separator character - void SetList(const char *list); - - /// Return the position of the currently selected list item - int GetSelection() const; - - /// Return the value of an item in the list - std::string GetValue(int item) const; - - void Show(bool show); - void Cancel(); - - /// Move the current list element by delta, scrolling appropriately - void Move(int delta); - - /// Select a list element that starts with word as the current element - void Select(const char *word); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/CallTip.cxx b/qrenderdoc/3rdparty/scintilla/src/CallTip.cxx deleted file mode 100644 index 541f4c683..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/CallTip.cxx +++ /dev/null @@ -1,336 +0,0 @@ -// Scintilla source code edit control -/** @file CallTip.cxx - ** Code for displaying call tips. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include - -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" - -#include "StringCopy.h" -#include "Position.h" -#include "CallTip.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -CallTip::CallTip() { - wCallTip = 0; - inCallTipMode = false; - posStartCallTip = 0; - rectUp = PRectangle(0,0,0,0); - rectDown = PRectangle(0,0,0,0); - lineHeight = 1; - offsetMain = 0; - startHighlight = 0; - endHighlight = 0; - tabSize = 0; - above = false; - useStyleCallTip = false; // for backwards compatibility - - insetX = 5; - widthArrow = 14; - borderHeight = 2; // Extra line for border and an empty line at top and bottom. - verticalOffset = 1; - -#ifdef __APPLE__ - // proper apple colours for the default - colourBG = ColourDesired(0xff, 0xff, 0xc6); - colourUnSel = ColourDesired(0, 0, 0); -#else - colourBG = ColourDesired(0xff, 0xff, 0xff); - colourUnSel = ColourDesired(0x80, 0x80, 0x80); -#endif - colourSel = ColourDesired(0, 0, 0x80); - colourShade = ColourDesired(0, 0, 0); - colourLight = ColourDesired(0xc0, 0xc0, 0xc0); - codePage = 0; - clickPlace = 0; -} - -CallTip::~CallTip() { - font.Release(); - wCallTip.Destroy(); -} - -// Although this test includes 0, we should never see a \0 character. -static bool IsArrowCharacter(char ch) { - return (ch == 0) || (ch == '\001') || (ch == '\002'); -} - -// We ignore tabs unless a tab width has been set. -bool CallTip::IsTabCharacter(char ch) const { - return (tabSize > 0) && (ch == '\t'); -} - -int CallTip::NextTabPos(int x) const { - if (tabSize > 0) { // paranoia... not called unless this is true - x -= insetX; // position relative to text - x = (x + tabSize) / tabSize; // tab "number" - return tabSize*x + insetX; // position of next tab - } else { - return x + 1; // arbitrary - } -} - -// Draw a section of the call tip that does not include \n in one colour. -// The text may include up to numEnds tabs or arrow characters. -void CallTip::DrawChunk(Surface *surface, int &x, const char *s, - int posStart, int posEnd, int ytext, PRectangle rcClient, - bool highlight, bool draw) { - s += posStart; - int len = posEnd - posStart; - - // Divide the text into sections that are all text, or that are - // single arrows or single tab characters (if tabSize > 0). - int maxEnd = 0; - const int numEnds = 10; - int ends[numEnds + 2]; - for (int i=0; i 0) - ends[maxEnd++] = i; - ends[maxEnd++] = i+1; - } - } - ends[maxEnd++] = len; - int startSeg = 0; - int xEnd; - for (int seg = 0; seg startSeg) { - if (IsArrowCharacter(s[startSeg])) { - xEnd = x + widthArrow; - bool upArrow = s[startSeg] == '\001'; - rcClient.left = static_cast(x); - rcClient.right = static_cast(xEnd); - if (draw) { - const int halfWidth = widthArrow / 2 - 3; - const int quarterWidth = halfWidth / 2; - const int centreX = x + widthArrow / 2 - 1; - const int centreY = static_cast(rcClient.top + rcClient.bottom) / 2; - surface->FillRectangle(rcClient, colourBG); - PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1, - rcClient.right - 2, rcClient.bottom - 1); - surface->FillRectangle(rcClientInner, colourUnSel); - - if (upArrow) { // Up arrow - Point pts[] = { - Point::FromInts(centreX - halfWidth, centreY + quarterWidth), - Point::FromInts(centreX + halfWidth, centreY + quarterWidth), - Point::FromInts(centreX, centreY - halfWidth + quarterWidth), - }; - surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG); - } else { // Down arrow - Point pts[] = { - Point::FromInts(centreX - halfWidth, centreY - quarterWidth), - Point::FromInts(centreX + halfWidth, centreY - quarterWidth), - Point::FromInts(centreX, centreY + halfWidth - quarterWidth), - }; - surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG); - } - } - offsetMain = xEnd; - if (upArrow) { - rectUp = rcClient; - } else { - rectDown = rcClient; - } - } else if (IsTabCharacter(s[startSeg])) { - xEnd = NextTabPos(x); - } else { - xEnd = x + RoundXYPosition(surface->WidthText(font, s + startSeg, endSeg - startSeg)); - if (draw) { - rcClient.left = static_cast(x); - rcClient.right = static_cast(xEnd); - surface->DrawTextTransparent(rcClient, font, static_cast(ytext), - s+startSeg, endSeg - startSeg, - highlight ? colourSel : colourUnSel); - } - } - x = xEnd; - startSeg = endSeg; - } - } -} - -int CallTip::PaintContents(Surface *surfaceWindow, bool draw) { - PRectangle rcClientPos = wCallTip.GetClientPosition(); - PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left, - rcClientPos.bottom - rcClientPos.top); - PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1); - - // To make a nice small call tip window, it is only sized to fit most normal characters without accents - int ascent = RoundXYPosition(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font)); - - // For each line... - // Draw the definition in three parts: before highlight, highlighted, after highlight - int ytext = static_cast(rcClient.top) + ascent + 1; - rcClient.bottom = ytext + surfaceWindow->Descent(font) + 1; - const char *chunkVal = val.c_str(); - bool moreChunks = true; - int maxWidth = 0; - - while (moreChunks) { - const char *chunkEnd = strchr(chunkVal, '\n'); - if (chunkEnd == NULL) { - chunkEnd = chunkVal + strlen(chunkVal); - moreChunks = false; - } - int chunkOffset = static_cast(chunkVal - val.c_str()); - int chunkLength = static_cast(chunkEnd - chunkVal); - int chunkEndOffset = chunkOffset + chunkLength; - int thisStartHighlight = Platform::Maximum(startHighlight, chunkOffset); - thisStartHighlight = Platform::Minimum(thisStartHighlight, chunkEndOffset); - thisStartHighlight -= chunkOffset; - int thisEndHighlight = Platform::Maximum(endHighlight, chunkOffset); - thisEndHighlight = Platform::Minimum(thisEndHighlight, chunkEndOffset); - thisEndHighlight -= chunkOffset; - rcClient.top = static_cast(ytext - ascent - 1); - - int x = insetX; // start each line at this inset - - DrawChunk(surfaceWindow, x, chunkVal, 0, thisStartHighlight, - ytext, rcClient, false, draw); - DrawChunk(surfaceWindow, x, chunkVal, thisStartHighlight, thisEndHighlight, - ytext, rcClient, true, draw); - DrawChunk(surfaceWindow, x, chunkVal, thisEndHighlight, chunkLength, - ytext, rcClient, false, draw); - - chunkVal = chunkEnd + 1; - ytext += lineHeight; - rcClient.bottom += lineHeight; - maxWidth = Platform::Maximum(maxWidth, x); - } - return maxWidth; -} - -void CallTip::PaintCT(Surface *surfaceWindow) { - if (val.empty()) - return; - PRectangle rcClientPos = wCallTip.GetClientPosition(); - PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left, - rcClientPos.bottom - rcClientPos.top); - PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1); - - surfaceWindow->FillRectangle(rcClient, colourBG); - - offsetMain = insetX; // initial alignment assuming no arrows - PaintContents(surfaceWindow, true); - -#ifndef __APPLE__ - // OSX doesn't put borders on "help tags" - // Draw a raised border around the edges of the window - surfaceWindow->MoveTo(0, static_cast(rcClientSize.bottom) - 1); - surfaceWindow->PenColour(colourShade); - surfaceWindow->LineTo(static_cast(rcClientSize.right) - 1, static_cast(rcClientSize.bottom) - 1); - surfaceWindow->LineTo(static_cast(rcClientSize.right) - 1, 0); - surfaceWindow->PenColour(colourLight); - surfaceWindow->LineTo(0, 0); - surfaceWindow->LineTo(0, static_cast(rcClientSize.bottom) - 1); -#endif -} - -void CallTip::MouseClick(Point pt) { - clickPlace = 0; - if (rectUp.Contains(pt)) - clickPlace = 1; - if (rectDown.Contains(pt)) - clickPlace = 2; -} - -PRectangle CallTip::CallTipStart(int pos, Point pt, int textHeight, const char *defn, - const char *faceName, int size, - int codePage_, int characterSet, - int technology, Window &wParent) { - clickPlace = 0; - val = defn; - codePage = codePage_; - Surface *surfaceMeasure = Surface::Allocate(technology); - if (!surfaceMeasure) - return PRectangle(); - surfaceMeasure->Init(wParent.GetID()); - surfaceMeasure->SetUnicodeMode(SC_CP_UTF8 == codePage); - surfaceMeasure->SetDBCSMode(codePage); - startHighlight = 0; - endHighlight = 0; - inCallTipMode = true; - posStartCallTip = pos; - XYPOSITION deviceHeight = static_cast(surfaceMeasure->DeviceHeightFont(size)); - FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet); - font.Create(fp); - // Look for multiple lines in the text - // Only support \n here - simply means container must avoid \r! - int numLines = 1; - const char *newline; - const char *look = val.c_str(); - rectUp = PRectangle(0,0,0,0); - rectDown = PRectangle(0,0,0,0); - offsetMain = insetX; // changed to right edge of any arrows - int width = PaintContents(surfaceMeasure, false) + insetX; - while ((newline = strchr(look, '\n')) != NULL) { - look = newline + 1; - numLines++; - } - lineHeight = RoundXYPosition(surfaceMeasure->Height(font)); - - // The returned - // rectangle is aligned to the right edge of the last arrow encountered in - // the tip text, else to the tip text left edge. - int height = lineHeight * numLines - static_cast(surfaceMeasure->InternalLeading(font)) + borderHeight * 2; - delete surfaceMeasure; - if (above) { - return PRectangle(pt.x - offsetMain, pt.y - verticalOffset - height, pt.x + width - offsetMain, pt.y - verticalOffset); - } else { - return PRectangle(pt.x - offsetMain, pt.y + verticalOffset + textHeight, pt.x + width - offsetMain, pt.y + verticalOffset + textHeight + height); - } -} - -void CallTip::CallTipCancel() { - inCallTipMode = false; - if (wCallTip.Created()) { - wCallTip.Destroy(); - } -} - -void CallTip::SetHighlight(int start, int end) { - // Avoid flashing by checking something has really changed - if ((start != startHighlight) || (end != endHighlight)) { - startHighlight = start; - endHighlight = (end > start) ? end : start; - if (wCallTip.Created()) { - wCallTip.InvalidateAll(); - } - } -} - -// Set the tab size (sizes > 0 enable the use of tabs). This also enables the -// use of the STYLE_CALLTIP. -void CallTip::SetTabSize(int tabSz) { - tabSize = tabSz; - useStyleCallTip = true; -} - -// Set the calltip position, below the text by default or if above is false -// else above the text. -void CallTip::SetPosition(bool aboveText) { - above = aboveText; -} - -// It might be better to have two access functions for this and to use -// them for all settings of colours. -void CallTip::SetForeBack(const ColourDesired &fore, const ColourDesired &back) { - colourBG = back; - colourUnSel = fore; -} diff --git a/qrenderdoc/3rdparty/scintilla/src/CallTip.h b/qrenderdoc/3rdparty/scintilla/src/CallTip.h deleted file mode 100644 index 840aa26ac..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/CallTip.h +++ /dev/null @@ -1,93 +0,0 @@ -// Scintilla source code edit control -/** @file CallTip.h - ** Interface to the call tip control. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CALLTIP_H -#define CALLTIP_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class CallTip { - int startHighlight; // character offset to start and... - int endHighlight; // ...end of highlighted text - std::string val; - Font font; - PRectangle rectUp; // rectangle of last up angle in the tip - PRectangle rectDown; // rectangle of last down arrow in the tip - int lineHeight; // vertical line spacing - int offsetMain; // The alignment point of the call tip - int tabSize; // Tab size in pixels, <=0 no TAB expand - bool useStyleCallTip; // if true, STYLE_CALLTIP should be used - bool above; // if true, display calltip above text - - // Private so CallTip objects can not be copied - CallTip(const CallTip &); - CallTip &operator=(const CallTip &); - void DrawChunk(Surface *surface, int &x, const char *s, - int posStart, int posEnd, int ytext, PRectangle rcClient, - bool highlight, bool draw); - int PaintContents(Surface *surfaceWindow, bool draw); - bool IsTabCharacter(char c) const; - int NextTabPos(int x) const; - -public: - Window wCallTip; - Window wDraw; - bool inCallTipMode; - int posStartCallTip; - ColourDesired colourBG; - ColourDesired colourUnSel; - ColourDesired colourSel; - ColourDesired colourShade; - ColourDesired colourLight; - int codePage; - int clickPlace; - - int insetX; // text inset in x from calltip border - int widthArrow; - int borderHeight; - int verticalOffset; // pixel offset up or down of the calltip with respect to the line - - CallTip(); - ~CallTip(); - - void PaintCT(Surface *surfaceWindow); - - void MouseClick(Point pt); - - /// Setup the calltip and return a rectangle of the area required. - PRectangle CallTipStart(int pos, Point pt, int textHeight, const char *defn, - const char *faceName, int size, int codePage_, - int characterSet, int technology, Window &wParent); - - void CallTipCancel(); - - /// Set a range of characters to be displayed in a highlight style. - /// Commonly used to highlight the current parameter. - void SetHighlight(int start, int end); - - /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand. - void SetTabSize(int tabSz); - - /// Set calltip position. - void SetPosition(bool aboveText); - - /// Used to determine which STYLE_xxxx to use for call tip information - bool UseStyleCallTip() const { return useStyleCallTip;} - - // Modify foreground and background colours - void SetForeBack(const ColourDesired &fore, const ColourDesired &back); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/CaseConvert.cxx b/qrenderdoc/3rdparty/scintilla/src/CaseConvert.cxx deleted file mode 100644 index 4fb755903..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/CaseConvert.cxx +++ /dev/null @@ -1,644 +0,0 @@ -// Scintilla source code edit control -// Encoding: UTF-8 -/** @file CaseConvert.cxx - ** Case fold characters and convert them to upper or lower case. - ** Tables automatically regenerated by scripts/GenerateCaseConvert.py - ** Should only be rarely regenerated for new versions of Unicode. - **/ -// Copyright 2013 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include - -#include -#include -#include -#include - -#include "StringCopy.h" -#include "CaseConvert.h" -#include "UniConversion.h" -#include "UnicodeFromUTF8.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -namespace { - // Use an unnamed namespace to protect the declarations from name conflicts - -// Unicode code points are ordered by groups and follow patterns. -// Most characters (pitch==1) are in ranges for a particular alphabet and their -// upper case forms are a fixed distance away. -// Another pattern (pitch==2) is where each lower case letter is preceded by -// the upper case form. These are also grouped into ranges. - -int symmetricCaseConversionRanges[] = { -//lower, upper, range length, range pitch -//++Autogenerated -- start of section automatically generated -//**\(\*\n\) -97,65,26,1, -224,192,23,1, -248,216,7,1, -257,256,24,2, -314,313,8,2, -331,330,23,2, -462,461,8,2, -479,478,9,2, -505,504,20,2, -547,546,9,2, -583,582,5,2, -945,913,17,1, -963,931,9,1, -985,984,12,2, -1072,1040,32,1, -1104,1024,16,1, -1121,1120,17,2, -1163,1162,27,2, -1218,1217,7,2, -1233,1232,44,2, -1377,1329,38,1, -7681,7680,75,2, -7841,7840,48,2, -7936,7944,8,1, -7952,7960,6,1, -7968,7976,8,1, -7984,7992,8,1, -8000,8008,6,1, -8032,8040,8,1, -8560,8544,16,1, -9424,9398,26,1, -11312,11264,47,1, -11393,11392,50,2, -11520,4256,38,1, -42561,42560,23,2, -42625,42624,12,2, -42787,42786,7,2, -42803,42802,31,2, -42879,42878,5,2, -42913,42912,5,2, -65345,65313,26,1, -66600,66560,40,1, - -//--Autogenerated -- end of section automatically generated -}; - -// Code points that are symmetric but don't fit into a range of similar characters -// are listed here. - -int symmetricCaseConversions[] = { -//lower, upper -//++Autogenerated -- start of section automatically generated -//**1 \(\*\n\) -255,376, -307,306, -309,308, -311,310, -378,377, -380,379, -382,381, -384,579, -387,386, -389,388, -392,391, -396,395, -402,401, -405,502, -409,408, -410,573, -414,544, -417,416, -419,418, -421,420, -424,423, -429,428, -432,431, -436,435, -438,437, -441,440, -445,444, -447,503, -454,452, -457,455, -460,458, -477,398, -499,497, -501,500, -572,571, -575,11390, -576,11391, -578,577, -592,11375, -593,11373, -594,11376, -595,385, -596,390, -598,393, -599,394, -601,399, -603,400, -608,403, -611,404, -613,42893, -614,42922, -616,407, -617,406, -619,11362, -623,412, -625,11374, -626,413, -629,415, -637,11364, -640,422, -643,425, -648,430, -649,580, -650,433, -651,434, -652,581, -658,439, -881,880, -883,882, -887,886, -891,1021, -892,1022, -893,1023, -940,902, -941,904, -942,905, -943,906, -972,908, -973,910, -974,911, -983,975, -1010,1017, -1016,1015, -1019,1018, -1231,1216, -7545,42877, -7549,11363, -8017,8025, -8019,8027, -8021,8029, -8023,8031, -8048,8122, -8049,8123, -8050,8136, -8051,8137, -8052,8138, -8053,8139, -8054,8154, -8055,8155, -8056,8184, -8057,8185, -8058,8170, -8059,8171, -8060,8186, -8061,8187, -8112,8120, -8113,8121, -8144,8152, -8145,8153, -8160,8168, -8161,8169, -8165,8172, -8526,8498, -8580,8579, -11361,11360, -11365,570, -11366,574, -11368,11367, -11370,11369, -11372,11371, -11379,11378, -11382,11381, -11500,11499, -11502,11501, -11507,11506, -11559,4295, -11565,4301, -42874,42873, -42876,42875, -42892,42891, -42897,42896, -42899,42898, - -//--Autogenerated -- end of section automatically generated -}; - -// Characters that have complex case conversions are listed here. -// This includes cases where more than one character is needed for a conversion, -// folding is different to lowering, or (as appropriate) upper(lower(x)) != x or -// lower(upper(x)) != x. - -const char *complexCaseConversions = -// Original | Folded | Upper | Lower | -//++Autogenerated -- start of section automatically generated -//**2 \(\*\n\) -"\xc2\xb5|\xce\xbc|\xce\x9c||" -"\xc3\x9f|ss|SS||" -"\xc4\xb0|i\xcc\x87||i\xcc\x87|" -"\xc4\xb1||I||" -"\xc5\x89|\xca\xbcn|\xca\xbcN||" -"\xc5\xbf|s|S||" -"\xc7\x85|\xc7\x86|\xc7\x84|\xc7\x86|" -"\xc7\x88|\xc7\x89|\xc7\x87|\xc7\x89|" -"\xc7\x8b|\xc7\x8c|\xc7\x8a|\xc7\x8c|" -"\xc7\xb0|j\xcc\x8c|J\xcc\x8c||" -"\xc7\xb2|\xc7\xb3|\xc7\xb1|\xc7\xb3|" -"\xcd\x85|\xce\xb9|\xce\x99||" -"\xce\x90|\xce\xb9\xcc\x88\xcc\x81|\xce\x99\xcc\x88\xcc\x81||" -"\xce\xb0|\xcf\x85\xcc\x88\xcc\x81|\xce\xa5\xcc\x88\xcc\x81||" -"\xcf\x82|\xcf\x83|\xce\xa3||" -"\xcf\x90|\xce\xb2|\xce\x92||" -"\xcf\x91|\xce\xb8|\xce\x98||" -"\xcf\x95|\xcf\x86|\xce\xa6||" -"\xcf\x96|\xcf\x80|\xce\xa0||" -"\xcf\xb0|\xce\xba|\xce\x9a||" -"\xcf\xb1|\xcf\x81|\xce\xa1||" -"\xcf\xb4|\xce\xb8||\xce\xb8|" -"\xcf\xb5|\xce\xb5|\xce\x95||" -"\xd6\x87|\xd5\xa5\xd6\x82|\xd4\xb5\xd5\x92||" -"\xe1\xba\x96|h\xcc\xb1|H\xcc\xb1||" -"\xe1\xba\x97|t\xcc\x88|T\xcc\x88||" -"\xe1\xba\x98|w\xcc\x8a|W\xcc\x8a||" -"\xe1\xba\x99|y\xcc\x8a|Y\xcc\x8a||" -"\xe1\xba\x9a|a\xca\xbe|A\xca\xbe||" -"\xe1\xba\x9b|\xe1\xb9\xa1|\xe1\xb9\xa0||" -"\xe1\xba\x9e|ss||\xc3\x9f|" -"\xe1\xbd\x90|\xcf\x85\xcc\x93|\xce\xa5\xcc\x93||" -"\xe1\xbd\x92|\xcf\x85\xcc\x93\xcc\x80|\xce\xa5\xcc\x93\xcc\x80||" -"\xe1\xbd\x94|\xcf\x85\xcc\x93\xcc\x81|\xce\xa5\xcc\x93\xcc\x81||" -"\xe1\xbd\x96|\xcf\x85\xcc\x93\xcd\x82|\xce\xa5\xcc\x93\xcd\x82||" -"\xe1\xbe\x80|\xe1\xbc\x80\xce\xb9|\xe1\xbc\x88\xce\x99||" -"\xe1\xbe\x81|\xe1\xbc\x81\xce\xb9|\xe1\xbc\x89\xce\x99||" -"\xe1\xbe\x82|\xe1\xbc\x82\xce\xb9|\xe1\xbc\x8a\xce\x99||" -"\xe1\xbe\x83|\xe1\xbc\x83\xce\xb9|\xe1\xbc\x8b\xce\x99||" -"\xe1\xbe\x84|\xe1\xbc\x84\xce\xb9|\xe1\xbc\x8c\xce\x99||" -"\xe1\xbe\x85|\xe1\xbc\x85\xce\xb9|\xe1\xbc\x8d\xce\x99||" -"\xe1\xbe\x86|\xe1\xbc\x86\xce\xb9|\xe1\xbc\x8e\xce\x99||" -"\xe1\xbe\x87|\xe1\xbc\x87\xce\xb9|\xe1\xbc\x8f\xce\x99||" -"\xe1\xbe\x88|\xe1\xbc\x80\xce\xb9|\xe1\xbc\x88\xce\x99|\xe1\xbe\x80|" -"\xe1\xbe\x89|\xe1\xbc\x81\xce\xb9|\xe1\xbc\x89\xce\x99|\xe1\xbe\x81|" -"\xe1\xbe\x8a|\xe1\xbc\x82\xce\xb9|\xe1\xbc\x8a\xce\x99|\xe1\xbe\x82|" -"\xe1\xbe\x8b|\xe1\xbc\x83\xce\xb9|\xe1\xbc\x8b\xce\x99|\xe1\xbe\x83|" -"\xe1\xbe\x8c|\xe1\xbc\x84\xce\xb9|\xe1\xbc\x8c\xce\x99|\xe1\xbe\x84|" -"\xe1\xbe\x8d|\xe1\xbc\x85\xce\xb9|\xe1\xbc\x8d\xce\x99|\xe1\xbe\x85|" -"\xe1\xbe\x8e|\xe1\xbc\x86\xce\xb9|\xe1\xbc\x8e\xce\x99|\xe1\xbe\x86|" -"\xe1\xbe\x8f|\xe1\xbc\x87\xce\xb9|\xe1\xbc\x8f\xce\x99|\xe1\xbe\x87|" -"\xe1\xbe\x90|\xe1\xbc\xa0\xce\xb9|\xe1\xbc\xa8\xce\x99||" -"\xe1\xbe\x91|\xe1\xbc\xa1\xce\xb9|\xe1\xbc\xa9\xce\x99||" -"\xe1\xbe\x92|\xe1\xbc\xa2\xce\xb9|\xe1\xbc\xaa\xce\x99||" -"\xe1\xbe\x93|\xe1\xbc\xa3\xce\xb9|\xe1\xbc\xab\xce\x99||" -"\xe1\xbe\x94|\xe1\xbc\xa4\xce\xb9|\xe1\xbc\xac\xce\x99||" -"\xe1\xbe\x95|\xe1\xbc\xa5\xce\xb9|\xe1\xbc\xad\xce\x99||" -"\xe1\xbe\x96|\xe1\xbc\xa6\xce\xb9|\xe1\xbc\xae\xce\x99||" -"\xe1\xbe\x97|\xe1\xbc\xa7\xce\xb9|\xe1\xbc\xaf\xce\x99||" -"\xe1\xbe\x98|\xe1\xbc\xa0\xce\xb9|\xe1\xbc\xa8\xce\x99|\xe1\xbe\x90|" -"\xe1\xbe\x99|\xe1\xbc\xa1\xce\xb9|\xe1\xbc\xa9\xce\x99|\xe1\xbe\x91|" -"\xe1\xbe\x9a|\xe1\xbc\xa2\xce\xb9|\xe1\xbc\xaa\xce\x99|\xe1\xbe\x92|" -"\xe1\xbe\x9b|\xe1\xbc\xa3\xce\xb9|\xe1\xbc\xab\xce\x99|\xe1\xbe\x93|" -"\xe1\xbe\x9c|\xe1\xbc\xa4\xce\xb9|\xe1\xbc\xac\xce\x99|\xe1\xbe\x94|" -"\xe1\xbe\x9d|\xe1\xbc\xa5\xce\xb9|\xe1\xbc\xad\xce\x99|\xe1\xbe\x95|" -"\xe1\xbe\x9e|\xe1\xbc\xa6\xce\xb9|\xe1\xbc\xae\xce\x99|\xe1\xbe\x96|" -"\xe1\xbe\x9f|\xe1\xbc\xa7\xce\xb9|\xe1\xbc\xaf\xce\x99|\xe1\xbe\x97|" -"\xe1\xbe\xa0|\xe1\xbd\xa0\xce\xb9|\xe1\xbd\xa8\xce\x99||" -"\xe1\xbe\xa1|\xe1\xbd\xa1\xce\xb9|\xe1\xbd\xa9\xce\x99||" -"\xe1\xbe\xa2|\xe1\xbd\xa2\xce\xb9|\xe1\xbd\xaa\xce\x99||" -"\xe1\xbe\xa3|\xe1\xbd\xa3\xce\xb9|\xe1\xbd\xab\xce\x99||" -"\xe1\xbe\xa4|\xe1\xbd\xa4\xce\xb9|\xe1\xbd\xac\xce\x99||" -"\xe1\xbe\xa5|\xe1\xbd\xa5\xce\xb9|\xe1\xbd\xad\xce\x99||" -"\xe1\xbe\xa6|\xe1\xbd\xa6\xce\xb9|\xe1\xbd\xae\xce\x99||" -"\xe1\xbe\xa7|\xe1\xbd\xa7\xce\xb9|\xe1\xbd\xaf\xce\x99||" -"\xe1\xbe\xa8|\xe1\xbd\xa0\xce\xb9|\xe1\xbd\xa8\xce\x99|\xe1\xbe\xa0|" -"\xe1\xbe\xa9|\xe1\xbd\xa1\xce\xb9|\xe1\xbd\xa9\xce\x99|\xe1\xbe\xa1|" -"\xe1\xbe\xaa|\xe1\xbd\xa2\xce\xb9|\xe1\xbd\xaa\xce\x99|\xe1\xbe\xa2|" -"\xe1\xbe\xab|\xe1\xbd\xa3\xce\xb9|\xe1\xbd\xab\xce\x99|\xe1\xbe\xa3|" -"\xe1\xbe\xac|\xe1\xbd\xa4\xce\xb9|\xe1\xbd\xac\xce\x99|\xe1\xbe\xa4|" -"\xe1\xbe\xad|\xe1\xbd\xa5\xce\xb9|\xe1\xbd\xad\xce\x99|\xe1\xbe\xa5|" -"\xe1\xbe\xae|\xe1\xbd\xa6\xce\xb9|\xe1\xbd\xae\xce\x99|\xe1\xbe\xa6|" -"\xe1\xbe\xaf|\xe1\xbd\xa7\xce\xb9|\xe1\xbd\xaf\xce\x99|\xe1\xbe\xa7|" -"\xe1\xbe\xb2|\xe1\xbd\xb0\xce\xb9|\xe1\xbe\xba\xce\x99||" -"\xe1\xbe\xb3|\xce\xb1\xce\xb9|\xce\x91\xce\x99||" -"\xe1\xbe\xb4|\xce\xac\xce\xb9|\xce\x86\xce\x99||" -"\xe1\xbe\xb6|\xce\xb1\xcd\x82|\xce\x91\xcd\x82||" -"\xe1\xbe\xb7|\xce\xb1\xcd\x82\xce\xb9|\xce\x91\xcd\x82\xce\x99||" -"\xe1\xbe\xbc|\xce\xb1\xce\xb9|\xce\x91\xce\x99|\xe1\xbe\xb3|" -"\xe1\xbe\xbe|\xce\xb9|\xce\x99||" -"\xe1\xbf\x82|\xe1\xbd\xb4\xce\xb9|\xe1\xbf\x8a\xce\x99||" -"\xe1\xbf\x83|\xce\xb7\xce\xb9|\xce\x97\xce\x99||" -"\xe1\xbf\x84|\xce\xae\xce\xb9|\xce\x89\xce\x99||" -"\xe1\xbf\x86|\xce\xb7\xcd\x82|\xce\x97\xcd\x82||" -"\xe1\xbf\x87|\xce\xb7\xcd\x82\xce\xb9|\xce\x97\xcd\x82\xce\x99||" -"\xe1\xbf\x8c|\xce\xb7\xce\xb9|\xce\x97\xce\x99|\xe1\xbf\x83|" -"\xe1\xbf\x92|\xce\xb9\xcc\x88\xcc\x80|\xce\x99\xcc\x88\xcc\x80||" -"\xe1\xbf\x93|\xce\xb9\xcc\x88\xcc\x81|\xce\x99\xcc\x88\xcc\x81||" -"\xe1\xbf\x96|\xce\xb9\xcd\x82|\xce\x99\xcd\x82||" -"\xe1\xbf\x97|\xce\xb9\xcc\x88\xcd\x82|\xce\x99\xcc\x88\xcd\x82||" -"\xe1\xbf\xa2|\xcf\x85\xcc\x88\xcc\x80|\xce\xa5\xcc\x88\xcc\x80||" -"\xe1\xbf\xa3|\xcf\x85\xcc\x88\xcc\x81|\xce\xa5\xcc\x88\xcc\x81||" -"\xe1\xbf\xa4|\xcf\x81\xcc\x93|\xce\xa1\xcc\x93||" -"\xe1\xbf\xa6|\xcf\x85\xcd\x82|\xce\xa5\xcd\x82||" -"\xe1\xbf\xa7|\xcf\x85\xcc\x88\xcd\x82|\xce\xa5\xcc\x88\xcd\x82||" -"\xe1\xbf\xb2|\xe1\xbd\xbc\xce\xb9|\xe1\xbf\xba\xce\x99||" -"\xe1\xbf\xb3|\xcf\x89\xce\xb9|\xce\xa9\xce\x99||" -"\xe1\xbf\xb4|\xcf\x8e\xce\xb9|\xce\x8f\xce\x99||" -"\xe1\xbf\xb6|\xcf\x89\xcd\x82|\xce\xa9\xcd\x82||" -"\xe1\xbf\xb7|\xcf\x89\xcd\x82\xce\xb9|\xce\xa9\xcd\x82\xce\x99||" -"\xe1\xbf\xbc|\xcf\x89\xce\xb9|\xce\xa9\xce\x99|\xe1\xbf\xb3|" -"\xe2\x84\xa6|\xcf\x89||\xcf\x89|" -"\xe2\x84\xaa|k||k|" -"\xe2\x84\xab|\xc3\xa5||\xc3\xa5|" -"\xef\xac\x80|ff|FF||" -"\xef\xac\x81|fi|FI||" -"\xef\xac\x82|fl|FL||" -"\xef\xac\x83|ffi|FFI||" -"\xef\xac\x84|ffl|FFL||" -"\xef\xac\x85|st|ST||" -"\xef\xac\x86|st|ST||" -"\xef\xac\x93|\xd5\xb4\xd5\xb6|\xd5\x84\xd5\x86||" -"\xef\xac\x94|\xd5\xb4\xd5\xa5|\xd5\x84\xd4\xb5||" -"\xef\xac\x95|\xd5\xb4\xd5\xab|\xd5\x84\xd4\xbb||" -"\xef\xac\x96|\xd5\xbe\xd5\xb6|\xd5\x8e\xd5\x86||" -"\xef\xac\x97|\xd5\xb4\xd5\xad|\xd5\x84\xd4\xbd||" - -//--Autogenerated -- end of section automatically generated -; - -class CaseConverter : public ICaseConverter { - // Maximum length of a case conversion result is 6 bytes in UTF-8 - enum { maxConversionLength=6 }; - struct ConversionString { - char conversion[maxConversionLength+1]; - ConversionString() { - conversion[0] = '\0'; - } - }; - // Conversions are initially store in a vector of structs but then decomposed into - // parallel arrays as that is about 10% faster to search. - struct CharacterConversion { - int character; - ConversionString conversion; - CharacterConversion(int character_=0, const char *conversion_="") : character(character_) { - StringCopy(conversion.conversion, conversion_); - } - bool operator<(const CharacterConversion &other) const { - return character < other.character; - } - }; - typedef std::vector CharacterToConversion; - CharacterToConversion characterToConversion; - // The parallel arrays - std::vector characters; - std::vector conversions; - -public: - CaseConverter() { - } - bool Initialised() const { - return characters.size() > 0; - } - void Add(int character, const char *conversion) { - characterToConversion.push_back(CharacterConversion(character, conversion)); - } - const char *Find(int character) { - const std::vector::iterator it = std::lower_bound(characters.begin(), characters.end(), character); - if (it == characters.end()) - return 0; - else if (*it == character) - return conversions[it - characters.begin()].conversion; - else - return 0; - } - size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed) { - size_t lenConverted = 0; - size_t mixedPos = 0; - unsigned char bytes[UTF8MaxBytes + 1]; - while (mixedPos < lenMixed) { - const unsigned char leadByte = static_cast(mixed[mixedPos]); - const char *caseConverted = 0; - size_t lenMixedChar = 1; - if (UTF8IsAscii(leadByte)) { - caseConverted = Find(leadByte); - } else { - bytes[0] = leadByte; - const int widthCharBytes = UTF8BytesOfLead[leadByte]; - for (int b=1; b= sizeConverted) - return 0; - } - } else { - // Character has no conversion so copy the input to output - for (size_t i=0; i= sizeConverted) - return 0; - } - } - mixedPos += lenMixedChar; - } - return lenConverted; - } - void FinishedAdding() { - std::sort(characterToConversion.begin(), characterToConversion.end()); - characters.reserve(characterToConversion.size()); - conversions.reserve(characterToConversion.size()); - for (CharacterToConversion::iterator it = characterToConversion.begin(); it != characterToConversion.end(); ++it) { - characters.push_back(it->character); - conversions.push_back(it->conversion); - } - // Empty the original calculated data completely - CharacterToConversion().swap(characterToConversion); - } -}; - -CaseConverter caseConvFold; -CaseConverter caseConvUp; -CaseConverter caseConvLow; - -void UTF8FromUTF32Character(int uch, char *putf) { - size_t k = 0; - if (uch < 0x80) { - putf[k++] = static_cast(uch); - } else if (uch < 0x800) { - putf[k++] = static_cast(0xC0 | (uch >> 6)); - putf[k++] = static_cast(0x80 | (uch & 0x3f)); - } else if (uch < 0x10000) { - putf[k++] = static_cast(0xE0 | (uch >> 12)); - putf[k++] = static_cast(0x80 | ((uch >> 6) & 0x3f)); - putf[k++] = static_cast(0x80 | (uch & 0x3f)); - } else { - putf[k++] = static_cast(0xF0 | (uch >> 18)); - putf[k++] = static_cast(0x80 | ((uch >> 12) & 0x3f)); - putf[k++] = static_cast(0x80 | ((uch >> 6) & 0x3f)); - putf[k++] = static_cast(0x80 | (uch & 0x3f)); - } - putf[k] = 0; -} - -void AddSymmetric(enum CaseConversion conversion, int lower,int upper) { - char lowerUTF8[UTF8MaxBytes+1]; - UTF8FromUTF32Character(lower, lowerUTF8); - char upperUTF8[UTF8MaxBytes+1]; - UTF8FromUTF32Character(upper, upperUTF8); - - switch (conversion) { - case CaseConversionFold: - caseConvFold.Add(upper, lowerUTF8); - break; - case CaseConversionUpper: - caseConvUp.Add(lower, upperUTF8); - break; - case CaseConversionLower: - caseConvLow.Add(upper, lowerUTF8); - break; - } -} - -void SetupConversions(enum CaseConversion conversion) { - // First initialize for the symmetric ranges - for (size_t i=0; i(originUTF8)); - - if (conversion == CaseConversionFold && foldedUTF8[0]) { - caseConvFold.Add(character, foldedUTF8); - } - - if (conversion == CaseConversionUpper && upperUTF8[0]) { - caseConvUp.Add(character, upperUTF8); - } - - if (conversion == CaseConversionLower && lowerUTF8[0]) { - caseConvLow.Add(character, lowerUTF8); - } - } - - switch (conversion) { - case CaseConversionFold: - caseConvFold.FinishedAdding(); - break; - case CaseConversionUpper: - caseConvUp.FinishedAdding(); - break; - case CaseConversionLower: - caseConvLow.FinishedAdding(); - break; - } -} - -CaseConverter *ConverterForConversion(enum CaseConversion conversion) { - switch (conversion) { - case CaseConversionFold: - return &caseConvFold; - case CaseConversionUpper: - return &caseConvUp; - case CaseConversionLower: - return &caseConvLow; - } - return 0; -} - -} - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -ICaseConverter *ConverterFor(enum CaseConversion conversion) { - CaseConverter *pCaseConv = ConverterForConversion(conversion); - if (!pCaseConv->Initialised()) - SetupConversions(conversion); - return pCaseConv; -} - -const char *CaseConvert(int character, enum CaseConversion conversion) { - CaseConverter *pCaseConv = ConverterForConversion(conversion); - if (!pCaseConv->Initialised()) - SetupConversions(conversion); - return pCaseConv->Find(character); -} - -size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed, enum CaseConversion conversion) { - CaseConverter *pCaseConv = ConverterForConversion(conversion); - if (!pCaseConv->Initialised()) - SetupConversions(conversion); - return pCaseConv->CaseConvertString(converted, sizeConverted, mixed, lenMixed); -} - -std::string CaseConvertString(const std::string &s, enum CaseConversion conversion) { - std::string retMapped(s.length() * maxExpansionCaseConversion, 0); - size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(), - conversion); - retMapped.resize(lenMapped); - return retMapped; -} - -#ifdef SCI_NAMESPACE -} -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/CaseConvert.h b/qrenderdoc/3rdparty/scintilla/src/CaseConvert.h deleted file mode 100644 index 7a0100300..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/CaseConvert.h +++ /dev/null @@ -1,50 +0,0 @@ -// Scintilla source code edit control -// Encoding: UTF-8 -/** @file CaseConvert.h - ** Performs Unicode case conversions. - ** Does not handle locale-sensitive case conversion. - **/ -// Copyright 2013 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CASECONVERT_H -#define CASECONVERT_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -enum CaseConversion { - CaseConversionFold, - CaseConversionUpper, - CaseConversionLower -}; - -class ICaseConverter { -public: - virtual size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed) = 0; -}; - -ICaseConverter *ConverterFor(enum CaseConversion conversion); - -// Returns a UTF-8 string. Empty when no conversion -const char *CaseConvert(int character, enum CaseConversion conversion); - -// When performing CaseConvertString, the converted value may be up to 3 times longer than the input. -// Ligatures are often decomposed into multiple characters and long cases include: -// Î "\xce\x90" folds to Î¹ÌˆÌ "\xce\xb9\xcc\x88\xcc\x81" -const int maxExpansionCaseConversion=3; - -// Converts a mixed case string using a particular conversion. -// Result may be a different length to input and the length is the return value. -// If there is not enough space then 0 is returned. -size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed, enum CaseConversion conversion); - -// Converts a mixed case string using a particular conversion. -std::string CaseConvertString(const std::string &s, enum CaseConversion conversion); - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/CaseFolder.cxx b/qrenderdoc/3rdparty/scintilla/src/CaseFolder.cxx deleted file mode 100644 index 4e095df1a..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/CaseFolder.cxx +++ /dev/null @@ -1,69 +0,0 @@ -// Scintilla source code edit control -/** @file CaseFolder.cxx - ** Classes for case folding. - **/ -// Copyright 1998-2013 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include - -#include "CaseFolder.h" -#include "CaseConvert.h" -#include "UniConversion.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -CaseFolder::~CaseFolder() { -} - -CaseFolderTable::CaseFolderTable() { - for (size_t iChar=0; iChar(iChar); - } -} - -CaseFolderTable::~CaseFolderTable() { -} - -size_t CaseFolderTable::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { - if (lenMixed > sizeFolded) { - return 0; - } else { - for (size_t i=0; i(mixed[i])]; - } - return lenMixed; - } -} - -void CaseFolderTable::SetTranslation(char ch, char chTranslation) { - mapping[static_cast(ch)] = chTranslation; -} - -void CaseFolderTable::StandardASCII() { - for (size_t iChar=0; iChar= 'A' && iChar <= 'Z') { - mapping[iChar] = static_cast(iChar - 'A' + 'a'); - } else { - mapping[iChar] = static_cast(iChar); - } - } -} - -CaseFolderUnicode::CaseFolderUnicode() { - StandardASCII(); - converter = ConverterFor(CaseConversionFold); -} - -size_t CaseFolderUnicode::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { - if ((lenMixed == 1) && (sizeFolded > 0)) { - folded[0] = mapping[static_cast(mixed[0])]; - return 1; - } else { - return converter->CaseConvertString(folded, sizeFolded, mixed, lenMixed); - } -} diff --git a/qrenderdoc/3rdparty/scintilla/src/CaseFolder.h b/qrenderdoc/3rdparty/scintilla/src/CaseFolder.h deleted file mode 100644 index 2d754d4f3..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/CaseFolder.h +++ /dev/null @@ -1,45 +0,0 @@ -// Scintilla source code edit control -/** @file CaseFolder.h - ** Classes for case folding. - **/ -// Copyright 1998-2013 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CASEFOLDER_H -#define CASEFOLDER_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class CaseFolder { -public: - virtual ~CaseFolder(); - virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) = 0; -}; - -class CaseFolderTable : public CaseFolder { -protected: - char mapping[256]; -public: - CaseFolderTable(); - virtual ~CaseFolderTable(); - virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed); - void SetTranslation(char ch, char chTranslation); - void StandardASCII(); -}; - -class ICaseConverter; - -class CaseFolderUnicode : public CaseFolderTable { - ICaseConverter *converter; -public: - CaseFolderUnicode(); - virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/Catalogue.cxx b/qrenderdoc/3rdparty/scintilla/src/Catalogue.cxx deleted file mode 100644 index be8b595ba..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Catalogue.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// Scintilla source code edit control -/** @file Catalogue.cxx - ** Colourise for particular languages. - **/ -// Copyright 1998-2002 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "LexerModule.h" -#include "Catalogue.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static std::vector lexerCatalogue; -static int nextLanguage = SCLEX_AUTOMATIC+1; - -const LexerModule *Catalogue::Find(int language) { - Scintilla_LinkLexers(); - for (std::vector::iterator it=lexerCatalogue.begin(); - it != lexerCatalogue.end(); ++it) { - if ((*it)->GetLanguage() == language) { - return *it; - } - } - return 0; -} - -const LexerModule *Catalogue::Find(const char *languageName) { - Scintilla_LinkLexers(); - if (languageName) { - for (std::vector::iterator it=lexerCatalogue.begin(); - it != lexerCatalogue.end(); ++it) { - if ((*it)->languageName && (0 == strcmp((*it)->languageName, languageName))) { - return *it; - } - } - } - return 0; -} - -void Catalogue::AddLexerModule(LexerModule *plm) { - if (plm->GetLanguage() == SCLEX_AUTOMATIC) { - plm->language = nextLanguage; - nextLanguage++; - } - lexerCatalogue.push_back(plm); -} - -// To add or remove a lexer, add or remove its file and run LexGen.py. - -// Force a reference to all of the Scintilla lexers so that the linker will -// not remove the code of the lexers. -int Scintilla_LinkLexers() { - - static int initialised = 0; - if (initialised) - return 0; - initialised = 1; - -// Shorten the code that declares a lexer and ensures it is linked in by calling a method. -#define LINK_LEXER(lexer) extern LexerModule lexer; Catalogue::AddLexerModule(&lexer); - -//++Autogenerated -- run scripts/LexGen.py to regenerate -//**\(\tLINK_LEXER(\*);\n\) - LINK_LEXER(lmCPP); - LINK_LEXER(lmCPPNoCase); - LINK_LEXER(lmDiff); - LINK_LEXER(lmErrorList); - LINK_LEXER(lmHTML); - LINK_LEXER(lmJSON); - LINK_LEXER(lmNull); - LINK_LEXER(lmPHPSCRIPT); - LINK_LEXER(lmPython); - LINK_LEXER(lmRust); - LINK_LEXER(lmXML); - -//--Autogenerated -- end of automatically generated section - - return 1; -} diff --git a/qrenderdoc/3rdparty/scintilla/src/Catalogue.h b/qrenderdoc/3rdparty/scintilla/src/Catalogue.h deleted file mode 100644 index 7fea37da8..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Catalogue.h +++ /dev/null @@ -1,26 +0,0 @@ -// Scintilla source code edit control -/** @file Catalogue.h - ** Lexer infrastructure. - **/ -// Copyright 1998-2010 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CATALOGUE_H -#define CATALOGUE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class Catalogue { -public: - static const LexerModule *Find(int language); - static const LexerModule *Find(const char *languageName); - static void AddLexerModule(LexerModule *plm); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/CellBuffer.cxx b/qrenderdoc/3rdparty/scintilla/src/CellBuffer.cxx deleted file mode 100644 index 6ad990a63..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/CellBuffer.cxx +++ /dev/null @@ -1,842 +0,0 @@ -// Scintilla source code edit control -/** @file CellBuffer.cxx - ** Manages a buffer of cells. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "CellBuffer.h" -#include "UniConversion.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -LineVector::LineVector() : starts(256), perLine(0) { - Init(); -} - -LineVector::~LineVector() { - starts.DeleteAll(); -} - -void LineVector::Init() { - starts.DeleteAll(); - if (perLine) { - perLine->Init(); - } -} - -void LineVector::SetPerLine(PerLine *pl) { - perLine = pl; -} - -void LineVector::InsertText(int line, int delta) { - starts.InsertText(line, delta); -} - -void LineVector::InsertLine(int line, int position, bool lineStart) { - starts.InsertPartition(line, position); - if (perLine) { - if ((line > 0) && lineStart) - line--; - perLine->InsertLine(line); - } -} - -void LineVector::SetLineStart(int line, int position) { - starts.SetPartitionStartPosition(line, position); -} - -void LineVector::RemoveLine(int line) { - starts.RemovePartition(line); - if (perLine) { - perLine->RemoveLine(line); - } -} - -int LineVector::LineFromPosition(int pos) const { - return starts.PartitionFromPosition(pos); -} - -Action::Action() { - at = startAction; - position = 0; - data = 0; - lenData = 0; - mayCoalesce = false; -} - -Action::~Action() { - Destroy(); -} - -void Action::Create(actionType at_, int position_, const char *data_, int lenData_, bool mayCoalesce_) { - delete []data; - data = NULL; - position = position_; - at = at_; - if (lenData_) { - data = new char[lenData_]; - memcpy(data, data_, lenData_); - } - lenData = lenData_; - mayCoalesce = mayCoalesce_; -} - -void Action::Destroy() { - delete []data; - data = 0; -} - -void Action::Grab(Action *source) { - delete []data; - - position = source->position; - at = source->at; - data = source->data; - lenData = source->lenData; - mayCoalesce = source->mayCoalesce; - - // Ownership of source data transferred to this - source->position = 0; - source->at = startAction; - source->data = 0; - source->lenData = 0; - source->mayCoalesce = true; -} - -// The undo history stores a sequence of user operations that represent the user's view of the -// commands executed on the text. -// Each user operation contains a sequence of text insertion and text deletion actions. -// All the user operations are stored in a list of individual actions with 'start' actions used -// as delimiters between user operations. -// Initially there is one start action in the history. -// As each action is performed, it is recorded in the history. The action may either become -// part of the current user operation or may start a new user operation. If it is to be part of the -// current operation, then it overwrites the current last action. If it is to be part of a new -// operation, it is appended after the current last action. -// After writing the new action, a new start action is appended at the end of the history. -// The decision of whether to start a new user operation is based upon two factors. If a -// compound operation has been explicitly started by calling BeginUndoAction and no matching -// EndUndoAction (these calls nest) has been called, then the action is coalesced into the current -// operation. If there is no outstanding BeginUndoAction call then a new operation is started -// unless it looks as if the new action is caused by the user typing or deleting a stream of text. -// Sequences that look like typing or deletion are coalesced into a single user operation. - -UndoHistory::UndoHistory() { - - lenActions = 100; - actions = new Action[lenActions]; - maxAction = 0; - currentAction = 0; - undoSequenceDepth = 0; - savePoint = 0; - tentativePoint = -1; - - actions[currentAction].Create(startAction); -} - -UndoHistory::~UndoHistory() { - delete []actions; - actions = 0; -} - -void UndoHistory::EnsureUndoRoom() { - // Have to test that there is room for 2 more actions in the array - // as two actions may be created by the calling function - if (currentAction >= (lenActions - 2)) { - // Run out of undo nodes so extend the array - int lenActionsNew = lenActions * 2; - Action *actionsNew = new Action[lenActionsNew]; - for (int act = 0; act <= currentAction; act++) - actionsNew[act].Grab(&actions[act]); - delete []actions; - lenActions = lenActionsNew; - actions = actionsNew; - } -} - -const char *UndoHistory::AppendAction(actionType at, int position, const char *data, int lengthData, - bool &startSequence, bool mayCoalesce) { - EnsureUndoRoom(); - //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction); - //Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at, - // actions[currentAction - 1].position, actions[currentAction - 1].lenData); - if (currentAction < savePoint) { - savePoint = -1; - } - int oldCurrentAction = currentAction; - if (currentAction >= 1) { - if (0 == undoSequenceDepth) { - // Top level actions may not always be coalesced - int targetAct = -1; - const Action *actPrevious = &(actions[currentAction + targetAct]); - // Container actions may forward the coalesce state of Scintilla Actions. - while ((actPrevious->at == containerAction) && actPrevious->mayCoalesce) { - targetAct--; - actPrevious = &(actions[currentAction + targetAct]); - } - // See if current action can be coalesced into previous action - // Will work if both are inserts or deletes and position is same -#if defined(_MSC_VER) && defined(_PREFAST_) - // Visual Studio 2013 Code Analysis wrongly believes actions can be NULL at its next reference - __analysis_assume(actions); -#endif - if ((currentAction == savePoint) || (currentAction == tentativePoint)) { - currentAction++; - } else if (!actions[currentAction].mayCoalesce) { - // Not allowed to coalesce if this set - currentAction++; - } else if (!mayCoalesce || !actPrevious->mayCoalesce) { - currentAction++; - } else if (at == containerAction || actions[currentAction].at == containerAction) { - ; // A coalescible containerAction - } else if ((at != actPrevious->at) && (actPrevious->at != startAction)) { - currentAction++; - } else if ((at == insertAction) && - (position != (actPrevious->position + actPrevious->lenData))) { - // Insertions must be immediately after to coalesce - currentAction++; - } else if (at == removeAction) { - if ((lengthData == 1) || (lengthData == 2)) { - if ((position + lengthData) == actPrevious->position) { - ; // Backspace -> OK - } else if (position == actPrevious->position) { - ; // Delete -> OK - } else { - // Removals must be at same position to coalesce - currentAction++; - } - } else { - // Removals must be of one character to coalesce - currentAction++; - } - } else { - // Action coalesced. - } - - } else { - // Actions not at top level are always coalesced unless this is after return to top level - if (!actions[currentAction].mayCoalesce) - currentAction++; - } - } else { - currentAction++; - } - startSequence = oldCurrentAction != currentAction; - int actionWithData = currentAction; - actions[currentAction].Create(at, position, data, lengthData, mayCoalesce); - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; - return actions[actionWithData].data; -} - -void UndoHistory::BeginUndoAction() { - EnsureUndoRoom(); - if (undoSequenceDepth == 0) { - if (actions[currentAction].at != startAction) { - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; - } - actions[currentAction].mayCoalesce = false; - } - undoSequenceDepth++; -} - -void UndoHistory::EndUndoAction() { - PLATFORM_ASSERT(undoSequenceDepth > 0); - EnsureUndoRoom(); - undoSequenceDepth--; - if (0 == undoSequenceDepth) { - if (actions[currentAction].at != startAction) { - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; - } - actions[currentAction].mayCoalesce = false; - } -} - -void UndoHistory::DropUndoSequence() { - undoSequenceDepth = 0; -} - -void UndoHistory::DeleteUndoHistory() { - for (int i = 1; i < maxAction; i++) - actions[i].Destroy(); - maxAction = 0; - currentAction = 0; - actions[currentAction].Create(startAction); - savePoint = 0; - tentativePoint = -1; -} - -void UndoHistory::SetSavePoint() { - savePoint = currentAction; -} - -bool UndoHistory::IsSavePoint() const { - return savePoint == currentAction; -} - -void UndoHistory::TentativeStart() { - tentativePoint = currentAction; -} - -void UndoHistory::TentativeCommit() { - tentativePoint = -1; - // Truncate undo history - maxAction = currentAction; -} - -int UndoHistory::TentativeSteps() { - // Drop any trailing startAction - if (actions[currentAction].at == startAction && currentAction > 0) - currentAction--; - if (tentativePoint >= 0) - return currentAction - tentativePoint; - else - return -1; -} - -bool UndoHistory::CanUndo() const { - return (currentAction > 0) && (maxAction > 0); -} - -int UndoHistory::StartUndo() { - // Drop any trailing startAction - if (actions[currentAction].at == startAction && currentAction > 0) - currentAction--; - - // Count the steps in this action - int act = currentAction; - while (actions[act].at != startAction && act > 0) { - act--; - } - return currentAction - act; -} - -const Action &UndoHistory::GetUndoStep() const { - return actions[currentAction]; -} - -void UndoHistory::CompletedUndoStep() { - currentAction--; -} - -bool UndoHistory::CanRedo() const { - return maxAction > currentAction; -} - -int UndoHistory::StartRedo() { - // Drop any leading startAction - if (actions[currentAction].at == startAction && currentAction < maxAction) - currentAction++; - - // Count the steps in this action - int act = currentAction; - while (actions[act].at != startAction && act < maxAction) { - act++; - } - return act - currentAction; -} - -const Action &UndoHistory::GetRedoStep() const { - return actions[currentAction]; -} - -void UndoHistory::CompletedRedoStep() { - currentAction++; -} - -CellBuffer::CellBuffer() { - readOnly = false; - utf8LineEnds = 0; - collectingUndo = true; -} - -CellBuffer::~CellBuffer() { -} - -char CellBuffer::CharAt(int position) const { - return substance.ValueAt(position); -} - -void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) const { - if (lengthRetrieve <= 0) - return; - if (position < 0) - return; - if ((position + lengthRetrieve) > substance.Length()) { - Platform::DebugPrintf("Bad GetCharRange %d for %d of %d\n", position, - lengthRetrieve, substance.Length()); - return; - } - substance.GetRange(buffer, position, lengthRetrieve); -} - -char CellBuffer::StyleAt(int position) const { - return style.ValueAt(position); -} - -void CellBuffer::GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const { - if (lengthRetrieve < 0) - return; - if (position < 0) - return; - if ((position + lengthRetrieve) > style.Length()) { - Platform::DebugPrintf("Bad GetStyleRange %d for %d of %d\n", position, - lengthRetrieve, style.Length()); - return; - } - style.GetRange(reinterpret_cast(buffer), position, lengthRetrieve); -} - -const char *CellBuffer::BufferPointer() { - return substance.BufferPointer(); -} - -const char *CellBuffer::RangePointer(int position, int rangeLength) { - return substance.RangePointer(position, rangeLength); -} - -int CellBuffer::GapPosition() const { - return substance.GapPosition(); -} - -// The char* returned is to an allocation owned by the undo history -const char *CellBuffer::InsertString(int position, const char *s, int insertLength, bool &startSequence) { - // InsertString and DeleteChars are the bottleneck though which all changes occur - const char *data = s; - if (!readOnly) { - if (collectingUndo) { - // Save into the undo/redo stack, but only the characters - not the formatting - // This takes up about half load time - data = uh.AppendAction(insertAction, position, s, insertLength, startSequence); - } - - BasicInsertString(position, s, insertLength); - } - return data; -} - -bool CellBuffer::SetStyleAt(int position, char styleValue) { - char curVal = style.ValueAt(position); - if (curVal != styleValue) { - style.SetValueAt(position, styleValue); - return true; - } else { - return false; - } -} - -bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue) { - bool changed = false; - PLATFORM_ASSERT(lengthStyle == 0 || - (lengthStyle > 0 && lengthStyle + position <= style.Length())); - while (lengthStyle--) { - char curVal = style.ValueAt(position); - if (curVal != styleValue) { - style.SetValueAt(position, styleValue); - changed = true; - } - position++; - } - return changed; -} - -// The char* returned is to an allocation owned by the undo history -const char *CellBuffer::DeleteChars(int position, int deleteLength, bool &startSequence) { - // InsertString and DeleteChars are the bottleneck though which all changes occur - PLATFORM_ASSERT(deleteLength > 0); - const char *data = 0; - if (!readOnly) { - if (collectingUndo) { - // Save into the undo/redo stack, but only the characters - not the formatting - // The gap would be moved to position anyway for the deletion so this doesn't cost extra - data = substance.RangePointer(position, deleteLength); - data = uh.AppendAction(removeAction, position, data, deleteLength, startSequence); - } - - BasicDeleteChars(position, deleteLength); - } - return data; -} - -int CellBuffer::Length() const { - return substance.Length(); -} - -void CellBuffer::Allocate(int newSize) { - substance.ReAllocate(newSize); - style.ReAllocate(newSize); -} - -void CellBuffer::SetLineEndTypes(int utf8LineEnds_) { - if (utf8LineEnds != utf8LineEnds_) { - utf8LineEnds = utf8LineEnds_; - ResetLineEnds(); - } -} - -bool CellBuffer::ContainsLineEnd(const char *s, int length) const { - unsigned char chBeforePrev = 0; - unsigned char chPrev = 0; - for (int i = 0; i < length; i++) { - const unsigned char ch = s[i]; - if ((ch == '\r') || (ch == '\n')) { - return true; - } else if (utf8LineEnds) { - unsigned char back3[3] = { chBeforePrev, chPrev, ch }; - if (UTF8IsSeparator(back3) || UTF8IsNEL(back3 + 1)) { - return true; - } - } - chBeforePrev = chPrev; - chPrev = ch; - } - return false; -} - -void CellBuffer::SetPerLine(PerLine *pl) { - lv.SetPerLine(pl); -} - -int CellBuffer::Lines() const { - return lv.Lines(); -} - -int CellBuffer::LineStart(int line) const { - if (line < 0) - return 0; - else if (line >= Lines()) - return Length(); - else - return lv.LineStart(line); -} - -bool CellBuffer::IsReadOnly() const { - return readOnly; -} - -void CellBuffer::SetReadOnly(bool set) { - readOnly = set; -} - -void CellBuffer::SetSavePoint() { - uh.SetSavePoint(); -} - -bool CellBuffer::IsSavePoint() const { - return uh.IsSavePoint(); -} - -void CellBuffer::TentativeStart() { - uh.TentativeStart(); -} - -void CellBuffer::TentativeCommit() { - uh.TentativeCommit(); -} - -int CellBuffer::TentativeSteps() { - return uh.TentativeSteps(); -} - -bool CellBuffer::TentativeActive() const { - return uh.TentativeActive(); -} - -// Without undo - -void CellBuffer::InsertLine(int line, int position, bool lineStart) { - lv.InsertLine(line, position, lineStart); -} - -void CellBuffer::RemoveLine(int line) { - lv.RemoveLine(line); -} - -bool CellBuffer::UTF8LineEndOverlaps(int position) const { - unsigned char bytes[] = { - static_cast(substance.ValueAt(position-2)), - static_cast(substance.ValueAt(position-1)), - static_cast(substance.ValueAt(position)), - static_cast(substance.ValueAt(position+1)), - }; - return UTF8IsSeparator(bytes) || UTF8IsSeparator(bytes+1) || UTF8IsNEL(bytes+1); -} - -void CellBuffer::ResetLineEnds() { - // Reinitialize line data -- too much work to preserve - lv.Init(); - - int position = 0; - int length = Length(); - int lineInsert = 1; - bool atLineStart = true; - lv.InsertText(lineInsert-1, length); - unsigned char chBeforePrev = 0; - unsigned char chPrev = 0; - for (int i = 0; i < length; i++) { - unsigned char ch = substance.ValueAt(position + i); - if (ch == '\r') { - InsertLine(lineInsert, (position + i) + 1, atLineStart); - lineInsert++; - } else if (ch == '\n') { - if (chPrev == '\r') { - // Patch up what was end of line - lv.SetLineStart(lineInsert - 1, (position + i) + 1); - } else { - InsertLine(lineInsert, (position + i) + 1, atLineStart); - lineInsert++; - } - } else if (utf8LineEnds) { - unsigned char back3[3] = {chBeforePrev, chPrev, ch}; - if (UTF8IsSeparator(back3) || UTF8IsNEL(back3+1)) { - InsertLine(lineInsert, (position + i) + 1, atLineStart); - lineInsert++; - } - } - chBeforePrev = chPrev; - chPrev = ch; - } -} - -void CellBuffer::BasicInsertString(int position, const char *s, int insertLength) { - if (insertLength == 0) - return; - PLATFORM_ASSERT(insertLength > 0); - - unsigned char chAfter = substance.ValueAt(position); - bool breakingUTF8LineEnd = false; - if (utf8LineEnds && UTF8IsTrailByte(chAfter)) { - breakingUTF8LineEnd = UTF8LineEndOverlaps(position); - } - - substance.InsertFromArray(position, s, 0, insertLength); - style.InsertValue(position, insertLength, 0); - - int lineInsert = lv.LineFromPosition(position) + 1; - bool atLineStart = lv.LineStart(lineInsert-1) == position; - // Point all the lines after the insertion point further along in the buffer - lv.InsertText(lineInsert-1, insertLength); - unsigned char chBeforePrev = substance.ValueAt(position - 2); - unsigned char chPrev = substance.ValueAt(position - 1); - if (chPrev == '\r' && chAfter == '\n') { - // Splitting up a crlf pair at position - InsertLine(lineInsert, position, false); - lineInsert++; - } - if (breakingUTF8LineEnd) { - RemoveLine(lineInsert); - } - unsigned char ch = ' '; - for (int i = 0; i < insertLength; i++) { - ch = s[i]; - if (ch == '\r') { - InsertLine(lineInsert, (position + i) + 1, atLineStart); - lineInsert++; - } else if (ch == '\n') { - if (chPrev == '\r') { - // Patch up what was end of line - lv.SetLineStart(lineInsert - 1, (position + i) + 1); - } else { - InsertLine(lineInsert, (position + i) + 1, atLineStart); - lineInsert++; - } - } else if (utf8LineEnds) { - unsigned char back3[3] = {chBeforePrev, chPrev, ch}; - if (UTF8IsSeparator(back3) || UTF8IsNEL(back3+1)) { - InsertLine(lineInsert, (position + i) + 1, atLineStart); - lineInsert++; - } - } - chBeforePrev = chPrev; - chPrev = ch; - } - // Joining two lines where last insertion is cr and following substance starts with lf - if (chAfter == '\n') { - if (ch == '\r') { - // End of line already in buffer so drop the newly created one - RemoveLine(lineInsert - 1); - } - } else if (utf8LineEnds && !UTF8IsAscii(chAfter)) { - // May have end of UTF-8 line end in buffer and start in insertion - for (int j = 0; j < UTF8SeparatorLength-1; j++) { - unsigned char chAt = substance.ValueAt(position + insertLength + j); - unsigned char back3[3] = {chBeforePrev, chPrev, chAt}; - if (UTF8IsSeparator(back3)) { - InsertLine(lineInsert, (position + insertLength + j) + 1, atLineStart); - lineInsert++; - } - if ((j == 0) && UTF8IsNEL(back3+1)) { - InsertLine(lineInsert, (position + insertLength + j) + 1, atLineStart); - lineInsert++; - } - chBeforePrev = chPrev; - chPrev = chAt; - } - } -} - -void CellBuffer::BasicDeleteChars(int position, int deleteLength) { - if (deleteLength == 0) - return; - - if ((position == 0) && (deleteLength == substance.Length())) { - // If whole buffer is being deleted, faster to reinitialise lines data - // than to delete each line. - lv.Init(); - } else { - // Have to fix up line positions before doing deletion as looking at text in buffer - // to work out which lines have been removed - - int lineRemove = lv.LineFromPosition(position) + 1; - lv.InsertText(lineRemove-1, - (deleteLength)); - unsigned char chPrev = substance.ValueAt(position - 1); - unsigned char chBefore = chPrev; - unsigned char chNext = substance.ValueAt(position); - bool ignoreNL = false; - if (chPrev == '\r' && chNext == '\n') { - // Move back one - lv.SetLineStart(lineRemove, position); - lineRemove++; - ignoreNL = true; // First \n is not real deletion - } - if (utf8LineEnds && UTF8IsTrailByte(chNext)) { - if (UTF8LineEndOverlaps(position)) { - RemoveLine(lineRemove); - } - } - - unsigned char ch = chNext; - for (int i = 0; i < deleteLength; i++) { - chNext = substance.ValueAt(position + i + 1); - if (ch == '\r') { - if (chNext != '\n') { - RemoveLine(lineRemove); - } - } else if (ch == '\n') { - if (ignoreNL) { - ignoreNL = false; // Further \n are real deletions - } else { - RemoveLine(lineRemove); - } - } else if (utf8LineEnds) { - if (!UTF8IsAscii(ch)) { - unsigned char next3[3] = {ch, chNext, - static_cast(substance.ValueAt(position + i + 2))}; - if (UTF8IsSeparator(next3) || UTF8IsNEL(next3)) { - RemoveLine(lineRemove); - } - } - } - - ch = chNext; - } - // May have to fix up end if last deletion causes cr to be next to lf - // or removes one of a crlf pair - char chAfter = substance.ValueAt(position + deleteLength); - if (chBefore == '\r' && chAfter == '\n') { - // Using lineRemove-1 as cr ended line before start of deletion - RemoveLine(lineRemove - 1); - lv.SetLineStart(lineRemove - 1, position + 1); - } - } - substance.DeleteRange(position, deleteLength); - style.DeleteRange(position, deleteLength); -} - -bool CellBuffer::SetUndoCollection(bool collectUndo) { - collectingUndo = collectUndo; - uh.DropUndoSequence(); - return collectingUndo; -} - -bool CellBuffer::IsCollectingUndo() const { - return collectingUndo; -} - -void CellBuffer::BeginUndoAction() { - uh.BeginUndoAction(); -} - -void CellBuffer::EndUndoAction() { - uh.EndUndoAction(); -} - -void CellBuffer::AddUndoAction(int token, bool mayCoalesce) { - bool startSequence; - uh.AppendAction(containerAction, token, 0, 0, startSequence, mayCoalesce); -} - -void CellBuffer::DeleteUndoHistory() { - uh.DeleteUndoHistory(); -} - -bool CellBuffer::CanUndo() const { - return uh.CanUndo(); -} - -int CellBuffer::StartUndo() { - return uh.StartUndo(); -} - -const Action &CellBuffer::GetUndoStep() const { - return uh.GetUndoStep(); -} - -void CellBuffer::PerformUndoStep() { - const Action &actionStep = uh.GetUndoStep(); - if (actionStep.at == insertAction) { - if (substance.Length() < actionStep.lenData) { - throw std::runtime_error( - "CellBuffer::PerformUndoStep: deletion must be less than document length."); - } - BasicDeleteChars(actionStep.position, actionStep.lenData); - } else if (actionStep.at == removeAction) { - BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); - } - uh.CompletedUndoStep(); -} - -bool CellBuffer::CanRedo() const { - return uh.CanRedo(); -} - -int CellBuffer::StartRedo() { - return uh.StartRedo(); -} - -const Action &CellBuffer::GetRedoStep() const { - return uh.GetRedoStep(); -} - -void CellBuffer::PerformRedoStep() { - const Action &actionStep = uh.GetRedoStep(); - if (actionStep.at == insertAction) { - BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); - } else if (actionStep.at == removeAction) { - BasicDeleteChars(actionStep.position, actionStep.lenData); - } - uh.CompletedRedoStep(); -} - diff --git a/qrenderdoc/3rdparty/scintilla/src/CellBuffer.h b/qrenderdoc/3rdparty/scintilla/src/CellBuffer.h deleted file mode 100644 index c1e973cff..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/CellBuffer.h +++ /dev/null @@ -1,216 +0,0 @@ -// Scintilla source code edit control -/** @file CellBuffer.h - ** Manages the text of the document. - **/ -// Copyright 1998-2004 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CELLBUFFER_H -#define CELLBUFFER_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -// Interface to per-line data that wants to see each line insertion and deletion -class PerLine { -public: - virtual ~PerLine() {} - virtual void Init()=0; - virtual void InsertLine(int line)=0; - virtual void RemoveLine(int line)=0; -}; - -/** - * The line vector contains information about each of the lines in a cell buffer. - */ -class LineVector { - - Partitioning starts; - PerLine *perLine; - -public: - - LineVector(); - ~LineVector(); - void Init(); - void SetPerLine(PerLine *pl); - - void InsertText(int line, int delta); - void InsertLine(int line, int position, bool lineStart); - void SetLineStart(int line, int position); - void RemoveLine(int line); - int Lines() const { - return starts.Partitions(); - } - int LineFromPosition(int pos) const; - int LineStart(int line) const { - return starts.PositionFromPartition(line); - } -}; - -enum actionType { insertAction, removeAction, startAction, containerAction }; - -/** - * Actions are used to store all the information required to perform one undo/redo step. - */ -class Action { -public: - actionType at; - int position; - char *data; - int lenData; - bool mayCoalesce; - - Action(); - ~Action(); - void Create(actionType at_, int position_=0, const char *data_=0, int lenData_=0, bool mayCoalesce_=true); - void Destroy(); - void Grab(Action *source); -}; - -/** - * - */ -class UndoHistory { - Action *actions; - int lenActions; - int maxAction; - int currentAction; - int undoSequenceDepth; - int savePoint; - int tentativePoint; - - void EnsureUndoRoom(); - - // Private so UndoHistory objects can not be copied - UndoHistory(const UndoHistory &); - -public: - UndoHistory(); - ~UndoHistory(); - - const char *AppendAction(actionType at, int position, const char *data, int length, bool &startSequence, bool mayCoalesce=true); - - void BeginUndoAction(); - void EndUndoAction(); - void DropUndoSequence(); - void DeleteUndoHistory(); - - /// The save point is a marker in the undo stack where the container has stated that - /// the buffer was saved. Undo and redo can move over the save point. - void SetSavePoint(); - bool IsSavePoint() const; - - // Tentative actions are used for input composition so that it can be undone cleanly - void TentativeStart(); - void TentativeCommit(); - bool TentativeActive() const { return tentativePoint >= 0; } - int TentativeSteps(); - - /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is - /// called that many times. Similarly for redo. - bool CanUndo() const; - int StartUndo(); - const Action &GetUndoStep() const; - void CompletedUndoStep(); - bool CanRedo() const; - int StartRedo(); - const Action &GetRedoStep() const; - void CompletedRedoStep(); -}; - -/** - * Holder for an expandable array of characters that supports undo and line markers. - * Based on article "Data Structures in a Bit-Mapped Text Editor" - * by Wilfred J. Hansen, Byte January 1987, page 183. - */ -class CellBuffer { -private: - SplitVector substance; - SplitVector style; - bool readOnly; - int utf8LineEnds; - - bool collectingUndo; - UndoHistory uh; - - LineVector lv; - - bool UTF8LineEndOverlaps(int position) const; - void ResetLineEnds(); - /// Actions without undo - void BasicInsertString(int position, const char *s, int insertLength); - void BasicDeleteChars(int position, int deleteLength); - -public: - - CellBuffer(); - ~CellBuffer(); - - /// Retrieving positions outside the range of the buffer works and returns 0 - char CharAt(int position) const; - void GetCharRange(char *buffer, int position, int lengthRetrieve) const; - char StyleAt(int position) const; - void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const; - const char *BufferPointer(); - const char *RangePointer(int position, int rangeLength); - int GapPosition() const; - - int Length() const; - void Allocate(int newSize); - int GetLineEndTypes() const { return utf8LineEnds; } - void SetLineEndTypes(int utf8LineEnds_); - bool ContainsLineEnd(const char *s, int length) const; - void SetPerLine(PerLine *pl); - int Lines() const; - int LineStart(int line) const; - int LineFromPosition(int pos) const { return lv.LineFromPosition(pos); } - void InsertLine(int line, int position, bool lineStart); - void RemoveLine(int line); - const char *InsertString(int position, const char *s, int insertLength, bool &startSequence); - - /// Setting styles for positions outside the range of the buffer is safe and has no effect. - /// @return true if the style of a character is changed. - bool SetStyleAt(int position, char styleValue); - bool SetStyleFor(int position, int length, char styleValue); - - const char *DeleteChars(int position, int deleteLength, bool &startSequence); - - bool IsReadOnly() const; - void SetReadOnly(bool set); - - /// The save point is a marker in the undo stack where the container has stated that - /// the buffer was saved. Undo and redo can move over the save point. - void SetSavePoint(); - bool IsSavePoint() const; - - void TentativeStart(); - void TentativeCommit(); - bool TentativeActive() const; - int TentativeSteps(); - - bool SetUndoCollection(bool collectUndo); - bool IsCollectingUndo() const; - void BeginUndoAction(); - void EndUndoAction(); - void AddUndoAction(int token, bool mayCoalesce); - void DeleteUndoHistory(); - - /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is - /// called that many times. Similarly for redo. - bool CanUndo() const; - int StartUndo(); - const Action &GetUndoStep() const; - void PerformUndoStep(); - bool CanRedo() const; - int StartRedo(); - const Action &GetRedoStep() const; - void PerformRedoStep(); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/CharClassify.cxx b/qrenderdoc/3rdparty/scintilla/src/CharClassify.cxx deleted file mode 100644 index 8678e6d64..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/CharClassify.cxx +++ /dev/null @@ -1,61 +0,0 @@ -// Scintilla source code edit control -/** @file CharClassify.cxx - ** Character classifications used by Document and RESearch. - **/ -// Copyright 2006 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include - -#include - -#include "CharClassify.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -CharClassify::CharClassify() { - SetDefaultCharClasses(true); -} - -void CharClassify::SetDefaultCharClasses(bool includeWordClass) { - // Initialize all char classes to default values - for (int ch = 0; ch < 256; ch++) { - if (ch == '\r' || ch == '\n') - charClass[ch] = ccNewLine; - else if (ch < 0x20 || ch == ' ') - charClass[ch] = ccSpace; - else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_')) - charClass[ch] = ccWord; - else - charClass[ch] = ccPunctuation; - } -} - -void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) { - // Apply the newCharClass to the specifed chars - if (chars) { - while (*chars) { - charClass[*chars] = static_cast(newCharClass); - chars++; - } - } -} - -int CharClassify::GetCharsOfClass(cc characterClass, unsigned char *buffer) const { - // Get characters belonging to the given char class; return the number - // of characters (if the buffer is NULL, don't write to it). - int count = 0; - for (int ch = maxChar - 1; ch >= 0; --ch) { - if (charClass[ch] == characterClass) { - ++count; - if (buffer) { - *buffer = static_cast(ch); - buffer++; - } - } - } - return count; -} diff --git a/qrenderdoc/3rdparty/scintilla/src/CharClassify.h b/qrenderdoc/3rdparty/scintilla/src/CharClassify.h deleted file mode 100644 index 63e8e8be2..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/CharClassify.h +++ /dev/null @@ -1,35 +0,0 @@ -// Scintilla source code edit control -/** @file CharClassify.h - ** Character classifications used by Document and RESearch. - **/ -// Copyright 2006-2009 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CHARCLASSIFY_H -#define CHARCLASSIFY_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class CharClassify { -public: - CharClassify(); - - enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation }; - void SetDefaultCharClasses(bool includeWordClass); - void SetCharClasses(const unsigned char *chars, cc newCharClass); - int GetCharsOfClass(cc charClass, unsigned char *buffer) const; - cc GetClass(unsigned char ch) const { return static_cast(charClass[ch]);} - bool IsWord(unsigned char ch) const { return static_cast(charClass[ch]) == ccWord;} - -private: - enum { maxChar=256 }; - unsigned char charClass[maxChar]; // not type cc to save space -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/ContractionState.cxx b/qrenderdoc/3rdparty/scintilla/src/ContractionState.cxx deleted file mode 100644 index 41627c173..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/ContractionState.cxx +++ /dev/null @@ -1,316 +0,0 @@ -// Scintilla source code edit control -/** @file ContractionState.cxx - ** Manages visibility of lines for folding and wrapping. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include - -#include -#include - -#include "Platform.h" - -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "SparseVector.h" -#include "ContractionState.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -ContractionState::ContractionState() : visible(0), expanded(0), heights(0), foldDisplayTexts(0), displayLines(0), linesInDocument(1) { - //InsertLine(0); -} - -ContractionState::~ContractionState() { - Clear(); -} - -void ContractionState::EnsureData() { - if (OneToOne()) { - visible = new RunStyles(); - expanded = new RunStyles(); - heights = new RunStyles(); - foldDisplayTexts = new SparseVector(); - displayLines = new Partitioning(4); - InsertLines(0, linesInDocument); - } -} - -void ContractionState::Clear() { - delete visible; - visible = 0; - delete expanded; - expanded = 0; - delete heights; - heights = 0; - delete foldDisplayTexts; - foldDisplayTexts = 0; - delete displayLines; - displayLines = 0; - linesInDocument = 1; -} - -int ContractionState::LinesInDoc() const { - if (OneToOne()) { - return linesInDocument; - } else { - return displayLines->Partitions() - 1; - } -} - -int ContractionState::LinesDisplayed() const { - if (OneToOne()) { - return linesInDocument; - } else { - return displayLines->PositionFromPartition(LinesInDoc()); - } -} - -int ContractionState::DisplayFromDoc(int lineDoc) const { - if (OneToOne()) { - return (lineDoc <= linesInDocument) ? lineDoc : linesInDocument; - } else { - if (lineDoc > displayLines->Partitions()) - lineDoc = displayLines->Partitions(); - return displayLines->PositionFromPartition(lineDoc); - } -} - -int ContractionState::DisplayLastFromDoc(int lineDoc) const { - return DisplayFromDoc(lineDoc) + GetHeight(lineDoc) - 1; -} - -int ContractionState::DocFromDisplay(int lineDisplay) const { - if (OneToOne()) { - return lineDisplay; - } else { - if (lineDisplay <= 0) { - return 0; - } - if (lineDisplay > LinesDisplayed()) { - return displayLines->PartitionFromPosition(LinesDisplayed()); - } - int lineDoc = displayLines->PartitionFromPosition(lineDisplay); - PLATFORM_ASSERT(GetVisible(lineDoc)); - return lineDoc; - } -} - -void ContractionState::InsertLine(int lineDoc) { - if (OneToOne()) { - linesInDocument++; - } else { - visible->InsertSpace(lineDoc, 1); - visible->SetValueAt(lineDoc, 1); - expanded->InsertSpace(lineDoc, 1); - expanded->SetValueAt(lineDoc, 1); - heights->InsertSpace(lineDoc, 1); - heights->SetValueAt(lineDoc, 1); - foldDisplayTexts->InsertSpace(lineDoc, 1); - foldDisplayTexts->SetValueAt(lineDoc, NULL); - int lineDisplay = DisplayFromDoc(lineDoc); - displayLines->InsertPartition(lineDoc, lineDisplay); - displayLines->InsertText(lineDoc, 1); - } -} - -void ContractionState::InsertLines(int lineDoc, int lineCount) { - for (int l = 0; l < lineCount; l++) { - InsertLine(lineDoc + l); - } - Check(); -} - -void ContractionState::DeleteLine(int lineDoc) { - if (OneToOne()) { - linesInDocument--; - } else { - if (GetVisible(lineDoc)) { - displayLines->InsertText(lineDoc, -heights->ValueAt(lineDoc)); - } - displayLines->RemovePartition(lineDoc); - visible->DeleteRange(lineDoc, 1); - expanded->DeleteRange(lineDoc, 1); - heights->DeleteRange(lineDoc, 1); - foldDisplayTexts->DeletePosition(lineDoc); - } -} - -void ContractionState::DeleteLines(int lineDoc, int lineCount) { - for (int l = 0; l < lineCount; l++) { - DeleteLine(lineDoc); - } - Check(); -} - -bool ContractionState::GetVisible(int lineDoc) const { - if (OneToOne()) { - return true; - } else { - if (lineDoc >= visible->Length()) - return true; - return visible->ValueAt(lineDoc) == 1; - } -} - -bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool isVisible) { - if (OneToOne() && isVisible) { - return false; - } else { - EnsureData(); - int delta = 0; - Check(); - if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < LinesInDoc())) { - for (int line = lineDocStart; line <= lineDocEnd; line++) { - if (GetVisible(line) != isVisible) { - int difference = isVisible ? heights->ValueAt(line) : -heights->ValueAt(line); - visible->SetValueAt(line, isVisible ? 1 : 0); - displayLines->InsertText(line, difference); - delta += difference; - } - } - } else { - return false; - } - Check(); - return delta != 0; - } -} - -bool ContractionState::HiddenLines() const { - if (OneToOne()) { - return false; - } else { - return !visible->AllSameAs(1); - } -} - -const char *ContractionState::GetFoldDisplayText(int lineDoc) const { - Check(); - return foldDisplayTexts->ValueAt(lineDoc); -} - -bool ContractionState::SetFoldDisplayText(int lineDoc, const char *text) { - EnsureData(); - const char *foldText = foldDisplayTexts->ValueAt(lineDoc); - if (!foldText || 0 != strcmp(text, foldText)) { - foldDisplayTexts->SetValueAt(lineDoc, text); - Check(); - return true; - } else { - Check(); - return false; - } -} - -bool ContractionState::GetExpanded(int lineDoc) const { - if (OneToOne()) { - return true; - } else { - Check(); - return expanded->ValueAt(lineDoc) == 1; - } -} - -bool ContractionState::SetExpanded(int lineDoc, bool isExpanded) { - if (OneToOne() && isExpanded) { - return false; - } else { - EnsureData(); - if (isExpanded != (expanded->ValueAt(lineDoc) == 1)) { - expanded->SetValueAt(lineDoc, isExpanded ? 1 : 0); - Check(); - return true; - } else { - Check(); - return false; - } - } -} - -bool ContractionState::GetFoldDisplayTextShown(int lineDoc) const { - return !GetExpanded(lineDoc) && GetFoldDisplayText(lineDoc); -} - -int ContractionState::ContractedNext(int lineDocStart) const { - if (OneToOne()) { - return -1; - } else { - Check(); - if (!expanded->ValueAt(lineDocStart)) { - return lineDocStart; - } else { - int lineDocNextChange = expanded->EndRun(lineDocStart); - if (lineDocNextChange < LinesInDoc()) - return lineDocNextChange; - else - return -1; - } - } -} - -int ContractionState::GetHeight(int lineDoc) const { - if (OneToOne()) { - return 1; - } else { - return heights->ValueAt(lineDoc); - } -} - -// Set the number of display lines needed for this line. -// Return true if this is a change. -bool ContractionState::SetHeight(int lineDoc, int height) { - if (OneToOne() && (height == 1)) { - return false; - } else if (lineDoc < LinesInDoc()) { - EnsureData(); - if (GetHeight(lineDoc) != height) { - if (GetVisible(lineDoc)) { - displayLines->InsertText(lineDoc, height - GetHeight(lineDoc)); - } - heights->SetValueAt(lineDoc, height); - Check(); - return true; - } else { - Check(); - return false; - } - } else { - return false; - } -} - -void ContractionState::ShowAll() { - int lines = LinesInDoc(); - Clear(); - linesInDocument = lines; -} - -// Debugging checks - -void ContractionState::Check() const { -#ifdef CHECK_CORRECTNESS - for (int vline = 0; vline < LinesDisplayed(); vline++) { - const int lineDoc = DocFromDisplay(vline); - PLATFORM_ASSERT(GetVisible(lineDoc)); - } - for (int lineDoc = 0; lineDoc < LinesInDoc(); lineDoc++) { - const int displayThis = DisplayFromDoc(lineDoc); - const int displayNext = DisplayFromDoc(lineDoc + 1); - const int height = displayNext - displayThis; - PLATFORM_ASSERT(height >= 0); - if (GetVisible(lineDoc)) { - PLATFORM_ASSERT(GetHeight(lineDoc) == height); - } else { - PLATFORM_ASSERT(0 == height); - } - } -#endif -} diff --git a/qrenderdoc/3rdparty/scintilla/src/ContractionState.h b/qrenderdoc/3rdparty/scintilla/src/ContractionState.h deleted file mode 100644 index 622696939..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/ContractionState.h +++ /dev/null @@ -1,77 +0,0 @@ -// Scintilla source code edit control -/** @file ContractionState.h - ** Manages visibility of lines for folding and wrapping. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CONTRACTIONSTATE_H -#define CONTRACTIONSTATE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -template -class SparseVector; - -/** - */ -class ContractionState { - // These contain 1 element for every document line. - RunStyles *visible; - RunStyles *expanded; - RunStyles *heights; - SparseVector *foldDisplayTexts; - Partitioning *displayLines; - int linesInDocument; - - void EnsureData(); - - bool OneToOne() const { - // True when each document line is exactly one display line so need for - // complex data structures. - return visible == 0; - } - -public: - ContractionState(); - virtual ~ContractionState(); - - void Clear(); - - int LinesInDoc() const; - int LinesDisplayed() const; - int DisplayFromDoc(int lineDoc) const; - int DisplayLastFromDoc(int lineDoc) const; - int DocFromDisplay(int lineDisplay) const; - - void InsertLine(int lineDoc); - void InsertLines(int lineDoc, int lineCount); - void DeleteLine(int lineDoc); - void DeleteLines(int lineDoc, int lineCount); - - bool GetVisible(int lineDoc) const; - bool SetVisible(int lineDocStart, int lineDocEnd, bool isVisible); - bool HiddenLines() const; - - const char *GetFoldDisplayText(int lineDoc) const; - bool SetFoldDisplayText(int lineDoc, const char *text); - - bool GetExpanded(int lineDoc) const; - bool SetExpanded(int lineDoc, bool isExpanded); - bool GetFoldDisplayTextShown(int lineDoc) const; - int ContractedNext(int lineDocStart) const; - - int GetHeight(int lineDoc) const; - bool SetHeight(int lineDoc, int height); - - void ShowAll(); - void Check() const; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/Decoration.cxx b/qrenderdoc/3rdparty/scintilla/src/Decoration.cxx deleted file mode 100644 index 389db5029..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Decoration.cxx +++ /dev/null @@ -1,198 +0,0 @@ -/** @file Decoration.cxx - ** Visual elements added over text. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "Decoration.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -Decoration::Decoration(int indicator_) : next(0), indicator(indicator_) { -} - -Decoration::~Decoration() { -} - -bool Decoration::Empty() const { - return (rs.Runs() == 1) && (rs.AllSameAs(0)); -} - -DecorationList::DecorationList() : currentIndicator(0), currentValue(1), current(0), - lengthDocument(0), root(0), clickNotified(false) { -} - -DecorationList::~DecorationList() { - Decoration *deco = root; - while (deco) { - Decoration *decoNext = deco->next; - delete deco; - deco = decoNext; - } - root = 0; - current = 0; -} - -Decoration *DecorationList::DecorationFromIndicator(int indicator) { - for (Decoration *deco=root; deco; deco = deco->next) { - if (deco->indicator == indicator) { - return deco; - } - } - return 0; -} - -Decoration *DecorationList::Create(int indicator, int length) { - currentIndicator = indicator; - Decoration *decoNew = new Decoration(indicator); - decoNew->rs.InsertSpace(0, length); - - Decoration *decoPrev = 0; - Decoration *deco = root; - - while (deco && (deco->indicator < indicator)) { - decoPrev = deco; - deco = deco->next; - } - if (decoPrev == 0) { - decoNew->next = root; - root = decoNew; - } else { - decoNew->next = deco; - decoPrev->next = decoNew; - } - return decoNew; -} - -void DecorationList::Delete(int indicator) { - Decoration *decoToDelete = 0; - if (root) { - if (root->indicator == indicator) { - decoToDelete = root; - root = root->next; - } else { - Decoration *deco=root; - while (deco->next && !decoToDelete) { - if (deco->next && deco->next->indicator == indicator) { - decoToDelete = deco->next; - deco->next = decoToDelete->next; - } else { - deco = deco->next; - } - } - } - } - if (decoToDelete) { - delete decoToDelete; - current = 0; - } -} - -void DecorationList::SetCurrentIndicator(int indicator) { - currentIndicator = indicator; - current = DecorationFromIndicator(indicator); - currentValue = 1; -} - -void DecorationList::SetCurrentValue(int value) { - currentValue = value ? value : 1; -} - -bool DecorationList::FillRange(int &position, int value, int &fillLength) { - if (!current) { - current = DecorationFromIndicator(currentIndicator); - if (!current) { - current = Create(currentIndicator, lengthDocument); - } - } - bool changed = current->rs.FillRange(position, value, fillLength); - if (current->Empty()) { - Delete(currentIndicator); - } - return changed; -} - -void DecorationList::InsertSpace(int position, int insertLength) { - const bool atEnd = position == lengthDocument; - lengthDocument += insertLength; - for (Decoration *deco=root; deco; deco = deco->next) { - deco->rs.InsertSpace(position, insertLength); - if (atEnd) { - deco->rs.FillRange(position, 0, insertLength); - } - } -} - -void DecorationList::DeleteRange(int position, int deleteLength) { - lengthDocument -= deleteLength; - Decoration *deco; - for (deco=root; deco; deco = deco->next) { - deco->rs.DeleteRange(position, deleteLength); - } - DeleteAnyEmpty(); -} - -void DecorationList::DeleteAnyEmpty() { - Decoration *deco = root; - while (deco) { - if ((lengthDocument == 0) || deco->Empty()) { - Delete(deco->indicator); - deco = root; - } else { - deco = deco->next; - } - } -} - -int DecorationList::AllOnFor(int position) const { - int mask = 0; - for (Decoration *deco=root; deco; deco = deco->next) { - if (deco->rs.ValueAt(position)) { - if (deco->indicator < INDIC_IME) { - mask |= 1 << deco->indicator; - } - } - } - return mask; -} - -int DecorationList::ValueAt(int indicator, int position) { - Decoration *deco = DecorationFromIndicator(indicator); - if (deco) { - return deco->rs.ValueAt(position); - } - return 0; -} - -int DecorationList::Start(int indicator, int position) { - Decoration *deco = DecorationFromIndicator(indicator); - if (deco) { - return deco->rs.StartRun(position); - } - return 0; -} - -int DecorationList::End(int indicator, int position) { - Decoration *deco = DecorationFromIndicator(indicator); - if (deco) { - return deco->rs.EndRun(position); - } - return 0; -} diff --git a/qrenderdoc/3rdparty/scintilla/src/Decoration.h b/qrenderdoc/3rdparty/scintilla/src/Decoration.h deleted file mode 100644 index a0c434af8..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Decoration.h +++ /dev/null @@ -1,64 +0,0 @@ -/** @file Decoration.h - ** Visual elements added over text. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef DECORATION_H -#define DECORATION_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class Decoration { -public: - Decoration *next; - RunStyles rs; - int indicator; - - explicit Decoration(int indicator_); - ~Decoration(); - - bool Empty() const; -}; - -class DecorationList { - int currentIndicator; - int currentValue; - Decoration *current; - int lengthDocument; - Decoration *DecorationFromIndicator(int indicator); - Decoration *Create(int indicator, int length); - void Delete(int indicator); - void DeleteAnyEmpty(); -public: - Decoration *root; - bool clickNotified; - - DecorationList(); - ~DecorationList(); - - void SetCurrentIndicator(int indicator); - int GetCurrentIndicator() const { return currentIndicator; } - - void SetCurrentValue(int value); - int GetCurrentValue() const { return currentValue; } - - // Returns true if some values may have changed - bool FillRange(int &position, int value, int &fillLength); - - void InsertSpace(int position, int insertLength); - void DeleteRange(int position, int deleteLength); - - int AllOnFor(int position) const; - int ValueAt(int indicator, int position); - int Start(int indicator, int position); - int End(int indicator, int position); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/Document.cxx b/qrenderdoc/3rdparty/scintilla/src/Document.cxx deleted file mode 100644 index c105bdda3..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Document.cxx +++ /dev/null @@ -1,3081 +0,0 @@ -// Scintilla source code edit control -/** @file Document.cxx - ** Text document that handles notifications, DBCS, styling, words and end of line. - **/ -// Copyright 1998-2011 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define NOEXCEPT - -#ifndef NO_CXX11_REGEX -#include -#if defined(__GLIBCXX__) -// If using the GNU implementation of then have 'noexcept' so can use -// when defining regex iterators to keep Clang analyze happy. -#undef NOEXCEPT -#define NOEXCEPT noexcept -#endif -#endif - -#include "Platform.h" - -#include "ILexer.h" -#include "Scintilla.h" - -#include "CharacterSet.h" -#include "CharacterCategory.h" -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "CellBuffer.h" -#include "PerLine.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "CaseFolder.h" -#include "Document.h" -#include "RESearch.h" -#include "UniConversion.h" -#include "UnicodeFromUTF8.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -void LexInterface::Colourise(int start, int end) { - if (pdoc && instance && !performingStyle) { - // Protect against reentrance, which may occur, for example, when - // fold points are discovered while performing styling and the folding - // code looks for child lines which may trigger styling. - performingStyle = true; - - int lengthDoc = pdoc->Length(); - if (end == -1) - end = lengthDoc; - int len = end - start; - - PLATFORM_ASSERT(len >= 0); - PLATFORM_ASSERT(start + len <= lengthDoc); - - int styleStart = 0; - if (start > 0) - styleStart = pdoc->StyleAt(start - 1); - - if (len > 0) { - instance->Lex(start, len, styleStart, pdoc); - instance->Fold(start, len, styleStart, pdoc); - } - - performingStyle = false; - } -} - -int LexInterface::LineEndTypesSupported() { - if (instance) { - int interfaceVersion = instance->Version(); - if (interfaceVersion >= lvSubStyles) { - ILexerWithSubStyles *ssinstance = static_cast(instance); - return ssinstance->LineEndTypesSupported(); - } - } - return 0; -} - -Document::Document() { - refCount = 0; - pcf = NULL; -#ifdef _WIN32 - eolMode = SC_EOL_CRLF; -#else - eolMode = SC_EOL_LF; -#endif - dbcsCodePage = 0; - lineEndBitSet = SC_LINE_END_TYPE_DEFAULT; - endStyled = 0; - styleClock = 0; - enteredModification = 0; - enteredStyling = 0; - enteredReadOnlyCount = 0; - insertionSet = false; - tabInChars = 8; - indentInChars = 0; - actualIndentInChars = 8; - useTabs = true; - tabIndents = true; - backspaceUnindents = false; - durationStyleOneLine = 0.00001; - - matchesValid = false; - regex = 0; - - UTF8BytesOfLeadInitialise(); - - perLineData[ldMarkers] = new LineMarkers(); - perLineData[ldLevels] = new LineLevels(); - perLineData[ldState] = new LineState(); - perLineData[ldMargin] = new LineAnnotation(); - perLineData[ldAnnotation] = new LineAnnotation(); - - cb.SetPerLine(this); - - pli = 0; -} - -Document::~Document() { - for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { - it->watcher->NotifyDeleted(this, it->userData); - } - for (int j=0; jInit(); - } -} - -int Document::LineEndTypesSupported() const { - if ((SC_CP_UTF8 == dbcsCodePage) && pli) - return pli->LineEndTypesSupported(); - else - return 0; -} - -bool Document::SetDBCSCodePage(int dbcsCodePage_) { - if (dbcsCodePage != dbcsCodePage_) { - dbcsCodePage = dbcsCodePage_; - SetCaseFolder(NULL); - cb.SetLineEndTypes(lineEndBitSet & LineEndTypesSupported()); - return true; - } else { - return false; - } -} - -bool Document::SetLineEndTypesAllowed(int lineEndBitSet_) { - if (lineEndBitSet != lineEndBitSet_) { - lineEndBitSet = lineEndBitSet_; - int lineEndBitSetActive = lineEndBitSet & LineEndTypesSupported(); - if (lineEndBitSetActive != cb.GetLineEndTypes()) { - ModifiedAt(0); - cb.SetLineEndTypes(lineEndBitSetActive); - return true; - } else { - return false; - } - } else { - return false; - } -} - -void Document::InsertLine(int line) { - for (int j=0; jInsertLine(line); - } -} - -void Document::RemoveLine(int line) { - for (int j=0; jRemoveLine(line); - } -} - -// Increase reference count and return its previous value. -int Document::AddRef() { - return refCount++; -} - -// Decrease reference count and return its previous value. -// Delete the document if reference count reaches zero. -int SCI_METHOD Document::Release() { - int curRefCount = --refCount; - if (curRefCount == 0) - delete this; - return curRefCount; -} - -void Document::SetSavePoint() { - cb.SetSavePoint(); - NotifySavePoint(true); -} - -void Document::TentativeUndo() { - if (!TentativeActive()) - return; - CheckReadOnly(); - if (enteredModification == 0) { - enteredModification++; - if (!cb.IsReadOnly()) { - bool startSavePoint = cb.IsSavePoint(); - bool multiLine = false; - int steps = cb.TentativeSteps(); - //Platform::DebugPrintf("Steps=%d\n", steps); - for (int step = 0; step < steps; step++) { - const int prevLinesTotal = LinesTotal(); - const Action &action = cb.GetUndoStep(); - if (action.at == removeAction) { - NotifyModified(DocModification( - SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); - } else if (action.at == containerAction) { - DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_UNDO); - dm.token = action.position; - NotifyModified(dm); - } else { - NotifyModified(DocModification( - SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); - } - cb.PerformUndoStep(); - if (action.at != containerAction) { - ModifiedAt(action.position); - } - - int modFlags = SC_PERFORMED_UNDO; - // With undo, an insertion action becomes a deletion notification - if (action.at == removeAction) { - modFlags |= SC_MOD_INSERTTEXT; - } else if (action.at == insertAction) { - modFlags |= SC_MOD_DELETETEXT; - } - if (steps > 1) - modFlags |= SC_MULTISTEPUNDOREDO; - const int linesAdded = LinesTotal() - prevLinesTotal; - if (linesAdded != 0) - multiLine = true; - if (step == steps - 1) { - modFlags |= SC_LASTSTEPINUNDOREDO; - if (multiLine) - modFlags |= SC_MULTILINEUNDOREDO; - } - NotifyModified(DocModification(modFlags, action.position, action.lenData, - linesAdded, action.data)); - } - - bool endSavePoint = cb.IsSavePoint(); - if (startSavePoint != endSavePoint) - NotifySavePoint(endSavePoint); - - cb.TentativeCommit(); - } - enteredModification--; - } -} - -int Document::GetMark(int line) { - return static_cast(perLineData[ldMarkers])->MarkValue(line); -} - -int Document::MarkerNext(int lineStart, int mask) const { - return static_cast(perLineData[ldMarkers])->MarkerNext(lineStart, mask); -} - -int Document::AddMark(int line, int markerNum) { - if (line >= 0 && line <= LinesTotal()) { - int prev = static_cast(perLineData[ldMarkers])-> - AddMark(line, markerNum, LinesTotal()); - DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - NotifyModified(mh); - return prev; - } else { - return 0; - } -} - -void Document::AddMarkSet(int line, int valueSet) { - if (line < 0 || line > LinesTotal()) { - return; - } - unsigned int m = valueSet; - for (int i = 0; m; i++, m >>= 1) - if (m & 1) - static_cast(perLineData[ldMarkers])-> - AddMark(line, i, LinesTotal()); - DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - NotifyModified(mh); -} - -void Document::DeleteMark(int line, int markerNum) { - static_cast(perLineData[ldMarkers])->DeleteMark(line, markerNum, false); - DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - NotifyModified(mh); -} - -void Document::DeleteMarkFromHandle(int markerHandle) { - static_cast(perLineData[ldMarkers])->DeleteMarkFromHandle(markerHandle); - DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); - mh.line = -1; - NotifyModified(mh); -} - -void Document::DeleteAllMarks(int markerNum) { - bool someChanges = false; - for (int line = 0; line < LinesTotal(); line++) { - if (static_cast(perLineData[ldMarkers])->DeleteMark(line, markerNum, true)) - someChanges = true; - } - if (someChanges) { - DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); - mh.line = -1; - NotifyModified(mh); - } -} - -int Document::LineFromHandle(int markerHandle) { - return static_cast(perLineData[ldMarkers])->LineFromHandle(markerHandle); -} - -Sci_Position SCI_METHOD Document::LineStart(Sci_Position line) const { - return cb.LineStart(line); -} - -bool Document::IsLineStartPosition(int position) const { - return LineStart(LineFromPosition(position)) == position; -} - -Sci_Position SCI_METHOD Document::LineEnd(Sci_Position line) const { - if (line >= LinesTotal() - 1) { - return LineStart(line + 1); - } else { - int position = LineStart(line + 1); - if (SC_CP_UTF8 == dbcsCodePage) { - unsigned char bytes[] = { - static_cast(cb.CharAt(position-3)), - static_cast(cb.CharAt(position-2)), - static_cast(cb.CharAt(position-1)), - }; - if (UTF8IsSeparator(bytes)) { - return position - UTF8SeparatorLength; - } - if (UTF8IsNEL(bytes+1)) { - return position - UTF8NELLength; - } - } - position--; // Back over CR or LF - // When line terminator is CR+LF, may need to go back one more - if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) { - position--; - } - return position; - } -} - -void SCI_METHOD Document::SetErrorStatus(int status) { - // Tell the watchers an error has occurred. - for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { - it->watcher->NotifyErrorOccurred(this, it->userData, status); - } -} - -Sci_Position SCI_METHOD Document::LineFromPosition(Sci_Position pos) const { - return cb.LineFromPosition(pos); -} - -int Document::LineEndPosition(int position) const { - return LineEnd(LineFromPosition(position)); -} - -bool Document::IsLineEndPosition(int position) const { - return LineEnd(LineFromPosition(position)) == position; -} - -bool Document::IsPositionInLineEnd(int position) const { - return position >= LineEnd(LineFromPosition(position)); -} - -int Document::VCHomePosition(int position) const { - int line = LineFromPosition(position); - int startPosition = LineStart(line); - int endLine = LineEnd(line); - int startText = startPosition; - while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t')) - startText++; - if (position == startText) - return startPosition; - else - return startText; -} - -int SCI_METHOD Document::SetLevel(Sci_Position line, int level) { - int prev = static_cast(perLineData[ldLevels])->SetLevel(line, level, LinesTotal()); - if (prev != level) { - DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, - LineStart(line), 0, 0, 0, line); - mh.foldLevelNow = level; - mh.foldLevelPrev = prev; - NotifyModified(mh); - } - return prev; -} - -int SCI_METHOD Document::GetLevel(Sci_Position line) const { - return static_cast(perLineData[ldLevels])->GetLevel(line); -} - -void Document::ClearLevels() { - static_cast(perLineData[ldLevels])->ClearLevels(); -} - -static bool IsSubordinate(int levelStart, int levelTry) { - if (levelTry & SC_FOLDLEVELWHITEFLAG) - return true; - else - return LevelNumber(levelStart) < LevelNumber(levelTry); -} - -int Document::GetLastChild(int lineParent, int level, int lastLine) { - if (level == -1) - level = LevelNumber(GetLevel(lineParent)); - int maxLine = LinesTotal(); - int lookLastLine = (lastLine != -1) ? Platform::Minimum(LinesTotal() - 1, lastLine) : -1; - int lineMaxSubord = lineParent; - while (lineMaxSubord < maxLine - 1) { - EnsureStyledTo(LineStart(lineMaxSubord + 2)); - if (!IsSubordinate(level, GetLevel(lineMaxSubord + 1))) - break; - if ((lookLastLine != -1) && (lineMaxSubord >= lookLastLine) && !(GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG)) - break; - lineMaxSubord++; - } - if (lineMaxSubord > lineParent) { - if (level > LevelNumber(GetLevel(lineMaxSubord + 1))) { - // Have chewed up some whitespace that belongs to a parent so seek back - if (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG) { - lineMaxSubord--; - } - } - } - return lineMaxSubord; -} - -int Document::GetFoldParent(int line) const { - int level = LevelNumber(GetLevel(line)); - int lineLook = line - 1; - while ((lineLook > 0) && ( - (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || - (LevelNumber(GetLevel(lineLook)) >= level)) - ) { - lineLook--; - } - if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) && - (LevelNumber(GetLevel(lineLook)) < level)) { - return lineLook; - } else { - return -1; - } -} - -void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, int line, int lastLine) { - int level = GetLevel(line); - int lookLastLine = Platform::Maximum(line, lastLine) + 1; - - int lookLine = line; - int lookLineLevel = level; - int lookLineLevelNum = LevelNumber(lookLineLevel); - while ((lookLine > 0) && ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || - ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum >= LevelNumber(GetLevel(lookLine + 1)))))) { - lookLineLevel = GetLevel(--lookLine); - lookLineLevelNum = LevelNumber(lookLineLevel); - } - - int beginFoldBlock = (lookLineLevel & SC_FOLDLEVELHEADERFLAG) ? lookLine : GetFoldParent(lookLine); - if (beginFoldBlock == -1) { - highlightDelimiter.Clear(); - return; - } - - int endFoldBlock = GetLastChild(beginFoldBlock, -1, lookLastLine); - int firstChangeableLineBefore = -1; - if (endFoldBlock < line) { - lookLine = beginFoldBlock - 1; - lookLineLevel = GetLevel(lookLine); - lookLineLevelNum = LevelNumber(lookLineLevel); - while ((lookLine >= 0) && (lookLineLevelNum >= SC_FOLDLEVELBASE)) { - if (lookLineLevel & SC_FOLDLEVELHEADERFLAG) { - if (GetLastChild(lookLine, -1, lookLastLine) == line) { - beginFoldBlock = lookLine; - endFoldBlock = line; - firstChangeableLineBefore = line - 1; - } - } - if ((lookLine > 0) && (lookLineLevelNum == SC_FOLDLEVELBASE) && (LevelNumber(GetLevel(lookLine - 1)) > lookLineLevelNum)) - break; - lookLineLevel = GetLevel(--lookLine); - lookLineLevelNum = LevelNumber(lookLineLevel); - } - } - if (firstChangeableLineBefore == -1) { - for (lookLine = line - 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = LevelNumber(lookLineLevel); - lookLine >= beginFoldBlock; - lookLineLevel = GetLevel(--lookLine), lookLineLevelNum = LevelNumber(lookLineLevel)) { - if ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || (lookLineLevelNum > LevelNumber(level))) { - firstChangeableLineBefore = lookLine; - break; - } - } - } - if (firstChangeableLineBefore == -1) - firstChangeableLineBefore = beginFoldBlock - 1; - - int firstChangeableLineAfter = -1; - for (lookLine = line + 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = LevelNumber(lookLineLevel); - lookLine <= endFoldBlock; - lookLineLevel = GetLevel(++lookLine), lookLineLevelNum = LevelNumber(lookLineLevel)) { - if ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum < LevelNumber(GetLevel(lookLine + 1)))) { - firstChangeableLineAfter = lookLine; - break; - } - } - if (firstChangeableLineAfter == -1) - firstChangeableLineAfter = endFoldBlock + 1; - - highlightDelimiter.beginFoldBlock = beginFoldBlock; - highlightDelimiter.endFoldBlock = endFoldBlock; - highlightDelimiter.firstChangeableLineBefore = firstChangeableLineBefore; - highlightDelimiter.firstChangeableLineAfter = firstChangeableLineAfter; -} - -int Document::ClampPositionIntoDocument(int pos) const { - return Platform::Clamp(pos, 0, Length()); -} - -bool Document::IsCrLf(int pos) const { - if (pos < 0) - return false; - if (pos >= (Length() - 1)) - return false; - return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n'); -} - -int Document::LenChar(int pos) { - if (pos < 0) { - return 1; - } else if (IsCrLf(pos)) { - return 2; - } else if (SC_CP_UTF8 == dbcsCodePage) { - const unsigned char leadByte = static_cast(cb.CharAt(pos)); - const int widthCharBytes = UTF8BytesOfLead[leadByte]; - int lengthDoc = Length(); - if ((pos + widthCharBytes) > lengthDoc) - return lengthDoc - pos; - else - return widthCharBytes; - } else if (dbcsCodePage) { - return IsDBCSLeadByte(cb.CharAt(pos)) ? 2 : 1; - } else { - return 1; - } -} - -bool Document::InGoodUTF8(int pos, int &start, int &end) const { - int trail = pos; - while ((trail>0) && (pos-trail < UTF8MaxBytes) && UTF8IsTrailByte(static_cast(cb.CharAt(trail-1)))) - trail--; - start = (trail > 0) ? trail-1 : trail; - - const unsigned char leadByte = static_cast(cb.CharAt(start)); - const int widthCharBytes = UTF8BytesOfLead[leadByte]; - if (widthCharBytes == 1) { - return false; - } else { - int trailBytes = widthCharBytes - 1; - int len = pos - start; - if (len > trailBytes) - // pos too far from lead - return false; - char charBytes[UTF8MaxBytes] = {static_cast(leadByte),0,0,0}; - for (int b=1; b(start+b)); - int utf8status = UTF8Classify(reinterpret_cast(charBytes), widthCharBytes); - if (utf8status & UTF8MaskInvalid) - return false; - end = start + widthCharBytes; - return true; - } -} - -// Normalise a position so that it is not halfway through a two byte character. -// This can occur in two situations - -// When lines are terminated with \r\n pairs which should be treated as one character. -// When displaying DBCS text such as Japanese. -// If moving, move the position in the indicated direction. -int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) const { - //Platform::DebugPrintf("NoCRLF %d %d\n", pos, moveDir); - // If out of range, just return minimum/maximum value. - if (pos <= 0) - return 0; - if (pos >= Length()) - return Length(); - - // PLATFORM_ASSERT(pos > 0 && pos < Length()); - if (checkLineEnd && IsCrLf(pos - 1)) { - if (moveDir > 0) - return pos + 1; - else - return pos - 1; - } - - if (dbcsCodePage) { - if (SC_CP_UTF8 == dbcsCodePage) { - unsigned char ch = static_cast(cb.CharAt(pos)); - // If ch is not a trail byte then pos is valid intercharacter position - if (UTF8IsTrailByte(ch)) { - int startUTF = pos; - int endUTF = pos; - if (InGoodUTF8(pos, startUTF, endUTF)) { - // ch is a trail byte within a UTF-8 character - if (moveDir > 0) - pos = endUTF; - else - pos = startUTF; - } - // Else invalid UTF-8 so return position of isolated trail byte - } - } else { - // Anchor DBCS calculations at start of line because start of line can - // not be a DBCS trail byte. - int posStartLine = LineStart(LineFromPosition(pos)); - if (pos == posStartLine) - return pos; - - // Step back until a non-lead-byte is found. - int posCheck = pos; - while ((posCheck > posStartLine) && IsDBCSLeadByte(cb.CharAt(posCheck-1))) - posCheck--; - - // Check from known start of character. - while (posCheck < pos) { - int mbsize = IsDBCSLeadByte(cb.CharAt(posCheck)) ? 2 : 1; - if (posCheck + mbsize == pos) { - return pos; - } else if (posCheck + mbsize > pos) { - if (moveDir > 0) { - return posCheck + mbsize; - } else { - return posCheck; - } - } - posCheck += mbsize; - } - } - } - - return pos; -} - -// NextPosition moves between valid positions - it can not handle a position in the middle of a -// multi-byte character. It is used to iterate through text more efficiently than MovePositionOutsideChar. -// A \r\n pair is treated as two characters. -int Document::NextPosition(int pos, int moveDir) const { - // If out of range, just return minimum/maximum value. - int increment = (moveDir > 0) ? 1 : -1; - if (pos + increment <= 0) - return 0; - if (pos + increment >= Length()) - return Length(); - - if (dbcsCodePage) { - if (SC_CP_UTF8 == dbcsCodePage) { - if (increment == 1) { - // Simple forward movement case so can avoid some checks - const unsigned char leadByte = static_cast(cb.CharAt(pos)); - if (UTF8IsAscii(leadByte)) { - // Single byte character or invalid - pos++; - } else { - const int widthCharBytes = UTF8BytesOfLead[leadByte]; - char charBytes[UTF8MaxBytes] = {static_cast(leadByte),0,0,0}; - for (int b=1; b(pos+b)); - int utf8status = UTF8Classify(reinterpret_cast(charBytes), widthCharBytes); - if (utf8status & UTF8MaskInvalid) - pos++; - else - pos += utf8status & UTF8MaskWidth; - } - } else { - // Examine byte before position - pos--; - unsigned char ch = static_cast(cb.CharAt(pos)); - // If ch is not a trail byte then pos is valid intercharacter position - if (UTF8IsTrailByte(ch)) { - // If ch is a trail byte in a valid UTF-8 character then return start of character - int startUTF = pos; - int endUTF = pos; - if (InGoodUTF8(pos, startUTF, endUTF)) { - pos = startUTF; - } - // Else invalid UTF-8 so return position of isolated trail byte - } - } - } else { - if (moveDir > 0) { - int mbsize = IsDBCSLeadByte(cb.CharAt(pos)) ? 2 : 1; - pos += mbsize; - if (pos > Length()) - pos = Length(); - } else { - // Anchor DBCS calculations at start of line because start of line can - // not be a DBCS trail byte. - int posStartLine = LineStart(LineFromPosition(pos)); - // See http://msdn.microsoft.com/en-us/library/cc194792%28v=MSDN.10%29.aspx - // http://msdn.microsoft.com/en-us/library/cc194790.aspx - if ((pos - 1) <= posStartLine) { - return pos - 1; - } else if (IsDBCSLeadByte(cb.CharAt(pos - 1))) { - // Must actually be trail byte - return pos - 2; - } else { - // Otherwise, step back until a non-lead-byte is found. - int posTemp = pos - 1; - while (posStartLine <= --posTemp && IsDBCSLeadByte(cb.CharAt(posTemp))) - ; - // Now posTemp+1 must point to the beginning of a character, - // so figure out whether we went back an even or an odd - // number of bytes and go back 1 or 2 bytes, respectively. - return (pos - 1 - ((pos - posTemp) & 1)); - } - } - } - } else { - pos += increment; - } - - return pos; -} - -bool Document::NextCharacter(int &pos, int moveDir) const { - // Returns true if pos changed - int posNext = NextPosition(pos, moveDir); - if (posNext == pos) { - return false; - } else { - pos = posNext; - return true; - } -} - -Document::CharacterExtracted Document::CharacterAfter(int position) const { - if (position >= Length()) { - return CharacterExtracted(unicodeReplacementChar, 0); - } - const unsigned char leadByte = static_cast(cb.CharAt(position)); - if (!dbcsCodePage || UTF8IsAscii(leadByte)) { - // Common case: ASCII character - return CharacterExtracted(leadByte, 1); - } - if (SC_CP_UTF8 == dbcsCodePage) { - const int widthCharBytes = UTF8BytesOfLead[leadByte]; - unsigned char charBytes[UTF8MaxBytes] = { leadByte, 0, 0, 0 }; - for (int b = 1; b(cb.CharAt(position + b)); - int utf8status = UTF8Classify(charBytes, widthCharBytes); - if (utf8status & UTF8MaskInvalid) { - // Treat as invalid and use up just one byte - return CharacterExtracted(unicodeReplacementChar, 1); - } else { - return CharacterExtracted(UnicodeFromUTF8(charBytes), utf8status & UTF8MaskWidth); - } - } else { - if (IsDBCSLeadByte(leadByte) && ((position + 1) < Length())) { - return CharacterExtracted::DBCS(leadByte, static_cast(cb.CharAt(position + 1))); - } else { - return CharacterExtracted(leadByte, 1); - } - } -} - -Document::CharacterExtracted Document::CharacterBefore(int position) const { - if (position <= 0) { - return CharacterExtracted(unicodeReplacementChar, 0); - } - const unsigned char previousByte = static_cast(cb.CharAt(position - 1)); - if (0 == dbcsCodePage) { - return CharacterExtracted(previousByte, 1); - } - if (SC_CP_UTF8 == dbcsCodePage) { - if (UTF8IsAscii(previousByte)) { - return CharacterExtracted(previousByte, 1); - } - position--; - // If previousByte is not a trail byte then its invalid - if (UTF8IsTrailByte(previousByte)) { - // If previousByte is a trail byte in a valid UTF-8 character then find start of character - int startUTF = position; - int endUTF = position; - if (InGoodUTF8(position, startUTF, endUTF)) { - const int widthCharBytes = endUTF - startUTF; - unsigned char charBytes[UTF8MaxBytes] = { 0, 0, 0, 0 }; - for (int b = 0; b(cb.CharAt(startUTF + b)); - int utf8status = UTF8Classify(charBytes, widthCharBytes); - if (utf8status & UTF8MaskInvalid) { - // Treat as invalid and use up just one byte - return CharacterExtracted(unicodeReplacementChar, 1); - } else { - return CharacterExtracted(UnicodeFromUTF8(charBytes), utf8status & UTF8MaskWidth); - } - } - // Else invalid UTF-8 so return position of isolated trail byte - } - return CharacterExtracted(unicodeReplacementChar, 1); - } else { - // Moving backwards in DBCS is complex so use NextPosition - const int posStartCharacter = NextPosition(position, -1); - return CharacterAfter(posStartCharacter); - } -} - -// Return -1 on out-of-bounds -Sci_Position SCI_METHOD Document::GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const { - int pos = positionStart; - if (dbcsCodePage) { - const int increment = (characterOffset > 0) ? 1 : -1; - while (characterOffset != 0) { - const int posNext = NextPosition(pos, increment); - if (posNext == pos) - return INVALID_POSITION; - pos = posNext; - characterOffset -= increment; - } - } else { - pos = positionStart + characterOffset; - if ((pos < 0) || (pos > Length())) - return INVALID_POSITION; - } - return pos; -} - -int Document::GetRelativePositionUTF16(int positionStart, int characterOffset) const { - int pos = positionStart; - if (dbcsCodePage) { - const int increment = (characterOffset > 0) ? 1 : -1; - while (characterOffset != 0) { - const int posNext = NextPosition(pos, increment); - if (posNext == pos) - return INVALID_POSITION; - if (abs(pos-posNext) > 3) // 4 byte character = 2*UTF16. - characterOffset -= increment; - pos = posNext; - characterOffset -= increment; - } - } else { - pos = positionStart + characterOffset; - if ((pos < 0) || (pos > Length())) - return INVALID_POSITION; - } - return pos; -} - -int SCI_METHOD Document::GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const { - int character; - int bytesInCharacter = 1; - if (dbcsCodePage) { - const unsigned char leadByte = static_cast(cb.CharAt(position)); - if (SC_CP_UTF8 == dbcsCodePage) { - if (UTF8IsAscii(leadByte)) { - // Single byte character or invalid - character = leadByte; - } else { - const int widthCharBytes = UTF8BytesOfLead[leadByte]; - unsigned char charBytes[UTF8MaxBytes] = {leadByte,0,0,0}; - for (int b=1; b(cb.CharAt(position+b)); - int utf8status = UTF8Classify(charBytes, widthCharBytes); - if (utf8status & UTF8MaskInvalid) { - // Report as singleton surrogate values which are invalid Unicode - character = 0xDC80 + leadByte; - } else { - bytesInCharacter = utf8status & UTF8MaskWidth; - character = UnicodeFromUTF8(charBytes); - } - } - } else { - if (IsDBCSLeadByte(leadByte)) { - bytesInCharacter = 2; - character = (leadByte << 8) | static_cast(cb.CharAt(position+1)); - } else { - character = leadByte; - } - } - } else { - character = cb.CharAt(position); - } - if (pWidth) { - *pWidth = bytesInCharacter; - } - return character; -} - -int SCI_METHOD Document::CodePage() const { - return dbcsCodePage; -} - -bool SCI_METHOD Document::IsDBCSLeadByte(char ch) const { - // Byte ranges found in Wikipedia articles with relevant search strings in each case - unsigned char uch = static_cast(ch); - switch (dbcsCodePage) { - case 932: - // Shift_jis - return ((uch >= 0x81) && (uch <= 0x9F)) || - ((uch >= 0xE0) && (uch <= 0xFC)); - // Lead bytes F0 to FC may be a Microsoft addition. - case 936: - // GBK - return (uch >= 0x81) && (uch <= 0xFE); - case 949: - // Korean Wansung KS C-5601-1987 - return (uch >= 0x81) && (uch <= 0xFE); - case 950: - // Big5 - return (uch >= 0x81) && (uch <= 0xFE); - case 1361: - // Korean Johab KS C-5601-1992 - return - ((uch >= 0x84) && (uch <= 0xD3)) || - ((uch >= 0xD8) && (uch <= 0xDE)) || - ((uch >= 0xE0) && (uch <= 0xF9)); - } - return false; -} - -static inline bool IsSpaceOrTab(int ch) { - return ch == ' ' || ch == '\t'; -} - -// Need to break text into segments near lengthSegment but taking into -// account the encoding to not break inside a UTF-8 or DBCS character -// and also trying to avoid breaking inside a pair of combining characters. -// The segment length must always be long enough (more than 4 bytes) -// so that there will be at least one whole character to make a segment. -// For UTF-8, text must consist only of valid whole characters. -// In preference order from best to worst: -// 1) Break after space -// 2) Break before punctuation -// 3) Break after whole character - -int Document::SafeSegment(const char *text, int length, int lengthSegment) const { - if (length <= lengthSegment) - return length; - int lastSpaceBreak = -1; - int lastPunctuationBreak = -1; - int lastEncodingAllowedBreak = 0; - for (int j=0; j < lengthSegment;) { - unsigned char ch = static_cast(text[j]); - if (j > 0) { - if (IsSpaceOrTab(text[j - 1]) && !IsSpaceOrTab(text[j])) { - lastSpaceBreak = j; - } - if (ch < 'A') { - lastPunctuationBreak = j; - } - } - lastEncodingAllowedBreak = j; - - if (dbcsCodePage == SC_CP_UTF8) { - j += UTF8BytesOfLead[ch]; - } else if (dbcsCodePage) { - j += IsDBCSLeadByte(ch) ? 2 : 1; - } else { - j++; - } - } - if (lastSpaceBreak >= 0) { - return lastSpaceBreak; - } else if (lastPunctuationBreak >= 0) { - return lastPunctuationBreak; - } - return lastEncodingAllowedBreak; -} - -EncodingFamily Document::CodePageFamily() const { - if (SC_CP_UTF8 == dbcsCodePage) - return efUnicode; - else if (dbcsCodePage) - return efDBCS; - else - return efEightBit; -} - -void Document::ModifiedAt(int pos) { - if (endStyled > pos) - endStyled = pos; -} - -void Document::CheckReadOnly() { - if (cb.IsReadOnly() && enteredReadOnlyCount == 0) { - enteredReadOnlyCount++; - NotifyModifyAttempt(); - enteredReadOnlyCount--; - } -} - -// Document only modified by gateways DeleteChars, InsertString, Undo, Redo, and SetStyleAt. -// SetStyleAt does not change the persistent state of a document - -bool Document::DeleteChars(int pos, int len) { - if (pos < 0) - return false; - if (len <= 0) - return false; - if ((pos + len) > Length()) - return false; - CheckReadOnly(); - if (enteredModification != 0) { - return false; - } else { - enteredModification++; - if (!cb.IsReadOnly()) { - NotifyModified( - DocModification( - SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, - pos, len, - 0, 0)); - int prevLinesTotal = LinesTotal(); - bool startSavePoint = cb.IsSavePoint(); - bool startSequence = false; - const char *text = cb.DeleteChars(pos, len, startSequence); - if (startSavePoint && cb.IsCollectingUndo()) - NotifySavePoint(!startSavePoint); - if ((pos < Length()) || (pos == 0)) - ModifiedAt(pos); - else - ModifiedAt(pos-1); - NotifyModified( - DocModification( - SC_MOD_DELETETEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), - pos, len, - LinesTotal() - prevLinesTotal, text)); - } - enteredModification--; - } - return !cb.IsReadOnly(); -} - -/** - * Insert a string with a length. - */ -int Document::InsertString(int position, const char *s, int insertLength) { - if (insertLength <= 0) { - return 0; - } - CheckReadOnly(); // Application may change read only state here - if (cb.IsReadOnly()) { - return 0; - } - if (enteredModification != 0) { - return 0; - } - enteredModification++; - insertionSet = false; - insertion.clear(); - NotifyModified( - DocModification( - SC_MOD_INSERTCHECK, - position, insertLength, - 0, s)); - if (insertionSet) { - s = insertion.c_str(); - insertLength = static_cast(insertion.length()); - } - NotifyModified( - DocModification( - SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, - position, insertLength, - 0, s)); - int prevLinesTotal = LinesTotal(); - bool startSavePoint = cb.IsSavePoint(); - bool startSequence = false; - const char *text = cb.InsertString(position, s, insertLength, startSequence); - if (startSavePoint && cb.IsCollectingUndo()) - NotifySavePoint(!startSavePoint); - ModifiedAt(position); - NotifyModified( - DocModification( - SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), - position, insertLength, - LinesTotal() - prevLinesTotal, text)); - if (insertionSet) { // Free memory as could be large - std::string().swap(insertion); - } - enteredModification--; - return insertLength; -} - -void Document::ChangeInsertion(const char *s, int length) { - insertionSet = true; - insertion.assign(s, length); -} - -int SCI_METHOD Document::AddData(char *data, Sci_Position length) { - try { - int position = Length(); - InsertString(position, data, length); - } catch (std::bad_alloc &) { - return SC_STATUS_BADALLOC; - } catch (...) { - return SC_STATUS_FAILURE; - } - return 0; -} - -void * SCI_METHOD Document::ConvertToDocument() { - return this; -} - -int Document::Undo() { - int newPos = -1; - CheckReadOnly(); - if ((enteredModification == 0) && (cb.IsCollectingUndo())) { - enteredModification++; - if (!cb.IsReadOnly()) { - bool startSavePoint = cb.IsSavePoint(); - bool multiLine = false; - int steps = cb.StartUndo(); - //Platform::DebugPrintf("Steps=%d\n", steps); - int coalescedRemovePos = -1; - int coalescedRemoveLen = 0; - int prevRemoveActionPos = -1; - int prevRemoveActionLen = 0; - for (int step = 0; step < steps; step++) { - const int prevLinesTotal = LinesTotal(); - const Action &action = cb.GetUndoStep(); - if (action.at == removeAction) { - NotifyModified(DocModification( - SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); - } else if (action.at == containerAction) { - DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_UNDO); - dm.token = action.position; - NotifyModified(dm); - if (!action.mayCoalesce) { - coalescedRemovePos = -1; - coalescedRemoveLen = 0; - prevRemoveActionPos = -1; - prevRemoveActionLen = 0; - } - } else { - NotifyModified(DocModification( - SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); - } - cb.PerformUndoStep(); - if (action.at != containerAction) { - ModifiedAt(action.position); - newPos = action.position; - } - - int modFlags = SC_PERFORMED_UNDO; - // With undo, an insertion action becomes a deletion notification - if (action.at == removeAction) { - newPos += action.lenData; - modFlags |= SC_MOD_INSERTTEXT; - if ((coalescedRemoveLen > 0) && - (action.position == prevRemoveActionPos || action.position == (prevRemoveActionPos + prevRemoveActionLen))) { - coalescedRemoveLen += action.lenData; - newPos = coalescedRemovePos + coalescedRemoveLen; - } else { - coalescedRemovePos = action.position; - coalescedRemoveLen = action.lenData; - } - prevRemoveActionPos = action.position; - prevRemoveActionLen = action.lenData; - } else if (action.at == insertAction) { - modFlags |= SC_MOD_DELETETEXT; - coalescedRemovePos = -1; - coalescedRemoveLen = 0; - prevRemoveActionPos = -1; - prevRemoveActionLen = 0; - } - if (steps > 1) - modFlags |= SC_MULTISTEPUNDOREDO; - const int linesAdded = LinesTotal() - prevLinesTotal; - if (linesAdded != 0) - multiLine = true; - if (step == steps - 1) { - modFlags |= SC_LASTSTEPINUNDOREDO; - if (multiLine) - modFlags |= SC_MULTILINEUNDOREDO; - } - NotifyModified(DocModification(modFlags, action.position, action.lenData, - linesAdded, action.data)); - } - - bool endSavePoint = cb.IsSavePoint(); - if (startSavePoint != endSavePoint) - NotifySavePoint(endSavePoint); - } - enteredModification--; - } - return newPos; -} - -int Document::Redo() { - int newPos = -1; - CheckReadOnly(); - if ((enteredModification == 0) && (cb.IsCollectingUndo())) { - enteredModification++; - if (!cb.IsReadOnly()) { - bool startSavePoint = cb.IsSavePoint(); - bool multiLine = false; - int steps = cb.StartRedo(); - for (int step = 0; step < steps; step++) { - const int prevLinesTotal = LinesTotal(); - const Action &action = cb.GetRedoStep(); - if (action.at == insertAction) { - NotifyModified(DocModification( - SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action)); - } else if (action.at == containerAction) { - DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_REDO); - dm.token = action.position; - NotifyModified(dm); - } else { - NotifyModified(DocModification( - SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action)); - } - cb.PerformRedoStep(); - if (action.at != containerAction) { - ModifiedAt(action.position); - newPos = action.position; - } - - int modFlags = SC_PERFORMED_REDO; - if (action.at == insertAction) { - newPos += action.lenData; - modFlags |= SC_MOD_INSERTTEXT; - } else if (action.at == removeAction) { - modFlags |= SC_MOD_DELETETEXT; - } - if (steps > 1) - modFlags |= SC_MULTISTEPUNDOREDO; - const int linesAdded = LinesTotal() - prevLinesTotal; - if (linesAdded != 0) - multiLine = true; - if (step == steps - 1) { - modFlags |= SC_LASTSTEPINUNDOREDO; - if (multiLine) - modFlags |= SC_MULTILINEUNDOREDO; - } - NotifyModified( - DocModification(modFlags, action.position, action.lenData, - linesAdded, action.data)); - } - - bool endSavePoint = cb.IsSavePoint(); - if (startSavePoint != endSavePoint) - NotifySavePoint(endSavePoint); - } - enteredModification--; - } - return newPos; -} - -void Document::DelChar(int pos) { - DeleteChars(pos, LenChar(pos)); -} - -void Document::DelCharBack(int pos) { - if (pos <= 0) { - return; - } else if (IsCrLf(pos - 2)) { - DeleteChars(pos - 2, 2); - } else if (dbcsCodePage) { - int startChar = NextPosition(pos, -1); - DeleteChars(startChar, pos - startChar); - } else { - DeleteChars(pos - 1, 1); - } -} - -static int NextTab(int pos, int tabSize) { - return ((pos / tabSize) + 1) * tabSize; -} - -static std::string CreateIndentation(int indent, int tabSize, bool insertSpaces) { - std::string indentation; - if (!insertSpaces) { - while (indent >= tabSize) { - indentation += '\t'; - indent -= tabSize; - } - } - while (indent > 0) { - indentation += ' '; - indent--; - } - return indentation; -} - -int SCI_METHOD Document::GetLineIndentation(Sci_Position line) { - int indent = 0; - if ((line >= 0) && (line < LinesTotal())) { - int lineStart = LineStart(line); - int length = Length(); - for (int i = lineStart; i < length; i++) { - char ch = cb.CharAt(i); - if (ch == ' ') - indent++; - else if (ch == '\t') - indent = NextTab(indent, tabInChars); - else - return indent; - } - } - return indent; -} - -int Document::SetLineIndentation(int line, int indent) { - int indentOfLine = GetLineIndentation(line); - if (indent < 0) - indent = 0; - if (indent != indentOfLine) { - std::string linebuf = CreateIndentation(indent, tabInChars, !useTabs); - int thisLineStart = LineStart(line); - int indentPos = GetLineIndentPosition(line); - UndoGroup ug(this); - DeleteChars(thisLineStart, indentPos - thisLineStart); - return thisLineStart + InsertString(thisLineStart, linebuf.c_str(), - static_cast(linebuf.length())); - } else { - return GetLineIndentPosition(line); - } -} - -int Document::GetLineIndentPosition(int line) const { - if (line < 0) - return 0; - int pos = LineStart(line); - int length = Length(); - while ((pos < length) && IsSpaceOrTab(cb.CharAt(pos))) { - pos++; - } - return pos; -} - -int Document::GetColumn(int pos) { - int column = 0; - int line = LineFromPosition(pos); - if ((line >= 0) && (line < LinesTotal())) { - for (int i = LineStart(line); i < pos;) { - char ch = cb.CharAt(i); - if (ch == '\t') { - column = NextTab(column, tabInChars); - i++; - } else if (ch == '\r') { - return column; - } else if (ch == '\n') { - return column; - } else if (i >= Length()) { - return column; - } else { - column++; - i = NextPosition(i, 1); - } - } - } - return column; -} - -int Document::CountCharacters(int startPos, int endPos) const { - startPos = MovePositionOutsideChar(startPos, 1, false); - endPos = MovePositionOutsideChar(endPos, -1, false); - int count = 0; - int i = startPos; - while (i < endPos) { - count++; - i = NextPosition(i, 1); - } - return count; -} - -int Document::CountUTF16(int startPos, int endPos) const { - startPos = MovePositionOutsideChar(startPos, 1, false); - endPos = MovePositionOutsideChar(endPos, -1, false); - int count = 0; - int i = startPos; - while (i < endPos) { - count++; - const int next = NextPosition(i, 1); - if ((next - i) > 3) - count++; - i = next; - } - return count; -} - -int Document::FindColumn(int line, int column) { - int position = LineStart(line); - if ((line >= 0) && (line < LinesTotal())) { - int columnCurrent = 0; - while ((columnCurrent < column) && (position < Length())) { - char ch = cb.CharAt(position); - if (ch == '\t') { - columnCurrent = NextTab(columnCurrent, tabInChars); - if (columnCurrent > column) - return position; - position++; - } else if (ch == '\r') { - return position; - } else if (ch == '\n') { - return position; - } else { - columnCurrent++; - position = NextPosition(position, 1); - } - } - } - return position; -} - -void Document::Indent(bool forwards, int lineBottom, int lineTop) { - // Dedent - suck white space off the front of the line to dedent by equivalent of a tab - for (int line = lineBottom; line >= lineTop; line--) { - int indentOfLine = GetLineIndentation(line); - if (forwards) { - if (LineStart(line) < LineEnd(line)) { - SetLineIndentation(line, indentOfLine + IndentSize()); - } - } else { - SetLineIndentation(line, indentOfLine - IndentSize()); - } - } -} - -// Convert line endings for a piece of text to a particular mode. -// Stop at len or when a NUL is found. -std::string Document::TransformLineEnds(const char *s, size_t len, int eolModeWanted) { - std::string dest; - for (size_t i = 0; (i < len) && (s[i]); i++) { - if (s[i] == '\n' || s[i] == '\r') { - if (eolModeWanted == SC_EOL_CR) { - dest.push_back('\r'); - } else if (eolModeWanted == SC_EOL_LF) { - dest.push_back('\n'); - } else { // eolModeWanted == SC_EOL_CRLF - dest.push_back('\r'); - dest.push_back('\n'); - } - if ((s[i] == '\r') && (i+1 < len) && (s[i+1] == '\n')) { - i++; - } - } else { - dest.push_back(s[i]); - } - } - return dest; -} - -void Document::ConvertLineEnds(int eolModeSet) { - UndoGroup ug(this); - - for (int pos = 0; pos < Length(); pos++) { - if (cb.CharAt(pos) == '\r') { - if (cb.CharAt(pos + 1) == '\n') { - // CRLF - if (eolModeSet == SC_EOL_CR) { - DeleteChars(pos + 1, 1); // Delete the LF - } else if (eolModeSet == SC_EOL_LF) { - DeleteChars(pos, 1); // Delete the CR - } else { - pos++; - } - } else { - // CR - if (eolModeSet == SC_EOL_CRLF) { - pos += InsertString(pos + 1, "\n", 1); // Insert LF - } else if (eolModeSet == SC_EOL_LF) { - pos += InsertString(pos, "\n", 1); // Insert LF - DeleteChars(pos, 1); // Delete CR - pos--; - } - } - } else if (cb.CharAt(pos) == '\n') { - // LF - if (eolModeSet == SC_EOL_CRLF) { - pos += InsertString(pos, "\r", 1); // Insert CR - } else if (eolModeSet == SC_EOL_CR) { - pos += InsertString(pos, "\r", 1); // Insert CR - DeleteChars(pos, 1); // Delete LF - pos--; - } - } - } - -} - -bool Document::IsWhiteLine(int line) const { - int currentChar = LineStart(line); - int endLine = LineEnd(line); - while (currentChar < endLine) { - if (cb.CharAt(currentChar) != ' ' && cb.CharAt(currentChar) != '\t') { - return false; - } - ++currentChar; - } - return true; -} - -int Document::ParaUp(int pos) const { - int line = LineFromPosition(pos); - line--; - while (line >= 0 && IsWhiteLine(line)) { // skip empty lines - line--; - } - while (line >= 0 && !IsWhiteLine(line)) { // skip non-empty lines - line--; - } - line++; - return LineStart(line); -} - -int Document::ParaDown(int pos) const { - int line = LineFromPosition(pos); - while (line < LinesTotal() && !IsWhiteLine(line)) { // skip non-empty lines - line++; - } - while (line < LinesTotal() && IsWhiteLine(line)) { // skip empty lines - line++; - } - if (line < LinesTotal()) - return LineStart(line); - else // end of a document - return LineEnd(line-1); -} - -bool Document::IsASCIIWordByte(unsigned char ch) const { - if (IsASCII(ch)) { - return charClass.GetClass(ch) == CharClassify::ccWord; - } else { - return false; - } -} - -CharClassify::cc Document::WordCharacterClass(unsigned int ch) const { - if (dbcsCodePage && (!UTF8IsAscii(ch))) { - if (SC_CP_UTF8 == dbcsCodePage) { - // Use hard coded Unicode class - const CharacterCategory cc = CategoriseCharacter(ch); - switch (cc) { - - // Separator, Line/Paragraph - case ccZl: - case ccZp: - return CharClassify::ccNewLine; - - // Separator, Space - case ccZs: - // Other - case ccCc: - case ccCf: - case ccCs: - case ccCo: - case ccCn: - return CharClassify::ccSpace; - - // Letter - case ccLu: - case ccLl: - case ccLt: - case ccLm: - case ccLo: - // Number - case ccNd: - case ccNl: - case ccNo: - // Mark - includes combining diacritics - case ccMn: - case ccMc: - case ccMe: - return CharClassify::ccWord; - - // Punctuation - case ccPc: - case ccPd: - case ccPs: - case ccPe: - case ccPi: - case ccPf: - case ccPo: - // Symbol - case ccSm: - case ccSc: - case ccSk: - case ccSo: - return CharClassify::ccPunctuation; - - } - } else { - // Asian DBCS - return CharClassify::ccWord; - } - } - return charClass.GetClass(static_cast(ch)); -} - -/** - * Used by commmands that want to select whole words. - * Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0. - */ -int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) const { - CharClassify::cc ccStart = CharClassify::ccWord; - if (delta < 0) { - if (!onlyWordCharacters) { - const CharacterExtracted ce = CharacterBefore(pos); - ccStart = WordCharacterClass(ce.character); - } - while (pos > 0) { - const CharacterExtracted ce = CharacterBefore(pos); - if (WordCharacterClass(ce.character) != ccStart) - break; - pos -= ce.widthBytes; - } - } else { - if (!onlyWordCharacters && pos < Length()) { - const CharacterExtracted ce = CharacterAfter(pos); - ccStart = WordCharacterClass(ce.character); - } - while (pos < Length()) { - const CharacterExtracted ce = CharacterAfter(pos); - if (WordCharacterClass(ce.character) != ccStart) - break; - pos += ce.widthBytes; - } - } - return MovePositionOutsideChar(pos, delta, true); -} - -/** - * Find the start of the next word in either a forward (delta >= 0) or backwards direction - * (delta < 0). - * This is looking for a transition between character classes although there is also some - * additional movement to transit white space. - * Used by cursor movement by word commands. - */ -int Document::NextWordStart(int pos, int delta) const { - if (delta < 0) { - while (pos > 0) { - const CharacterExtracted ce = CharacterBefore(pos); - if (WordCharacterClass(ce.character) != CharClassify::ccSpace) - break; - pos -= ce.widthBytes; - } - if (pos > 0) { - CharacterExtracted ce = CharacterBefore(pos); - const CharClassify::cc ccStart = WordCharacterClass(ce.character); - while (pos > 0) { - ce = CharacterBefore(pos); - if (WordCharacterClass(ce.character) != ccStart) - break; - pos -= ce.widthBytes; - } - } - } else { - CharacterExtracted ce = CharacterAfter(pos); - const CharClassify::cc ccStart = WordCharacterClass(ce.character); - while (pos < Length()) { - ce = CharacterAfter(pos); - if (WordCharacterClass(ce.character) != ccStart) - break; - pos += ce.widthBytes; - } - while (pos < Length()) { - ce = CharacterAfter(pos); - if (WordCharacterClass(ce.character) != CharClassify::ccSpace) - break; - pos += ce.widthBytes; - } - } - return pos; -} - -/** - * Find the end of the next word in either a forward (delta >= 0) or backwards direction - * (delta < 0). - * This is looking for a transition between character classes although there is also some - * additional movement to transit white space. - * Used by cursor movement by word commands. - */ -int Document::NextWordEnd(int pos, int delta) const { - if (delta < 0) { - if (pos > 0) { - CharacterExtracted ce = CharacterBefore(pos); - CharClassify::cc ccStart = WordCharacterClass(ce.character); - if (ccStart != CharClassify::ccSpace) { - while (pos > 0) { - ce = CharacterBefore(pos); - if (WordCharacterClass(ce.character) != ccStart) - break; - pos -= ce.widthBytes; - } - } - while (pos > 0) { - ce = CharacterBefore(pos); - if (WordCharacterClass(ce.character) != CharClassify::ccSpace) - break; - pos -= ce.widthBytes; - } - } - } else { - while (pos < Length()) { - CharacterExtracted ce = CharacterAfter(pos); - if (WordCharacterClass(ce.character) != CharClassify::ccSpace) - break; - pos += ce.widthBytes; - } - if (pos < Length()) { - CharacterExtracted ce = CharacterAfter(pos); - CharClassify::cc ccStart = WordCharacterClass(ce.character); - while (pos < Length()) { - ce = CharacterAfter(pos); - if (WordCharacterClass(ce.character) != ccStart) - break; - pos += ce.widthBytes; - } - } - } - return pos; -} - -/** - * Check that the character at the given position is a word or punctuation character and that - * the previous character is of a different character class. - */ -bool Document::IsWordStartAt(int pos) const { - if (pos >= Length()) - return false; - if (pos > 0) { - const CharacterExtracted cePos = CharacterAfter(pos); - const CharClassify::cc ccPos = WordCharacterClass(cePos.character); - const CharacterExtracted cePrev = CharacterBefore(pos); - const CharClassify::cc ccPrev = WordCharacterClass(cePrev.character); - return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) && - (ccPos != ccPrev); - } - return true; -} - -/** - * Check that the character at the given position is a word or punctuation character and that - * the next character is of a different character class. - */ -bool Document::IsWordEndAt(int pos) const { - if (pos <= 0) - return false; - if (pos < Length()) { - const CharacterExtracted cePos = CharacterAfter(pos); - const CharClassify::cc ccPos = WordCharacterClass(cePos.character); - const CharacterExtracted cePrev = CharacterBefore(pos); - const CharClassify::cc ccPrev = WordCharacterClass(cePrev.character); - return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) && - (ccPrev != ccPos); - } - return true; -} - -/** - * Check that the given range is has transitions between character classes at both - * ends and where the characters on the inside are word or punctuation characters. - */ -bool Document::IsWordAt(int start, int end) const { - return (start < end) && IsWordStartAt(start) && IsWordEndAt(end); -} - -bool Document::MatchesWordOptions(bool word, bool wordStart, int pos, int length) const { - return (!word && !wordStart) || - (word && IsWordAt(pos, pos + length)) || - (wordStart && IsWordStartAt(pos)); -} - -bool Document::HasCaseFolder(void) const { - return pcf != 0; -} - -void Document::SetCaseFolder(CaseFolder *pcf_) { - delete pcf; - pcf = pcf_; -} - -Document::CharacterExtracted Document::ExtractCharacter(int position) const { - const unsigned char leadByte = static_cast(cb.CharAt(position)); - if (UTF8IsAscii(leadByte)) { - // Common case: ASCII character - return CharacterExtracted(leadByte, 1); - } - const int widthCharBytes = UTF8BytesOfLead[leadByte]; - unsigned char charBytes[UTF8MaxBytes] = { leadByte, 0, 0, 0 }; - for (int b=1; b(cb.CharAt(position + b)); - int utf8status = UTF8Classify(charBytes, widthCharBytes); - if (utf8status & UTF8MaskInvalid) { - // Treat as invalid and use up just one byte - return CharacterExtracted(unicodeReplacementChar, 1); - } else { - return CharacterExtracted(UnicodeFromUTF8(charBytes), utf8status & UTF8MaskWidth); - } -} - -/** - * Find text in document, supporting both forward and backward - * searches (just pass minPos > maxPos to do a backward search) - * Has not been tested with backwards DBCS searches yet. - */ -long Document::FindText(int minPos, int maxPos, const char *search, - int flags, int *length) { - if (*length <= 0) - return minPos; - const bool caseSensitive = (flags & SCFIND_MATCHCASE) != 0; - const bool word = (flags & SCFIND_WHOLEWORD) != 0; - const bool wordStart = (flags & SCFIND_WORDSTART) != 0; - const bool regExp = (flags & SCFIND_REGEXP) != 0; - if (regExp) { - if (!regex) - regex = CreateRegexSearch(&charClass); - return regex->FindText(this, minPos, maxPos, search, caseSensitive, word, wordStart, flags, length); - } else { - - const bool forward = minPos <= maxPos; - const int increment = forward ? 1 : -1; - - // Range endpoints should not be inside DBCS characters, but just in case, move them. - const int startPos = MovePositionOutsideChar(minPos, increment, false); - const int endPos = MovePositionOutsideChar(maxPos, increment, false); - - // Compute actual search ranges needed - const int lengthFind = *length; - - //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); - const int limitPos = Platform::Maximum(startPos, endPos); - int pos = startPos; - if (!forward) { - // Back all of a character - pos = NextPosition(pos, increment); - } - if (caseSensitive) { - const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos; - const char charStartSearch = search[0]; - while (forward ? (pos < endSearch) : (pos >= endSearch)) { - if (CharAt(pos) == charStartSearch) { - bool found = (pos + lengthFind) <= limitPos; - for (int indexSearch = 1; (indexSearch < lengthFind) && found; indexSearch++) { - found = CharAt(pos + indexSearch) == search[indexSearch]; - } - if (found && MatchesWordOptions(word, wordStart, pos, lengthFind)) { - return pos; - } - } - if (!NextCharacter(pos, increment)) - break; - } - } else if (SC_CP_UTF8 == dbcsCodePage) { - const size_t maxFoldingExpansion = 4; - std::vector searchThing(lengthFind * UTF8MaxBytes * maxFoldingExpansion + 1); - const int lenSearch = static_cast( - pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind)); - char bytes[UTF8MaxBytes + 1]; - char folded[UTF8MaxBytes * maxFoldingExpansion + 1]; - while (forward ? (pos < endPos) : (pos >= endPos)) { - int widthFirstCharacter = 0; - int posIndexDocument = pos; - int indexSearch = 0; - bool characterMatches = true; - for (;;) { - const unsigned char leadByte = static_cast(cb.CharAt(posIndexDocument)); - bytes[0] = leadByte; - int widthChar = 1; - if (!UTF8IsAscii(leadByte)) { - const int widthCharBytes = UTF8BytesOfLead[leadByte]; - for (int b=1; b(bytes), widthCharBytes) & UTF8MaskWidth; - } - if (!widthFirstCharacter) - widthFirstCharacter = widthChar; - if ((posIndexDocument + widthChar) > limitPos) - break; - const int lenFlat = static_cast(pcf->Fold(folded, sizeof(folded), bytes, widthChar)); - folded[lenFlat] = 0; - // Does folded match the buffer - characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat); - if (!characterMatches) - break; - posIndexDocument += widthChar; - indexSearch += lenFlat; - if (indexSearch >= lenSearch) - break; - } - if (characterMatches && (indexSearch == static_cast(lenSearch))) { - if (MatchesWordOptions(word, wordStart, pos, posIndexDocument - pos)) { - *length = posIndexDocument - pos; - return pos; - } - } - if (forward) { - pos += widthFirstCharacter; - } else { - if (!NextCharacter(pos, increment)) - break; - } - } - } else if (dbcsCodePage) { - const size_t maxBytesCharacter = 2; - const size_t maxFoldingExpansion = 4; - std::vector searchThing(lengthFind * maxBytesCharacter * maxFoldingExpansion + 1); - const int lenSearch = static_cast( - pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind)); - while (forward ? (pos < endPos) : (pos >= endPos)) { - int indexDocument = 0; - int indexSearch = 0; - bool characterMatches = true; - while (characterMatches && - ((pos + indexDocument) < limitPos) && - (indexSearch < lenSearch)) { - char bytes[maxBytesCharacter + 1]; - bytes[0] = cb.CharAt(pos + indexDocument); - const int widthChar = IsDBCSLeadByte(bytes[0]) ? 2 : 1; - if (widthChar == 2) - bytes[1] = cb.CharAt(pos + indexDocument + 1); - if ((pos + indexDocument + widthChar) > limitPos) - break; - char folded[maxBytesCharacter * maxFoldingExpansion + 1]; - const int lenFlat = static_cast(pcf->Fold(folded, sizeof(folded), bytes, widthChar)); - folded[lenFlat] = 0; - // Does folded match the buffer - characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat); - indexDocument += widthChar; - indexSearch += lenFlat; - } - if (characterMatches && (indexSearch == static_cast(lenSearch))) { - if (MatchesWordOptions(word, wordStart, pos, indexDocument)) { - *length = indexDocument; - return pos; - } - } - if (!NextCharacter(pos, increment)) - break; - } - } else { - const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos; - std::vector searchThing(lengthFind + 1); - pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind); - while (forward ? (pos < endSearch) : (pos >= endSearch)) { - bool found = (pos + lengthFind) <= limitPos; - for (int indexSearch = 0; (indexSearch < lengthFind) && found; indexSearch++) { - char ch = CharAt(pos + indexSearch); - char folded[2]; - pcf->Fold(folded, sizeof(folded), &ch, 1); - found = folded[0] == searchThing[indexSearch]; - } - if (found && MatchesWordOptions(word, wordStart, pos, lengthFind)) { - return pos; - } - if (!NextCharacter(pos, increment)) - break; - } - } - } - //Platform::DebugPrintf("Not found\n"); - return -1; -} - -const char *Document::SubstituteByPosition(const char *text, int *length) { - if (regex) - return regex->SubstituteByPosition(this, text, length); - else - return 0; -} - -int Document::LinesTotal() const { - return cb.Lines(); -} - -void Document::SetDefaultCharClasses(bool includeWordClass) { - charClass.SetDefaultCharClasses(includeWordClass); -} - -void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass) { - charClass.SetCharClasses(chars, newCharClass); -} - -int Document::GetCharsOfClass(CharClassify::cc characterClass, unsigned char *buffer) const { - return charClass.GetCharsOfClass(characterClass, buffer); -} - -void SCI_METHOD Document::StartStyling(Sci_Position position, char) { - endStyled = position; -} - -bool SCI_METHOD Document::SetStyleFor(Sci_Position length, char style) { - if (enteredStyling != 0) { - return false; - } else { - enteredStyling++; - int prevEndStyled = endStyled; - if (cb.SetStyleFor(endStyled, length, style)) { - DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, - prevEndStyled, length); - NotifyModified(mh); - } - endStyled += length; - enteredStyling--; - return true; - } -} - -bool SCI_METHOD Document::SetStyles(Sci_Position length, const char *styles) { - if (enteredStyling != 0) { - return false; - } else { - enteredStyling++; - bool didChange = false; - int startMod = 0; - int endMod = 0; - for (int iPos = 0; iPos < length; iPos++, endStyled++) { - PLATFORM_ASSERT(endStyled < Length()); - if (cb.SetStyleAt(endStyled, styles[iPos])) { - if (!didChange) { - startMod = endStyled; - } - didChange = true; - endMod = endStyled; - } - } - if (didChange) { - DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, - startMod, endMod - startMod + 1); - NotifyModified(mh); - } - enteredStyling--; - return true; - } -} - -void Document::EnsureStyledTo(int pos) { - if ((enteredStyling == 0) && (pos > GetEndStyled())) { - IncrementStyleClock(); - if (pli && !pli->UseContainerLexing()) { - int lineEndStyled = LineFromPosition(GetEndStyled()); - int endStyledTo = LineStart(lineEndStyled); - pli->Colourise(endStyledTo, pos); - } else { - // Ask the watchers to style, and stop as soon as one responds. - for (std::vector::iterator it = watchers.begin(); - (pos > GetEndStyled()) && (it != watchers.end()); ++it) { - it->watcher->NotifyStyleNeeded(this, it->userData, pos); - } - } - } -} - -void Document::StyleToAdjustingLineDuration(int pos) { - // Place bounds on the duration used to avoid glitches spiking it - // and so causing slow styling or non-responsive scrolling - const double minDurationOneLine = 0.000001; - const double maxDurationOneLine = 0.0001; - - // Alpha value for exponential smoothing. - // Most recent value contributes 25% to smoothed value. - const double alpha = 0.25; - - const Sci_Position lineFirst = LineFromPosition(GetEndStyled()); - ElapsedTime etStyling; - EnsureStyledTo(pos); - const double durationStyling = etStyling.Duration(); - const Sci_Position lineLast = LineFromPosition(GetEndStyled()); - if (lineLast >= lineFirst + 8) { - // Only adjust for styling multiple lines to avoid instability - const double durationOneLine = durationStyling / (lineLast - lineFirst); - durationStyleOneLine = alpha * durationOneLine + (1.0 - alpha) * durationStyleOneLine; - if (durationStyleOneLine < minDurationOneLine) { - durationStyleOneLine = minDurationOneLine; - } else if (durationStyleOneLine > maxDurationOneLine) { - durationStyleOneLine = maxDurationOneLine; - } - } -} - -void Document::LexerChanged() { - // Tell the watchers the lexer has changed. - for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { - it->watcher->NotifyLexerChanged(this, it->userData); - } -} - -int SCI_METHOD Document::SetLineState(Sci_Position line, int state) { - int statePrevious = static_cast(perLineData[ldState])->SetLineState(line, state); - if (state != statePrevious) { - DocModification mh(SC_MOD_CHANGELINESTATE, LineStart(line), 0, 0, 0, line); - NotifyModified(mh); - } - return statePrevious; -} - -int SCI_METHOD Document::GetLineState(Sci_Position line) const { - return static_cast(perLineData[ldState])->GetLineState(line); -} - -int Document::GetMaxLineState() { - return static_cast(perLineData[ldState])->GetMaxLineState(); -} - -void SCI_METHOD Document::ChangeLexerState(Sci_Position start, Sci_Position end) { - DocModification mh(SC_MOD_LEXERSTATE, start, end-start, 0, 0, 0); - NotifyModified(mh); -} - -StyledText Document::MarginStyledText(int line) const { - LineAnnotation *pla = static_cast(perLineData[ldMargin]); - return StyledText(pla->Length(line), pla->Text(line), - pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); -} - -void Document::MarginSetText(int line, const char *text) { - static_cast(perLineData[ldMargin])->SetText(line, text); - DocModification mh(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line); - NotifyModified(mh); -} - -void Document::MarginSetStyle(int line, int style) { - static_cast(perLineData[ldMargin])->SetStyle(line, style); - NotifyModified(DocModification(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line)); -} - -void Document::MarginSetStyles(int line, const unsigned char *styles) { - static_cast(perLineData[ldMargin])->SetStyles(line, styles); - NotifyModified(DocModification(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line)); -} - -void Document::MarginClearAll() { - int maxEditorLine = LinesTotal(); - for (int l=0; l(perLineData[ldMargin])->ClearAll(); -} - -StyledText Document::AnnotationStyledText(int line) const { - LineAnnotation *pla = static_cast(perLineData[ldAnnotation]); - return StyledText(pla->Length(line), pla->Text(line), - pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); -} - -void Document::AnnotationSetText(int line, const char *text) { - if (line >= 0 && line < LinesTotal()) { - const int linesBefore = AnnotationLines(line); - static_cast(perLineData[ldAnnotation])->SetText(line, text); - const int linesAfter = AnnotationLines(line); - DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line); - mh.annotationLinesAdded = linesAfter - linesBefore; - NotifyModified(mh); - } -} - -void Document::AnnotationSetStyle(int line, int style) { - static_cast(perLineData[ldAnnotation])->SetStyle(line, style); - DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line); - NotifyModified(mh); -} - -void Document::AnnotationSetStyles(int line, const unsigned char *styles) { - if (line >= 0 && line < LinesTotal()) { - static_cast(perLineData[ldAnnotation])->SetStyles(line, styles); - } -} - -int Document::AnnotationLines(int line) const { - return static_cast(perLineData[ldAnnotation])->Lines(line); -} - -void Document::AnnotationClearAll() { - int maxEditorLine = LinesTotal(); - for (int l=0; l(perLineData[ldAnnotation])->ClearAll(); -} - -void Document::IncrementStyleClock() { - styleClock = (styleClock + 1) % 0x100000; -} - -void SCI_METHOD Document::DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) { - if (decorations.FillRange(position, value, fillLength)) { - DocModification mh(SC_MOD_CHANGEINDICATOR | SC_PERFORMED_USER, - position, fillLength); - NotifyModified(mh); - } -} - -bool Document::AddWatcher(DocWatcher *watcher, void *userData) { - WatcherWithUserData wwud(watcher, userData); - std::vector::iterator it = - std::find(watchers.begin(), watchers.end(), wwud); - if (it != watchers.end()) - return false; - watchers.push_back(wwud); - return true; -} - -bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) { - std::vector::iterator it = - std::find(watchers.begin(), watchers.end(), WatcherWithUserData(watcher, userData)); - if (it != watchers.end()) { - watchers.erase(it); - return true; - } - return false; -} - -void Document::NotifyModifyAttempt() { - for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { - it->watcher->NotifyModifyAttempt(this, it->userData); - } -} - -void Document::NotifySavePoint(bool atSavePoint) { - for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { - it->watcher->NotifySavePoint(this, it->userData, atSavePoint); - } -} - -void Document::NotifyModified(DocModification mh) { - if (mh.modificationType & SC_MOD_INSERTTEXT) { - decorations.InsertSpace(mh.position, mh.length); - } else if (mh.modificationType & SC_MOD_DELETETEXT) { - decorations.DeleteRange(mh.position, mh.length); - } - for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { - it->watcher->NotifyModified(this, mh, it->userData); - } -} - -// Used for word part navigation. -static bool IsASCIIPunctuationCharacter(unsigned int ch) { - switch (ch) { - case '!': - case '"': - case '#': - case '$': - case '%': - case '&': - case '\'': - case '(': - case ')': - case '*': - case '+': - case ',': - case '-': - case '.': - case '/': - case ':': - case ';': - case '<': - case '=': - case '>': - case '?': - case '@': - case '[': - case '\\': - case ']': - case '^': - case '_': - case '`': - case '{': - case '|': - case '}': - case '~': - return true; - default: - return false; - } -} - -bool Document::IsWordPartSeparator(unsigned int ch) const { - return (WordCharacterClass(ch) == CharClassify::ccWord) && IsASCIIPunctuationCharacter(ch); -} - -int Document::WordPartLeft(int pos) const { - if (pos > 0) { - pos -= CharacterBefore(pos).widthBytes; - CharacterExtracted ceStart = CharacterAfter(pos); - if (IsWordPartSeparator(ceStart.character)) { - while (pos > 0 && IsWordPartSeparator(CharacterAfter(pos).character)) { - pos -= CharacterBefore(pos).widthBytes; - } - } - if (pos > 0) { - ceStart = CharacterAfter(pos); - pos -= CharacterBefore(pos).widthBytes; - if (IsLowerCase(ceStart.character)) { - while (pos > 0 && IsLowerCase(CharacterAfter(pos).character)) - pos -= CharacterBefore(pos).widthBytes; - if (!IsUpperCase(CharacterAfter(pos).character) && !IsLowerCase(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else if (IsUpperCase(ceStart.character)) { - while (pos > 0 && IsUpperCase(CharacterAfter(pos).character)) - pos -= CharacterBefore(pos).widthBytes; - if (!IsUpperCase(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else if (IsADigit(ceStart.character)) { - while (pos > 0 && IsADigit(CharacterAfter(pos).character)) - pos -= CharacterBefore(pos).widthBytes; - if (!IsADigit(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else if (IsASCIIPunctuationCharacter(ceStart.character)) { - while (pos > 0 && IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) - pos -= CharacterBefore(pos).widthBytes; - if (!IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else if (isspacechar(ceStart.character)) { - while (pos > 0 && isspacechar(CharacterAfter(pos).character)) - pos -= CharacterBefore(pos).widthBytes; - if (!isspacechar(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else if (!IsASCII(ceStart.character)) { - while (pos > 0 && !IsASCII(CharacterAfter(pos).character)) - pos -= CharacterBefore(pos).widthBytes; - if (IsASCII(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else { - pos += CharacterAfter(pos).widthBytes; - } - } - } - return pos; -} - -int Document::WordPartRight(int pos) const { - CharacterExtracted ceStart = CharacterAfter(pos); - const int length = Length(); - if (IsWordPartSeparator(ceStart.character)) { - while (pos < length && IsWordPartSeparator(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - ceStart = CharacterAfter(pos); - } - if (!IsASCII(ceStart.character)) { - while (pos < length && !IsASCII(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else if (IsLowerCase(ceStart.character)) { - while (pos < length && IsLowerCase(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else if (IsUpperCase(ceStart.character)) { - if (IsLowerCase(CharacterAfter(pos + ceStart.widthBytes).character)) { - pos += CharacterAfter(pos).widthBytes; - while (pos < length && IsLowerCase(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else { - while (pos < length && IsUpperCase(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } - if (IsLowerCase(CharacterAfter(pos).character) && IsUpperCase(CharacterBefore(pos).character)) - pos -= CharacterBefore(pos).widthBytes; - } else if (IsADigit(ceStart.character)) { - while (pos < length && IsADigit(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else if (IsASCIIPunctuationCharacter(ceStart.character)) { - while (pos < length && IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else if (isspacechar(ceStart.character)) { - while (pos < length && isspacechar(CharacterAfter(pos).character)) - pos += CharacterAfter(pos).widthBytes; - } else { - pos += CharacterAfter(pos).widthBytes; - } - return pos; -} - -static bool IsLineEndChar(char c) { - return (c == '\n' || c == '\r'); -} - -int Document::ExtendStyleRange(int pos, int delta, bool singleLine) { - int sStart = cb.StyleAt(pos); - if (delta < 0) { - while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos)))) - pos--; - pos++; - } else { - while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos)))) - pos++; - } - return pos; -} - -static char BraceOpposite(char ch) { - switch (ch) { - case '(': - return ')'; - case ')': - return '('; - case '[': - return ']'; - case ']': - return '['; - case '{': - return '}'; - case '}': - return '{'; - case '<': - return '>'; - case '>': - return '<'; - default: - return '\0'; - } -} - -// TODO: should be able to extend styled region to find matching brace -int Document::BraceMatch(int position, int /*maxReStyle*/) { - char chBrace = CharAt(position); - char chSeek = BraceOpposite(chBrace); - if (chSeek == '\0') - return - 1; - const int styBrace = StyleIndexAt(position); - int direction = -1; - if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<') - direction = 1; - int depth = 1; - position = NextPosition(position, direction); - while ((position >= 0) && (position < Length())) { - char chAtPos = CharAt(position); - const int styAtPos = StyleIndexAt(position); - if ((position > GetEndStyled()) || (styAtPos == styBrace)) { - if (chAtPos == chBrace) - depth++; - if (chAtPos == chSeek) - depth--; - if (depth == 0) - return position; - } - int positionBeforeMove = position; - position = NextPosition(position, direction); - if (position == positionBeforeMove) - break; - } - return - 1; -} - -/** - * Implementation of RegexSearchBase for the default built-in regular expression engine - */ -class BuiltinRegex : public RegexSearchBase { -public: - explicit BuiltinRegex(CharClassify *charClassTable) : search(charClassTable) {} - - virtual ~BuiltinRegex() { - } - - virtual long FindText(Document *doc, int minPos, int maxPos, const char *s, - bool caseSensitive, bool word, bool wordStart, int flags, - int *length); - - virtual const char *SubstituteByPosition(Document *doc, const char *text, int *length); - -private: - RESearch search; - std::string substituted; -}; - -namespace { - -/** -* RESearchRange keeps track of search range. -*/ -class RESearchRange { -public: - const Document *doc; - int increment; - int startPos; - int endPos; - int lineRangeStart; - int lineRangeEnd; - int lineRangeBreak; - RESearchRange(const Document *doc_, int minPos, int maxPos) : doc(doc_) { - increment = (minPos <= maxPos) ? 1 : -1; - - // Range endpoints should not be inside DBCS characters, but just in case, move them. - startPos = doc->MovePositionOutsideChar(minPos, 1, false); - endPos = doc->MovePositionOutsideChar(maxPos, 1, false); - - lineRangeStart = doc->LineFromPosition(startPos); - lineRangeEnd = doc->LineFromPosition(endPos); - if ((increment == 1) && - (startPos >= doc->LineEnd(lineRangeStart)) && - (lineRangeStart < lineRangeEnd)) { - // the start position is at end of line or between line end characters. - lineRangeStart++; - startPos = doc->LineStart(lineRangeStart); - } else if ((increment == -1) && - (startPos <= doc->LineStart(lineRangeStart)) && - (lineRangeStart > lineRangeEnd)) { - // the start position is at beginning of line. - lineRangeStart--; - startPos = doc->LineEnd(lineRangeStart); - } - lineRangeBreak = lineRangeEnd + increment; - } - Range LineRange(int line) const { - Range range(doc->LineStart(line), doc->LineEnd(line)); - if (increment == 1) { - if (line == lineRangeStart) - range.start = startPos; - if (line == lineRangeEnd) - range.end = endPos; - } else { - if (line == lineRangeEnd) - range.start = endPos; - if (line == lineRangeStart) - range.end = startPos; - } - return range; - } -}; - -// Define a way for the Regular Expression code to access the document -class DocumentIndexer : public CharacterIndexer { - Document *pdoc; - int end; -public: - DocumentIndexer(Document *pdoc_, int end_) : - pdoc(pdoc_), end(end_) { - } - - virtual ~DocumentIndexer() { - } - - virtual char CharAt(int index) { - if (index < 0 || index >= end) - return 0; - else - return pdoc->CharAt(index); - } -}; - -#ifndef NO_CXX11_REGEX - -class ByteIterator : public std::iterator { -public: - const Document *doc; - Position position; - ByteIterator(const Document *doc_ = 0, Position position_ = 0) : doc(doc_), position(position_) { - } - ByteIterator(const ByteIterator &other) NOEXCEPT { - doc = other.doc; - position = other.position; - } - ByteIterator &operator=(const ByteIterator &other) { - if (this != &other) { - doc = other.doc; - position = other.position; - } - return *this; - } - char operator*() const { - return doc->CharAt(position); - } - ByteIterator &operator++() { - position++; - return *this; - } - ByteIterator operator++(int) { - ByteIterator retVal(*this); - position++; - return retVal; - } - ByteIterator &operator--() { - position--; - return *this; - } - bool operator==(const ByteIterator &other) const { - return doc == other.doc && position == other.position; - } - bool operator!=(const ByteIterator &other) const { - return doc != other.doc || position != other.position; - } - int Pos() const { - return position; - } - int PosRoundUp() const { - return position; - } -}; - -// On Windows, wchar_t is 16 bits wide and on Unix it is 32 bits wide. -// Would be better to use sizeof(wchar_t) or similar to differentiate -// but easier for now to hard-code platforms. -// C++11 has char16_t and char32_t but neither Clang nor Visual C++ -// appear to allow specializing basic_regex over these. - -#ifdef _WIN32 -#define WCHAR_T_IS_16 1 -#else -#define WCHAR_T_IS_16 0 -#endif - -#if WCHAR_T_IS_16 - -// On Windows, report non-BMP characters as 2 separate surrogates as that -// matches wregex since it is based on wchar_t. -class UTF8Iterator : public std::iterator { - // These 3 fields determine the iterator position and are used for comparisons - const Document *doc; - Position position; - size_t characterIndex; - // Remaining fields are derived from the determining fields so are excluded in comparisons - unsigned int lenBytes; - size_t lenCharacters; - wchar_t buffered[2]; -public: - UTF8Iterator(const Document *doc_ = 0, Position position_ = 0) : - doc(doc_), position(position_), characterIndex(0), lenBytes(0), lenCharacters(0) { - buffered[0] = 0; - buffered[1] = 0; - if (doc) { - ReadCharacter(); - } - } - UTF8Iterator(const UTF8Iterator &other) { - doc = other.doc; - position = other.position; - characterIndex = other.characterIndex; - lenBytes = other.lenBytes; - lenCharacters = other.lenCharacters; - buffered[0] = other.buffered[0]; - buffered[1] = other.buffered[1]; - } - UTF8Iterator &operator=(const UTF8Iterator &other) { - if (this != &other) { - doc = other.doc; - position = other.position; - characterIndex = other.characterIndex; - lenBytes = other.lenBytes; - lenCharacters = other.lenCharacters; - buffered[0] = other.buffered[0]; - buffered[1] = other.buffered[1]; - } - return *this; - } - wchar_t operator*() const { - assert(lenCharacters != 0); - return buffered[characterIndex]; - } - UTF8Iterator &operator++() { - if ((characterIndex + 1) < (lenCharacters)) { - characterIndex++; - } else { - position += lenBytes; - ReadCharacter(); - characterIndex = 0; - } - return *this; - } - UTF8Iterator operator++(int) { - UTF8Iterator retVal(*this); - if ((characterIndex + 1) < (lenCharacters)) { - characterIndex++; - } else { - position += lenBytes; - ReadCharacter(); - characterIndex = 0; - } - return retVal; - } - UTF8Iterator &operator--() { - if (characterIndex) { - characterIndex--; - } else { - position = doc->NextPosition(position, -1); - ReadCharacter(); - characterIndex = lenCharacters - 1; - } - return *this; - } - bool operator==(const UTF8Iterator &other) const { - // Only test the determining fields, not the character widths and values derived from this - return doc == other.doc && - position == other.position && - characterIndex == other.characterIndex; - } - bool operator!=(const UTF8Iterator &other) const { - // Only test the determining fields, not the character widths and values derived from this - return doc != other.doc || - position != other.position || - characterIndex != other.characterIndex; - } - int Pos() const { - return position; - } - int PosRoundUp() const { - if (characterIndex) - return position + lenBytes; // Force to end of character - else - return position; - } -private: - void ReadCharacter() { - Document::CharacterExtracted charExtracted = doc->ExtractCharacter(position); - lenBytes = charExtracted.widthBytes; - if (charExtracted.character == unicodeReplacementChar) { - lenCharacters = 1; - buffered[0] = static_cast(charExtracted.character); - } else { - lenCharacters = UTF16FromUTF32Character(charExtracted.character, buffered); - } - } -}; - -#else - -// On Unix, report non-BMP characters as single characters - -class UTF8Iterator : public std::iterator { - const Document *doc; - Position position; -public: - UTF8Iterator(const Document *doc_=0, Position position_=0) : doc(doc_), position(position_) { - } - UTF8Iterator(const UTF8Iterator &other) NOEXCEPT { - doc = other.doc; - position = other.position; - } - UTF8Iterator &operator=(const UTF8Iterator &other) { - if (this != &other) { - doc = other.doc; - position = other.position; - } - return *this; - } - wchar_t operator*() const { - Document::CharacterExtracted charExtracted = doc->ExtractCharacter(position); - return charExtracted.character; - } - UTF8Iterator &operator++() { - position = doc->NextPosition(position, 1); - return *this; - } - UTF8Iterator operator++(int) { - UTF8Iterator retVal(*this); - position = doc->NextPosition(position, 1); - return retVal; - } - UTF8Iterator &operator--() { - position = doc->NextPosition(position, -1); - return *this; - } - bool operator==(const UTF8Iterator &other) const { - return doc == other.doc && position == other.position; - } - bool operator!=(const UTF8Iterator &other) const { - return doc != other.doc || position != other.position; - } - int Pos() const { - return position; - } - int PosRoundUp() const { - return position; - } -}; - -#endif - -std::regex_constants::match_flag_type MatchFlags(const Document *doc, int startPos, int endPos) { - std::regex_constants::match_flag_type flagsMatch = std::regex_constants::match_default; - if (!doc->IsLineStartPosition(startPos)) - flagsMatch |= std::regex_constants::match_not_bol; - if (!doc->IsLineEndPosition(endPos)) - flagsMatch |= std::regex_constants::match_not_eol; - return flagsMatch; -} - -template -bool MatchOnLines(const Document *doc, const Regex ®exp, const RESearchRange &resr, RESearch &search) { - bool matched = false; - std::match_results match; - - // MSVC and libc++ have problems with ^ and $ matching line ends inside a range - // If they didn't then the line by line iteration could be removed for the forwards - // case and replaced with the following 4 lines: - // Iterator uiStart(doc, startPos); - // Iterator uiEnd(doc, endPos); - // flagsMatch = MatchFlags(doc, startPos, endPos); - // matched = std::regex_search(uiStart, uiEnd, match, regexp, flagsMatch); - - // Line by line. - for (int line = resr.lineRangeStart; line != resr.lineRangeBreak; line += resr.increment) { - const Range lineRange = resr.LineRange(line); - Iterator itStart(doc, lineRange.start); - Iterator itEnd(doc, lineRange.end); - std::regex_constants::match_flag_type flagsMatch = MatchFlags(doc, lineRange.start, lineRange.end); - matched = std::regex_search(itStart, itEnd, match, regexp, flagsMatch); - // Check for the last match on this line. - if (matched) { - if (resr.increment == -1) { - while (matched) { - Iterator itNext(doc, match[0].second.PosRoundUp()); - flagsMatch = MatchFlags(doc, itNext.Pos(), lineRange.end); - std::match_results matchNext; - matched = std::regex_search(itNext, itEnd, matchNext, regexp, flagsMatch); - if (matched) { - if (match[0].first == match[0].second) { - // Empty match means failure so exit - return false; - } - match = matchNext; - } - } - matched = true; - } - break; - } - } - if (matched) { - for (size_t co = 0; co < match.size(); co++) { - search.bopat[co] = match[co].first.Pos(); - search.eopat[co] = match[co].second.PosRoundUp(); - Sci::Position lenMatch = search.eopat[co] - search.bopat[co]; - search.pat[co].resize(lenMatch); - for (Sci::Position iPos = 0; iPos < lenMatch; iPos++) { - search.pat[co][iPos] = doc->CharAt(iPos + search.bopat[co]); - } - } - } - return matched; -} - -long Cxx11RegexFindText(Document *doc, int minPos, int maxPos, const char *s, - bool caseSensitive, int *length, RESearch &search) { - const RESearchRange resr(doc, minPos, maxPos); - try { - //ElapsedTime et; - std::regex::flag_type flagsRe = std::regex::ECMAScript; - // Flags that apper to have no effect: - // | std::regex::collate | std::regex::extended; - if (!caseSensitive) - flagsRe = flagsRe | std::regex::icase; - - // Clear the RESearch so can fill in matches - search.Clear(); - - bool matched = false; - if (SC_CP_UTF8 == doc->dbcsCodePage) { - unsigned int lenS = static_cast(strlen(s)); - std::vector ws(lenS + 1); -#if WCHAR_T_IS_16 - size_t outLen = UTF16FromUTF8(s, lenS, &ws[0], lenS); -#else - size_t outLen = UTF32FromUTF8(s, lenS, reinterpret_cast(&ws[0]), lenS); -#endif - ws[outLen] = 0; - std::wregex regexp; -#if defined(__APPLE__) - // Using a UTF-8 locale doesn't change to Unicode over a byte buffer so '.' - // is one byte not one character. - // However, on OS X this makes wregex act as Unicode - std::locale localeU("en_US.UTF-8"); - regexp.imbue(localeU); -#endif - regexp.assign(&ws[0], flagsRe); - matched = MatchOnLines(doc, regexp, resr, search); - - } else { - std::regex regexp; - regexp.assign(s, flagsRe); - matched = MatchOnLines(doc, regexp, resr, search); - } - - int posMatch = -1; - if (matched) { - posMatch = search.bopat[0]; - *length = search.eopat[0] - search.bopat[0]; - } - // Example - search in doc/ScintillaHistory.html for - // [[:upper:]]eta[[:space:]] - // On MacBook, normally around 1 second but with locale imbued -> 14 seconds. - //double durSearch = et.Duration(true); - //Platform::DebugPrintf("Search:%9.6g \n", durSearch); - return posMatch; - } catch (std::regex_error &) { - // Failed to create regular expression - throw RegexError(); - } catch (...) { - // Failed in some other way - return -1; - } -} - -#endif - -} - -long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s, - bool caseSensitive, bool, bool, int flags, - int *length) { - -#ifndef NO_CXX11_REGEX - if (flags & SCFIND_CXX11REGEX) { - return Cxx11RegexFindText(doc, minPos, maxPos, s, - caseSensitive, length, search); - } -#endif - - const RESearchRange resr(doc, minPos, maxPos); - - const bool posix = (flags & SCFIND_POSIX) != 0; - - const char *errmsg = search.Compile(s, *length, caseSensitive, posix); - if (errmsg) { - return -1; - } - // Find a variable in a property file: \$(\([A-Za-z0-9_.]+\)) - // Replace first '.' with '-' in each property file variable reference: - // Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\)) - // Replace: $(\1-\2) - int pos = -1; - int lenRet = 0; - const char searchEnd = s[*length - 1]; - const char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0'; - for (int line = resr.lineRangeStart; line != resr.lineRangeBreak; line += resr.increment) { - int startOfLine = doc->LineStart(line); - int endOfLine = doc->LineEnd(line); - if (resr.increment == 1) { - if (line == resr.lineRangeStart) { - if ((resr.startPos != startOfLine) && (s[0] == '^')) - continue; // Can't match start of line if start position after start of line - startOfLine = resr.startPos; - } - if (line == resr.lineRangeEnd) { - if ((resr.endPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\')) - continue; // Can't match end of line if end position before end of line - endOfLine = resr.endPos; - } - } else { - if (line == resr.lineRangeEnd) { - if ((resr.endPos != startOfLine) && (s[0] == '^')) - continue; // Can't match start of line if end position after start of line - startOfLine = resr.endPos; - } - if (line == resr.lineRangeStart) { - if ((resr.startPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\')) - continue; // Can't match end of line if start position before end of line - endOfLine = resr.startPos; - } - } - - DocumentIndexer di(doc, endOfLine); - int success = search.Execute(di, startOfLine, endOfLine); - if (success) { - pos = search.bopat[0]; - // Ensure only whole characters selected - search.eopat[0] = doc->MovePositionOutsideChar(search.eopat[0], 1, false); - lenRet = search.eopat[0] - search.bopat[0]; - // There can be only one start of a line, so no need to look for last match in line - if ((resr.increment == -1) && (s[0] != '^')) { - // Check for the last match on this line. - int repetitions = 1000; // Break out of infinite loop - while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) { - success = search.Execute(di, pos+1, endOfLine); - if (success) { - if (search.eopat[0] <= minPos) { - pos = search.bopat[0]; - lenRet = search.eopat[0] - search.bopat[0]; - } else { - success = 0; - } - } - } - } - break; - } - } - *length = lenRet; - return pos; -} - -const char *BuiltinRegex::SubstituteByPosition(Document *doc, const char *text, int *length) { - substituted.clear(); - DocumentIndexer di(doc, doc->Length()); - search.GrabMatches(di); - for (int j = 0; j < *length; j++) { - if (text[j] == '\\') { - if (text[j + 1] >= '0' && text[j + 1] <= '9') { - unsigned int patNum = text[j + 1] - '0'; - unsigned int len = search.eopat[patNum] - search.bopat[patNum]; - if (!search.pat[patNum].empty()) // Will be null if try for a match that did not occur - substituted.append(search.pat[patNum].c_str(), len); - j++; - } else { - j++; - switch (text[j]) { - case 'a': - substituted.push_back('\a'); - break; - case 'b': - substituted.push_back('\b'); - break; - case 'f': - substituted.push_back('\f'); - break; - case 'n': - substituted.push_back('\n'); - break; - case 'r': - substituted.push_back('\r'); - break; - case 't': - substituted.push_back('\t'); - break; - case 'v': - substituted.push_back('\v'); - break; - case '\\': - substituted.push_back('\\'); - break; - default: - substituted.push_back('\\'); - j--; - } - } - } else { - substituted.push_back(text[j]); - } - } - *length = static_cast(substituted.length()); - return substituted.c_str(); -} - -#ifndef SCI_OWNREGEX - -#ifdef SCI_NAMESPACE - -RegexSearchBase *Scintilla::CreateRegexSearch(CharClassify *charClassTable) { - return new BuiltinRegex(charClassTable); -} - -#else - -RegexSearchBase *CreateRegexSearch(CharClassify *charClassTable) { - return new BuiltinRegex(charClassTable); -} - -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/Document.h b/qrenderdoc/3rdparty/scintilla/src/Document.h deleted file mode 100644 index c0a0bb808..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Document.h +++ /dev/null @@ -1,551 +0,0 @@ -// Scintilla source code edit control -/** @file Document.h - ** Text document that handles notifications, DBCS, styling, words and end of line. - **/ -// Copyright 1998-2011 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef DOCUMENT_H -#define DOCUMENT_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - * A Position is a position within a document between two characters or at the beginning or end. - * Sometimes used as a character index where it identifies the character after the position. - */ -typedef int Position; -const Position invalidPosition = -1; - -enum EncodingFamily { efEightBit, efUnicode, efDBCS }; - -/** - * The range class represents a range of text in a document. - * The two values are not sorted as one end may be more significant than the other - * as is the case for the selection where the end position is the position of the caret. - * If either position is invalidPosition then the range is invalid and most operations will fail. - */ -class Range { -public: - Position start; - Position end; - - explicit Range(Position pos=0) : - start(pos), end(pos) { - } - Range(Position start_, Position end_) : - start(start_), end(end_) { - } - - bool operator==(const Range &other) const { - return (start == other.start) && (end == other.end); - } - - bool Valid() const { - return (start != invalidPosition) && (end != invalidPosition); - } - - Position First() const { - return (start <= end) ? start : end; - } - - Position Last() const { - return (start > end) ? start : end; - } - - // Is the position within the range? - bool Contains(Position pos) const { - if (start < end) { - return (pos >= start && pos <= end); - } else { - return (pos <= start && pos >= end); - } - } - - // Is the character after pos within the range? - bool ContainsCharacter(Position pos) const { - if (start < end) { - return (pos >= start && pos < end); - } else { - return (pos < start && pos >= end); - } - } - - bool Contains(Range other) const { - return Contains(other.start) && Contains(other.end); - } - - bool Overlaps(Range other) const { - return - Contains(other.start) || - Contains(other.end) || - other.Contains(start) || - other.Contains(end); - } -}; - -class DocWatcher; -class DocModification; -class Document; - -/** - * Interface class for regular expression searching - */ -class RegexSearchBase { -public: - virtual ~RegexSearchBase() {} - - virtual long FindText(Document *doc, int minPos, int maxPos, const char *s, - bool caseSensitive, bool word, bool wordStart, int flags, int *length) = 0; - - ///@return String with the substitutions, must remain valid until the next call or destruction - virtual const char *SubstituteByPosition(Document *doc, const char *text, int *length) = 0; -}; - -/// Factory function for RegexSearchBase -extern RegexSearchBase *CreateRegexSearch(CharClassify *charClassTable); - -struct StyledText { - size_t length; - const char *text; - bool multipleStyles; - size_t style; - const unsigned char *styles; - StyledText(size_t length_, const char *text_, bool multipleStyles_, int style_, const unsigned char *styles_) : - length(length_), text(text_), multipleStyles(multipleStyles_), style(style_), styles(styles_) { - } - // Return number of bytes from start to before '\n' or end of text. - // Return 1 when start is outside text - size_t LineLength(size_t start) const { - size_t cur = start; - while ((cur < length) && (text[cur] != '\n')) - cur++; - return cur-start; - } - size_t StyleAt(size_t i) const { - return multipleStyles ? styles[i] : style; - } -}; - -class HighlightDelimiter { -public: - HighlightDelimiter() : isEnabled(false) { - Clear(); - } - - void Clear() { - beginFoldBlock = -1; - endFoldBlock = -1; - firstChangeableLineBefore = -1; - firstChangeableLineAfter = -1; - } - - bool NeedsDrawing(int line) const { - return isEnabled && (line <= firstChangeableLineBefore || line >= firstChangeableLineAfter); - } - - bool IsFoldBlockHighlighted(int line) const { - return isEnabled && beginFoldBlock != -1 && beginFoldBlock <= line && line <= endFoldBlock; - } - - bool IsHeadOfFoldBlock(int line) const { - return beginFoldBlock == line && line < endFoldBlock; - } - - bool IsBodyOfFoldBlock(int line) const { - return beginFoldBlock != -1 && beginFoldBlock < line && line < endFoldBlock; - } - - bool IsTailOfFoldBlock(int line) const { - return beginFoldBlock != -1 && beginFoldBlock < line && line == endFoldBlock; - } - - int beginFoldBlock; // Begin of current fold block - int endFoldBlock; // End of current fold block - int firstChangeableLineBefore; // First line that triggers repaint before starting line that determined current fold block - int firstChangeableLineAfter; // First line that triggers repaint after starting line that determined current fold block - bool isEnabled; -}; - -class Document; - -inline int LevelNumber(int level) { - return level & SC_FOLDLEVELNUMBERMASK; -} - -class LexInterface { -protected: - Document *pdoc; - ILexer *instance; - bool performingStyle; ///< Prevent reentrance -public: - explicit LexInterface(Document *pdoc_) : pdoc(pdoc_), instance(0), performingStyle(false) { - } - virtual ~LexInterface() { - } - void Colourise(int start, int end); - int LineEndTypesSupported(); - bool UseContainerLexing() const { - return instance == 0; - } -}; - -struct RegexError : public std::runtime_error { - RegexError() : std::runtime_error("regex failure") {} -}; - -/** - */ -class Document : PerLine, public IDocumentWithLineEnd, public ILoader { - -public: - /** Used to pair watcher pointer with user data. */ - struct WatcherWithUserData { - DocWatcher *watcher; - void *userData; - WatcherWithUserData(DocWatcher *watcher_=0, void *userData_=0) : - watcher(watcher_), userData(userData_) { - } - bool operator==(const WatcherWithUserData &other) const { - return (watcher == other.watcher) && (userData == other.userData); - } - }; - -private: - int refCount; - CellBuffer cb; - CharClassify charClass; - CaseFolder *pcf; - int endStyled; - int styleClock; - int enteredModification; - int enteredStyling; - int enteredReadOnlyCount; - - bool insertionSet; - std::string insertion; - - std::vector watchers; - - // ldSize is not real data - it is for dimensions and loops - enum lineData { ldMarkers, ldLevels, ldState, ldMargin, ldAnnotation, ldSize }; - PerLine *perLineData[ldSize]; - - bool matchesValid; - RegexSearchBase *regex; - -public: - - struct CharacterExtracted { - unsigned int character; - unsigned int widthBytes; - CharacterExtracted(unsigned int character_, unsigned int widthBytes_) : - character(character_), widthBytes(widthBytes_) { - } - // For DBCS characters turn 2 bytes into an int - static CharacterExtracted DBCS(unsigned char lead, unsigned char trail) { - return CharacterExtracted((lead << 8) | trail, 2); - } - }; - - LexInterface *pli; - - int eolMode; - /// Can also be SC_CP_UTF8 to enable UTF-8 mode - int dbcsCodePage; - int lineEndBitSet; - int tabInChars; - int indentInChars; - int actualIndentInChars; - bool useTabs; - bool tabIndents; - bool backspaceUnindents; - double durationStyleOneLine; - - DecorationList decorations; - - Document(); - virtual ~Document(); - - int AddRef(); - int SCI_METHOD Release(); - - virtual void Init(); - int LineEndTypesSupported() const; - bool SetDBCSCodePage(int dbcsCodePage_); - int GetLineEndTypesAllowed() const { return cb.GetLineEndTypes(); } - bool SetLineEndTypesAllowed(int lineEndBitSet_); - int GetLineEndTypesActive() const { return cb.GetLineEndTypes(); } - virtual void InsertLine(int line); - virtual void RemoveLine(int line); - - int SCI_METHOD Version() const { - return dvLineEnd; - } - - void SCI_METHOD SetErrorStatus(int status); - - Sci_Position SCI_METHOD LineFromPosition(Sci_Position pos) const; - int ClampPositionIntoDocument(int pos) const; - bool ContainsLineEnd(const char *s, int length) const { return cb.ContainsLineEnd(s, length); } - bool IsCrLf(int pos) const; - int LenChar(int pos); - bool InGoodUTF8(int pos, int &start, int &end) const; - int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const; - int NextPosition(int pos, int moveDir) const; - bool NextCharacter(int &pos, int moveDir) const; // Returns true if pos changed - Document::CharacterExtracted CharacterAfter(int position) const; - Document::CharacterExtracted CharacterBefore(int position) const; - Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const; - int GetRelativePositionUTF16(int positionStart, int characterOffset) const; - int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const; - int SCI_METHOD CodePage() const; - bool SCI_METHOD IsDBCSLeadByte(char ch) const; - int SafeSegment(const char *text, int length, int lengthSegment) const; - EncodingFamily CodePageFamily() const; - - // Gateways to modifying document - void ModifiedAt(int pos); - void CheckReadOnly(); - bool DeleteChars(int pos, int len); - int InsertString(int position, const char *s, int insertLength); - void ChangeInsertion(const char *s, int length); - int SCI_METHOD AddData(char *data, Sci_Position length); - void * SCI_METHOD ConvertToDocument(); - int Undo(); - int Redo(); - bool CanUndo() const { return cb.CanUndo(); } - bool CanRedo() const { return cb.CanRedo(); } - void DeleteUndoHistory() { cb.DeleteUndoHistory(); } - bool SetUndoCollection(bool collectUndo) { - return cb.SetUndoCollection(collectUndo); - } - bool IsCollectingUndo() const { return cb.IsCollectingUndo(); } - void BeginUndoAction() { cb.BeginUndoAction(); } - void EndUndoAction() { cb.EndUndoAction(); } - void AddUndoAction(int token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); } - void SetSavePoint(); - bool IsSavePoint() const { return cb.IsSavePoint(); } - - void TentativeStart() { cb.TentativeStart(); } - void TentativeCommit() { cb.TentativeCommit(); } - void TentativeUndo(); - bool TentativeActive() const { return cb.TentativeActive(); } - - const char * SCI_METHOD BufferPointer() { return cb.BufferPointer(); } - const char *RangePointer(int position, int rangeLength) { return cb.RangePointer(position, rangeLength); } - int GapPosition() const { return cb.GapPosition(); } - - int SCI_METHOD GetLineIndentation(Sci_Position line); - int SetLineIndentation(int line, int indent); - int GetLineIndentPosition(int line) const; - int GetColumn(int position); - int CountCharacters(int startPos, int endPos) const; - int CountUTF16(int startPos, int endPos) const; - int FindColumn(int line, int column); - void Indent(bool forwards, int lineBottom, int lineTop); - static std::string TransformLineEnds(const char *s, size_t len, int eolModeWanted); - void ConvertLineEnds(int eolModeSet); - void SetReadOnly(bool set) { cb.SetReadOnly(set); } - bool IsReadOnly() const { return cb.IsReadOnly(); } - - void DelChar(int pos); - void DelCharBack(int pos); - - char CharAt(int position) const { return cb.CharAt(position); } - void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const { - cb.GetCharRange(buffer, position, lengthRetrieve); - } - char SCI_METHOD StyleAt(Sci_Position position) const { return cb.StyleAt(position); } - int StyleIndexAt(Sci_Position position) const { return static_cast(cb.StyleAt(position)); } - void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const { - cb.GetStyleRange(buffer, position, lengthRetrieve); - } - int GetMark(int line); - int MarkerNext(int lineStart, int mask) const; - int AddMark(int line, int markerNum); - void AddMarkSet(int line, int valueSet); - void DeleteMark(int line, int markerNum); - void DeleteMarkFromHandle(int markerHandle); - void DeleteAllMarks(int markerNum); - int LineFromHandle(int markerHandle); - Sci_Position SCI_METHOD LineStart(Sci_Position line) const; - bool IsLineStartPosition(int position) const; - Sci_Position SCI_METHOD LineEnd(Sci_Position line) const; - int LineEndPosition(int position) const; - bool IsLineEndPosition(int position) const; - bool IsPositionInLineEnd(int position) const; - int VCHomePosition(int position) const; - - int SCI_METHOD SetLevel(Sci_Position line, int level); - int SCI_METHOD GetLevel(Sci_Position line) const; - void ClearLevels(); - int GetLastChild(int lineParent, int level=-1, int lastLine=-1); - int GetFoldParent(int line) const; - void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int lastLine); - - void Indent(bool forwards); - int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false) const; - int NextWordStart(int pos, int delta) const; - int NextWordEnd(int pos, int delta) const; - Sci_Position SCI_METHOD Length() const { return cb.Length(); } - void Allocate(int newSize) { cb.Allocate(newSize); } - - CharacterExtracted ExtractCharacter(int position) const; - - bool IsWordStartAt(int pos) const; - bool IsWordEndAt(int pos) const; - bool IsWordAt(int start, int end) const; - - bool MatchesWordOptions(bool word, bool wordStart, int pos, int length) const; - bool HasCaseFolder(void) const; - void SetCaseFolder(CaseFolder *pcf_); - long FindText(int minPos, int maxPos, const char *search, int flags, int *length); - const char *SubstituteByPosition(const char *text, int *length); - int LinesTotal() const; - - void SetDefaultCharClasses(bool includeWordClass); - void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass); - int GetCharsOfClass(CharClassify::cc characterClass, unsigned char *buffer) const; - void SCI_METHOD StartStyling(Sci_Position position, char mask); - bool SCI_METHOD SetStyleFor(Sci_Position length, char style); - bool SCI_METHOD SetStyles(Sci_Position length, const char *styles); - int GetEndStyled() const { return endStyled; } - void EnsureStyledTo(int pos); - void StyleToAdjustingLineDuration(int pos); - void LexerChanged(); - int GetStyleClock() const { return styleClock; } - void IncrementStyleClock(); - void SCI_METHOD DecorationSetCurrentIndicator(int indicator) { - decorations.SetCurrentIndicator(indicator); - } - void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength); - - int SCI_METHOD SetLineState(Sci_Position line, int state); - int SCI_METHOD GetLineState(Sci_Position line) const; - int GetMaxLineState(); - void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end); - - StyledText MarginStyledText(int line) const; - void MarginSetStyle(int line, int style); - void MarginSetStyles(int line, const unsigned char *styles); - void MarginSetText(int line, const char *text); - void MarginClearAll(); - - StyledText AnnotationStyledText(int line) const; - void AnnotationSetText(int line, const char *text); - void AnnotationSetStyle(int line, int style); - void AnnotationSetStyles(int line, const unsigned char *styles); - int AnnotationLines(int line) const; - void AnnotationClearAll(); - - bool AddWatcher(DocWatcher *watcher, void *userData); - bool RemoveWatcher(DocWatcher *watcher, void *userData); - - bool IsASCIIWordByte(unsigned char ch) const; - CharClassify::cc WordCharacterClass(unsigned int ch) const; - bool IsWordPartSeparator(unsigned int ch) const; - int WordPartLeft(int pos) const; - int WordPartRight(int pos) const; - int ExtendStyleRange(int pos, int delta, bool singleLine = false); - bool IsWhiteLine(int line) const; - int ParaUp(int pos) const; - int ParaDown(int pos) const; - int IndentSize() const { return actualIndentInChars; } - int BraceMatch(int position, int maxReStyle); - -private: - void NotifyModifyAttempt(); - void NotifySavePoint(bool atSavePoint); - void NotifyModified(DocModification mh); -}; - -class UndoGroup { - Document *pdoc; - bool groupNeeded; -public: - UndoGroup(Document *pdoc_, bool groupNeeded_=true) : - pdoc(pdoc_), groupNeeded(groupNeeded_) { - if (groupNeeded) { - pdoc->BeginUndoAction(); - } - } - ~UndoGroup() { - if (groupNeeded) { - pdoc->EndUndoAction(); - } - } - bool Needed() const { - return groupNeeded; - } -}; - - -/** - * To optimise processing of document modifications by DocWatchers, a hint is passed indicating the - * scope of the change. - * If the DocWatcher is a document view then this can be used to optimise screen updating. - */ -class DocModification { -public: - int modificationType; - int position; - int length; - int linesAdded; /**< Negative if lines deleted. */ - const char *text; /**< Only valid for changes to text, not for changes to style. */ - int line; - int foldLevelNow; - int foldLevelPrev; - int annotationLinesAdded; - int token; - - DocModification(int modificationType_, int position_=0, int length_=0, - int linesAdded_=0, const char *text_=0, int line_=0) : - modificationType(modificationType_), - position(position_), - length(length_), - linesAdded(linesAdded_), - text(text_), - line(line_), - foldLevelNow(0), - foldLevelPrev(0), - annotationLinesAdded(0), - token(0) {} - - DocModification(int modificationType_, const Action &act, int linesAdded_=0) : - modificationType(modificationType_), - position(act.position), - length(act.lenData), - linesAdded(linesAdded_), - text(act.data), - line(0), - foldLevelNow(0), - foldLevelPrev(0), - annotationLinesAdded(0), - token(0) {} -}; - -/** - * A class that wants to receive notifications from a Document must be derived from DocWatcher - * and implement the notification methods. It can then be added to the watcher list with AddWatcher. - */ -class DocWatcher { -public: - virtual ~DocWatcher() {} - - virtual void NotifyModifyAttempt(Document *doc, void *userData) = 0; - virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0; - virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0; - virtual void NotifyDeleted(Document *doc, void *userData) = 0; - virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0; - virtual void NotifyLexerChanged(Document *doc, void *userData) = 0; - virtual void NotifyErrorOccurred(Document *doc, void *userData, int status) = 0; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/EditModel.cxx b/qrenderdoc/3rdparty/scintilla/src/EditModel.cxx deleted file mode 100644 index 0f64e07f9..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/EditModel.cxx +++ /dev/null @@ -1,79 +0,0 @@ -// Scintilla source code edit control -/** @file EditModel.cxx - ** Defines the editor state that must be visible to EditorView. - **/ -// Copyright 1998-2014 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "ILexer.h" -#include "Scintilla.h" - -#include "StringCopy.h" -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" -#include "CellBuffer.h" -#include "KeyMap.h" -#include "Indicator.h" -#include "XPM.h" -#include "LineMarker.h" -#include "Style.h" -#include "ViewStyle.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "CaseFolder.h" -#include "Document.h" -#include "UniConversion.h" -#include "Selection.h" -#include "PositionCache.h" -#include "EditModel.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -Caret::Caret() : - active(false), on(false), period(500) {} - -EditModel::EditModel() { - inOverstrike = false; - xOffset = 0; - trackLineWidth = false; - posDrag = SelectionPosition(invalidPosition); - braces[0] = invalidPosition; - braces[1] = invalidPosition; - bracesMatchStyle = STYLE_BRACEBAD; - highlightGuideColumn = 0; - primarySelection = true; - imeInteraction = imeWindowed; - foldFlags = 0; - foldDisplayTextStyle = SC_FOLDDISPLAYTEXT_HIDDEN; - hotspot = Range(invalidPosition); - hoverIndicatorPos = invalidPosition; - wrapWidth = LineLayout::wrapWidthInfinite; - pdoc = new Document(); - pdoc->AddRef(); -} - -EditModel::~EditModel() { - pdoc->Release(); - pdoc = 0; -} diff --git a/qrenderdoc/3rdparty/scintilla/src/EditModel.h b/qrenderdoc/3rdparty/scintilla/src/EditModel.h deleted file mode 100644 index 847fd728d..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/EditModel.h +++ /dev/null @@ -1,71 +0,0 @@ -// Scintilla source code edit control -/** @file EditModel.h - ** Defines the editor state that must be visible to EditorView. - **/ -// Copyright 1998-2014 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef EDITMODEL_H -#define EDITMODEL_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** -*/ -class Caret { -public: - bool active; - bool on; - int period; - - Caret(); -}; - -class EditModel { - // Private so EditModel objects can not be copied - explicit EditModel(const EditModel &); - EditModel &operator=(const EditModel &); - -public: - bool inOverstrike; - int xOffset; ///< Horizontal scrolled amount in pixels - bool trackLineWidth; - - SpecialRepresentations reprs; - Caret caret; - SelectionPosition posDrag; - Position braces[2]; - int bracesMatchStyle; - int highlightGuideColumn; - Selection sel; - bool primarySelection; - - enum IMEInteraction { imeWindowed, imeInline } imeInteraction; - - int foldFlags; - int foldDisplayTextStyle; - ContractionState cs; - // Hotspot support - Range hotspot; - int hoverIndicatorPos; - - // Wrapping support - int wrapWidth; - - Document *pdoc; - - EditModel(); - virtual ~EditModel(); - virtual int TopLineOfMain() const = 0; - virtual Point GetVisibleOriginInMain() const = 0; - virtual int LinesOnScreen() const = 0; - virtual Range GetHotSpotRange() const = 0; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/EditView.cxx b/qrenderdoc/3rdparty/scintilla/src/EditView.cxx deleted file mode 100644 index 5c622568b..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/EditView.cxx +++ /dev/null @@ -1,2311 +0,0 @@ -// Scintilla source code edit control -/** @file EditView.cxx - ** Defines the appearance of the main text area of the editor window. - **/ -// Copyright 1998-2014 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "ILexer.h" -#include "Scintilla.h" - -#include "StringCopy.h" -#include "CharacterSet.h" -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" -#include "CellBuffer.h" -#include "PerLine.h" -#include "KeyMap.h" -#include "Indicator.h" -#include "XPM.h" -#include "LineMarker.h" -#include "Style.h" -#include "ViewStyle.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "CaseFolder.h" -#include "Document.h" -#include "UniConversion.h" -#include "Selection.h" -#include "PositionCache.h" -#include "EditModel.h" -#include "MarginView.h" -#include "EditView.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static inline bool IsControlCharacter(int ch) { - // iscntrl returns true for lots of chars > 127 which are displayable - return ch >= 0 && ch < ' '; -} - -PrintParameters::PrintParameters() { - magnification = 0; - colourMode = SC_PRINT_NORMAL; - wrapState = eWrapWord; -} - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st) { - if (st.multipleStyles) { - for (size_t iStyle = 0; iStyle(styles[endSegment + 1]) == style)) - endSegment++; - FontAlias fontText = vs.styles[style + styleOffset].font; - width += static_cast(surface->WidthText(fontText, text + start, - static_cast(endSegment - start + 1))); - start = endSegment + 1; - } - return width; -} - -int WidestLineWidth(Surface *surface, const ViewStyle &vs, int styleOffset, const StyledText &st) { - int widthMax = 0; - size_t start = 0; - while (start < st.length) { - size_t lenLine = st.LineLength(start); - int widthSubLine; - if (st.multipleStyles) { - widthSubLine = WidthStyledText(surface, vs, styleOffset, st.text + start, st.styles + start, lenLine); - } else { - FontAlias fontText = vs.styles[styleOffset + st.style].font; - widthSubLine = static_cast(surface->WidthText(fontText, - st.text + start, static_cast(lenLine))); - } - if (widthSubLine > widthMax) - widthMax = widthSubLine; - start += lenLine + 1; - } - return widthMax; -} - -void DrawTextNoClipPhase(Surface *surface, PRectangle rc, const Style &style, XYPOSITION ybase, - const char *s, int len, DrawPhase phase) { - FontAlias fontText = style.font; - if (phase & drawBack) { - if (phase & drawText) { - // Drawing both - surface->DrawTextNoClip(rc, fontText, ybase, s, len, - style.fore, style.back); - } else { - surface->FillRectangle(rc, style.back); - } - } else if (phase & drawText) { - surface->DrawTextTransparent(rc, fontText, ybase, s, len, style.fore); - } -} - -void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRectangle rcText, - const StyledText &st, size_t start, size_t length, DrawPhase phase) { - - if (st.multipleStyles) { - int x = static_cast(rcText.left); - size_t i = 0; - while (i < length) { - size_t end = i; - size_t style = st.styles[i + start]; - while (end < length - 1 && st.styles[start + end + 1] == style) - end++; - style += styleOffset; - FontAlias fontText = vs.styles[style].font; - const int width = static_cast(surface->WidthText(fontText, - st.text + start + i, static_cast(end - i + 1))); - PRectangle rcSegment = rcText; - rcSegment.left = static_cast(x); - rcSegment.right = static_cast(x + width + 1); - DrawTextNoClipPhase(surface, rcSegment, vs.styles[style], - rcText.top + vs.maxAscent, st.text + start + i, - static_cast(end - i + 1), phase); - x += width; - i = end + 1; - } - } else { - const size_t style = st.style + styleOffset; - DrawTextNoClipPhase(surface, rcText, vs.styles[style], - rcText.top + vs.maxAscent, st.text + start, - static_cast(length), phase); - } -} - -#ifdef SCI_NAMESPACE -} -#endif - -const XYPOSITION epsilon = 0.0001f; // A small nudge to avoid floating point precision issues - -EditView::EditView() { - ldTabstops = NULL; - tabWidthMinimumPixels = 2; // needed for calculating tab stops for fractional proportional fonts - hideSelection = false; - drawOverstrikeCaret = true; - bufferedDraw = true; - phasesDraw = phasesTwo; - lineWidthMaxSeen = 0; - additionalCaretsBlink = true; - additionalCaretsVisible = true; - imeCaretBlockOverride = false; - pixmapLine = 0; - pixmapIndentGuide = 0; - pixmapIndentGuideHighlight = 0; - llc.SetLevel(LineLayoutCache::llcCaret); - posCache.SetSize(0x400); - tabArrowHeight = 4; - customDrawTabArrow = NULL; - customDrawWrapMarker = NULL; -} - -EditView::~EditView() { - delete ldTabstops; - ldTabstops = NULL; -} - -bool EditView::SetTwoPhaseDraw(bool twoPhaseDraw) { - const PhasesDraw phasesDrawNew = twoPhaseDraw ? phasesTwo : phasesOne; - const bool redraw = phasesDraw != phasesDrawNew; - phasesDraw = phasesDrawNew; - return redraw; -} - -bool EditView::SetPhasesDraw(int phases) { - const PhasesDraw phasesDrawNew = static_cast(phases); - const bool redraw = phasesDraw != phasesDrawNew; - phasesDraw = phasesDrawNew; - return redraw; -} - -bool EditView::LinesOverlap() const { - return phasesDraw == phasesMultiple; -} - -void EditView::ClearAllTabstops() { - delete ldTabstops; - ldTabstops = 0; -} - -XYPOSITION EditView::NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const { - int next = GetNextTabstop(line, static_cast(x + tabWidthMinimumPixels)); - if (next > 0) - return static_cast(next); - return (static_cast((x + tabWidthMinimumPixels) / tabWidth) + 1) * tabWidth; -} - -bool EditView::ClearTabstops(int line) { - LineTabstops *lt = static_cast(ldTabstops); - return lt && lt->ClearTabstops(line); -} - -bool EditView::AddTabstop(int line, int x) { - if (!ldTabstops) { - ldTabstops = new LineTabstops(); - } - LineTabstops *lt = static_cast(ldTabstops); - return lt && lt->AddTabstop(line, x); -} - -int EditView::GetNextTabstop(int line, int x) const { - LineTabstops *lt = static_cast(ldTabstops); - if (lt) { - return lt->GetNextTabstop(line, x); - } else { - return 0; - } -} - -void EditView::LinesAddedOrRemoved(int lineOfPos, int linesAdded) { - if (ldTabstops) { - if (linesAdded > 0) { - for (int line = lineOfPos; line < lineOfPos + linesAdded; line++) { - ldTabstops->InsertLine(line); - } - } else { - for (int line = (lineOfPos + -linesAdded) - 1; line >= lineOfPos; line--) { - ldTabstops->RemoveLine(line); - } - } - } -} - -void EditView::DropGraphics(bool freeObjects) { - if (freeObjects) { - delete pixmapLine; - pixmapLine = 0; - delete pixmapIndentGuide; - pixmapIndentGuide = 0; - delete pixmapIndentGuideHighlight; - pixmapIndentGuideHighlight = 0; - } else { - if (pixmapLine) - pixmapLine->Release(); - if (pixmapIndentGuide) - pixmapIndentGuide->Release(); - if (pixmapIndentGuideHighlight) - pixmapIndentGuideHighlight->Release(); - } -} - -void EditView::AllocateGraphics(const ViewStyle &vsDraw) { - if (!pixmapLine) - pixmapLine = Surface::Allocate(vsDraw.technology); - if (!pixmapIndentGuide) - pixmapIndentGuide = Surface::Allocate(vsDraw.technology); - if (!pixmapIndentGuideHighlight) - pixmapIndentGuideHighlight = Surface::Allocate(vsDraw.technology); -} - -static const char *ControlCharacterString(unsigned char ch) { - const char *reps[] = { - "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", - "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", - "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", - "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" - }; - if (ch < ELEMENTS(reps)) { - return reps[ch]; - } else { - return "BAD"; - } -} - -static void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid, const ViewStyle &vsDraw) { - if ((rcTab.left + 2) < (rcTab.right - 1)) - surface->MoveTo(static_cast(rcTab.left) + 2, ymid); - else - surface->MoveTo(static_cast(rcTab.right) - 1, ymid); - surface->LineTo(static_cast(rcTab.right) - 1, ymid); - - // Draw the arrow head if needed - if (vsDraw.tabDrawMode == tdLongArrow) { - int ydiff = static_cast(rcTab.bottom - rcTab.top) / 2; - int xhead = static_cast(rcTab.right) - 1 - ydiff; - if (xhead <= rcTab.left) { - ydiff -= static_cast(rcTab.left) - xhead - 1; - xhead = static_cast(rcTab.left) - 1; - } - surface->LineTo(xhead, ymid - ydiff); - surface->MoveTo(static_cast(rcTab.right) - 1, ymid); - surface->LineTo(xhead, ymid + ydiff); - } -} - -void EditView::RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw) { - if (!pixmapIndentGuide->Initialised()) { - // 1 extra pixel in height so can handle odd/even positions and so produce a continuous line - pixmapIndentGuide->InitPixMap(1, vsDraw.lineHeight + 1, surfaceWindow, wid); - pixmapIndentGuideHighlight->InitPixMap(1, vsDraw.lineHeight + 1, surfaceWindow, wid); - PRectangle rcIG = PRectangle::FromInts(0, 0, 1, vsDraw.lineHeight); - pixmapIndentGuide->FillRectangle(rcIG, vsDraw.styles[STYLE_INDENTGUIDE].back); - pixmapIndentGuide->PenColour(vsDraw.styles[STYLE_INDENTGUIDE].fore); - pixmapIndentGuideHighlight->FillRectangle(rcIG, vsDraw.styles[STYLE_BRACELIGHT].back); - pixmapIndentGuideHighlight->PenColour(vsDraw.styles[STYLE_BRACELIGHT].fore); - for (int stripe = 1; stripe < vsDraw.lineHeight + 1; stripe += 2) { - PRectangle rcPixel = PRectangle::FromInts(0, stripe, 1, stripe + 1); - pixmapIndentGuide->FillRectangle(rcPixel, vsDraw.styles[STYLE_INDENTGUIDE].fore); - pixmapIndentGuideHighlight->FillRectangle(rcPixel, vsDraw.styles[STYLE_BRACELIGHT].fore); - } - } -} - -LineLayout *EditView::RetrieveLineLayout(int lineNumber, const EditModel &model) { - int posLineStart = model.pdoc->LineStart(lineNumber); - int posLineEnd = model.pdoc->LineStart(lineNumber + 1); - PLATFORM_ASSERT(posLineEnd >= posLineStart); - int lineCaret = model.pdoc->LineFromPosition(model.sel.MainCaret()); - return llc.Retrieve(lineNumber, lineCaret, - posLineEnd - posLineStart, model.pdoc->GetStyleClock(), - model.LinesOnScreen() + 1, model.pdoc->LinesTotal()); -} - -/** -* Fill in the LineLayout data for the given line. -* Copy the given @a line and its styles from the document into local arrays. -* Also determine the x position at which each character starts. -*/ -void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, const ViewStyle &vstyle, LineLayout *ll, int width) { - if (!ll) - return; - - PLATFORM_ASSERT(line < model.pdoc->LinesTotal()); - PLATFORM_ASSERT(ll->chars != NULL); - int posLineStart = model.pdoc->LineStart(line); - int posLineEnd = model.pdoc->LineStart(line + 1); - // If the line is very long, limit the treatment to a length that should fit in the viewport - if (posLineEnd >(posLineStart + ll->maxLineLength)) { - posLineEnd = posLineStart + ll->maxLineLength; - } - if (ll->validity == LineLayout::llCheckTextAndStyle) { - int lineLength = posLineEnd - posLineStart; - if (!vstyle.viewEOL) { - lineLength = model.pdoc->LineEnd(line) - posLineStart; - } - if (lineLength == ll->numCharsInLine) { - // See if chars, styles, indicators, are all the same - bool allSame = true; - // Check base line layout - int styleByte = 0; - int numCharsInLine = 0; - while (numCharsInLine < lineLength) { - int charInDoc = numCharsInLine + posLineStart; - char chDoc = model.pdoc->CharAt(charInDoc); - styleByte = model.pdoc->StyleIndexAt(charInDoc); - allSame = allSame && - (ll->styles[numCharsInLine] == styleByte); - if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed) - allSame = allSame && - (ll->chars[numCharsInLine] == chDoc); - else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) - allSame = allSame && - (ll->chars[numCharsInLine] == MakeLowerCase(chDoc)); - else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper) - allSame = allSame && - (ll->chars[numCharsInLine] == MakeUpperCase(chDoc)); - else { // Style::caseCamel - if ((model.pdoc->IsASCIIWordByte(ll->chars[numCharsInLine])) && - ((numCharsInLine == 0) || (!model.pdoc->IsASCIIWordByte(ll->chars[numCharsInLine - 1])))) { - allSame = allSame && (ll->chars[numCharsInLine] == MakeUpperCase(chDoc)); - } else { - allSame = allSame && (ll->chars[numCharsInLine] == MakeLowerCase(chDoc)); - } - } - numCharsInLine++; - } - allSame = allSame && (ll->styles[numCharsInLine] == styleByte); // For eolFilled - if (allSame) { - ll->validity = LineLayout::llPositions; - } else { - ll->validity = LineLayout::llInvalid; - } - } else { - ll->validity = LineLayout::llInvalid; - } - } - if (ll->validity == LineLayout::llInvalid) { - ll->widthLine = LineLayout::wrapWidthInfinite; - ll->lines = 1; - if (vstyle.edgeState == EDGE_BACKGROUND) { - ll->edgeColumn = model.pdoc->FindColumn(line, vstyle.theEdge.column); - if (ll->edgeColumn >= posLineStart) { - ll->edgeColumn -= posLineStart; - } - } else { - ll->edgeColumn = -1; - } - - // Fill base line layout - const int lineLength = posLineEnd - posLineStart; - model.pdoc->GetCharRange(ll->chars, posLineStart, lineLength); - model.pdoc->GetStyleRange(ll->styles, posLineStart, lineLength); - int numCharsBeforeEOL = model.pdoc->LineEnd(line) - posLineStart; - const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL; - for (int styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) { - const unsigned char styleByte = ll->styles[styleInLine]; - ll->styles[styleInLine] = styleByte; - } - const unsigned char styleByteLast = (lineLength > 0) ? ll->styles[lineLength - 1] : 0; - if (vstyle.someStylesForceCase) { - for (int charInLine = 0; charInLinechars[charInLine]; - if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseUpper) - ll->chars[charInLine] = static_cast(MakeUpperCase(chDoc)); - else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseLower) - ll->chars[charInLine] = static_cast(MakeLowerCase(chDoc)); - else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseCamel) { - if ((model.pdoc->IsASCIIWordByte(ll->chars[charInLine])) && - ((charInLine == 0) || (!model.pdoc->IsASCIIWordByte(ll->chars[charInLine - 1])))) { - ll->chars[charInLine] = static_cast(MakeUpperCase(chDoc)); - } else { - ll->chars[charInLine] = static_cast(MakeLowerCase(chDoc)); - } - } - } - } - ll->xHighlightGuide = 0; - // Extra element at the end of the line to hold end x position and act as - ll->chars[numCharsInLine] = 0; // Also triggers processing in the loops as this is a control character - ll->styles[numCharsInLine] = styleByteLast; // For eolFilled - - // Layout the line, determining the position of each character, - // with an extra element at the end for the end of the line. - ll->positions[0] = 0; - bool lastSegItalics = false; - - BreakFinder bfLayout(ll, NULL, Range(0, numCharsInLine), posLineStart, 0, false, model.pdoc, &model.reprs, NULL); - while (bfLayout.More()) { - - const TextSegment ts = bfLayout.Next(); - - std::fill(&ll->positions[ts.start + 1], &ll->positions[ts.end() + 1], 0.0f); - if (vstyle.styles[ll->styles[ts.start]].visible) { - if (ts.representation) { - XYPOSITION representationWidth = vstyle.controlCharWidth; - if (ll->chars[ts.start] == '\t') { - // Tab is a special case of representation, taking a variable amount of space - const XYPOSITION x = ll->positions[ts.start]; - representationWidth = NextTabstopPos(line, x, vstyle.tabWidth) - ll->positions[ts.start]; - } else { - if (representationWidth <= 0.0) { - XYPOSITION positionsRepr[256]; // Should expand when needed - posCache.MeasureWidths(surface, vstyle, STYLE_CONTROLCHAR, ts.representation->stringRep.c_str(), - static_cast(ts.representation->stringRep.length()), positionsRepr, model.pdoc); - representationWidth = positionsRepr[ts.representation->stringRep.length() - 1] + vstyle.ctrlCharPadding; - } - } - for (int ii = 0; ii < ts.length; ii++) - ll->positions[ts.start + 1 + ii] = representationWidth; - } else { - if ((ts.length == 1) && (' ' == ll->chars[ts.start])) { - // Over half the segments are single characters and of these about half are space characters. - ll->positions[ts.start + 1] = vstyle.styles[ll->styles[ts.start]].spaceWidth; - } else { - posCache.MeasureWidths(surface, vstyle, ll->styles[ts.start], ll->chars + ts.start, - ts.length, ll->positions + ts.start + 1, model.pdoc); - } - } - lastSegItalics = (!ts.representation) && ((ll->chars[ts.end() - 1] != ' ') && vstyle.styles[ll->styles[ts.start]].italic); - } - - for (int posToIncrease = ts.start + 1; posToIncrease <= ts.end(); posToIncrease++) { - ll->positions[posToIncrease] += ll->positions[ts.start]; - } - } - - // Small hack to make lines that end with italics not cut off the edge of the last character - if (lastSegItalics) { - ll->positions[numCharsInLine] += vstyle.lastSegItalicsOffset; - } - ll->numCharsInLine = numCharsInLine; - ll->numCharsBeforeEOL = numCharsBeforeEOL; - ll->validity = LineLayout::llPositions; - } - // Hard to cope when too narrow, so just assume there is space - if (width < 20) { - width = 20; - } - if ((ll->validity == LineLayout::llPositions) || (ll->widthLine != width)) { - ll->widthLine = width; - if (width == LineLayout::wrapWidthInfinite) { - ll->lines = 1; - } else if (width > ll->positions[ll->numCharsInLine]) { - // Simple common case where line does not need wrapping. - ll->lines = 1; - } else { - if (vstyle.wrapVisualFlags & SC_WRAPVISUALFLAG_END) { - width -= static_cast(vstyle.aveCharWidth); // take into account the space for end wrap mark - } - XYPOSITION wrapAddIndent = 0; // This will be added to initial indent of line - if (vstyle.wrapIndentMode == SC_WRAPINDENT_INDENT) { - wrapAddIndent = model.pdoc->IndentSize() * vstyle.spaceWidth; - } else if (vstyle.wrapIndentMode == SC_WRAPINDENT_FIXED) { - wrapAddIndent = vstyle.wrapVisualStartIndent * vstyle.aveCharWidth; - } - ll->wrapIndent = wrapAddIndent; - if (vstyle.wrapIndentMode != SC_WRAPINDENT_FIXED) - for (int i = 0; i < ll->numCharsInLine; i++) { - if (!IsSpaceOrTab(ll->chars[i])) { - ll->wrapIndent += ll->positions[i]; // Add line indent - break; - } - } - // Check for text width minimum - if (ll->wrapIndent > width - static_cast(vstyle.aveCharWidth) * 15) - ll->wrapIndent = wrapAddIndent; - // Check for wrapIndent minimum - if ((vstyle.wrapVisualFlags & SC_WRAPVISUALFLAG_START) && (ll->wrapIndent < vstyle.aveCharWidth)) - ll->wrapIndent = vstyle.aveCharWidth; // Indent to show start visual - ll->lines = 0; - // Calculate line start positions based upon width. - int lastGoodBreak = 0; - int lastLineStart = 0; - XYACCUMULATOR startOffset = 0; - int p = 0; - while (p < ll->numCharsInLine) { - if ((ll->positions[p + 1] - startOffset) >= width) { - if (lastGoodBreak == lastLineStart) { - // Try moving to start of last character - if (p > 0) { - lastGoodBreak = model.pdoc->MovePositionOutsideChar(p + posLineStart, -1) - - posLineStart; - } - if (lastGoodBreak == lastLineStart) { - // Ensure at least one character on line. - lastGoodBreak = model.pdoc->MovePositionOutsideChar(lastGoodBreak + posLineStart + 1, 1) - - posLineStart; - } - } - lastLineStart = lastGoodBreak; - ll->lines++; - ll->SetLineStart(ll->lines, lastGoodBreak); - startOffset = ll->positions[lastGoodBreak]; - // take into account the space for start wrap mark and indent - startOffset -= ll->wrapIndent; - p = lastGoodBreak + 1; - continue; - } - if (p > 0) { - if (vstyle.wrapState == eWrapChar) { - lastGoodBreak = model.pdoc->MovePositionOutsideChar(p + posLineStart, -1) - - posLineStart; - p = model.pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart; - continue; - } else if ((vstyle.wrapState == eWrapWord) && (ll->styles[p] != ll->styles[p - 1])) { - lastGoodBreak = p; - } else if (IsSpaceOrTab(ll->chars[p - 1]) && !IsSpaceOrTab(ll->chars[p])) { - lastGoodBreak = p; - } - } - p++; - } - ll->lines++; - } - ll->validity = LineLayout::llLines; - } -} - -Point EditView::LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, int topLine, - const ViewStyle &vs, PointEnd pe) { - Point pt; - if (pos.Position() == INVALID_POSITION) - return pt; - int lineDoc = model.pdoc->LineFromPosition(pos.Position()); - int posLineStart = model.pdoc->LineStart(lineDoc); - if ((pe & peLineEnd) && (lineDoc > 0) && (pos.Position() == posLineStart)) { - // Want point at end of first line - lineDoc--; - posLineStart = model.pdoc->LineStart(lineDoc); - } - const int lineVisible = model.cs.DisplayFromDoc(lineDoc); - AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); - if (surface && ll) { - LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); - const int posInLine = pos.Position() - posLineStart; - pt = ll->PointFromPosition(posInLine, vs.lineHeight, pe); - pt.y += (lineVisible - topLine) * vs.lineHeight; - pt.x += vs.textStart - model.xOffset; - } - pt.x += pos.VirtualSpace() * vs.styles[ll->EndLineStyle()].spaceWidth; - return pt; -} - -Range EditView::RangeDisplayLine(Surface *surface, const EditModel &model, int lineVisible, const ViewStyle &vs) { - Range rangeSubLine = Range(0,0); - if (lineVisible < 0) { - return rangeSubLine; - } - const int lineDoc = model.cs.DocFromDisplay(lineVisible); - const int positionLineStart = model.pdoc->LineStart(lineDoc); - AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); - if (surface && ll) { - LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); - const int lineStartSet = model.cs.DisplayFromDoc(lineDoc); - const int subLine = lineVisible - lineStartSet; - if (subLine < ll->lines) { - rangeSubLine = ll->SubLineRange(subLine); - if (subLine == ll->lines-1) { - rangeSubLine.end = model.pdoc->LineStart(lineDoc + 1) - - positionLineStart; - } - } - } - rangeSubLine.start += positionLineStart; - rangeSubLine.end += positionLineStart; - return rangeSubLine; -} - -SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid, bool charPosition, bool virtualSpace, const ViewStyle &vs) { - pt.x = pt.x - vs.textStart; - int visibleLine = static_cast(floor(pt.y / vs.lineHeight)); - if (!canReturnInvalid && (visibleLine < 0)) - visibleLine = 0; - const int lineDoc = model.cs.DocFromDisplay(visibleLine); - if (canReturnInvalid && (lineDoc < 0)) - return SelectionPosition(INVALID_POSITION); - if (lineDoc >= model.pdoc->LinesTotal()) - return SelectionPosition(canReturnInvalid ? INVALID_POSITION : model.pdoc->Length()); - const int posLineStart = model.pdoc->LineStart(lineDoc); - AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); - if (surface && ll) { - LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); - const int lineStartSet = model.cs.DisplayFromDoc(lineDoc); - const int subLine = visibleLine - lineStartSet; - if (subLine < ll->lines) { - const Range rangeSubLine = ll->SubLineRange(subLine); - const XYPOSITION subLineStart = ll->positions[rangeSubLine.start]; - if (subLine > 0) // Wrapped - pt.x -= ll->wrapIndent; - const int positionInLine = ll->FindPositionFromX(static_cast(pt.x + subLineStart), - rangeSubLine, charPosition); - if (positionInLine < rangeSubLine.end) { - return SelectionPosition(model.pdoc->MovePositionOutsideChar(positionInLine + posLineStart, 1)); - } - if (virtualSpace) { - const XYPOSITION spaceWidth = vs.styles[ll->EndLineStyle()].spaceWidth; - const int spaceOffset = static_cast( - (pt.x + subLineStart - ll->positions[rangeSubLine.end] + spaceWidth / 2) / spaceWidth); - return SelectionPosition(rangeSubLine.end + posLineStart, spaceOffset); - } else if (canReturnInvalid) { - if (pt.x < (ll->positions[rangeSubLine.end] - subLineStart)) { - return SelectionPosition(model.pdoc->MovePositionOutsideChar(rangeSubLine.end + posLineStart, 1)); - } - } else { - return SelectionPosition(rangeSubLine.end + posLineStart); - } - } - if (!canReturnInvalid) - return SelectionPosition(ll->numCharsInLine + posLineStart); - } - return SelectionPosition(canReturnInvalid ? INVALID_POSITION : posLineStart); -} - -/** -* Find the document position corresponding to an x coordinate on a particular document line. -* Ensure is between whole characters when document is in multi-byte or UTF-8 mode. -* This method is used for rectangular selections and does not work on wrapped lines. -*/ -SelectionPosition EditView::SPositionFromLineX(Surface *surface, const EditModel &model, int lineDoc, int x, const ViewStyle &vs) { - AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); - if (surface && ll) { - const int posLineStart = model.pdoc->LineStart(lineDoc); - LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); - const Range rangeSubLine = ll->SubLineRange(0); - const XYPOSITION subLineStart = ll->positions[rangeSubLine.start]; - const int positionInLine = ll->FindPositionFromX(x + subLineStart, rangeSubLine, false); - if (positionInLine < rangeSubLine.end) { - return SelectionPosition(model.pdoc->MovePositionOutsideChar(positionInLine + posLineStart, 1)); - } - const XYPOSITION spaceWidth = vs.styles[ll->EndLineStyle()].spaceWidth; - const int spaceOffset = static_cast( - (x + subLineStart - ll->positions[rangeSubLine.end] + spaceWidth / 2) / spaceWidth); - return SelectionPosition(rangeSubLine.end + posLineStart, spaceOffset); - } - return SelectionPosition(0); -} - -int EditView::DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs) { - int lineDoc = model.pdoc->LineFromPosition(pos); - int lineDisplay = model.cs.DisplayFromDoc(lineDoc); - AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); - if (surface && ll) { - LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); - unsigned int posLineStart = model.pdoc->LineStart(lineDoc); - int posInLine = pos - posLineStart; - lineDisplay--; // To make up for first increment ahead. - for (int subLine = 0; subLine < ll->lines; subLine++) { - if (posInLine >= ll->LineStart(subLine)) { - lineDisplay++; - } - } - } - return lineDisplay; -} - -int EditView::StartEndDisplayLine(Surface *surface, const EditModel &model, int pos, bool start, const ViewStyle &vs) { - int line = model.pdoc->LineFromPosition(pos); - AutoLineLayout ll(llc, RetrieveLineLayout(line, model)); - int posRet = INVALID_POSITION; - if (surface && ll) { - unsigned int posLineStart = model.pdoc->LineStart(line); - LayoutLine(model, line, surface, vs, ll, model.wrapWidth); - int posInLine = pos - posLineStart; - if (posInLine <= ll->maxLineLength) { - for (int subLine = 0; subLine < ll->lines; subLine++) { - if ((posInLine >= ll->LineStart(subLine)) && - (posInLine <= ll->LineStart(subLine + 1)) && - (posInLine <= ll->numCharsBeforeEOL)) { - if (start) { - posRet = ll->LineStart(subLine) + posLineStart; - } else { - if (subLine == ll->lines - 1) - posRet = ll->numCharsBeforeEOL + posLineStart; - else - posRet = ll->LineStart(subLine + 1) + posLineStart - 1; - } - } - } - } - } - return posRet; -} - -static ColourDesired SelectionBackground(const ViewStyle &vsDraw, bool main, bool primarySelection) { - return main ? - (primarySelection ? vsDraw.selColours.back : vsDraw.selBackground2) : - vsDraw.selAdditionalBackground; -} - -static ColourDesired TextBackground(const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - ColourOptional background, int inSelection, bool inHotspot, int styleMain, int i) { - if (inSelection == 1) { - if (vsDraw.selColours.back.isSet && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { - return SelectionBackground(vsDraw, true, model.primarySelection); - } - } else if (inSelection == 2) { - if (vsDraw.selColours.back.isSet && (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA)) { - return SelectionBackground(vsDraw, false, model.primarySelection); - } - } else { - if ((vsDraw.edgeState == EDGE_BACKGROUND) && - (i >= ll->edgeColumn) && - (i < ll->numCharsBeforeEOL)) - return vsDraw.theEdge.colour; - if (inHotspot && vsDraw.hotspotColours.back.isSet) - return vsDraw.hotspotColours.back; - } - if (background.isSet && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) { - return background; - } else { - return vsDraw.styles[styleMain].back; - } -} - -void EditView::DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight) { - Point from = Point::FromInts(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); - PRectangle rcCopyArea = PRectangle::FromInts(start + 1, static_cast(rcSegment.top), start + 2, static_cast(rcSegment.bottom)); - surface->Copy(rcCopyArea, from, - highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide); -} - -static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourDesired fill, int alpha) { - if (alpha != SC_ALPHA_NOALPHA) { - surface->AlphaRectangle(rc, 0, fill, alpha, fill, alpha, 0); - } -} - -static void DrawTextBlob(Surface *surface, const ViewStyle &vsDraw, PRectangle rcSegment, - const char *s, ColourDesired textBack, ColourDesired textFore, bool fillBackground) { - if (rcSegment.Empty()) - return; - if (fillBackground) { - surface->FillRectangle(rcSegment, textBack); - } - FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; - int normalCharHeight = static_cast(surface->Ascent(ctrlCharsFont) - - surface->InternalLeading(ctrlCharsFont)); - PRectangle rcCChar = rcSegment; - rcCChar.left = rcCChar.left + 1; - rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight; - rcCChar.bottom = rcSegment.top + vsDraw.maxAscent + 1; - PRectangle rcCentral = rcCChar; - rcCentral.top++; - rcCentral.bottom--; - surface->FillRectangle(rcCentral, textFore); - PRectangle rcChar = rcCChar; - rcChar.left++; - rcChar.right--; - surface->DrawTextClipped(rcChar, ctrlCharsFont, - rcSegment.top + vsDraw.maxAscent, s, static_cast(s ? strlen(s) : 0), - textBack, textFore); -} - -void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - PRectangle rcLine, int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart, - ColourOptional background) { - - const int posLineStart = model.pdoc->LineStart(line); - PRectangle rcSegment = rcLine; - - const bool lastSubLine = subLine == (ll->lines - 1); - XYPOSITION virtualSpace = 0; - if (lastSubLine) { - const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; - virtualSpace = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)) * spaceWidth; - } - XYPOSITION xEol = static_cast(ll->positions[lineEnd] - subLineStart); - - // Fill the virtual space and show selections within it - if (virtualSpace > 0.0f) { - rcSegment.left = xEol + xStart; - rcSegment.right = xEol + xStart + virtualSpace; - surface->FillRectangle(rcSegment, background.isSet ? background : vsDraw.styles[ll->styles[ll->numCharsInLine]].back); - if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) { - SelectionSegment virtualSpaceRange(SelectionPosition(model.pdoc->LineEnd(line)), SelectionPosition(model.pdoc->LineEnd(line), model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)))); - for (size_t r = 0; rEndLineStyle()].spaceWidth; - rcSegment.left = xStart + ll->positions[portion.start.Position() - posLineStart] - - static_cast(subLineStart)+portion.start.VirtualSpace() * spaceWidth; - rcSegment.right = xStart + ll->positions[portion.end.Position() - posLineStart] - - static_cast(subLineStart)+portion.end.VirtualSpace() * spaceWidth; - rcSegment.left = (rcSegment.left > rcLine.left) ? rcSegment.left : rcLine.left; - rcSegment.right = (rcSegment.right < rcLine.right) ? rcSegment.right : rcLine.right; - surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, r == model.sel.Main(), model.primarySelection)); - } - } - } - } - } - - int eolInSelection = 0; - int alpha = SC_ALPHA_NOALPHA; - if (!hideSelection) { - int posAfterLineEnd = model.pdoc->LineStart(line + 1); - eolInSelection = (lastSubLine == true) ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0; - alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; - } - - // Draw the [CR], [LF], or [CR][LF] blobs if visible line ends are on - XYPOSITION blobsWidth = 0; - if (lastSubLine) { - for (int eolPos = ll->numCharsBeforeEOL; eolPosnumCharsInLine; eolPos++) { - rcSegment.left = xStart + ll->positions[eolPos] - static_cast(subLineStart)+virtualSpace; - rcSegment.right = xStart + ll->positions[eolPos + 1] - static_cast(subLineStart)+virtualSpace; - blobsWidth += rcSegment.Width(); - char hexits[4]; - const char *ctrlChar; - unsigned char chEOL = ll->chars[eolPos]; - int styleMain = ll->styles[eolPos]; - ColourDesired textBack = TextBackground(model, vsDraw, ll, background, eolInSelection, false, styleMain, eolPos); - if (UTF8IsAscii(chEOL)) { - ctrlChar = ControlCharacterString(chEOL); - } else { - const Representation *repr = model.reprs.RepresentationFromCharacter(ll->chars + eolPos, ll->numCharsInLine - eolPos); - if (repr) { - ctrlChar = repr->stringRep.c_str(); - eolPos = ll->numCharsInLine; - } else { - sprintf(hexits, "x%2X", chEOL); - ctrlChar = hexits; - } - } - ColourDesired textFore = vsDraw.styles[styleMain].fore; - if (eolInSelection && vsDraw.selColours.fore.isSet) { - textFore = (eolInSelection == 1) ? vsDraw.selColours.fore : vsDraw.selAdditionalForeground; - } - if (eolInSelection && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1)) { - if (alpha == SC_ALPHA_NOALPHA) { - surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection)); - } else { - surface->FillRectangle(rcSegment, textBack); - } - } else { - surface->FillRectangle(rcSegment, textBack); - } - DrawTextBlob(surface, vsDraw, rcSegment, ctrlChar, textBack, textFore, phasesDraw == phasesOne); - if (eolInSelection && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) { - SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha); - } - } - } - - // Draw the eol-is-selected rectangle - rcSegment.left = xEol + xStart + virtualSpace + blobsWidth; - rcSegment.right = rcSegment.left + vsDraw.aveCharWidth; - - if (eolInSelection && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) { - surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection)); - } else { - if (background.isSet) { - surface->FillRectangle(rcSegment, background); - } else if (line < model.pdoc->LinesTotal() - 1) { - surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back); - } else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) { - surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back); - } else { - surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back); - } - if (eolInSelection && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) { - SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha); - } - } - - rcSegment.left = rcSegment.right; - if (rcSegment.left < rcLine.left) - rcSegment.left = rcLine.left; - rcSegment.right = rcLine.right; - - bool fillRemainder = !lastSubLine || model.foldDisplayTextStyle == SC_FOLDDISPLAYTEXT_HIDDEN || !model.cs.GetFoldDisplayTextShown(line); - if (fillRemainder) { - // Fill the remainder of the line - FillLineRemainder(surface, model, vsDraw, ll, line, rcSegment, subLine); - } - - bool drawWrapMarkEnd = false; - - if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_END) { - if (subLine + 1 < ll->lines) { - drawWrapMarkEnd = ll->LineStart(subLine + 1) != 0; - } - } - - if (drawWrapMarkEnd) { - PRectangle rcPlace = rcSegment; - - if (vsDraw.wrapVisualFlagsLocation & SC_WRAPVISUALFLAGLOC_END_BY_TEXT) { - rcPlace.left = xEol + xStart + virtualSpace; - rcPlace.right = rcPlace.left + vsDraw.aveCharWidth; - } else { - // rcLine is clipped to text area - rcPlace.right = rcLine.right; - rcPlace.left = rcPlace.right - vsDraw.aveCharWidth; - } - if (customDrawWrapMarker == NULL) { - DrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour()); - } else { - customDrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour()); - } - } -} - -static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, const ViewStyle &vsDraw, - const LineLayout *ll, int xStart, PRectangle rcLine, int secondCharacter, int subLine, Indicator::DrawState drawState, int value) { - const XYPOSITION subLineStart = ll->positions[ll->LineStart(subLine)]; - PRectangle rcIndic( - ll->positions[startPos] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent, - ll->positions[endPos] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent + 3); - PRectangle rcFirstCharacter = rcIndic; - // Allow full descent space for character indicators - rcFirstCharacter.bottom = rcLine.top + vsDraw.maxAscent + vsDraw.maxDescent; - if (secondCharacter >= 0) { - rcFirstCharacter.right = ll->positions[secondCharacter] + xStart - subLineStart; - } else { - // Indicator continued from earlier line so make an empty box and don't draw - rcFirstCharacter.right = rcFirstCharacter.left; - } - vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine, rcFirstCharacter, drawState, value); -} - -static void DrawIndicators(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, int xStart, PRectangle rcLine, int subLine, int lineEnd, bool under, int hoverIndicatorPos) { - // Draw decorators - const int posLineStart = model.pdoc->LineStart(line); - const int lineStart = ll->LineStart(subLine); - const int posLineEnd = posLineStart + lineEnd; - - for (Decoration *deco = model.pdoc->decorations.root; deco; deco = deco->next) { - if (under == vsDraw.indicators[deco->indicator].under) { - int startPos = posLineStart + lineStart; - if (!deco->rs.ValueAt(startPos)) { - startPos = deco->rs.EndRun(startPos); - } - while ((startPos < posLineEnd) && (deco->rs.ValueAt(startPos))) { - const Range rangeRun(deco->rs.StartRun(startPos), deco->rs.EndRun(startPos)); - const int endPos = std::min(rangeRun.end, posLineEnd); - const bool hover = vsDraw.indicators[deco->indicator].IsDynamic() && - rangeRun.ContainsCharacter(hoverIndicatorPos); - const int value = deco->rs.ValueAt(startPos); - Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal; - const int posSecond = model.pdoc->MovePositionOutsideChar(rangeRun.First() + 1, 1); - DrawIndicator(deco->indicator, startPos - posLineStart, endPos - posLineStart, - surface, vsDraw, ll, xStart, rcLine, posSecond - posLineStart, subLine, drawState, value); - startPos = endPos; - if (!deco->rs.ValueAt(startPos)) { - startPos = deco->rs.EndRun(startPos); - } - } - } - } - - // Use indicators to highlight matching braces - if ((vsDraw.braceHighlightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACELIGHT)) || - (vsDraw.braceBadLightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACEBAD))) { - int braceIndicator = (model.bracesMatchStyle == STYLE_BRACELIGHT) ? vsDraw.braceHighlightIndicator : vsDraw.braceBadLightIndicator; - if (under == vsDraw.indicators[braceIndicator].under) { - Range rangeLine(posLineStart + lineStart, posLineEnd); - if (rangeLine.ContainsCharacter(model.braces[0])) { - int braceOffset = model.braces[0] - posLineStart; - if (braceOffset < ll->numCharsInLine) { - const int secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[0] + 1, 1) - posLineStart; - DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, secondOffset, subLine, Indicator::drawNormal, 1); - } - } - if (rangeLine.ContainsCharacter(model.braces[1])) { - int braceOffset = model.braces[1] - posLineStart; - if (braceOffset < ll->numCharsInLine) { - const int secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[1] + 1, 1) - posLineStart; - DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, secondOffset, subLine, Indicator::drawNormal, 1); - } - } - } - } -} - -void EditView::DrawFoldDisplayText(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase) { - const bool lastSubLine = subLine == (ll->lines - 1); - if (!lastSubLine) - return; - - if ((model.foldDisplayTextStyle == SC_FOLDDISPLAYTEXT_HIDDEN) || !model.cs.GetFoldDisplayTextShown(line)) - return; - - PRectangle rcSegment = rcLine; - const char *foldDisplayText = model.cs.GetFoldDisplayText(line); - const int lengthFoldDisplayText = static_cast(strlen(foldDisplayText)); - FontAlias fontText = vsDraw.styles[STYLE_FOLDDISPLAYTEXT].font; - const int widthFoldDisplayText = static_cast(surface->WidthText(fontText, foldDisplayText, lengthFoldDisplayText)); - - int eolInSelection = 0; - int alpha = SC_ALPHA_NOALPHA; - if (!hideSelection) { - int posAfterLineEnd = model.pdoc->LineStart(line + 1); - eolInSelection = (subLine == (ll->lines - 1)) ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0; - alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; - } - - const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; - XYPOSITION virtualSpace = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)) * spaceWidth; - rcSegment.left = xStart + static_cast(ll->positions[ll->numCharsInLine] - subLineStart) + spaceWidth + virtualSpace; - rcSegment.right = rcSegment.left + static_cast(widthFoldDisplayText); - - ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); - FontAlias textFont = vsDraw.styles[STYLE_FOLDDISPLAYTEXT].font; - ColourDesired textFore = vsDraw.styles[STYLE_FOLDDISPLAYTEXT].fore; - if (eolInSelection && (vsDraw.selColours.fore.isSet)) { - textFore = (eolInSelection == 1) ? vsDraw.selColours.fore : vsDraw.selAdditionalForeground; - } - ColourDesired textBack = TextBackground(model, vsDraw, ll, background, eolInSelection, - false, STYLE_FOLDDISPLAYTEXT, -1); - - if (model.trackLineWidth) { - if (rcSegment.right + 1> lineWidthMaxSeen) { - // Fold display text border drawn on rcSegment.right with width 1 is the last visble object of the line - lineWidthMaxSeen = static_cast(rcSegment.right + 1); - } - } - - if ((phasesDraw != phasesOne) && (phase & drawBack)) { - surface->FillRectangle(rcSegment, textBack); - - // Fill Remainder of the line - PRectangle rcRemainder = rcSegment; - rcRemainder.left = rcRemainder.right + 1; - if (rcRemainder.left < rcLine.left) - rcRemainder.left = rcLine.left; - rcRemainder.right = rcLine.right; - FillLineRemainder(surface, model, vsDraw, ll, line, rcRemainder, subLine); - } - - if (phase & drawText) { - if (phasesDraw != phasesOne) { - surface->DrawTextTransparent(rcSegment, textFont, - rcSegment.top + vsDraw.maxAscent, foldDisplayText, - lengthFoldDisplayText, textFore); - } else { - surface->DrawTextNoClip(rcSegment, textFont, - rcSegment.top + vsDraw.maxAscent, foldDisplayText, - lengthFoldDisplayText, textFore, textBack); - } - } - - if (phase & drawIndicatorsFore) { - if (model.foldDisplayTextStyle == SC_FOLDDISPLAYTEXT_BOXED) { - surface->PenColour(textFore); - surface->MoveTo(static_cast(rcSegment.left), static_cast(rcSegment.top)); - surface->LineTo(static_cast(rcSegment.left), static_cast(rcSegment.bottom)); - surface->MoveTo(static_cast(rcSegment.right), static_cast(rcSegment.top)); - surface->LineTo(static_cast(rcSegment.right), static_cast(rcSegment.bottom)); - surface->MoveTo(static_cast(rcSegment.left), static_cast(rcSegment.top)); - surface->LineTo(static_cast(rcSegment.right), static_cast(rcSegment.top)); - surface->MoveTo(static_cast(rcSegment.left), static_cast(rcSegment.bottom - 1)); - surface->LineTo(static_cast(rcSegment.right), static_cast(rcSegment.bottom - 1)); - } - } - - if (phase & drawSelectionTranslucent) { - if (eolInSelection && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && alpha != SC_ALPHA_NOALPHA) { - SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha); - } - } -} - -static bool AnnotationBoxedOrIndented(int annotationVisible) { - return annotationVisible == ANNOTATION_BOXED || annotationVisible == ANNOTATION_INDENTED; -} - -void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase) { - int indent = static_cast(model.pdoc->GetLineIndentation(line) * vsDraw.spaceWidth); - PRectangle rcSegment = rcLine; - int annotationLine = subLine - ll->lines; - const StyledText stAnnotation = model.pdoc->AnnotationStyledText(line); - if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) { - if (phase & drawBack) { - surface->FillRectangle(rcSegment, vsDraw.styles[0].back); - } - rcSegment.left = static_cast(xStart); - if (model.trackLineWidth || AnnotationBoxedOrIndented(vsDraw.annotationVisible)) { - // Only care about calculating width if tracking or need to draw indented box - int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation); - if (AnnotationBoxedOrIndented(vsDraw.annotationVisible)) { - widthAnnotation += static_cast(vsDraw.spaceWidth * 2); // Margins - rcSegment.left = static_cast(xStart + indent); - rcSegment.right = rcSegment.left + widthAnnotation; - } - if (widthAnnotation > lineWidthMaxSeen) - lineWidthMaxSeen = widthAnnotation; - } - const int annotationLines = model.pdoc->AnnotationLines(line); - size_t start = 0; - size_t lengthAnnotation = stAnnotation.LineLength(start); - int lineInAnnotation = 0; - while ((lineInAnnotation < annotationLine) && (start < stAnnotation.length)) { - start += lengthAnnotation + 1; - lengthAnnotation = stAnnotation.LineLength(start); - lineInAnnotation++; - } - PRectangle rcText = rcSegment; - if ((phase & drawBack) && AnnotationBoxedOrIndented(vsDraw.annotationVisible)) { - surface->FillRectangle(rcText, - vsDraw.styles[stAnnotation.StyleAt(start) + vsDraw.annotationStyleOffset].back); - rcText.left += vsDraw.spaceWidth; - } - DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText, - stAnnotation, start, lengthAnnotation, phase); - if ((phase & drawBack) && (vsDraw.annotationVisible == ANNOTATION_BOXED)) { - surface->PenColour(vsDraw.styles[vsDraw.annotationStyleOffset].fore); - surface->MoveTo(static_cast(rcSegment.left), static_cast(rcSegment.top)); - surface->LineTo(static_cast(rcSegment.left), static_cast(rcSegment.bottom)); - surface->MoveTo(static_cast(rcSegment.right), static_cast(rcSegment.top)); - surface->LineTo(static_cast(rcSegment.right), static_cast(rcSegment.bottom)); - if (subLine == ll->lines) { - surface->MoveTo(static_cast(rcSegment.left), static_cast(rcSegment.top)); - surface->LineTo(static_cast(rcSegment.right), static_cast(rcSegment.top)); - } - if (subLine == ll->lines + annotationLines - 1) { - surface->MoveTo(static_cast(rcSegment.left), static_cast(rcSegment.bottom - 1)); - surface->LineTo(static_cast(rcSegment.right), static_cast(rcSegment.bottom - 1)); - } - } - } -} - -static void DrawBlockCaret(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int subLine, int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour) { - - int lineStart = ll->LineStart(subLine); - int posBefore = posCaret; - int posAfter = model.pdoc->MovePositionOutsideChar(posCaret + 1, 1); - int numCharsToDraw = posAfter - posCaret; - - // Work out where the starting and ending offsets are. We need to - // see if the previous character shares horizontal space, such as a - // glyph / combining character. If so we'll need to draw that too. - int offsetFirstChar = offset; - int offsetLastChar = offset + (posAfter - posCaret); - while ((posBefore > 0) && ((offsetLastChar - numCharsToDraw) >= lineStart)) { - if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - numCharsToDraw]) > 0) { - // The char does not share horizontal space - break; - } - // Char shares horizontal space, update the numChars to draw - // Update posBefore to point to the prev char - posBefore = model.pdoc->MovePositionOutsideChar(posBefore - 1, -1); - numCharsToDraw = posAfter - posBefore; - offsetFirstChar = offset - (posCaret - posBefore); - } - - // See if the next character shares horizontal space, if so we'll - // need to draw that too. - if (offsetFirstChar < 0) - offsetFirstChar = 0; - numCharsToDraw = offsetLastChar - offsetFirstChar; - while ((offsetLastChar < ll->LineStart(subLine + 1)) && (offsetLastChar <= ll->numCharsInLine)) { - // Update posAfter to point to the 2nd next char, this is where - // the next character ends, and 2nd next begins. We'll need - // to compare these two - posBefore = posAfter; - posAfter = model.pdoc->MovePositionOutsideChar(posAfter + 1, 1); - offsetLastChar = offset + (posAfter - posCaret); - if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - (posAfter - posBefore)]) > 0) { - // The char does not share horizontal space - break; - } - // Char shares horizontal space, update the numChars to draw - numCharsToDraw = offsetLastChar - offsetFirstChar; - } - - // We now know what to draw, update the caret drawing rectangle - rcCaret.left = ll->positions[offsetFirstChar] - ll->positions[lineStart] + xStart; - rcCaret.right = ll->positions[offsetFirstChar + numCharsToDraw] - ll->positions[lineStart] + xStart; - - // Adjust caret position to take into account any word wrapping symbols. - if ((ll->wrapIndent != 0) && (lineStart != 0)) { - XYPOSITION wordWrapCharWidth = ll->wrapIndent; - rcCaret.left += wordWrapCharWidth; - rcCaret.right += wordWrapCharWidth; - } - - // This character is where the caret block is, we override the colours - // (inversed) for drawing the caret here. - int styleMain = ll->styles[offsetFirstChar]; - FontAlias fontText = vsDraw.styles[styleMain].font; - surface->DrawTextClipped(rcCaret, fontText, - rcCaret.top + vsDraw.maxAscent, ll->chars + offsetFirstChar, - numCharsToDraw, vsDraw.styles[styleMain].back, - caretColour); -} - -void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int lineDoc, int xStart, PRectangle rcLine, int subLine) const { - // When drag is active it is the only caret drawn - bool drawDrag = model.posDrag.IsValid(); - if (hideSelection && !drawDrag) - return; - const int posLineStart = model.pdoc->LineStart(lineDoc); - // For each selection draw - for (size_t r = 0; (rEndLineStyle()].spaceWidth; - const XYPOSITION virtualOffset = posCaret.VirtualSpace() * spaceWidth; - if (ll->InLine(offset, subLine) && offset <= ll->numCharsBeforeEOL) { - XYPOSITION xposCaret = ll->positions[offset] + virtualOffset - ll->positions[ll->LineStart(subLine)]; - if (ll->wrapIndent != 0) { - int lineStart = ll->LineStart(subLine); - if (lineStart != 0) // Wrapped - xposCaret += ll->wrapIndent; - } - bool caretBlinkState = (model.caret.active && model.caret.on) || (!additionalCaretsBlink && !mainCaret); - bool caretVisibleState = additionalCaretsVisible || mainCaret; - if ((xposCaret >= 0) && (vsDraw.caretWidth > 0) && (vsDraw.caretStyle != CARETSTYLE_INVISIBLE) && - ((model.posDrag.IsValid()) || (caretBlinkState && caretVisibleState))) { - bool caretAtEOF = false; - bool caretAtEOL = false; - bool drawBlockCaret = false; - XYPOSITION widthOverstrikeCaret; - XYPOSITION caretWidthOffset = 0; - PRectangle rcCaret = rcLine; - - if (posCaret.Position() == model.pdoc->Length()) { // At end of document - caretAtEOF = true; - widthOverstrikeCaret = vsDraw.aveCharWidth; - } else if ((posCaret.Position() - posLineStart) >= ll->numCharsInLine) { // At end of line - caretAtEOL = true; - widthOverstrikeCaret = vsDraw.aveCharWidth; - } else { - const int widthChar = model.pdoc->LenChar(posCaret.Position()); - widthOverstrikeCaret = ll->positions[offset + widthChar] - ll->positions[offset]; - } - if (widthOverstrikeCaret < 3) // Make sure its visible - widthOverstrikeCaret = 3; - - if (xposCaret > 0) - caretWidthOffset = 0.51f; // Move back so overlaps both character cells. - xposCaret += xStart; - if (model.posDrag.IsValid()) { - /* Dragging text, use a line caret */ - rcCaret.left = static_cast(RoundXYPosition(xposCaret - caretWidthOffset)); - rcCaret.right = rcCaret.left + vsDraw.caretWidth; - } else if (model.inOverstrike && drawOverstrikeCaret) { - /* Overstrike (insert mode), use a modified bar caret */ - rcCaret.top = rcCaret.bottom - 2; - rcCaret.left = xposCaret + 1; - rcCaret.right = rcCaret.left + widthOverstrikeCaret - 1; - } else if ((vsDraw.caretStyle == CARETSTYLE_BLOCK) || imeCaretBlockOverride) { - /* Block caret */ - rcCaret.left = xposCaret; - if (!caretAtEOL && !caretAtEOF && (ll->chars[offset] != '\t') && !(IsControlCharacter(ll->chars[offset]))) { - drawBlockCaret = true; - rcCaret.right = xposCaret + widthOverstrikeCaret; - } else { - rcCaret.right = xposCaret + vsDraw.aveCharWidth; - } - } else { - /* Line caret */ - rcCaret.left = static_cast(RoundXYPosition(xposCaret - caretWidthOffset)); - rcCaret.right = rcCaret.left + vsDraw.caretWidth; - } - ColourDesired caretColour = mainCaret ? vsDraw.caretcolour : vsDraw.additionalCaretColour; - if (drawBlockCaret) { - DrawBlockCaret(surface, model, vsDraw, ll, subLine, xStart, offset, posCaret.Position(), rcCaret, caretColour); - } else { - surface->FillRectangle(rcCaret, caretColour); - } - } - } - if (drawDrag) - break; - } -} - -static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll, - int xStart, PRectangle rcLine, ColourOptional background, DrawWrapMarkerFn customDrawWrapMarker) { - // default bgnd here.. - surface->FillRectangle(rcLine, background.isSet ? background : - vsDraw.styles[STYLE_DEFAULT].back); - - if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_START) { - - // draw continuation rect - PRectangle rcPlace = rcLine; - - rcPlace.left = static_cast(xStart); - rcPlace.right = rcPlace.left + ll->wrapIndent; - - if (vsDraw.wrapVisualFlagsLocation & SC_WRAPVISUALFLAGLOC_START_BY_TEXT) - rcPlace.left = rcPlace.right - vsDraw.aveCharWidth; - else - rcPlace.right = rcPlace.left + vsDraw.aveCharWidth; - - if (customDrawWrapMarker == NULL) { - DrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour()); - } else { - customDrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour()); - } - } -} - -void EditView::DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - PRectangle rcLine, Range lineRange, int posLineStart, int xStart, - int subLine, ColourOptional background) const { - - const bool selBackDrawn = vsDraw.SelectionBackgroundDrawn(); - bool inIndentation = subLine == 0; // Do not handle indentation except on first subline. - const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; - // Does not take margin into account but not significant - const int xStartVisible = static_cast(subLineStart)-xStart; - - BreakFinder bfBack(ll, &model.sel, lineRange, posLineStart, xStartVisible, selBackDrawn, model.pdoc, &model.reprs, NULL); - - const bool drawWhitespaceBackground = vsDraw.WhitespaceBackgroundDrawn() && !background.isSet; - - // Background drawing loop - while (bfBack.More()) { - - const TextSegment ts = bfBack.Next(); - const int i = ts.end() - 1; - const int iDoc = i + posLineStart; - - PRectangle rcSegment = rcLine; - rcSegment.left = ll->positions[ts.start] + xStart - static_cast(subLineStart); - rcSegment.right = ll->positions[ts.end()] + xStart - static_cast(subLineStart); - // Only try to draw if really visible - enhances performance by not calling environment to - // draw strings that are completely past the right side of the window. - if (!rcSegment.Empty() && rcSegment.Intersects(rcLine)) { - // Clip to line rectangle, since may have a huge position which will not work with some platforms - if (rcSegment.left < rcLine.left) - rcSegment.left = rcLine.left; - if (rcSegment.right > rcLine.right) - rcSegment.right = rcLine.right; - - const int inSelection = hideSelection ? 0 : model.sel.CharacterInSelection(iDoc); - const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc); - ColourDesired textBack = TextBackground(model, vsDraw, ll, background, inSelection, - inHotspot, ll->styles[i], i); - if (ts.representation) { - if (ll->chars[i] == '\t') { - // Tab display - if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) - textBack = vsDraw.whitespaceColours.back; - } else { - // Blob display - inIndentation = false; - } - surface->FillRectangle(rcSegment, textBack); - } else { - // Normal text display - surface->FillRectangle(rcSegment, textBack); - if (vsDraw.viewWhitespace != wsInvisible) { - for (int cpos = 0; cpos <= i - ts.start; cpos++) { - if (ll->chars[cpos + ts.start] == ' ') { - if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) { - PRectangle rcSpace( - ll->positions[cpos + ts.start] + xStart - static_cast(subLineStart), - rcSegment.top, - ll->positions[cpos + ts.start + 1] + xStart - static_cast(subLineStart), - rcSegment.bottom); - surface->FillRectangle(rcSpace, vsDraw.whitespaceColours.back); - } - } else { - inIndentation = false; - } - } - } - } - } else if (rcSegment.left > rcLine.right) { - break; - } - } -} - -static void DrawEdgeLine(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, - Range lineRange, int xStart) { - if (vsDraw.edgeState == EDGE_LINE) { - PRectangle rcSegment = rcLine; - int edgeX = static_cast(vsDraw.theEdge.column * vsDraw.spaceWidth); - rcSegment.left = static_cast(edgeX + xStart); - if ((ll->wrapIndent != 0) && (lineRange.start != 0)) - rcSegment.left -= ll->wrapIndent; - rcSegment.right = rcSegment.left + 1; - surface->FillRectangle(rcSegment, vsDraw.theEdge.colour); - } else if (vsDraw.edgeState == EDGE_MULTILINE) { - for (size_t edge = 0; edge < vsDraw.theMultiEdge.size(); edge++) { - if (vsDraw.theMultiEdge[edge].column >= 0) { - PRectangle rcSegment = rcLine; - int edgeX = static_cast(vsDraw.theMultiEdge[edge].column * vsDraw.spaceWidth); - rcSegment.left = static_cast(edgeX + xStart); - if ((ll->wrapIndent != 0) && (lineRange.start != 0)) - rcSegment.left -= ll->wrapIndent; - rcSegment.right = rcSegment.left + 1; - surface->FillRectangle(rcSegment, vsDraw.theMultiEdge[edge].colour); - } - } - } -} - -// Draw underline mark as part of background if not transparent -static void DrawMarkUnderline(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, - int line, PRectangle rcLine) { - int marks = model.pdoc->GetMark(line); - for (int markBit = 0; (markBit < 32) && marks; markBit++) { - if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE) && - (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { - PRectangle rcUnderline = rcLine; - rcUnderline.top = rcUnderline.bottom - 2; - surface->FillRectangle(rcUnderline, vsDraw.markers[markBit].back); - } - marks >>= 1; - } -} -static void DrawTranslucentSelection(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, PRectangle rcLine, int subLine, Range lineRange, int xStart) { - if ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha != SC_ALPHA_NOALPHA)) { - const int posLineStart = model.pdoc->LineStart(line); - const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; - // For each selection draw - int virtualSpaces = 0; - if (subLine == (ll->lines - 1)) { - virtualSpaces = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)); - } - SelectionPosition posStart(posLineStart + lineRange.start); - SelectionPosition posEnd(posLineStart + lineRange.end, virtualSpaces); - SelectionSegment virtualSpaceRange(posStart, posEnd); - for (size_t r = 0; r < model.sel.Count(); r++) { - int alpha = (r == model.sel.Main()) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; - if (alpha != SC_ALPHA_NOALPHA) { - SelectionSegment portion = model.sel.Range(r).Intersect(virtualSpaceRange); - if (!portion.Empty()) { - const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; - PRectangle rcSegment = rcLine; - rcSegment.left = xStart + ll->positions[portion.start.Position() - posLineStart] - - static_cast(subLineStart)+portion.start.VirtualSpace() * spaceWidth; - rcSegment.right = xStart + ll->positions[portion.end.Position() - posLineStart] - - static_cast(subLineStart)+portion.end.VirtualSpace() * spaceWidth; - if ((ll->wrapIndent != 0) && (lineRange.start != 0)) { - if ((portion.start.Position() - posLineStart) == lineRange.start && model.sel.Range(r).ContainsCharacter(portion.start.Position() - 1)) - rcSegment.left -= static_cast(ll->wrapIndent); // indentation added to xStart was truncated to int, so we do the same here - } - rcSegment.left = (rcSegment.left > rcLine.left) ? rcSegment.left : rcLine.left; - rcSegment.right = (rcSegment.right < rcLine.right) ? rcSegment.right : rcLine.right; - if (rcSegment.right > rcLine.left) - SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, r == model.sel.Main(), model.primarySelection), alpha); - } - } - } - } -} - -// Draw any translucent whole line states -static void DrawTranslucentLineState(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, PRectangle rcLine) { - if ((model.caret.active || vsDraw.alwaysShowCaretLineBackground) && vsDraw.showCaretLineBackground && ll->containsCaret) { - SimpleAlphaRectangle(surface, rcLine, vsDraw.caretLineBackground, vsDraw.caretLineAlpha); - } - const int marksOfLine = model.pdoc->GetMark(line); - int marksDrawnInText = marksOfLine & vsDraw.maskDrawInText; - for (int markBit = 0; (markBit < 32) && marksDrawnInText; markBit++) { - if (marksDrawnInText & 1) { - if (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) { - SimpleAlphaRectangle(surface, rcLine, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); - } else if (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE) { - PRectangle rcUnderline = rcLine; - rcUnderline.top = rcUnderline.bottom - 2; - SimpleAlphaRectangle(surface, rcUnderline, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); - } - } - marksDrawnInText >>= 1; - } - int marksDrawnInLine = marksOfLine & vsDraw.maskInLine; - for (int markBit = 0; (markBit < 32) && marksDrawnInLine; markBit++) { - if (marksDrawnInLine & 1) { - SimpleAlphaRectangle(surface, rcLine, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); - } - marksDrawnInLine >>= 1; - } -} - -void EditView::DrawForeground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int lineVisible, PRectangle rcLine, Range lineRange, int posLineStart, int xStart, - int subLine, ColourOptional background) { - - const bool selBackDrawn = vsDraw.SelectionBackgroundDrawn(); - const bool drawWhitespaceBackground = vsDraw.WhitespaceBackgroundDrawn() && !background.isSet; - bool inIndentation = subLine == 0; // Do not handle indentation except on first subline. - - const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; - const XYPOSITION indentWidth = model.pdoc->IndentSize() * vsDraw.spaceWidth; - - // Does not take margin into account but not significant - const int xStartVisible = static_cast(subLineStart)-xStart; - - // Foreground drawing loop - BreakFinder bfFore(ll, &model.sel, lineRange, posLineStart, xStartVisible, - (((phasesDraw == phasesOne) && selBackDrawn) || vsDraw.selColours.fore.isSet), model.pdoc, &model.reprs, &vsDraw); - - while (bfFore.More()) { - - const TextSegment ts = bfFore.Next(); - const int i = ts.end() - 1; - const int iDoc = i + posLineStart; - - PRectangle rcSegment = rcLine; - rcSegment.left = ll->positions[ts.start] + xStart - static_cast(subLineStart); - rcSegment.right = ll->positions[ts.end()] + xStart - static_cast(subLineStart); - // Only try to draw if really visible - enhances performance by not calling environment to - // draw strings that are completely past the right side of the window. - if (rcSegment.Intersects(rcLine)) { - int styleMain = ll->styles[i]; - ColourDesired textFore = vsDraw.styles[styleMain].fore; - FontAlias textFont = vsDraw.styles[styleMain].font; - //hotspot foreground - const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc); - if (inHotspot) { - if (vsDraw.hotspotColours.fore.isSet) - textFore = vsDraw.hotspotColours.fore; - } - if (vsDraw.indicatorsSetFore > 0) { - // At least one indicator sets the text colour so see if it applies to this segment - for (Decoration *deco = model.pdoc->decorations.root; deco; deco = deco->next) { - const int indicatorValue = deco->rs.ValueAt(ts.start + posLineStart); - if (indicatorValue) { - const Indicator &indicator = vsDraw.indicators[deco->indicator]; - const bool hover = indicator.IsDynamic() && - ((model.hoverIndicatorPos >= ts.start + posLineStart) && - (model.hoverIndicatorPos <= ts.end() + posLineStart)); - if (hover) { - if (indicator.sacHover.style == INDIC_TEXTFORE) { - textFore = indicator.sacHover.fore; - } - } else { - if (indicator.sacNormal.style == INDIC_TEXTFORE) { - if (indicator.Flags() & SC_INDICFLAG_VALUEFORE) - textFore = indicatorValue & SC_INDICVALUEMASK; - else - textFore = indicator.sacNormal.fore; - } - } - } - } - } - const int inSelection = hideSelection ? 0 : model.sel.CharacterInSelection(iDoc); - if (inSelection && (vsDraw.selColours.fore.isSet)) { - textFore = (inSelection == 1) ? vsDraw.selColours.fore : vsDraw.selAdditionalForeground; - } - ColourDesired textBack = TextBackground(model, vsDraw, ll, background, inSelection, inHotspot, styleMain, i); - if (ts.representation) { - if (ll->chars[i] == '\t') { - // Tab display - if (phasesDraw == phasesOne) { - if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) - textBack = vsDraw.whitespaceColours.back; - surface->FillRectangle(rcSegment, textBack); - } - if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { - for (int indentCount = static_cast((ll->positions[i] + epsilon) / indentWidth); - indentCount <= (ll->positions[i + 1] - epsilon) / indentWidth; - indentCount++) { - if (indentCount > 0) { - int xIndent = static_cast(indentCount * indentWidth); - DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, - (ll->xHighlightGuide == xIndent)); - } - } - } - if (vsDraw.viewWhitespace != wsInvisible) { - if (vsDraw.WhiteSpaceVisible(inIndentation)) { - if (vsDraw.whitespaceColours.fore.isSet) - textFore = vsDraw.whitespaceColours.fore; - surface->PenColour(textFore); - PRectangle rcTab(rcSegment.left + 1, rcSegment.top + tabArrowHeight, - rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent); - if (customDrawTabArrow == NULL) - DrawTabArrow(surface, rcTab, static_cast(rcSegment.top + vsDraw.lineHeight / 2), vsDraw); - else - customDrawTabArrow(surface, rcTab, static_cast(rcSegment.top + vsDraw.lineHeight / 2)); - } - } - } else { - inIndentation = false; - if (vsDraw.controlCharSymbol >= 32) { - // Using one font for all control characters so it can be controlled independently to ensure - // the box goes around the characters tightly. Seems to be no way to work out what height - // is taken by an individual character - internal leading gives varying results. - FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; - char cc[2] = { static_cast(vsDraw.controlCharSymbol), '\0' }; - surface->DrawTextNoClip(rcSegment, ctrlCharsFont, - rcSegment.top + vsDraw.maxAscent, - cc, 1, textBack, textFore); - } else { - DrawTextBlob(surface, vsDraw, rcSegment, ts.representation->stringRep.c_str(), - textBack, textFore, phasesDraw == phasesOne); - } - } - } else { - // Normal text display - if (vsDraw.styles[styleMain].visible) { - if (phasesDraw != phasesOne) { - surface->DrawTextTransparent(rcSegment, textFont, - rcSegment.top + vsDraw.maxAscent, ll->chars + ts.start, - i - ts.start + 1, textFore); - } else { - surface->DrawTextNoClip(rcSegment, textFont, - rcSegment.top + vsDraw.maxAscent, ll->chars + ts.start, - i - ts.start + 1, textFore, textBack); - } - } - if (vsDraw.viewWhitespace != wsInvisible || - (inIndentation && vsDraw.viewIndentationGuides != ivNone)) { - for (int cpos = 0; cpos <= i - ts.start; cpos++) { - if (ll->chars[cpos + ts.start] == ' ') { - if (vsDraw.viewWhitespace != wsInvisible) { - if (vsDraw.whitespaceColours.fore.isSet) - textFore = vsDraw.whitespaceColours.fore; - if (vsDraw.WhiteSpaceVisible(inIndentation)) { - XYPOSITION xmid = (ll->positions[cpos + ts.start] + ll->positions[cpos + ts.start + 1]) / 2; - if ((phasesDraw == phasesOne) && drawWhitespaceBackground) { - textBack = vsDraw.whitespaceColours.back; - PRectangle rcSpace( - ll->positions[cpos + ts.start] + xStart - static_cast(subLineStart), - rcSegment.top, - ll->positions[cpos + ts.start + 1] + xStart - static_cast(subLineStart), - rcSegment.bottom); - surface->FillRectangle(rcSpace, textBack); - } - const int halfDotWidth = vsDraw.whitespaceSize / 2; - PRectangle rcDot(xmid + xStart - halfDotWidth - static_cast(subLineStart), - rcSegment.top + vsDraw.lineHeight / 2, 0.0f, 0.0f); - rcDot.right = rcDot.left + vsDraw.whitespaceSize; - rcDot.bottom = rcDot.top + vsDraw.whitespaceSize; - surface->FillRectangle(rcDot, textFore); - } - } - if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { - for (int indentCount = static_cast((ll->positions[cpos + ts.start] + epsilon) / indentWidth); - indentCount <= (ll->positions[cpos + ts.start + 1] - epsilon) / indentWidth; - indentCount++) { - if (indentCount > 0) { - int xIndent = static_cast(indentCount * indentWidth); - DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, - (ll->xHighlightGuide == xIndent)); - } - } - } - } else { - inIndentation = false; - } - } - } - } - if (ll->hotspot.Valid() && vsDraw.hotspotUnderline && ll->hotspot.ContainsCharacter(iDoc)) { - PRectangle rcUL = rcSegment; - rcUL.top = rcUL.top + vsDraw.maxAscent + 1; - rcUL.bottom = rcUL.top + 1; - if (vsDraw.hotspotColours.fore.isSet) - surface->FillRectangle(rcUL, vsDraw.hotspotColours.fore); - else - surface->FillRectangle(rcUL, textFore); - } else if (vsDraw.styles[styleMain].underline) { - PRectangle rcUL = rcSegment; - rcUL.top = rcUL.top + vsDraw.maxAscent + 1; - rcUL.bottom = rcUL.top + 1; - surface->FillRectangle(rcUL, textFore); - } - } else if (rcSegment.left > rcLine.right) { - break; - } - } -} - -void EditView::DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, int lineVisible, PRectangle rcLine, int xStart, int subLine) { - if ((vsDraw.viewIndentationGuides == ivLookForward || vsDraw.viewIndentationGuides == ivLookBoth) - && (subLine == 0)) { - const int posLineStart = model.pdoc->LineStart(line); - int indentSpace = model.pdoc->GetLineIndentation(line); - int xStartText = static_cast(ll->positions[model.pdoc->GetLineIndentPosition(line) - posLineStart]); - - // Find the most recent line with some text - - int lineLastWithText = line; - while (lineLastWithText > Platform::Maximum(line - 20, 0) && model.pdoc->IsWhiteLine(lineLastWithText)) { - lineLastWithText--; - } - if (lineLastWithText < line) { - xStartText = 100000; // Don't limit to visible indentation on empty line - // This line is empty, so use indentation of last line with text - int indentLastWithText = model.pdoc->GetLineIndentation(lineLastWithText); - int isFoldHeader = model.pdoc->GetLevel(lineLastWithText) & SC_FOLDLEVELHEADERFLAG; - if (isFoldHeader) { - // Level is one more level than parent - indentLastWithText += model.pdoc->IndentSize(); - } - if (vsDraw.viewIndentationGuides == ivLookForward) { - // In viLookForward mode, previous line only used if it is a fold header - if (isFoldHeader) { - indentSpace = Platform::Maximum(indentSpace, indentLastWithText); - } - } else { // viLookBoth - indentSpace = Platform::Maximum(indentSpace, indentLastWithText); - } - } - - int lineNextWithText = line; - while (lineNextWithText < Platform::Minimum(line + 20, model.pdoc->LinesTotal()) && model.pdoc->IsWhiteLine(lineNextWithText)) { - lineNextWithText++; - } - if (lineNextWithText > line) { - xStartText = 100000; // Don't limit to visible indentation on empty line - // This line is empty, so use indentation of first next line with text - indentSpace = Platform::Maximum(indentSpace, - model.pdoc->GetLineIndentation(lineNextWithText)); - } - - for (int indentPos = model.pdoc->IndentSize(); indentPos < indentSpace; indentPos += model.pdoc->IndentSize()) { - int xIndent = static_cast(indentPos * vsDraw.spaceWidth); - if (xIndent < xStartText) { - DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcLine, - (ll->xHighlightGuide == xIndent)); - } - } - } -} - -void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, int lineVisible, int xStart, PRectangle rcLine, int subLine, DrawPhase phase) { - - if (subLine >= ll->lines) { - DrawAnnotation(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, phase); - return; // No further drawing - } - - // See if something overrides the line background color. - const ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); - - const int posLineStart = model.pdoc->LineStart(line); - - const Range lineRange = ll->SubLineRange(subLine); - const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; - - if ((ll->wrapIndent != 0) && (subLine > 0)) { - if (phase & drawBack) { - DrawWrapIndentAndMarker(surface, vsDraw, ll, xStart, rcLine, background, customDrawWrapMarker); - } - xStart += static_cast(ll->wrapIndent); - } - - if ((phasesDraw != phasesOne) && (phase & drawBack)) { - DrawBackground(surface, model, vsDraw, ll, rcLine, lineRange, posLineStart, xStart, - subLine, background); - DrawEOL(surface, model, vsDraw, ll, rcLine, line, lineRange.end, - xStart, subLine, subLineStart, background); - } - - if (phase & drawIndicatorsBack) { - DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, true, model.hoverIndicatorPos); - DrawEdgeLine(surface, vsDraw, ll, rcLine, lineRange, xStart); - DrawMarkUnderline(surface, model, vsDraw, line, rcLine); - } - - if (phase & drawText) { - DrawForeground(surface, model, vsDraw, ll, lineVisible, rcLine, lineRange, posLineStart, xStart, - subLine, background); - } - - if (phase & drawIndentationGuides) { - DrawIndentGuidesOverEmpty(surface, model, vsDraw, ll, line, lineVisible, rcLine, xStart, subLine); - } - - if (phase & drawIndicatorsFore) { - DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, false, model.hoverIndicatorPos); - } - - // End of the drawing of the current line - if (phasesDraw == phasesOne) { - DrawEOL(surface, model, vsDraw, ll, rcLine, line, lineRange.end, - xStart, subLine, subLineStart, background); - } - - DrawFoldDisplayText(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, subLineStart, phase); - - if (!hideSelection && (phase & drawSelectionTranslucent)) { - DrawTranslucentSelection(surface, model, vsDraw, ll, line, rcLine, subLine, lineRange, xStart); - } - - if (phase & drawLineTranslucent) { - DrawTranslucentLineState(surface, model, vsDraw, ll, line, rcLine); - } -} - -static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, int line, PRectangle rcLine) { - bool expanded = model.cs.GetExpanded(line); - const int level = model.pdoc->GetLevel(line); - const int levelNext = model.pdoc->GetLevel(line + 1); - if ((level & SC_FOLDLEVELHEADERFLAG) && - (LevelNumber(level) < LevelNumber(levelNext))) { - // Paint the line above the fold - if ((expanded && (model.foldFlags & SC_FOLDFLAG_LINEBEFORE_EXPANDED)) - || - (!expanded && (model.foldFlags & SC_FOLDFLAG_LINEBEFORE_CONTRACTED))) { - PRectangle rcFoldLine = rcLine; - rcFoldLine.bottom = rcFoldLine.top + 1; - surface->FillRectangle(rcFoldLine, vsDraw.styles[STYLE_DEFAULT].fore); - } - // Paint the line below the fold - if ((expanded && (model.foldFlags & SC_FOLDFLAG_LINEAFTER_EXPANDED)) - || - (!expanded && (model.foldFlags & SC_FOLDFLAG_LINEAFTER_CONTRACTED))) { - PRectangle rcFoldLine = rcLine; - rcFoldLine.top = rcFoldLine.bottom - 1; - surface->FillRectangle(rcFoldLine, vsDraw.styles[STYLE_DEFAULT].fore); - } - } -} - -void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectangle rcArea, - PRectangle rcClient, const ViewStyle &vsDraw) { - // Allow text at start of line to overlap 1 pixel into the margin as this displays - // serifs and italic stems for aliased text. - const int leftTextOverlap = ((model.xOffset == 0) && (vsDraw.leftMarginWidth > 0)) ? 1 : 0; - - // Do the painting - if (rcArea.right > vsDraw.textStart - leftTextOverlap) { - - Surface *surface = surfaceWindow; - if (bufferedDraw) { - surface = pixmapLine; - PLATFORM_ASSERT(pixmapLine->Initialised()); - } - surface->SetUnicodeMode(SC_CP_UTF8 == model.pdoc->dbcsCodePage); - surface->SetDBCSMode(model.pdoc->dbcsCodePage); - - const Point ptOrigin = model.GetVisibleOriginInMain(); - - const int screenLinePaintFirst = static_cast(rcArea.top) / vsDraw.lineHeight; - const int xStart = vsDraw.textStart - model.xOffset + static_cast(ptOrigin.x); - - SelectionPosition posCaret = model.sel.RangeMain().caret; - if (model.posDrag.IsValid()) - posCaret = model.posDrag; - const int lineCaret = model.pdoc->LineFromPosition(posCaret.Position()); - - PRectangle rcTextArea = rcClient; - if (vsDraw.marginInside) { - rcTextArea.left += vsDraw.textStart; - rcTextArea.right -= vsDraw.rightMarginWidth; - } else { - rcTextArea = rcArea; - } - - // Remove selection margin from drawing area so text will not be drawn - // on it in unbuffered mode. - if (!bufferedDraw && vsDraw.marginInside) { - PRectangle rcClipText = rcTextArea; - rcClipText.left -= leftTextOverlap; - surfaceWindow->SetClip(rcClipText); - } - - // Loop on visible lines - //double durLayout = 0.0; - //double durPaint = 0.0; - //double durCopy = 0.0; - //ElapsedTime etWhole; - - const bool bracesIgnoreStyle = ((vsDraw.braceHighlightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACELIGHT)) || - (vsDraw.braceBadLightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACEBAD))); - - int lineDocPrevious = -1; // Used to avoid laying out one document line multiple times - AutoLineLayout ll(llc, 0); - std::vector phases; - if ((phasesDraw == phasesMultiple) && !bufferedDraw) { - for (DrawPhase phase = drawBack; phase <= drawCarets; phase = static_cast(phase * 2)) { - phases.push_back(phase); - } - } else { - phases.push_back(drawAll); - } - for (std::vector::iterator it = phases.begin(); it != phases.end(); ++it) { - int ypos = 0; - if (!bufferedDraw) - ypos += screenLinePaintFirst * vsDraw.lineHeight; - int yposScreen = screenLinePaintFirst * vsDraw.lineHeight; - int visibleLine = model.TopLineOfMain() + screenLinePaintFirst; - while (visibleLine < model.cs.LinesDisplayed() && yposScreen < rcArea.bottom) { - - const int lineDoc = model.cs.DocFromDisplay(visibleLine); - // Only visible lines should be handled by the code within the loop - PLATFORM_ASSERT(model.cs.GetVisible(lineDoc)); - const int lineStartSet = model.cs.DisplayFromDoc(lineDoc); - const int subLine = visibleLine - lineStartSet; - - // Copy this line and its styles from the document into local arrays - // and determine the x position at which each character starts. - //ElapsedTime et; - if (lineDoc != lineDocPrevious) { - ll.Set(0); - ll.Set(RetrieveLineLayout(lineDoc, model)); - LayoutLine(model, lineDoc, surface, vsDraw, ll, model.wrapWidth); - lineDocPrevious = lineDoc; - } - //durLayout += et.Duration(true); - - if (ll) { - ll->containsCaret = !hideSelection && (lineDoc == lineCaret); - ll->hotspot = model.GetHotSpotRange(); - - PRectangle rcLine = rcTextArea; - rcLine.top = static_cast(ypos); - rcLine.bottom = static_cast(ypos + vsDraw.lineHeight); - - Range rangeLine(model.pdoc->LineStart(lineDoc), model.pdoc->LineStart(lineDoc + 1)); - - // Highlight the current braces if any - ll->SetBracesHighlight(rangeLine, model.braces, static_cast(model.bracesMatchStyle), - static_cast(model.highlightGuideColumn * vsDraw.spaceWidth), bracesIgnoreStyle); - - if (leftTextOverlap && (bufferedDraw || ((phasesDraw < phasesMultiple) && (*it & drawBack)))) { - // Clear the left margin - PRectangle rcSpacer = rcLine; - rcSpacer.right = rcSpacer.left; - rcSpacer.left -= 1; - surface->FillRectangle(rcSpacer, vsDraw.styles[STYLE_DEFAULT].back); - } - - DrawLine(surface, model, vsDraw, ll, lineDoc, visibleLine, xStart, rcLine, subLine, *it); - //durPaint += et.Duration(true); - - // Restore the previous styles for the brace highlights in case layout is in cache. - ll->RestoreBracesHighlight(rangeLine, model.braces, bracesIgnoreStyle); - - if (*it & drawFoldLines) { - DrawFoldLines(surface, model, vsDraw, lineDoc, rcLine); - } - - if (*it & drawCarets) { - DrawCarets(surface, model, vsDraw, ll, lineDoc, xStart, rcLine, subLine); - } - - if (bufferedDraw) { - Point from = Point::FromInts(vsDraw.textStart - leftTextOverlap, 0); - PRectangle rcCopyArea = PRectangle::FromInts(vsDraw.textStart - leftTextOverlap, yposScreen, - static_cast(rcClient.right - vsDraw.rightMarginWidth), - yposScreen + vsDraw.lineHeight); - surfaceWindow->Copy(rcCopyArea, from, *pixmapLine); - } - - lineWidthMaxSeen = Platform::Maximum( - lineWidthMaxSeen, static_cast(ll->positions[ll->numCharsInLine])); - //durCopy += et.Duration(true); - } - - if (!bufferedDraw) { - ypos += vsDraw.lineHeight; - } - - yposScreen += vsDraw.lineHeight; - visibleLine++; - } - } - ll.Set(0); - //if (durPaint < 0.00000001) - // durPaint = 0.00000001; - - // Right column limit indicator - PRectangle rcBeyondEOF = (vsDraw.marginInside) ? rcClient : rcArea; - rcBeyondEOF.left = static_cast(vsDraw.textStart); - rcBeyondEOF.right = rcBeyondEOF.right - ((vsDraw.marginInside) ? vsDraw.rightMarginWidth : 0); - rcBeyondEOF.top = static_cast((model.cs.LinesDisplayed() - model.TopLineOfMain()) * vsDraw.lineHeight); - if (rcBeyondEOF.top < rcBeyondEOF.bottom) { - surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.styles[STYLE_DEFAULT].back); - if (vsDraw.edgeState == EDGE_LINE) { - int edgeX = static_cast(vsDraw.theEdge.column * vsDraw.spaceWidth); - rcBeyondEOF.left = static_cast(edgeX + xStart); - rcBeyondEOF.right = rcBeyondEOF.left + 1; - surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.theEdge.colour); - } else if (vsDraw.edgeState == EDGE_MULTILINE) { - for (size_t edge = 0; edge < vsDraw.theMultiEdge.size(); edge++) { - if (vsDraw.theMultiEdge[edge].column >= 0) { - int edgeX = static_cast(vsDraw.theMultiEdge[edge].column * vsDraw.spaceWidth); - rcBeyondEOF.left = static_cast(edgeX + xStart); - rcBeyondEOF.right = rcBeyondEOF.left + 1; - surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.theMultiEdge[edge].colour); - } - } - } - } - //Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset); - - //Platform::DebugPrintf( - //"Layout:%9.6g Paint:%9.6g Ratio:%9.6g Copy:%9.6g Total:%9.6g\n", - //durLayout, durPaint, durLayout / durPaint, durCopy, etWhole.Duration()); - } -} - -void EditView::FillLineRemainder(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, PRectangle rcArea, int subLine) { - int eolInSelection = 0; - int alpha = SC_ALPHA_NOALPHA; - if (!hideSelection) { - int posAfterLineEnd = model.pdoc->LineStart(line + 1); - eolInSelection = (subLine == (ll->lines - 1)) ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0; - alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; - } - - ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); - - if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) { - surface->FillRectangle(rcArea, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection)); - } else { - if (background.isSet) { - surface->FillRectangle(rcArea, background); - } else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) { - surface->FillRectangle(rcArea, vsDraw.styles[ll->styles[ll->numCharsInLine]].back); - } else { - surface->FillRectangle(rcArea, vsDraw.styles[STYLE_DEFAULT].back); - } - if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) { - SimpleAlphaRectangle(surface, rcArea, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha); - } - } -} - -// Space (3 space characters) between line numbers and text when printing. -#define lineNumberPrintSpace " " - -static ColourDesired InvertedLight(ColourDesired orig) { - unsigned int r = orig.GetRed(); - unsigned int g = orig.GetGreen(); - unsigned int b = orig.GetBlue(); - unsigned int l = (r + g + b) / 3; // There is a better calculation for this that matches human eye - unsigned int il = 0xff - l; - if (l == 0) - return ColourDesired(0xff, 0xff, 0xff); - r = r * il / l; - g = g * il / l; - b = b * il / l; - return ColourDesired(Platform::Minimum(r, 0xff), Platform::Minimum(g, 0xff), Platform::Minimum(b, 0xff)); -} - -long EditView::FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure, - const EditModel &model, const ViewStyle &vs) { - // Can't use measurements cached for screen - posCache.Clear(); - - ViewStyle vsPrint(vs); - vsPrint.technology = SC_TECHNOLOGY_DEFAULT; - - // Modify the view style for printing as do not normally want any of the transient features to be printed - // Printing supports only the line number margin. - int lineNumberIndex = -1; - for (size_t margin = 0; margin < vs.ms.size(); margin++) { - if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) { - lineNumberIndex = static_cast(margin); - } else { - vsPrint.ms[margin].width = 0; - } - } - vsPrint.fixedColumnWidth = 0; - vsPrint.zoomLevel = printParameters.magnification; - // Don't show indentation guides - // If this ever gets changed, cached pixmap would need to be recreated if technology != SC_TECHNOLOGY_DEFAULT - vsPrint.viewIndentationGuides = ivNone; - // Don't show the selection when printing - vsPrint.selColours.back.isSet = false; - vsPrint.selColours.fore.isSet = false; - vsPrint.selAlpha = SC_ALPHA_NOALPHA; - vsPrint.selAdditionalAlpha = SC_ALPHA_NOALPHA; - vsPrint.whitespaceColours.back.isSet = false; - vsPrint.whitespaceColours.fore.isSet = false; - vsPrint.showCaretLineBackground = false; - vsPrint.alwaysShowCaretLineBackground = false; - // Don't highlight matching braces using indicators - vsPrint.braceHighlightIndicatorSet = false; - vsPrint.braceBadLightIndicatorSet = false; - - // Set colours for printing according to users settings - for (size_t sty = 0; sty < vsPrint.styles.size(); sty++) { - if (printParameters.colourMode == SC_PRINT_INVERTLIGHT) { - vsPrint.styles[sty].fore = InvertedLight(vsPrint.styles[sty].fore); - vsPrint.styles[sty].back = InvertedLight(vsPrint.styles[sty].back); - } else if (printParameters.colourMode == SC_PRINT_BLACKONWHITE) { - vsPrint.styles[sty].fore = ColourDesired(0, 0, 0); - vsPrint.styles[sty].back = ColourDesired(0xff, 0xff, 0xff); - } else if (printParameters.colourMode == SC_PRINT_COLOURONWHITE) { - vsPrint.styles[sty].back = ColourDesired(0xff, 0xff, 0xff); - } else if (printParameters.colourMode == SC_PRINT_COLOURONWHITEDEFAULTBG) { - if (sty <= STYLE_DEFAULT) { - vsPrint.styles[sty].back = ColourDesired(0xff, 0xff, 0xff); - } - } - } - // White background for the line numbers - vsPrint.styles[STYLE_LINENUMBER].back = ColourDesired(0xff, 0xff, 0xff); - - // Printing uses different margins, so reset screen margins - vsPrint.leftMarginWidth = 0; - vsPrint.rightMarginWidth = 0; - - vsPrint.Refresh(*surfaceMeasure, model.pdoc->tabInChars); - // Determining width must happen after fonts have been realised in Refresh - int lineNumberWidth = 0; - if (lineNumberIndex >= 0) { - lineNumberWidth = static_cast(surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, - "99999" lineNumberPrintSpace, 5 + static_cast(strlen(lineNumberPrintSpace)))); - vsPrint.ms[lineNumberIndex].width = lineNumberWidth; - vsPrint.Refresh(*surfaceMeasure, model.pdoc->tabInChars); // Recalculate fixedColumnWidth - } - - int linePrintStart = model.pdoc->LineFromPosition(static_cast(pfr->chrg.cpMin)); - int linePrintLast = linePrintStart + (pfr->rc.bottom - pfr->rc.top) / vsPrint.lineHeight - 1; - if (linePrintLast < linePrintStart) - linePrintLast = linePrintStart; - int linePrintMax = model.pdoc->LineFromPosition(static_cast(pfr->chrg.cpMax)); - if (linePrintLast > linePrintMax) - linePrintLast = linePrintMax; - //Platform::DebugPrintf("Formatting lines=[%0d,%0d,%0d] top=%0d bottom=%0d line=%0d %0d\n", - // linePrintStart, linePrintLast, linePrintMax, pfr->rc.top, pfr->rc.bottom, vsPrint.lineHeight, - // surfaceMeasure->Height(vsPrint.styles[STYLE_LINENUMBER].font)); - int endPosPrint = model.pdoc->Length(); - if (linePrintLast < model.pdoc->LinesTotal()) - endPosPrint = model.pdoc->LineStart(linePrintLast + 1); - - // Ensure we are styled to where we are formatting. - model.pdoc->EnsureStyledTo(endPosPrint); - - int xStart = vsPrint.fixedColumnWidth + pfr->rc.left; - int ypos = pfr->rc.top; - - int lineDoc = linePrintStart; - - int nPrintPos = static_cast(pfr->chrg.cpMin); - int visibleLine = 0; - int widthPrint = pfr->rc.right - pfr->rc.left - vsPrint.fixedColumnWidth; - if (printParameters.wrapState == eWrapNone) - widthPrint = LineLayout::wrapWidthInfinite; - - while (lineDoc <= linePrintLast && ypos < pfr->rc.bottom) { - - // When printing, the hdc and hdcTarget may be the same, so - // changing the state of surfaceMeasure may change the underlying - // state of surface. Therefore, any cached state is discarded before - // using each surface. - surfaceMeasure->FlushCachedState(); - - // Copy this line and its styles from the document into local arrays - // and determine the x position at which each character starts. - LineLayout ll(model.pdoc->LineStart(lineDoc + 1) - model.pdoc->LineStart(lineDoc) + 1); - LayoutLine(model, lineDoc, surfaceMeasure, vsPrint, &ll, widthPrint); - - ll.containsCaret = false; - - PRectangle rcLine = PRectangle::FromInts( - pfr->rc.left, - ypos, - pfr->rc.right - 1, - ypos + vsPrint.lineHeight); - - // When document line is wrapped over multiple display lines, find where - // to start printing from to ensure a particular position is on the first - // line of the page. - if (visibleLine == 0) { - int startWithinLine = nPrintPos - model.pdoc->LineStart(lineDoc); - for (int iwl = 0; iwl < ll.lines - 1; iwl++) { - if (ll.LineStart(iwl) <= startWithinLine && ll.LineStart(iwl + 1) >= startWithinLine) { - visibleLine = -iwl; - } - } - - if (ll.lines > 1 && startWithinLine >= ll.LineStart(ll.lines - 1)) { - visibleLine = -(ll.lines - 1); - } - } - - if (draw && lineNumberWidth && - (ypos + vsPrint.lineHeight <= pfr->rc.bottom) && - (visibleLine >= 0)) { - char number[100]; - sprintf(number, "%d" lineNumberPrintSpace, lineDoc + 1); - PRectangle rcNumber = rcLine; - rcNumber.right = rcNumber.left + lineNumberWidth; - // Right justify - rcNumber.left = rcNumber.right - surfaceMeasure->WidthText( - vsPrint.styles[STYLE_LINENUMBER].font, number, static_cast(strlen(number))); - surface->FlushCachedState(); - surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font, - static_cast(ypos + vsPrint.maxAscent), number, static_cast(strlen(number)), - vsPrint.styles[STYLE_LINENUMBER].fore, - vsPrint.styles[STYLE_LINENUMBER].back); - } - - // Draw the line - surface->FlushCachedState(); - - for (int iwl = 0; iwl < ll.lines; iwl++) { - if (ypos + vsPrint.lineHeight <= pfr->rc.bottom) { - if (visibleLine >= 0) { - if (draw) { - rcLine.top = static_cast(ypos); - rcLine.bottom = static_cast(ypos + vsPrint.lineHeight); - DrawLine(surface, model, vsPrint, &ll, lineDoc, visibleLine, xStart, rcLine, iwl, drawAll); - } - ypos += vsPrint.lineHeight; - } - visibleLine++; - if (iwl == ll.lines - 1) - nPrintPos = model.pdoc->LineStart(lineDoc + 1); - else - nPrintPos += ll.LineStart(iwl + 1) - ll.LineStart(iwl); - } - } - - ++lineDoc; - } - - // Clear cache so measurements are not used for screen - posCache.Clear(); - - return nPrintPos; -} diff --git a/qrenderdoc/3rdparty/scintilla/src/EditView.h b/qrenderdoc/3rdparty/scintilla/src/EditView.h deleted file mode 100644 index 8551daa3b..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/EditView.h +++ /dev/null @@ -1,180 +0,0 @@ -// Scintilla source code edit control -/** @file EditView.h - ** Defines the appearance of the main text area of the editor window. - **/ -// Copyright 1998-2014 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef EDITVIEW_H -#define EDITVIEW_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -struct PrintParameters { - int magnification; - int colourMode; - WrapMode wrapState; - PrintParameters(); -}; - -/** -* The view may be drawn in separate phases. -*/ -enum DrawPhase { - drawBack = 0x1, - drawIndicatorsBack = 0x2, - drawText = 0x4, - drawIndentationGuides = 0x8, - drawIndicatorsFore = 0x10, - drawSelectionTranslucent = 0x20, - drawLineTranslucent = 0x40, - drawFoldLines = 0x80, - drawCarets = 0x100, - drawAll = 0x1FF -}; - -bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st); -int WidestLineWidth(Surface *surface, const ViewStyle &vs, int styleOffset, const StyledText &st); -void DrawTextNoClipPhase(Surface *surface, PRectangle rc, const Style &style, XYPOSITION ybase, - const char *s, int len, DrawPhase phase); -void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRectangle rcText, - const StyledText &st, size_t start, size_t length, DrawPhase phase); - -typedef void (*DrawTabArrowFn)(Surface *surface, PRectangle rcTab, int ymid); - -/** -* EditView draws the main text area. -*/ -class EditView { -public: - PrintParameters printParameters; - PerLine *ldTabstops; - int tabWidthMinimumPixels; - - bool hideSelection; - bool drawOverstrikeCaret; - - /** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to - * the screen. This avoids flashing but is about 30% slower. */ - bool bufferedDraw; - /** In phasesTwo mode, drawing is performed in two phases, first the background - * and then the foreground. This avoids chopping off characters that overlap the next run. - * In multiPhaseDraw mode, drawing is performed in multiple phases with each phase drawing - * one feature over the whole drawing area, instead of within one line. This allows text to - * overlap from one line to the next. */ - enum PhasesDraw { phasesOne, phasesTwo, phasesMultiple }; - PhasesDraw phasesDraw; - - int lineWidthMaxSeen; - - bool additionalCaretsBlink; - bool additionalCaretsVisible; - - bool imeCaretBlockOverride; - - Surface *pixmapLine; - Surface *pixmapIndentGuide; - Surface *pixmapIndentGuideHighlight; - - LineLayoutCache llc; - PositionCache posCache; - - int tabArrowHeight; // draw arrow heads this many pixels above/below line midpoint - /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native - * DrawTabArrow function for drawing tab characters. Allow those platforms to - * override it instead of creating a new method in the Surface class that - * existing platforms must implement as empty. */ - DrawTabArrowFn customDrawTabArrow; - DrawWrapMarkerFn customDrawWrapMarker; - - EditView(); - virtual ~EditView(); - - bool SetTwoPhaseDraw(bool twoPhaseDraw); - bool SetPhasesDraw(int phases); - bool LinesOverlap() const; - - void ClearAllTabstops(); - XYPOSITION NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const; - bool ClearTabstops(int line); - bool AddTabstop(int line, int x); - int GetNextTabstop(int line, int x) const; - void LinesAddedOrRemoved(int lineOfPos, int linesAdded); - - void DropGraphics(bool freeObjects); - void AllocateGraphics(const ViewStyle &vsDraw); - void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw); - - LineLayout *RetrieveLineLayout(int lineNumber, const EditModel &model); - void LayoutLine(const EditModel &model, int line, Surface *surface, const ViewStyle &vstyle, - LineLayout *ll, int width = LineLayout::wrapWidthInfinite); - - Point LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, int topLine, - const ViewStyle &vs, PointEnd pe); - Range RangeDisplayLine(Surface *surface, const EditModel &model, int lineVisible, const ViewStyle &vs); - SelectionPosition SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument pt, bool canReturnInvalid, - bool charPosition, bool virtualSpace, const ViewStyle &vs); - SelectionPosition SPositionFromLineX(Surface *surface, const EditModel &model, int lineDoc, int x, const ViewStyle &vs); - int DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs); - int StartEndDisplayLine(Surface *surface, const EditModel &model, int pos, bool start, const ViewStyle &vs); - - void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight); - void DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, - int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart, - ColourOptional background); - void DrawFoldDisplayText(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase); - void DrawAnnotation(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase); - void DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line, - int xStart, PRectangle rcLine, int subLine) const; - void DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, - Range lineRange, int posLineStart, int xStart, - int subLine, ColourOptional background) const; - void DrawForeground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int lineVisible, - PRectangle rcLine, Range lineRange, int posLineStart, int xStart, - int subLine, ColourOptional background); - void DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, int lineVisible, PRectangle rcLine, int xStart, int subLine); - void DrawLine(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line, - int lineVisible, int xStart, PRectangle rcLine, int subLine, DrawPhase phase); - void PaintText(Surface *surfaceWindow, const EditModel &model, PRectangle rcArea, PRectangle rcClient, - const ViewStyle &vsDraw); - void FillLineRemainder(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, - int line, PRectangle rcArea, int subLine); - long FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure, - const EditModel &model, const ViewStyle &vs); -}; - -/** -* Convenience class to ensure LineLayout objects are always disposed. -*/ -class AutoLineLayout { - LineLayoutCache &llc; - LineLayout *ll; - AutoLineLayout &operator=(const AutoLineLayout &); -public: - AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) : llc(llc_), ll(ll_) {} - ~AutoLineLayout() { - llc.Dispose(ll); - ll = 0; - } - LineLayout *operator->() const { - return ll; - } - operator LineLayout *() const { - return ll; - } - void Set(LineLayout *ll_) { - llc.Dispose(ll); - ll = ll_; - } -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/Editor.cxx b/qrenderdoc/3rdparty/scintilla/src/Editor.cxx deleted file mode 100644 index 8e4ebf18a..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Editor.cxx +++ /dev/null @@ -1,8154 +0,0 @@ -// Scintilla source code edit control -/** @file Editor.cxx - ** Main code for the edit control. - **/ -// Copyright 1998-2011 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "ILexer.h" -#include "Scintilla.h" - -#include "StringCopy.h" -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" -#include "CellBuffer.h" -#include "PerLine.h" -#include "KeyMap.h" -#include "Indicator.h" -#include "XPM.h" -#include "LineMarker.h" -#include "Style.h" -#include "ViewStyle.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "CaseFolder.h" -#include "Document.h" -#include "UniConversion.h" -#include "Selection.h" -#include "PositionCache.h" -#include "EditModel.h" -#include "MarginView.h" -#include "EditView.h" -#include "Editor.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -/* - return whether this modification represents an operation that - may reasonably be deferred (not done now OR [possibly] at all) -*/ -static bool CanDeferToLastStep(const DocModification &mh) { - if (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) - return true; // CAN skip - if (!(mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO))) - return false; // MUST do - if (mh.modificationType & SC_MULTISTEPUNDOREDO) - return true; // CAN skip - return false; // PRESUMABLY must do -} - -static bool CanEliminate(const DocModification &mh) { - return - (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) != 0; -} - -/* - return whether this modification represents the FINAL step - in a [possibly lengthy] multi-step Undo/Redo sequence -*/ -static bool IsLastStep(const DocModification &mh) { - return - (mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)) != 0 - && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 - && (mh.modificationType & SC_LASTSTEPINUNDOREDO) != 0 - && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0; -} - -Timer::Timer() : - ticking(false), ticksToWait(0), tickerID(0) {} - -Idler::Idler() : - state(false), idlerID(0) {} - -static inline bool IsAllSpacesOrTabs(const char *s, unsigned int len) { - for (unsigned int i = 0; i < len; i++) { - // This is safe because IsSpaceOrTab() will return false for null terminators - if (!IsSpaceOrTab(s[i])) - return false; - } - return true; -} - -Editor::Editor() { - ctrlID = 0; - - stylesValid = false; - technology = SC_TECHNOLOGY_DEFAULT; - scaleRGBAImage = 100.0f; - - cursorMode = SC_CURSORNORMAL; - - hasFocus = false; - errorStatus = 0; - mouseDownCaptures = true; - mouseWheelCaptures = true; - - lastClickTime = 0; - doubleClickCloseThreshold = Point(3, 3); - dwellDelay = SC_TIME_FOREVER; - ticksToDwell = SC_TIME_FOREVER; - dwelling = false; - ptMouseLast.x = 0; - ptMouseLast.y = 0; - inDragDrop = ddNone; - dropWentOutside = false; - posDrop = SelectionPosition(invalidPosition); - hotSpotClickPos = INVALID_POSITION; - selectionType = selChar; - - lastXChosen = 0; - lineAnchorPos = 0; - originalAnchorPos = 0; - wordSelectAnchorStartPos = 0; - wordSelectAnchorEndPos = 0; - wordSelectInitialCaretPos = -1; - - caretXPolicy = CARET_SLOP | CARET_EVEN; - caretXSlop = 50; - - caretYPolicy = CARET_EVEN; - caretYSlop = 0; - - visiblePolicy = 0; - visibleSlop = 0; - - searchAnchor = 0; - - xCaretMargin = 50; - horizontalScrollBarVisible = true; - scrollWidth = 2000; - verticalScrollBarVisible = true; - endAtLastLine = true; - caretSticky = SC_CARETSTICKY_OFF; - marginOptions = SC_MARGINOPTION_NONE; - mouseSelectionRectangularSwitch = false; - multipleSelection = false; - additionalSelectionTyping = false; - multiPasteMode = SC_MULTIPASTE_ONCE; - virtualSpaceOptions = SCVS_NONE; - - targetStart = 0; - targetEnd = 0; - searchFlags = 0; - - topLine = 0; - posTopLine = 0; - - lengthForEncode = -1; - - needUpdateUI = 0; - ContainerNeedsUpdate(SC_UPDATE_CONTENT); - - paintState = notPainting; - paintAbandonedByStyling = false; - paintingAllText = false; - willRedrawAll = false; - idleStyling = SC_IDLESTYLING_NONE; - needIdleStyling = false; - - modEventMask = SC_MODEVENTMASKALL; - - pdoc->AddWatcher(this, 0); - - recordingMacro = false; - foldAutomatic = 0; - - convertPastes = true; - - SetRepresentations(); -} - -Editor::~Editor() { - pdoc->RemoveWatcher(this, 0); - DropGraphics(true); -} - -void Editor::Finalise() { - SetIdle(false); - CancelModes(); -} - -void Editor::SetRepresentations() { - reprs.Clear(); - - // C0 control set - const char *reps[] = { - "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", - "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", - "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", - "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" - }; - for (size_t j=0; j < ELEMENTS(reps); j++) { - char c[2] = { static_cast(j), 0 }; - reprs.SetRepresentation(c, reps[j]); - } - - // C1 control set - // As well as Unicode mode, ISO-8859-1 should use these - if (IsUnicodeMode()) { - const char *repsC1[] = { - "PAD", "HOP", "BPH", "NBH", "IND", "NEL", "SSA", "ESA", - "HTS", "HTJ", "VTS", "PLD", "PLU", "RI", "SS2", "SS3", - "DCS", "PU1", "PU2", "STS", "CCH", "MW", "SPA", "EPA", - "SOS", "SGCI", "SCI", "CSI", "ST", "OSC", "PM", "APC" - }; - for (size_t j=0; j < ELEMENTS(repsC1); j++) { - char c1[3] = { '\xc2', static_cast(0x80+j), 0 }; - reprs.SetRepresentation(c1, repsC1[j]); - } - reprs.SetRepresentation("\xe2\x80\xa8", "LS"); - reprs.SetRepresentation("\xe2\x80\xa9", "PS"); - } - - // UTF-8 invalid bytes - if (IsUnicodeMode()) { - for (int k=0x80; k < 0x100; k++) { - char hiByte[2] = { static_cast(k), 0 }; - char hexits[4]; - sprintf(hexits, "x%2X", k); - reprs.SetRepresentation(hiByte, hexits); - } - } -} - -void Editor::DropGraphics(bool freeObjects) { - marginView.DropGraphics(freeObjects); - view.DropGraphics(freeObjects); -} - -void Editor::AllocateGraphics() { - marginView.AllocateGraphics(vs); - view.AllocateGraphics(vs); -} - -void Editor::InvalidateStyleData() { - stylesValid = false; - vs.technology = technology; - DropGraphics(false); - AllocateGraphics(); - view.llc.Invalidate(LineLayout::llInvalid); - view.posCache.Clear(); -} - -void Editor::InvalidateStyleRedraw() { - NeedWrapping(); - InvalidateStyleData(); - Redraw(); -} - -void Editor::RefreshStyleData() { - if (!stylesValid) { - stylesValid = true; - AutoSurface surface(this); - if (surface) { - vs.Refresh(*surface, pdoc->tabInChars); - } - SetScrollBars(); - SetRectangularRange(); - } -} - -Point Editor::GetVisibleOriginInMain() const { - return Point(0,0); -} - -PointDocument Editor::DocumentPointFromView(Point ptView) const { - PointDocument ptDocument(ptView); - if (wMargin.GetID()) { - Point ptOrigin = GetVisibleOriginInMain(); - ptDocument.x += ptOrigin.x; - ptDocument.y += ptOrigin.y; - } else { - ptDocument.x += xOffset; - ptDocument.y += topLine * vs.lineHeight; - } - return ptDocument; -} - -int Editor::TopLineOfMain() const { - if (wMargin.GetID()) - return 0; - else - return topLine; -} - -PRectangle Editor::GetClientRectangle() const { - Window win = wMain; - return win.GetClientPosition(); -} - -PRectangle Editor::GetClientDrawingRectangle() { - return GetClientRectangle(); -} - -PRectangle Editor::GetTextRectangle() const { - PRectangle rc = GetClientRectangle(); - rc.left += vs.textStart; - rc.right -= vs.rightMarginWidth; - return rc; -} - -int Editor::LinesOnScreen() const { - PRectangle rcClient = GetClientRectangle(); - int htClient = static_cast(rcClient.bottom - rcClient.top); - //Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1); - return htClient / vs.lineHeight; -} - -int Editor::LinesToScroll() const { - int retVal = LinesOnScreen() - 1; - if (retVal < 1) - return 1; - else - return retVal; -} - -int Editor::MaxScrollPos() const { - //Platform::DebugPrintf("Lines %d screen = %d maxScroll = %d\n", - //LinesTotal(), LinesOnScreen(), LinesTotal() - LinesOnScreen() + 1); - int retVal = cs.LinesDisplayed(); - if (endAtLastLine) { - retVal -= LinesOnScreen(); - } else { - retVal--; - } - if (retVal < 0) { - return 0; - } else { - return retVal; - } -} - -SelectionPosition Editor::ClampPositionIntoDocument(SelectionPosition sp) const { - if (sp.Position() < 0) { - return SelectionPosition(0); - } else if (sp.Position() > pdoc->Length()) { - return SelectionPosition(pdoc->Length()); - } else { - // If not at end of line then set offset to 0 - if (!pdoc->IsLineEndPosition(sp.Position())) - sp.SetVirtualSpace(0); - return sp; - } -} - -Point Editor::LocationFromPosition(SelectionPosition pos, PointEnd pe) { - RefreshStyleData(); - AutoSurface surface(this); - return view.LocationFromPosition(surface, *this, pos, topLine, vs, pe); -} - -Point Editor::LocationFromPosition(int pos, PointEnd pe) { - return LocationFromPosition(SelectionPosition(pos), pe); -} - -int Editor::XFromPosition(int pos) { - Point pt = LocationFromPosition(pos); - return static_cast(pt.x) - vs.textStart + xOffset; -} - -int Editor::XFromPosition(SelectionPosition sp) { - Point pt = LocationFromPosition(sp); - return static_cast(pt.x) - vs.textStart + xOffset; -} - -SelectionPosition Editor::SPositionFromLocation(Point pt, bool canReturnInvalid, bool charPosition, bool virtualSpace) { - RefreshStyleData(); - AutoSurface surface(this); - - if (canReturnInvalid) { - PRectangle rcClient = GetTextRectangle(); - // May be in scroll view coordinates so translate back to main view - Point ptOrigin = GetVisibleOriginInMain(); - rcClient.Move(-ptOrigin.x, -ptOrigin.y); - if (!rcClient.Contains(pt)) - return SelectionPosition(INVALID_POSITION); - if (pt.x < vs.textStart) - return SelectionPosition(INVALID_POSITION); - if (pt.y < 0) - return SelectionPosition(INVALID_POSITION); - } - PointDocument ptdoc = DocumentPointFromView(pt); - return view.SPositionFromLocation(surface, *this, ptdoc, canReturnInvalid, charPosition, virtualSpace, vs); -} - -int Editor::PositionFromLocation(Point pt, bool canReturnInvalid, bool charPosition) { - return SPositionFromLocation(pt, canReturnInvalid, charPosition, false).Position(); -} - -/** -* Find the document position corresponding to an x coordinate on a particular document line. -* Ensure is between whole characters when document is in multi-byte or UTF-8 mode. -* This method is used for rectangular selections and does not work on wrapped lines. -*/ -SelectionPosition Editor::SPositionFromLineX(int lineDoc, int x) { - RefreshStyleData(); - if (lineDoc >= pdoc->LinesTotal()) - return SelectionPosition(pdoc->Length()); - //Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine); - AutoSurface surface(this); - return view.SPositionFromLineX(surface, *this, lineDoc, x, vs); -} - -int Editor::PositionFromLineX(int lineDoc, int x) { - return SPositionFromLineX(lineDoc, x).Position(); -} - -int Editor::LineFromLocation(Point pt) const { - return cs.DocFromDisplay(static_cast(pt.y) / vs.lineHeight + topLine); -} - -void Editor::SetTopLine(int topLineNew) { - if ((topLine != topLineNew) && (topLineNew >= 0)) { - topLine = topLineNew; - ContainerNeedsUpdate(SC_UPDATE_V_SCROLL); - } - posTopLine = pdoc->LineStart(cs.DocFromDisplay(topLine)); -} - -/** - * If painting then abandon the painting because a wider redraw is needed. - * @return true if calling code should stop drawing. - */ -bool Editor::AbandonPaint() { - if ((paintState == painting) && !paintingAllText) { - paintState = paintAbandoned; - } - return paintState == paintAbandoned; -} - -void Editor::RedrawRect(PRectangle rc) { - //Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom); - - // Clip the redraw rectangle into the client area - PRectangle rcClient = GetClientRectangle(); - if (rc.top < rcClient.top) - rc.top = rcClient.top; - if (rc.bottom > rcClient.bottom) - rc.bottom = rcClient.bottom; - if (rc.left < rcClient.left) - rc.left = rcClient.left; - if (rc.right > rcClient.right) - rc.right = rcClient.right; - - if ((rc.bottom > rc.top) && (rc.right > rc.left)) { - wMain.InvalidateRectangle(rc); - } -} - -void Editor::DiscardOverdraw() { - // Overridden on platforms that may draw outside visible area. -} - -void Editor::Redraw() { - //Platform::DebugPrintf("Redraw all\n"); - PRectangle rcClient = GetClientRectangle(); - wMain.InvalidateRectangle(rcClient); - if (wMargin.GetID()) - wMargin.InvalidateAll(); - //wMain.InvalidateAll(); -} - -void Editor::RedrawSelMargin(int line, bool allAfter) { - const bool markersInText = vs.maskInLine || vs.maskDrawInText; - if (!wMargin.GetID() || markersInText) { // May affect text area so may need to abandon and retry - if (AbandonPaint()) { - return; - } - } - if (wMargin.GetID() && markersInText) { - Redraw(); - return; - } - PRectangle rcMarkers = GetClientRectangle(); - if (!markersInText) { - // Normal case: just draw the margin - rcMarkers.right = rcMarkers.left + vs.fixedColumnWidth; - } - if (line != -1) { - PRectangle rcLine = RectangleFromRange(Range(pdoc->LineStart(line)), 0); - - // Inflate line rectangle if there are image markers with height larger than line height - if (vs.largestMarkerHeight > vs.lineHeight) { - int delta = (vs.largestMarkerHeight - vs.lineHeight + 1) / 2; - rcLine.top -= delta; - rcLine.bottom += delta; - if (rcLine.top < rcMarkers.top) - rcLine.top = rcMarkers.top; - if (rcLine.bottom > rcMarkers.bottom) - rcLine.bottom = rcMarkers.bottom; - } - - rcMarkers.top = rcLine.top; - if (!allAfter) - rcMarkers.bottom = rcLine.bottom; - if (rcMarkers.Empty()) - return; - } - if (wMargin.GetID()) { - Point ptOrigin = GetVisibleOriginInMain(); - rcMarkers.Move(-ptOrigin.x, -ptOrigin.y); - wMargin.InvalidateRectangle(rcMarkers); - } else { - wMain.InvalidateRectangle(rcMarkers); - } -} - -PRectangle Editor::RectangleFromRange(Range r, int overlap) { - const int minLine = cs.DisplayFromDoc(pdoc->LineFromPosition(r.First())); - const int maxLine = cs.DisplayLastFromDoc(pdoc->LineFromPosition(r.Last())); - const PRectangle rcClientDrawing = GetClientDrawingRectangle(); - PRectangle rc; - const int leftTextOverlap = ((xOffset == 0) && (vs.leftMarginWidth > 0)) ? 1 : 0; - rc.left = static_cast(vs.textStart - leftTextOverlap); - rc.top = static_cast((minLine - TopLineOfMain()) * vs.lineHeight - overlap); - if (rc.top < rcClientDrawing.top) - rc.top = rcClientDrawing.top; - // Extend to right of prepared area if any to prevent artifacts from caret line highlight - rc.right = rcClientDrawing.right; - rc.bottom = static_cast((maxLine - TopLineOfMain() + 1) * vs.lineHeight + overlap); - - return rc; -} - -void Editor::InvalidateRange(int start, int end) { - RedrawRect(RectangleFromRange(Range(start, end), view.LinesOverlap() ? vs.lineOverlap : 0)); -} - -int Editor::CurrentPosition() const { - return sel.MainCaret(); -} - -bool Editor::SelectionEmpty() const { - return sel.Empty(); -} - -SelectionPosition Editor::SelectionStart() { - return sel.RangeMain().Start(); -} - -SelectionPosition Editor::SelectionEnd() { - return sel.RangeMain().End(); -} - -void Editor::SetRectangularRange() { - if (sel.IsRectangular()) { - int xAnchor = XFromPosition(sel.Rectangular().anchor); - int xCaret = XFromPosition(sel.Rectangular().caret); - if (sel.selType == Selection::selThin) { - xCaret = xAnchor; - } - int lineAnchorRect = pdoc->LineFromPosition(sel.Rectangular().anchor.Position()); - int lineCaret = pdoc->LineFromPosition(sel.Rectangular().caret.Position()); - int increment = (lineCaret > lineAnchorRect) ? 1 : -1; - for (int line=lineAnchorRect; line != lineCaret+increment; line += increment) { - SelectionRange range(SPositionFromLineX(line, xCaret), SPositionFromLineX(line, xAnchor)); - if ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) == 0) - range.ClearVirtualSpace(); - if (line == lineAnchorRect) - sel.SetSelection(range); - else - sel.AddSelectionWithoutTrim(range); - } - } -} - -void Editor::ThinRectangularRange() { - if (sel.IsRectangular()) { - sel.selType = Selection::selThin; - if (sel.Rectangular().caret < sel.Rectangular().anchor) { - sel.Rectangular() = SelectionRange(sel.Range(sel.Count()-1).caret, sel.Range(0).anchor); - } else { - sel.Rectangular() = SelectionRange(sel.Range(sel.Count()-1).anchor, sel.Range(0).caret); - } - SetRectangularRange(); - } -} - -void Editor::InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection) { - if (sel.Count() > 1 || !(sel.RangeMain().anchor == newMain.anchor) || sel.IsRectangular()) { - invalidateWholeSelection = true; - } - int firstAffected = Platform::Minimum(sel.RangeMain().Start().Position(), newMain.Start().Position()); - // +1 for lastAffected ensures caret repainted - int lastAffected = Platform::Maximum(newMain.caret.Position()+1, newMain.anchor.Position()); - lastAffected = Platform::Maximum(lastAffected, sel.RangeMain().End().Position()); - if (invalidateWholeSelection) { - for (size_t r=0; rLineFromPosition(currentPos_.Position()); - /* For Line selection - ensure the anchor and caret are always - at the beginning and end of the region lines. */ - if (sel.selType == Selection::selLines) { - if (currentPos_ > anchor_) { - anchor_ = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(anchor_.Position()))); - currentPos_ = SelectionPosition(pdoc->LineEnd(pdoc->LineFromPosition(currentPos_.Position()))); - } else { - currentPos_ = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(currentPos_.Position()))); - anchor_ = SelectionPosition(pdoc->LineEnd(pdoc->LineFromPosition(anchor_.Position()))); - } - } - SelectionRange rangeNew(currentPos_, anchor_); - if (sel.Count() > 1 || !(sel.RangeMain() == rangeNew)) { - InvalidateSelection(rangeNew); - } - sel.RangeMain() = rangeNew; - SetRectangularRange(); - ClaimSelection(); - SetHoverIndicatorPosition(sel.MainCaret()); - - if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) { - RedrawSelMargin(); - } - QueueIdleWork(WorkNeeded::workUpdateUI); -} - -void Editor::SetSelection(int currentPos_, int anchor_) { - SetSelection(SelectionPosition(currentPos_), SelectionPosition(anchor_)); -} - -// Just move the caret on the main selection -void Editor::SetSelection(SelectionPosition currentPos_) { - currentPos_ = ClampPositionIntoDocument(currentPos_); - int currentLine = pdoc->LineFromPosition(currentPos_.Position()); - if (sel.Count() > 1 || !(sel.RangeMain().caret == currentPos_)) { - InvalidateSelection(SelectionRange(currentPos_)); - } - if (sel.IsRectangular()) { - sel.Rectangular() = - SelectionRange(SelectionPosition(currentPos_), sel.Rectangular().anchor); - SetRectangularRange(); - } else { - sel.RangeMain() = - SelectionRange(SelectionPosition(currentPos_), sel.RangeMain().anchor); - } - ClaimSelection(); - SetHoverIndicatorPosition(sel.MainCaret()); - - if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) { - RedrawSelMargin(); - } - QueueIdleWork(WorkNeeded::workUpdateUI); -} - -void Editor::SetSelection(int currentPos_) { - SetSelection(SelectionPosition(currentPos_)); -} - -void Editor::SetEmptySelection(SelectionPosition currentPos_) { - int currentLine = pdoc->LineFromPosition(currentPos_.Position()); - SelectionRange rangeNew(ClampPositionIntoDocument(currentPos_)); - if (sel.Count() > 1 || !(sel.RangeMain() == rangeNew)) { - InvalidateSelection(rangeNew); - } - sel.Clear(); - sel.RangeMain() = rangeNew; - SetRectangularRange(); - ClaimSelection(); - SetHoverIndicatorPosition(sel.MainCaret()); - - if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) { - RedrawSelMargin(); - } - QueueIdleWork(WorkNeeded::workUpdateUI); -} - -void Editor::SetEmptySelection(int currentPos_) { - SetEmptySelection(SelectionPosition(currentPos_)); -} - -void Editor::MultipleSelectAdd(AddNumber addNumber) { - if (SelectionEmpty() || !multipleSelection) { - // Select word at caret - const int startWord = pdoc->ExtendWordSelect(sel.MainCaret(), -1, true); - const int endWord = pdoc->ExtendWordSelect(startWord, 1, true); - TrimAndSetSelection(endWord, startWord); - - } else { - - if (!pdoc->HasCaseFolder()) - pdoc->SetCaseFolder(CaseFolderForEncoding()); - - const Range rangeMainSelection(sel.RangeMain().Start().Position(), sel.RangeMain().End().Position()); - const std::string selectedText = RangeText(rangeMainSelection.start, rangeMainSelection.end); - - const Range rangeTarget(targetStart, targetEnd); - std::vector searchRanges; - // Search should be over the target range excluding the current selection so - // may need to search 2 ranges, after the selection then before the selection. - if (rangeTarget.Overlaps(rangeMainSelection)) { - // Common case is that the selection is completely within the target but - // may also have overlap at start or end. - if (rangeMainSelection.end < rangeTarget.end) - searchRanges.push_back(Range(rangeMainSelection.end, rangeTarget.end)); - if (rangeTarget.start < rangeMainSelection.start) - searchRanges.push_back(Range(rangeTarget.start, rangeMainSelection.start)); - } else { - // No overlap - searchRanges.push_back(rangeTarget); - } - - for (std::vector::const_iterator it = searchRanges.begin(); it != searchRanges.end(); ++it) { - int searchStart = it->start; - const int searchEnd = it->end; - for (;;) { - int lengthFound = static_cast(selectedText.length()); - int pos = static_cast(pdoc->FindText(searchStart, searchEnd, - selectedText.c_str(), searchFlags, &lengthFound)); - if (pos >= 0) { - sel.AddSelection(SelectionRange(pos + lengthFound, pos)); - ScrollRange(sel.RangeMain()); - Redraw(); - if (addNumber == addOne) - return; - searchStart = pos + lengthFound; - } else { - break; - } - } - } - } -} - -bool Editor::RangeContainsProtected(int start, int end) const { - if (vs.ProtectionActive()) { - if (start > end) { - int t = start; - start = end; - end = t; - } - for (int pos = start; pos < end; pos++) { - if (vs.styles[pdoc->StyleIndexAt(pos)].IsProtected()) - return true; - } - } - return false; -} - -bool Editor::SelectionContainsProtected() { - for (size_t r=0; rMovePositionOutsideChar(pos.Position(), moveDir, checkLineEnd); - if (posMoved != pos.Position()) - pos.SetPosition(posMoved); - if (vs.ProtectionActive()) { - if (moveDir > 0) { - if ((pos.Position() > 0) && vs.styles[pdoc->StyleIndexAt(pos.Position() - 1)].IsProtected()) { - while ((pos.Position() < pdoc->Length()) && - (vs.styles[pdoc->StyleIndexAt(pos.Position())].IsProtected())) - pos.Add(1); - } - } else if (moveDir < 0) { - if (vs.styles[pdoc->StyleIndexAt(pos.Position())].IsProtected()) { - while ((pos.Position() > 0) && - (vs.styles[pdoc->StyleIndexAt(pos.Position() - 1)].IsProtected())) - pos.Add(-1); - } - } - } - return pos; -} - -void Editor::MovedCaret(SelectionPosition newPos, SelectionPosition previousPos, bool ensureVisible) { - const int currentLine = pdoc->LineFromPosition(newPos.Position()); - if (ensureVisible) { - // In case in need of wrapping to ensure DisplayFromDoc works. - if (currentLine >= wrapPending.start) - WrapLines(wsAll); - XYScrollPosition newXY = XYScrollToMakeVisible( - SelectionRange(posDrag.IsValid() ? posDrag : newPos), xysDefault); - if (previousPos.IsValid() && (newXY.xOffset == xOffset)) { - // simple vertical scroll then invalidate - ScrollTo(newXY.topLine); - InvalidateSelection(SelectionRange(previousPos), true); - } else { - SetXYScroll(newXY); - } - } - - ShowCaretAtCurrentPosition(); - NotifyCaretMove(); - - ClaimSelection(); - SetHoverIndicatorPosition(sel.MainCaret()); - QueueIdleWork(WorkNeeded::workUpdateUI); - - if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) { - RedrawSelMargin(); - } -} - -void Editor::MovePositionTo(SelectionPosition newPos, Selection::selTypes selt, bool ensureVisible) { - const SelectionPosition spCaret = ((sel.Count() == 1) && sel.Empty()) ? - sel.Last() : SelectionPosition(INVALID_POSITION); - - int delta = newPos.Position() - sel.MainCaret(); - newPos = ClampPositionIntoDocument(newPos); - newPos = MovePositionOutsideChar(newPos, delta); - if (!multipleSelection && sel.IsRectangular() && (selt == Selection::selStream)) { - // Can't turn into multiple selection so clear additional selections - InvalidateSelection(SelectionRange(newPos), true); - sel.DropAdditionalRanges(); - } - if (!sel.IsRectangular() && (selt == Selection::selRectangle)) { - // Switching to rectangular - InvalidateSelection(sel.RangeMain(), false); - SelectionRange rangeMain = sel.RangeMain(); - sel.Clear(); - sel.Rectangular() = rangeMain; - } - if (selt != Selection::noSel) { - sel.selType = selt; - } - if (selt != Selection::noSel || sel.MoveExtends()) { - SetSelection(newPos); - } else { - SetEmptySelection(newPos); - } - - MovedCaret(newPos, spCaret, ensureVisible); -} - -void Editor::MovePositionTo(int newPos, Selection::selTypes selt, bool ensureVisible) { - MovePositionTo(SelectionPosition(newPos), selt, ensureVisible); -} - -SelectionPosition Editor::MovePositionSoVisible(SelectionPosition pos, int moveDir) { - pos = ClampPositionIntoDocument(pos); - pos = MovePositionOutsideChar(pos, moveDir); - int lineDoc = pdoc->LineFromPosition(pos.Position()); - if (cs.GetVisible(lineDoc)) { - return pos; - } else { - int lineDisplay = cs.DisplayFromDoc(lineDoc); - if (moveDir > 0) { - // lineDisplay is already line before fold as lines in fold use display line of line after fold - lineDisplay = Platform::Clamp(lineDisplay, 0, cs.LinesDisplayed()); - return SelectionPosition(pdoc->LineStart(cs.DocFromDisplay(lineDisplay))); - } else { - lineDisplay = Platform::Clamp(lineDisplay - 1, 0, cs.LinesDisplayed()); - return SelectionPosition(pdoc->LineEnd(cs.DocFromDisplay(lineDisplay))); - } - } -} - -SelectionPosition Editor::MovePositionSoVisible(int pos, int moveDir) { - return MovePositionSoVisible(SelectionPosition(pos), moveDir); -} - -Point Editor::PointMainCaret() { - return LocationFromPosition(sel.Range(sel.Main()).caret); -} - -/** - * Choose the x position that the caret will try to stick to - * as it moves up and down. - */ -void Editor::SetLastXChosen() { - Point pt = PointMainCaret(); - lastXChosen = static_cast(pt.x) + xOffset; -} - -void Editor::ScrollTo(int line, bool moveThumb) { - int topLineNew = Platform::Clamp(line, 0, MaxScrollPos()); - if (topLineNew != topLine) { - // Try to optimise small scrolls -#ifndef UNDER_CE - int linesToMove = topLine - topLineNew; - bool performBlit = (abs(linesToMove) <= 10) && (paintState == notPainting); - willRedrawAll = !performBlit; -#endif - SetTopLine(topLineNew); - // Optimize by styling the view as this will invalidate any needed area - // which could abort the initial paint if discovered later. - StyleAreaBounded(GetClientRectangle(), true); -#ifndef UNDER_CE - // Perform redraw rather than scroll if many lines would be redrawn anyway. - if (performBlit) { - ScrollText(linesToMove); - } else { - Redraw(); - } - willRedrawAll = false; -#else - Redraw(); -#endif - if (moveThumb) { - SetVerticalScrollPos(); - } - } -} - -void Editor::ScrollText(int /* linesToMove */) { - //Platform::DebugPrintf("Editor::ScrollText %d\n", linesToMove); - Redraw(); -} - -void Editor::HorizontalScrollTo(int xPos) { - //Platform::DebugPrintf("HorizontalScroll %d\n", xPos); - if (xPos < 0) - xPos = 0; - if (!Wrapping() && (xOffset != xPos)) { - xOffset = xPos; - ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); - SetHorizontalScrollPos(); - RedrawRect(GetClientRectangle()); - } -} - -void Editor::VerticalCentreCaret() { - int lineDoc = pdoc->LineFromPosition(sel.IsRectangular() ? sel.Rectangular().caret.Position() : sel.MainCaret()); - int lineDisplay = cs.DisplayFromDoc(lineDoc); - int newTop = lineDisplay - (LinesOnScreen() / 2); - if (topLine != newTop) { - SetTopLine(newTop > 0 ? newTop : 0); - RedrawRect(GetClientRectangle()); - } -} - -// Avoid 64 bit compiler warnings. -// Scintilla does not support text buffers larger than 2**31 -static int istrlen(const char *s) { - return static_cast(s ? strlen(s) : 0); -} - -void Editor::MoveSelectedLines(int lineDelta) { - - // if selection doesn't start at the beginning of the line, set the new start - int selectionStart = SelectionStart().Position(); - int startLine = pdoc->LineFromPosition(selectionStart); - int beginningOfStartLine = pdoc->LineStart(startLine); - selectionStart = beginningOfStartLine; - - // if selection doesn't end at the beginning of a line greater than that of the start, - // then set it at the beginning of the next one - int selectionEnd = SelectionEnd().Position(); - int endLine = pdoc->LineFromPosition(selectionEnd); - int beginningOfEndLine = pdoc->LineStart(endLine); - bool appendEol = false; - if (selectionEnd > beginningOfEndLine - || selectionStart == selectionEnd) { - selectionEnd = pdoc->LineStart(endLine + 1); - appendEol = (selectionEnd == pdoc->Length() && pdoc->LineFromPosition(selectionEnd) == endLine); - } - - // if there's nowhere for the selection to move - // (i.e. at the beginning going up or at the end going down), - // stop it right there! - if ((selectionStart == 0 && lineDelta < 0) - || (selectionEnd == pdoc->Length() && lineDelta > 0) - || selectionStart == selectionEnd) { - return; - } - - UndoGroup ug(pdoc); - - if (lineDelta > 0 && selectionEnd == pdoc->LineStart(pdoc->LinesTotal() - 1)) { - SetSelection(pdoc->MovePositionOutsideChar(selectionEnd - 1, -1), selectionEnd); - ClearSelection(); - selectionEnd = CurrentPosition(); - } - SetSelection(selectionStart, selectionEnd); - - SelectionText selectedText; - CopySelectionRange(&selectedText); - - int selectionLength = SelectionRange(selectionStart, selectionEnd).Length(); - Point currentLocation = LocationFromPosition(CurrentPosition()); - int currentLine = LineFromLocation(currentLocation); - - if (appendEol) - SetSelection(pdoc->MovePositionOutsideChar(selectionStart - 1, -1), selectionEnd); - ClearSelection(); - - const char *eol = StringFromEOLMode(pdoc->eolMode); - if (currentLine + lineDelta >= pdoc->LinesTotal()) - pdoc->InsertString(pdoc->Length(), eol, istrlen(eol)); - GoToLine(currentLine + lineDelta); - - selectionLength = pdoc->InsertString(CurrentPosition(), selectedText.Data(), selectionLength); - if (appendEol) { - const int lengthInserted = pdoc->InsertString(CurrentPosition() + selectionLength, eol, istrlen(eol)); - selectionLength += lengthInserted; - } - SetSelection(CurrentPosition(), CurrentPosition() + selectionLength); -} - -void Editor::MoveSelectedLinesUp() { - MoveSelectedLines(-1); -} - -void Editor::MoveSelectedLinesDown() { - MoveSelectedLines(1); -} - -void Editor::MoveCaretInsideView(bool ensureVisible) { - PRectangle rcClient = GetTextRectangle(); - Point pt = PointMainCaret(); - if (pt.y < rcClient.top) { - MovePositionTo(SPositionFromLocation( - Point::FromInts(lastXChosen - xOffset, static_cast(rcClient.top)), - false, false, UserVirtualSpace()), - Selection::noSel, ensureVisible); - } else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) { - int yOfLastLineFullyDisplayed = static_cast(rcClient.top) + (LinesOnScreen() - 1) * vs.lineHeight; - MovePositionTo(SPositionFromLocation( - Point::FromInts(lastXChosen - xOffset, static_cast(rcClient.top) + yOfLastLineFullyDisplayed), - false, false, UserVirtualSpace()), - Selection::noSel, ensureVisible); - } -} - -int Editor::DisplayFromPosition(int pos) { - AutoSurface surface(this); - return view.DisplayFromPosition(surface, *this, pos, vs); -} - -/** - * Ensure the caret is reasonably visible in context. - * -Caret policy in SciTE - -If slop is set, we can define a slop value. -This value defines an unwanted zone (UZ) where the caret is... unwanted. -This zone is defined as a number of pixels near the vertical margins, -and as a number of lines near the horizontal margins. -By keeping the caret away from the edges, it is seen within its context, -so it is likely that the identifier that the caret is on can be completely seen, -and that the current line is seen with some of the lines following it which are -often dependent on that line. - -If strict is set, the policy is enforced... strictly. -The caret is centred on the display if slop is not set, -and cannot go in the UZ if slop is set. - -If jumps is set, the display is moved more energetically -so the caret can move in the same direction longer before the policy is applied again. -'3UZ' notation is used to indicate three time the size of the UZ as a distance to the margin. - -If even is not set, instead of having symmetrical UZs, -the left and bottom UZs are extended up to right and top UZs respectively. -This way, we favour the displaying of useful information: the beginning of lines, -where most code reside, and the lines after the caret, eg. the body of a function. - - | | | | | -slop | strict | jumps | even | Caret can go to the margin | When reaching limit (caret going out of - | | | | | visibility or going into the UZ) display is... ------+--------+-------+------+--------------------------------------------+-------------------------------------------------------------- - 0 | 0 | 0 | 0 | Yes | moved to put caret on top/on right - 0 | 0 | 0 | 1 | Yes | moved by one position - 0 | 0 | 1 | 0 | Yes | moved to put caret on top/on right - 0 | 0 | 1 | 1 | Yes | centred on the caret - 0 | 1 | - | 0 | Caret is always on top/on right of display | - - 0 | 1 | - | 1 | No, caret is always centred | - - 1 | 0 | 0 | 0 | Yes | moved to put caret out of the asymmetrical UZ - 1 | 0 | 0 | 1 | Yes | moved to put caret out of the UZ - 1 | 0 | 1 | 0 | Yes | moved to put caret at 3UZ of the top or right margin - 1 | 0 | 1 | 1 | Yes | moved to put caret at 3UZ of the margin - 1 | 1 | - | 0 | Caret is always at UZ of top/right margin | - - 1 | 1 | 0 | 1 | No, kept out of UZ | moved by one position - 1 | 1 | 1 | 1 | No, kept out of UZ | moved to put caret at 3UZ of the margin -*/ - -Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &range, const XYScrollOptions options) { - PRectangle rcClient = GetTextRectangle(); - Point pt = LocationFromPosition(range.caret); - Point ptAnchor = LocationFromPosition(range.anchor); - const Point ptOrigin = GetVisibleOriginInMain(); - pt.x += ptOrigin.x; - pt.y += ptOrigin.y; - ptAnchor.x += ptOrigin.x; - ptAnchor.y += ptOrigin.y; - const Point ptBottomCaret(pt.x, pt.y + vs.lineHeight - 1); - - XYScrollPosition newXY(xOffset, topLine); - if (rcClient.Empty()) { - return newXY; - } - - // Vertical positioning - if ((options & xysVertical) && (pt.y < rcClient.top || ptBottomCaret.y >= rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) { - const int lineCaret = DisplayFromPosition(range.caret.Position()); - const int linesOnScreen = LinesOnScreen(); - const int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2; - const bool bSlop = (caretYPolicy & CARET_SLOP) != 0; - const bool bStrict = (caretYPolicy & CARET_STRICT) != 0; - const bool bJump = (caretYPolicy & CARET_JUMPS) != 0; - const bool bEven = (caretYPolicy & CARET_EVEN) != 0; - - // It should be possible to scroll the window to show the caret, - // but this fails to remove the caret on GTK+ - if (bSlop) { // A margin is defined - int yMoveT, yMoveB; - if (bStrict) { - int yMarginT, yMarginB; - if (!(options & xysUseMargin)) { - // In drag mode, avoid moves - // otherwise, a double click will select several lines. - yMarginT = yMarginB = 0; - } else { - // yMarginT must equal to caretYSlop, with a minimum of 1 and - // a maximum of slightly less than half the heigth of the text area. - yMarginT = Platform::Clamp(caretYSlop, 1, halfScreen); - if (bEven) { - yMarginB = yMarginT; - } else { - yMarginB = linesOnScreen - yMarginT - 1; - } - } - yMoveT = yMarginT; - if (bEven) { - if (bJump) { - yMoveT = Platform::Clamp(caretYSlop * 3, 1, halfScreen); - } - yMoveB = yMoveT; - } else { - yMoveB = linesOnScreen - yMoveT - 1; - } - if (lineCaret < topLine + yMarginT) { - // Caret goes too high - newXY.topLine = lineCaret - yMoveT; - } else if (lineCaret > topLine + linesOnScreen - 1 - yMarginB) { - // Caret goes too low - newXY.topLine = lineCaret - linesOnScreen + 1 + yMoveB; - } - } else { // Not strict - yMoveT = bJump ? caretYSlop * 3 : caretYSlop; - yMoveT = Platform::Clamp(yMoveT, 1, halfScreen); - if (bEven) { - yMoveB = yMoveT; - } else { - yMoveB = linesOnScreen - yMoveT - 1; - } - if (lineCaret < topLine) { - // Caret goes too high - newXY.topLine = lineCaret - yMoveT; - } else if (lineCaret > topLine + linesOnScreen - 1) { - // Caret goes too low - newXY.topLine = lineCaret - linesOnScreen + 1 + yMoveB; - } - } - } else { // No slop - if (!bStrict && !bJump) { - // Minimal move - if (lineCaret < topLine) { - // Caret goes too high - newXY.topLine = lineCaret; - } else if (lineCaret > topLine + linesOnScreen - 1) { - // Caret goes too low - if (bEven) { - newXY.topLine = lineCaret - linesOnScreen + 1; - } else { - newXY.topLine = lineCaret; - } - } - } else { // Strict or going out of display - if (bEven) { - // Always center caret - newXY.topLine = lineCaret - halfScreen; - } else { - // Always put caret on top of display - newXY.topLine = lineCaret; - } - } - } - if (!(range.caret == range.anchor)) { - const int lineAnchor = DisplayFromPosition(range.anchor.Position()); - if (lineAnchor < lineCaret) { - // Shift up to show anchor or as much of range as possible - newXY.topLine = std::min(newXY.topLine, lineAnchor); - newXY.topLine = std::max(newXY.topLine, lineCaret - LinesOnScreen()); - } else { - // Shift down to show anchor or as much of range as possible - newXY.topLine = std::max(newXY.topLine, lineAnchor - LinesOnScreen()); - newXY.topLine = std::min(newXY.topLine, lineCaret); - } - } - newXY.topLine = Platform::Clamp(newXY.topLine, 0, MaxScrollPos()); - } - - // Horizontal positioning - if ((options & xysHorizontal) && !Wrapping()) { - const int halfScreen = Platform::Maximum(static_cast(rcClient.Width()) - 4, 4) / 2; - const bool bSlop = (caretXPolicy & CARET_SLOP) != 0; - const bool bStrict = (caretXPolicy & CARET_STRICT) != 0; - const bool bJump = (caretXPolicy & CARET_JUMPS) != 0; - const bool bEven = (caretXPolicy & CARET_EVEN) != 0; - - if (bSlop) { // A margin is defined - int xMoveL, xMoveR; - if (bStrict) { - int xMarginL, xMarginR; - if (!(options & xysUseMargin)) { - // In drag mode, avoid moves unless very near of the margin - // otherwise, a simple click will select text. - xMarginL = xMarginR = 2; - } else { - // xMargin must equal to caretXSlop, with a minimum of 2 and - // a maximum of slightly less than half the width of the text area. - xMarginR = Platform::Clamp(caretXSlop, 2, halfScreen); - if (bEven) { - xMarginL = xMarginR; - } else { - xMarginL = static_cast(rcClient.Width()) - xMarginR - 4; - } - } - if (bJump && bEven) { - // Jump is used only in even mode - xMoveL = xMoveR = Platform::Clamp(caretXSlop * 3, 1, halfScreen); - } else { - xMoveL = xMoveR = 0; // Not used, avoid a warning - } - if (pt.x < rcClient.left + xMarginL) { - // Caret is on the left of the display - if (bJump && bEven) { - newXY.xOffset -= xMoveL; - } else { - // Move just enough to allow to display the caret - newXY.xOffset -= static_cast((rcClient.left + xMarginL) - pt.x); - } - } else if (pt.x >= rcClient.right - xMarginR) { - // Caret is on the right of the display - if (bJump && bEven) { - newXY.xOffset += xMoveR; - } else { - // Move just enough to allow to display the caret - newXY.xOffset += static_cast(pt.x - (rcClient.right - xMarginR) + 1); - } - } - } else { // Not strict - xMoveR = bJump ? caretXSlop * 3 : caretXSlop; - xMoveR = Platform::Clamp(xMoveR, 1, halfScreen); - if (bEven) { - xMoveL = xMoveR; - } else { - xMoveL = static_cast(rcClient.Width()) - xMoveR - 4; - } - if (pt.x < rcClient.left) { - // Caret is on the left of the display - newXY.xOffset -= xMoveL; - } else if (pt.x >= rcClient.right) { - // Caret is on the right of the display - newXY.xOffset += xMoveR; - } - } - } else { // No slop - if (bStrict || - (bJump && (pt.x < rcClient.left || pt.x >= rcClient.right))) { - // Strict or going out of display - if (bEven) { - // Center caret - newXY.xOffset += static_cast(pt.x - rcClient.left - halfScreen); - } else { - // Put caret on right - newXY.xOffset += static_cast(pt.x - rcClient.right + 1); - } - } else { - // Move just enough to allow to display the caret - if (pt.x < rcClient.left) { - // Caret is on the left of the display - if (bEven) { - newXY.xOffset -= static_cast(rcClient.left - pt.x); - } else { - newXY.xOffset += static_cast(pt.x - rcClient.right) + 1; - } - } else if (pt.x >= rcClient.right) { - // Caret is on the right of the display - newXY.xOffset += static_cast(pt.x - rcClient.right) + 1; - } - } - } - // In case of a jump (find result) largely out of display, adjust the offset to display the caret - if (pt.x + xOffset < rcClient.left + newXY.xOffset) { - newXY.xOffset = static_cast(pt.x + xOffset - rcClient.left) - 2; - } else if (pt.x + xOffset >= rcClient.right + newXY.xOffset) { - newXY.xOffset = static_cast(pt.x + xOffset - rcClient.right) + 2; - if ((vs.caretStyle == CARETSTYLE_BLOCK) || view.imeCaretBlockOverride) { - // Ensure we can see a good portion of the block caret - newXY.xOffset += static_cast(vs.aveCharWidth); - } - } - if (!(range.caret == range.anchor)) { - if (ptAnchor.x < pt.x) { - // Shift to left to show anchor or as much of range as possible - int maxOffset = static_cast(ptAnchor.x + xOffset - rcClient.left) - 1; - int minOffset = static_cast(pt.x + xOffset - rcClient.right) + 1; - newXY.xOffset = std::min(newXY.xOffset, maxOffset); - newXY.xOffset = std::max(newXY.xOffset, minOffset); - } else { - // Shift to right to show anchor or as much of range as possible - int minOffset = static_cast(ptAnchor.x + xOffset - rcClient.right) + 1; - int maxOffset = static_cast(pt.x + xOffset - rcClient.left) - 1; - newXY.xOffset = std::max(newXY.xOffset, minOffset); - newXY.xOffset = std::min(newXY.xOffset, maxOffset); - } - } - if (newXY.xOffset < 0) { - newXY.xOffset = 0; - } - } - - return newXY; -} - -void Editor::SetXYScroll(XYScrollPosition newXY) { - if ((newXY.topLine != topLine) || (newXY.xOffset != xOffset)) { - if (newXY.topLine != topLine) { - SetTopLine(newXY.topLine); - SetVerticalScrollPos(); - } - if (newXY.xOffset != xOffset) { - xOffset = newXY.xOffset; - ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); - if (newXY.xOffset > 0) { - PRectangle rcText = GetTextRectangle(); - if (horizontalScrollBarVisible && - rcText.Width() + xOffset > scrollWidth) { - scrollWidth = xOffset + static_cast(rcText.Width()); - SetScrollBars(); - } - } - SetHorizontalScrollPos(); - } - Redraw(); - UpdateSystemCaret(); - } -} - -void Editor::ScrollRange(SelectionRange range) { - SetXYScroll(XYScrollToMakeVisible(range, xysDefault)); -} - -void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { - SetXYScroll(XYScrollToMakeVisible(SelectionRange(posDrag.IsValid() ? posDrag : sel.RangeMain().caret), - static_cast((useMargin?xysUseMargin:0)|(vert?xysVertical:0)|(horiz?xysHorizontal:0)))); -} - -void Editor::ShowCaretAtCurrentPosition() { - if (hasFocus) { - caret.active = true; - caret.on = true; - if (FineTickerAvailable()) { - FineTickerCancel(tickCaret); - if (caret.period > 0) - FineTickerStart(tickCaret, caret.period, caret.period/10); - } else { - SetTicking(true); - } - } else { - caret.active = false; - caret.on = false; - if (FineTickerAvailable()) { - FineTickerCancel(tickCaret); - } - } - InvalidateCaret(); -} - -void Editor::DropCaret() { - caret.active = false; - if (FineTickerAvailable()) { - FineTickerCancel(tickCaret); - } - InvalidateCaret(); -} - -void Editor::CaretSetPeriod(int period) { - if (caret.period != period) { - caret.period = period; - caret.on = true; - if (FineTickerAvailable()) { - FineTickerCancel(tickCaret); - if ((caret.active) && (caret.period > 0)) - FineTickerStart(tickCaret, caret.period, caret.period/10); - } - InvalidateCaret(); - } -} - -void Editor::InvalidateCaret() { - if (posDrag.IsValid()) { - InvalidateRange(posDrag.Position(), posDrag.Position() + 1); - } else { - for (size_t r=0; rlines; - } - return cs.SetHeight(lineToWrap, linesWrapped + - (vs.annotationVisible ? pdoc->AnnotationLines(lineToWrap) : 0)); -} - -// Perform wrapping for a subset of the lines needing wrapping. -// wsAll: wrap all lines which need wrapping in this single call -// wsVisible: wrap currently visible lines -// wsIdle: wrap one page + 100 lines -// Return true if wrapping occurred. -bool Editor::WrapLines(enum wrapScope ws) { - int goodTopLine = topLine; - bool wrapOccurred = false; - if (!Wrapping()) { - if (wrapWidth != LineLayout::wrapWidthInfinite) { - wrapWidth = LineLayout::wrapWidthInfinite; - for (int lineDoc = 0; lineDoc < pdoc->LinesTotal(); lineDoc++) { - cs.SetHeight(lineDoc, 1 + - (vs.annotationVisible ? pdoc->AnnotationLines(lineDoc) : 0)); - } - wrapOccurred = true; - } - wrapPending.Reset(); - - } else if (wrapPending.NeedsWrap()) { - wrapPending.start = std::min(wrapPending.start, pdoc->LinesTotal()); - if (!SetIdle(true)) { - // Idle processing not supported so full wrap required. - ws = wsAll; - } - // Decide where to start wrapping - int lineToWrap = wrapPending.start; - int lineToWrapEnd = std::min(wrapPending.end, pdoc->LinesTotal()); - const int lineDocTop = cs.DocFromDisplay(topLine); - const int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop); - if (ws == wsVisible) { - lineToWrap = Platform::Clamp(lineDocTop-5, wrapPending.start, pdoc->LinesTotal()); - // Priority wrap to just after visible area. - // Since wrapping could reduce display lines, treat each - // as taking only one display line. - lineToWrapEnd = lineDocTop; - int lines = LinesOnScreen() + 1; - while ((lineToWrapEnd < cs.LinesInDoc()) && (lines>0)) { - if (cs.GetVisible(lineToWrapEnd)) - lines--; - lineToWrapEnd++; - } - // .. and if the paint window is outside pending wraps - if ((lineToWrap > wrapPending.end) || (lineToWrapEnd < wrapPending.start)) { - // Currently visible text does not need wrapping - return false; - } - } else if (ws == wsIdle) { - lineToWrapEnd = lineToWrap + LinesOnScreen() + 100; - } - const int lineEndNeedWrap = std::min(wrapPending.end, pdoc->LinesTotal()); - lineToWrapEnd = std::min(lineToWrapEnd, lineEndNeedWrap); - - // Ensure all lines being wrapped are styled. - pdoc->EnsureStyledTo(pdoc->LineStart(lineToWrapEnd)); - - if (lineToWrap < lineToWrapEnd) { - - PRectangle rcTextArea = GetClientRectangle(); - rcTextArea.left = static_cast(vs.textStart); - rcTextArea.right -= vs.rightMarginWidth; - wrapWidth = static_cast(rcTextArea.Width()); - RefreshStyleData(); - AutoSurface surface(this); - if (surface) { -//Platform::DebugPrintf("Wraplines: scope=%0d need=%0d..%0d perform=%0d..%0d\n", ws, wrapPending.start, wrapPending.end, lineToWrap, lineToWrapEnd); - - while (lineToWrap < lineToWrapEnd) { - if (WrapOneLine(surface, lineToWrap)) { - wrapOccurred = true; - } - wrapPending.Wrapped(lineToWrap); - lineToWrap++; - } - - goodTopLine = cs.DisplayFromDoc(lineDocTop) + std::min(subLineTop, cs.GetHeight(lineDocTop)-1); - } - } - - // If wrapping is done, bring it to resting position - if (wrapPending.start >= lineEndNeedWrap) { - wrapPending.Reset(); - } - } - - if (wrapOccurred) { - SetScrollBars(); - SetTopLine(Platform::Clamp(goodTopLine, 0, MaxScrollPos())); - SetVerticalScrollPos(); - } - - return wrapOccurred; -} - -void Editor::LinesJoin() { - if (!RangeContainsProtected(targetStart, targetEnd)) { - UndoGroup ug(pdoc); - bool prevNonWS = true; - for (int pos = targetStart; pos < targetEnd; pos++) { - if (pdoc->IsPositionInLineEnd(pos)) { - targetEnd -= pdoc->LenChar(pos); - pdoc->DelChar(pos); - if (prevNonWS) { - // Ensure at least one space separating previous lines - const int lengthInserted = pdoc->InsertString(pos, " ", 1); - targetEnd += lengthInserted; - } - } else { - prevNonWS = pdoc->CharAt(pos) != ' '; - } - } - } -} - -const char *Editor::StringFromEOLMode(int eolMode) { - if (eolMode == SC_EOL_CRLF) { - return "\r\n"; - } else if (eolMode == SC_EOL_CR) { - return "\r"; - } else { - return "\n"; - } -} - -void Editor::LinesSplit(int pixelWidth) { - if (!RangeContainsProtected(targetStart, targetEnd)) { - if (pixelWidth == 0) { - PRectangle rcText = GetTextRectangle(); - pixelWidth = static_cast(rcText.Width()); - } - int lineStart = pdoc->LineFromPosition(targetStart); - int lineEnd = pdoc->LineFromPosition(targetEnd); - const char *eol = StringFromEOLMode(pdoc->eolMode); - UndoGroup ug(pdoc); - for (int line = lineStart; line <= lineEnd; line++) { - AutoSurface surface(this); - AutoLineLayout ll(view.llc, view.RetrieveLineLayout(line, *this)); - if (surface && ll) { - unsigned int posLineStart = pdoc->LineStart(line); - view.LayoutLine(*this, line, surface, vs, ll, pixelWidth); - int lengthInsertedTotal = 0; - for (int subLine = 1; subLine < ll->lines; subLine++) { - const int lengthInserted = pdoc->InsertString( - static_cast(posLineStart + lengthInsertedTotal + - ll->LineStart(subLine)), - eol, istrlen(eol)); - targetEnd += lengthInserted; - lengthInsertedTotal += lengthInserted; - } - } - lineEnd = pdoc->LineFromPosition(targetEnd); - } - } -} - -void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { - if (vs.fixedColumnWidth == 0) - return; - - AllocateGraphics(); - RefreshStyleData(); - RefreshPixMaps(surfWindow); - - // On GTK+ with Ubuntu overlay scroll bars, the surface may have been finished - // at this point. The Initialised call checks for this case and sets the status - // to be bad which avoids crashes in following calls. - if (!surfWindow->Initialised()) { - return; - } - - PRectangle rcMargin = GetClientRectangle(); - Point ptOrigin = GetVisibleOriginInMain(); - rcMargin.Move(0, -ptOrigin.y); - rcMargin.left = 0; - rcMargin.right = static_cast(vs.fixedColumnWidth); - - if (!rc.Intersects(rcMargin)) - return; - - Surface *surface; - if (view.bufferedDraw) { - surface = marginView.pixmapSelMargin; - } else { - surface = surfWindow; - } - - // Clip vertically to paint area to avoid drawing line numbers - if (rcMargin.bottom > rc.bottom) - rcMargin.bottom = rc.bottom; - if (rcMargin.top < rc.top) - rcMargin.top = rc.top; - - marginView.PaintMargin(surface, topLine, rc, rcMargin, *this, vs); - - if (view.bufferedDraw) { - surfWindow->Copy(rcMargin, Point(rcMargin.left, rcMargin.top), *marginView.pixmapSelMargin); - } -} - -void Editor::RefreshPixMaps(Surface *surfaceWindow) { - view.RefreshPixMaps(surfaceWindow, wMain.GetID(), vs); - marginView.RefreshPixMaps(surfaceWindow, wMain.GetID(), vs); - if (view.bufferedDraw) { - PRectangle rcClient = GetClientRectangle(); - if (!view.pixmapLine->Initialised()) { - - view.pixmapLine->InitPixMap(static_cast(rcClient.Width()), vs.lineHeight, - surfaceWindow, wMain.GetID()); - } - if (!marginView.pixmapSelMargin->Initialised()) { - marginView.pixmapSelMargin->InitPixMap(vs.fixedColumnWidth, - static_cast(rcClient.Height()), surfaceWindow, wMain.GetID()); - } - } -} - -void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { - //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n", - // paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom); - AllocateGraphics(); - - RefreshStyleData(); - if (paintState == paintAbandoned) - return; // Scroll bars may have changed so need redraw - RefreshPixMaps(surfaceWindow); - - paintAbandonedByStyling = false; - - StyleAreaBounded(rcArea, false); - - PRectangle rcClient = GetClientRectangle(); - //Platform::DebugPrintf("Client: (%3d,%3d) ... (%3d,%3d) %d\n", - // rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); - - if (NotifyUpdateUI()) { - RefreshStyleData(); - RefreshPixMaps(surfaceWindow); - } - - // Wrap the visible lines if needed. - if (WrapLines(wsVisible)) { - // The wrapping process has changed the height of some lines so - // abandon this paint for a complete repaint. - if (AbandonPaint()) { - return; - } - RefreshPixMaps(surfaceWindow); // In case pixmaps invalidated by scrollbar change - } - PLATFORM_ASSERT(marginView.pixmapSelPattern->Initialised()); - - if (!view.bufferedDraw) - surfaceWindow->SetClip(rcArea); - - if (paintState != paintAbandoned) { - if (vs.marginInside) { - PaintSelMargin(surfaceWindow, rcArea); - PRectangle rcRightMargin = rcClient; - rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth; - if (rcArea.Intersects(rcRightMargin)) { - surfaceWindow->FillRectangle(rcRightMargin, vs.styles[STYLE_DEFAULT].back); - } - } else { // Else separate view so separate paint event but leftMargin included to allow overlap - PRectangle rcLeftMargin = rcArea; - rcLeftMargin.left = 0; - rcLeftMargin.right = rcLeftMargin.left + vs.leftMarginWidth; - if (rcArea.Intersects(rcLeftMargin)) { - surfaceWindow->FillRectangle(rcLeftMargin, vs.styles[STYLE_DEFAULT].back); - } - } - } - - if (paintState == paintAbandoned) { - // Either styling or NotifyUpdateUI noticed that painting is needed - // outside the current painting rectangle - //Platform::DebugPrintf("Abandoning paint\n"); - if (Wrapping()) { - if (paintAbandonedByStyling) { - // Styling has spilled over a line end, such as occurs by starting a multiline - // comment. The width of subsequent text may have changed, so rewrap. - NeedWrapping(cs.DocFromDisplay(topLine)); - } - } - return; - } - - view.PaintText(surfaceWindow, *this, rcArea, rcClient, vs); - - if (horizontalScrollBarVisible && trackLineWidth && (view.lineWidthMaxSeen > scrollWidth)) { - if (FineTickerAvailable()) { - scrollWidth = view.lineWidthMaxSeen; - if (!FineTickerRunning(tickWiden)) { - FineTickerStart(tickWiden, 50, 5); - } - } - } - - NotifyPainted(); -} - -// This is mostly copied from the Paint method but with some things omitted -// such as the margin markers, line numbers, selection and caret -// Should be merged back into a combined Draw method. -long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) { - if (!pfr) - return 0; - - AutoSurface surface(pfr->hdc, this, SC_TECHNOLOGY_DEFAULT); - if (!surface) - return 0; - AutoSurface surfaceMeasure(pfr->hdcTarget, this, SC_TECHNOLOGY_DEFAULT); - if (!surfaceMeasure) { - return 0; - } - return view.FormatRange(draw, pfr, surface, surfaceMeasure, *this, vs); -} - -int Editor::TextWidth(int style, const char *text) { - RefreshStyleData(); - AutoSurface surface(this); - if (surface) { - return static_cast(surface->WidthText(vs.styles[style].font, text, istrlen(text))); - } else { - return 1; - } -} - -// Empty method is overridden on GTK+ to show / hide scrollbars -void Editor::ReconfigureScrollBars() {} - -void Editor::SetScrollBars() { - RefreshStyleData(); - - int nMax = MaxScrollPos(); - int nPage = LinesOnScreen(); - bool modified = ModifyScrollBars(nMax + nPage - 1, nPage); - if (modified) { - DwellEnd(true); - } - - // TODO: ensure always showing as many lines as possible - // May not be, if, for example, window made larger - if (topLine > MaxScrollPos()) { - SetTopLine(Platform::Clamp(topLine, 0, MaxScrollPos())); - SetVerticalScrollPos(); - Redraw(); - } - if (modified) { - if (!AbandonPaint()) - Redraw(); - } - //Platform::DebugPrintf("end max = %d page = %d\n", nMax, nPage); -} - -void Editor::ChangeSize() { - DropGraphics(false); - SetScrollBars(); - if (Wrapping()) { - PRectangle rcTextArea = GetClientRectangle(); - rcTextArea.left = static_cast(vs.textStart); - rcTextArea.right -= vs.rightMarginWidth; - if (wrapWidth != rcTextArea.Width()) { - NeedWrapping(); - Redraw(); - } - } -} - -int Editor::RealizeVirtualSpace(int position, unsigned int virtualSpace) { - if (virtualSpace > 0) { - const int line = pdoc->LineFromPosition(position); - const int indent = pdoc->GetLineIndentPosition(line); - if (indent == position) { - return pdoc->SetLineIndentation(line, pdoc->GetLineIndentation(line) + virtualSpace); - } else { - std::string spaceText(virtualSpace, ' '); - const int lengthInserted = pdoc->InsertString(position, spaceText.c_str(), virtualSpace); - position += lengthInserted; - } - } - return position; -} - -SelectionPosition Editor::RealizeVirtualSpace(const SelectionPosition &position) { - // Return the new position with no virtual space - return SelectionPosition(RealizeVirtualSpace(position.Position(), position.VirtualSpace())); -} - -void Editor::AddChar(char ch) { - char s[2]; - s[0] = ch; - s[1] = '\0'; - AddCharUTF(s, 1); -} - -void Editor::FilterSelections() { - if (!additionalSelectionTyping && (sel.Count() > 1)) { - InvalidateWholeSelection(); - sel.DropAdditionalRanges(); - } -} - -static bool cmpSelPtrs(const SelectionRange *a, const SelectionRange *b) { - return *a < *b; -} - -// AddCharUTF inserts an array of bytes which may or may not be in UTF-8. -void Editor::AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS) { - FilterSelections(); - { - UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty() || inOverstrike); - - // Vector elements point into selection in order to change selection. - std::vector selPtrs; - for (size_t r = 0; r < sel.Count(); r++) { - selPtrs.push_back(&sel.Range(r)); - } - // Order selections by position in document. - std::sort(selPtrs.begin(), selPtrs.end(), cmpSelPtrs); - - // Loop in reverse to avoid disturbing positions of selections yet to be processed. - for (std::vector::reverse_iterator rit = selPtrs.rbegin(); - rit != selPtrs.rend(); ++rit) { - SelectionRange *currentSel = *rit; - if (!RangeContainsProtected(currentSel->Start().Position(), - currentSel->End().Position())) { - int positionInsert = currentSel->Start().Position(); - if (!currentSel->Empty()) { - if (currentSel->Length()) { - pdoc->DeleteChars(positionInsert, currentSel->Length()); - currentSel->ClearVirtualSpace(); - } else { - // Range is all virtual so collapse to start of virtual space - currentSel->MinimizeVirtualSpace(); - } - } else if (inOverstrike) { - if (positionInsert < pdoc->Length()) { - if (!pdoc->IsPositionInLineEnd(positionInsert)) { - pdoc->DelChar(positionInsert); - currentSel->ClearVirtualSpace(); - } - } - } - positionInsert = RealizeVirtualSpace(positionInsert, currentSel->caret.VirtualSpace()); - const int lengthInserted = pdoc->InsertString(positionInsert, s, len); - if (lengthInserted > 0) { - currentSel->caret.SetPosition(positionInsert + lengthInserted); - currentSel->anchor.SetPosition(positionInsert + lengthInserted); - } - currentSel->ClearVirtualSpace(); - // If in wrap mode rewrap current line so EnsureCaretVisible has accurate information - if (Wrapping()) { - AutoSurface surface(this); - if (surface) { - if (WrapOneLine(surface, pdoc->LineFromPosition(positionInsert))) { - SetScrollBars(); - SetVerticalScrollPos(); - Redraw(); - } - } - } - } - } - } - if (Wrapping()) { - SetScrollBars(); - } - ThinRectangularRange(); - // If in wrap mode rewrap current line so EnsureCaretVisible has accurate information - EnsureCaretVisible(); - // Avoid blinking during rapid typing: - ShowCaretAtCurrentPosition(); - if ((caretSticky == SC_CARETSTICKY_OFF) || - ((caretSticky == SC_CARETSTICKY_WHITESPACE) && !IsAllSpacesOrTabs(s, len))) { - SetLastXChosen(); - } - - if (treatAsDBCS) { - NotifyChar((static_cast(s[0]) << 8) | - static_cast(s[1])); - } else if (len > 0) { - int byte = static_cast(s[0]); - if ((byte < 0xC0) || (1 == len)) { - // Handles UTF-8 characters between 0x01 and 0x7F and single byte - // characters when not in UTF-8 mode. - // Also treats \0 and naked trail bytes 0x80 to 0xBF as valid - // characters representing themselves. - } else { - unsigned int utf32[1] = { 0 }; - UTF32FromUTF8(s, len, utf32, ELEMENTS(utf32)); - byte = utf32[0]; - } - NotifyChar(byte); - } - - if (recordingMacro) { - NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast(s)); - } -} - -void Editor::ClearBeforeTentativeStart() { - // Make positions for the first composition string. - FilterSelections(); - UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty() || inOverstrike); - for (size_t r = 0; rDeleteChars(positionInsert, sel.Range(r).Length()); - sel.Range(r).ClearVirtualSpace(); - } else { - // Range is all virtual so collapse to start of virtual space - sel.Range(r).MinimizeVirtualSpace(); - } - } - RealizeVirtualSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); - sel.Range(r).ClearVirtualSpace(); - } - } -} - -void Editor::InsertPaste(const char *text, int len) { - if (multiPasteMode == SC_MULTIPASTE_ONCE) { - SelectionPosition selStart = sel.Start(); - selStart = RealizeVirtualSpace(selStart); - const int lengthInserted = pdoc->InsertString(selStart.Position(), text, len); - if (lengthInserted > 0) { - SetEmptySelection(selStart.Position() + lengthInserted); - } - } else { - // SC_MULTIPASTE_EACH - for (size_t r=0; rDeleteChars(positionInsert, sel.Range(r).Length()); - sel.Range(r).ClearVirtualSpace(); - } else { - // Range is all virtual so collapse to start of virtual space - sel.Range(r).MinimizeVirtualSpace(); - } - } - positionInsert = RealizeVirtualSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); - const int lengthInserted = pdoc->InsertString(positionInsert, text, len); - if (lengthInserted > 0) { - sel.Range(r).caret.SetPosition(positionInsert + lengthInserted); - sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted); - } - sel.Range(r).ClearVirtualSpace(); - } - } - } -} - -void Editor::InsertPasteShape(const char *text, int len, PasteShape shape) { - std::string convertedText; - if (convertPastes) { - // Convert line endings of the paste into our local line-endings mode - convertedText = Document::TransformLineEnds(text, len, pdoc->eolMode); - len = static_cast(convertedText.length()); - text = convertedText.c_str(); - } - if (shape == pasteRectangular) { - PasteRectangular(sel.Start(), text, len); - } else { - if (shape == pasteLine) { - int insertPos = pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())); - int lengthInserted = pdoc->InsertString(insertPos, text, len); - // add the newline if necessary - if ((len > 0) && (text[len - 1] != '\n' && text[len - 1] != '\r')) { - const char *endline = StringFromEOLMode(pdoc->eolMode); - int length = static_cast(strlen(endline)); - lengthInserted += pdoc->InsertString(insertPos + lengthInserted, endline, length); - } - if (sel.MainCaret() == insertPos) { - SetEmptySelection(sel.MainCaret() + lengthInserted); - } - } else { - InsertPaste(text, len); - } - } -} - -void Editor::ClearSelection(bool retainMultipleSelections) { - if (!sel.IsRectangular() && !retainMultipleSelections) - FilterSelections(); - UndoGroup ug(pdoc); - for (size_t r=0; rDeleteChars(sel.Range(r).Start().Position(), - sel.Range(r).Length()); - sel.Range(r) = SelectionRange(sel.Range(r).Start()); - } - } - } - ThinRectangularRange(); - sel.RemoveDuplicates(); - ClaimSelection(); - SetHoverIndicatorPosition(sel.MainCaret()); -} - -void Editor::ClearAll() { - { - UndoGroup ug(pdoc); - if (0 != pdoc->Length()) { - pdoc->DeleteChars(0, pdoc->Length()); - } - if (!pdoc->IsReadOnly()) { - cs.Clear(); - pdoc->AnnotationClearAll(); - pdoc->MarginClearAll(); - } - } - - view.ClearAllTabstops(); - - sel.Clear(); - SetTopLine(0); - SetVerticalScrollPos(); - InvalidateStyleRedraw(); -} - -void Editor::ClearDocumentStyle() { - Decoration *deco = pdoc->decorations.root; - while (deco) { - // Save next in case deco deleted - Decoration *decoNext = deco->next; - if (deco->indicator < INDIC_CONTAINER) { - pdoc->decorations.SetCurrentIndicator(deco->indicator); - pdoc->DecorationFillRange(0, 0, pdoc->Length()); - } - deco = decoNext; - } - pdoc->StartStyling(0, '\377'); - pdoc->SetStyleFor(pdoc->Length(), 0); - cs.ShowAll(); - SetAnnotationHeights(0, pdoc->LinesTotal()); - pdoc->ClearLevels(); -} - -void Editor::CopyAllowLine() { - SelectionText selectedText; - CopySelectionRange(&selectedText, true); - CopyToClipboard(selectedText); -} - -void Editor::Cut() { - pdoc->CheckReadOnly(); - if (!pdoc->IsReadOnly() && !SelectionContainsProtected()) { - Copy(); - ClearSelection(); - } -} - -void Editor::PasteRectangular(SelectionPosition pos, const char *ptr, int len) { - if (pdoc->IsReadOnly() || SelectionContainsProtected()) { - return; - } - sel.Clear(); - sel.RangeMain() = SelectionRange(pos); - int line = pdoc->LineFromPosition(sel.MainCaret()); - UndoGroup ug(pdoc); - sel.RangeMain().caret = RealizeVirtualSpace(sel.RangeMain().caret); - int xInsert = XFromPosition(sel.RangeMain().caret); - bool prevCr = false; - while ((len > 0) && IsEOLChar(ptr[len-1])) - len--; - for (int i = 0; i < len; i++) { - if (IsEOLChar(ptr[i])) { - if ((ptr[i] == '\r') || (!prevCr)) - line++; - if (line >= pdoc->LinesTotal()) { - if (pdoc->eolMode != SC_EOL_LF) - pdoc->InsertString(pdoc->Length(), "\r", 1); - if (pdoc->eolMode != SC_EOL_CR) - pdoc->InsertString(pdoc->Length(), "\n", 1); - } - // Pad the end of lines with spaces if required - sel.RangeMain().caret.SetPosition(PositionFromLineX(line, xInsert)); - if ((XFromPosition(sel.MainCaret()) < xInsert) && (i + 1 < len)) { - while (XFromPosition(sel.MainCaret()) < xInsert) { - assert(pdoc); - const int lengthInserted = pdoc->InsertString(sel.MainCaret(), " ", 1); - sel.RangeMain().caret.Add(lengthInserted); - } - } - prevCr = ptr[i] == '\r'; - } else { - const int lengthInserted = pdoc->InsertString(sel.MainCaret(), ptr + i, 1); - sel.RangeMain().caret.Add(lengthInserted); - prevCr = false; - } - } - SetEmptySelection(pos); -} - -bool Editor::CanPaste() { - return !pdoc->IsReadOnly() && !SelectionContainsProtected(); -} - -void Editor::Clear() { - // If multiple selections, don't delete EOLS - if (sel.Empty()) { - bool singleVirtual = false; - if ((sel.Count() == 1) && - !RangeContainsProtected(sel.MainCaret(), sel.MainCaret() + 1) && - sel.RangeMain().Start().VirtualSpace()) { - singleVirtual = true; - } - UndoGroup ug(pdoc, (sel.Count() > 1) || singleVirtual); - for (size_t r=0; rIsPositionInLineEnd(sel.Range(r).caret.Position())) { - pdoc->DelChar(sel.Range(r).caret.Position()); - sel.Range(r).ClearVirtualSpace(); - } // else multiple selection so don't eat line ends - } else { - sel.Range(r).ClearVirtualSpace(); - } - } - } else { - ClearSelection(); - } - sel.RemoveDuplicates(); - ShowCaretAtCurrentPosition(); // Avoid blinking -} - -void Editor::SelectAll() { - sel.Clear(); - SetSelection(0, pdoc->Length()); - Redraw(); -} - -void Editor::Undo() { - if (pdoc->CanUndo()) { - InvalidateCaret(); - int newPos = pdoc->Undo(); - if (newPos >= 0) - SetEmptySelection(newPos); - EnsureCaretVisible(); - } -} - -void Editor::Redo() { - if (pdoc->CanRedo()) { - int newPos = pdoc->Redo(); - if (newPos >= 0) - SetEmptySelection(newPos); - EnsureCaretVisible(); - } -} - -void Editor::DelCharBack(bool allowLineStartDeletion) { - RefreshStyleData(); - if (!sel.IsRectangular()) - FilterSelections(); - if (sel.IsRectangular()) - allowLineStartDeletion = false; - UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty()); - if (sel.Empty()) { - for (size_t r=0; rLineFromPosition(sel.Range(r).caret.Position()); - if (allowLineStartDeletion || (pdoc->LineStart(lineCurrentPos) != sel.Range(r).caret.Position())) { - if (pdoc->GetColumn(sel.Range(r).caret.Position()) <= pdoc->GetLineIndentation(lineCurrentPos) && - pdoc->GetColumn(sel.Range(r).caret.Position()) > 0 && pdoc->backspaceUnindents) { - UndoGroup ugInner(pdoc, !ug.Needed()); - int indentation = pdoc->GetLineIndentation(lineCurrentPos); - int indentationStep = pdoc->IndentSize(); - int indentationChange = indentation % indentationStep; - if (indentationChange == 0) - indentationChange = indentationStep; - const int posSelect = pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationChange); - // SetEmptySelection - sel.Range(r) = SelectionRange(posSelect); - } else { - pdoc->DelCharBack(sel.Range(r).caret.Position()); - } - } - } - } else { - sel.Range(r).ClearVirtualSpace(); - } - } - ThinRectangularRange(); - } else { - ClearSelection(); - } - sel.RemoveDuplicates(); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); - // Avoid blinking during rapid typing: - ShowCaretAtCurrentPosition(); -} - -int Editor::ModifierFlags(bool shift, bool ctrl, bool alt, bool meta, bool super) { - return - (shift ? SCI_SHIFT : 0) | - (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0) | - (meta ? SCI_META : 0) | - (super ? SCI_SUPER : 0); -} - -void Editor::NotifyFocus(bool focus) { - SCNotification scn = {}; - scn.nmhdr.code = focus ? SCN_FOCUSIN : SCN_FOCUSOUT; - NotifyParent(scn); -} - -void Editor::SetCtrlID(int identifier) { - ctrlID = identifier; -} - -void Editor::NotifyStyleToNeeded(int endStyleNeeded) { - SCNotification scn = {}; - scn.nmhdr.code = SCN_STYLENEEDED; - scn.position = endStyleNeeded; - NotifyParent(scn); -} - -void Editor::NotifyStyleNeeded(Document *, void *, int endStyleNeeded) { - NotifyStyleToNeeded(endStyleNeeded); -} - -void Editor::NotifyLexerChanged(Document *, void *) { -} - -void Editor::NotifyErrorOccurred(Document *, void *, int status) { - errorStatus = status; -} - -void Editor::NotifyChar(int ch) { - SCNotification scn = {}; - scn.nmhdr.code = SCN_CHARADDED; - scn.ch = ch; - NotifyParent(scn); -} - -void Editor::NotifySavePoint(bool isSavePoint) { - SCNotification scn = {}; - if (isSavePoint) { - scn.nmhdr.code = SCN_SAVEPOINTREACHED; - } else { - scn.nmhdr.code = SCN_SAVEPOINTLEFT; - } - NotifyParent(scn); -} - -void Editor::NotifyModifyAttempt() { - SCNotification scn = {}; - scn.nmhdr.code = SCN_MODIFYATTEMPTRO; - NotifyParent(scn); -} - -void Editor::NotifyDoubleClick(Point pt, int modifiers) { - SCNotification scn = {}; - scn.nmhdr.code = SCN_DOUBLECLICK; - scn.line = LineFromLocation(pt); - scn.position = PositionFromLocation(pt, true); - scn.modifiers = modifiers; - NotifyParent(scn); -} - -void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) { - NotifyDoubleClick(pt, ModifierFlags(shift, ctrl, alt)); -} - -void Editor::NotifyHotSpotDoubleClicked(int position, int modifiers) { - SCNotification scn = {}; - scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK; - scn.position = position; - scn.modifiers = modifiers; - NotifyParent(scn); -} - -void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt) { - NotifyHotSpotDoubleClicked(position, ModifierFlags(shift, ctrl, alt)); -} - -void Editor::NotifyHotSpotClicked(int position, int modifiers) { - SCNotification scn = {}; - scn.nmhdr.code = SCN_HOTSPOTCLICK; - scn.position = position; - scn.modifiers = modifiers; - NotifyParent(scn); -} - -void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) { - NotifyHotSpotClicked(position, ModifierFlags(shift, ctrl, alt)); -} - -void Editor::NotifyHotSpotReleaseClick(int position, int modifiers) { - SCNotification scn = {}; - scn.nmhdr.code = SCN_HOTSPOTRELEASECLICK; - scn.position = position; - scn.modifiers = modifiers; - NotifyParent(scn); -} - -void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt) { - NotifyHotSpotReleaseClick(position, ModifierFlags(shift, ctrl, alt)); -} - -bool Editor::NotifyUpdateUI() { - if (needUpdateUI) { - SCNotification scn = {}; - scn.nmhdr.code = SCN_UPDATEUI; - scn.updated = needUpdateUI; - NotifyParent(scn); - needUpdateUI = 0; - return true; - } - return false; -} - -void Editor::NotifyPainted() { - SCNotification scn = {}; - scn.nmhdr.code = SCN_PAINTED; - NotifyParent(scn); -} - -void Editor::NotifyIndicatorClick(bool click, int position, int modifiers) { - int mask = pdoc->decorations.AllOnFor(position); - if ((click && mask) || pdoc->decorations.clickNotified) { - SCNotification scn = {}; - pdoc->decorations.clickNotified = click; - scn.nmhdr.code = click ? SCN_INDICATORCLICK : SCN_INDICATORRELEASE; - scn.modifiers = modifiers; - scn.position = position; - NotifyParent(scn); - } -} - -void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt) { - NotifyIndicatorClick(click, position, ModifierFlags(shift, ctrl, alt)); -} - -bool Editor::NotifyMarginClick(Point pt, int modifiers) { - const int marginClicked = vs.MarginFromLocation(pt); - if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) { - int position = pdoc->LineStart(LineFromLocation(pt)); - if ((vs.ms[marginClicked].mask & SC_MASK_FOLDERS) && (foldAutomatic & SC_AUTOMATICFOLD_CLICK)) { - const bool ctrl = (modifiers & SCI_CTRL) != 0; - const bool shift = (modifiers & SCI_SHIFT) != 0; - int lineClick = pdoc->LineFromPosition(position); - if (shift && ctrl) { - FoldAll(SC_FOLDACTION_TOGGLE); - } else { - int levelClick = pdoc->GetLevel(lineClick); - if (levelClick & SC_FOLDLEVELHEADERFLAG) { - if (shift) { - // Ensure all children visible - FoldExpand(lineClick, SC_FOLDACTION_EXPAND, levelClick); - } else if (ctrl) { - FoldExpand(lineClick, SC_FOLDACTION_TOGGLE, levelClick); - } else { - // Toggle this line - FoldLine(lineClick, SC_FOLDACTION_TOGGLE); - } - } - } - return true; - } - SCNotification scn = {}; - scn.nmhdr.code = SCN_MARGINCLICK; - scn.modifiers = modifiers; - scn.position = position; - scn.margin = marginClicked; - NotifyParent(scn); - return true; - } else { - return false; - } -} - -bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) { - return NotifyMarginClick(pt, ModifierFlags(shift, ctrl, alt)); -} - -bool Editor::NotifyMarginRightClick(Point pt, int modifiers) { - int marginRightClicked = vs.MarginFromLocation(pt); - if ((marginRightClicked >= 0) && vs.ms[marginRightClicked].sensitive) { - int position = pdoc->LineStart(LineFromLocation(pt)); - SCNotification scn = {}; - scn.nmhdr.code = SCN_MARGINRIGHTCLICK; - scn.modifiers = modifiers; - scn.position = position; - scn.margin = marginRightClicked; - NotifyParent(scn); - return true; - } else { - return false; - } -} - -void Editor::NotifyNeedShown(int pos, int len) { - SCNotification scn = {}; - scn.nmhdr.code = SCN_NEEDSHOWN; - scn.position = pos; - scn.length = len; - NotifyParent(scn); -} - -void Editor::NotifyDwelling(Point pt, bool state) { - SCNotification scn = {}; - scn.nmhdr.code = state ? SCN_DWELLSTART : SCN_DWELLEND; - scn.position = PositionFromLocation(pt, true); - scn.x = static_cast(pt.x + vs.ExternalMarginWidth()); - scn.y = static_cast(pt.y); - NotifyParent(scn); -} - -void Editor::NotifyZoom() { - SCNotification scn = {}; - scn.nmhdr.code = SCN_ZOOM; - NotifyParent(scn); -} - -// Notifications from document -void Editor::NotifyModifyAttempt(Document *, void *) { - //Platform::DebugPrintf("** Modify Attempt\n"); - NotifyModifyAttempt(); -} - -void Editor::NotifySavePoint(Document *, void *, bool atSavePoint) { - //Platform::DebugPrintf("** Save Point %s\n", atSavePoint ? "On" : "Off"); - NotifySavePoint(atSavePoint); -} - -void Editor::CheckModificationForWrap(DocModification mh) { - if (mh.modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { - view.llc.Invalidate(LineLayout::llCheckTextAndStyle); - int lineDoc = pdoc->LineFromPosition(mh.position); - int lines = Platform::Maximum(0, mh.linesAdded); - if (Wrapping()) { - NeedWrapping(lineDoc, lineDoc + lines + 1); - } - RefreshStyleData(); - // Fix up annotation heights - SetAnnotationHeights(lineDoc, lineDoc + lines + 2); - } -} - -// Move a position so it is still after the same character as before the insertion. -static inline int MovePositionForInsertion(int position, int startInsertion, int length) { - if (position > startInsertion) { - return position + length; - } - return position; -} - -// Move a position so it is still after the same character as before the deletion if that -// character is still present else after the previous surviving character. -static inline int MovePositionForDeletion(int position, int startDeletion, int length) { - if (position > startDeletion) { - int endDeletion = startDeletion + length; - if (position > endDeletion) { - return position - length; - } else { - return startDeletion; - } - } else { - return position; - } -} - -void Editor::NotifyModified(Document *, DocModification mh, void *) { - ContainerNeedsUpdate(SC_UPDATE_CONTENT); - if (paintState == painting) { - CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length)); - } - if (mh.modificationType & SC_MOD_CHANGELINESTATE) { - if (paintState == painting) { - CheckForChangeOutsidePaint( - Range(pdoc->LineStart(mh.line), pdoc->LineStart(mh.line + 1))); - } else { - // Could check that change is before last visible line. - Redraw(); - } - } - if (mh.modificationType & SC_MOD_CHANGETABSTOPS) { - Redraw(); - } - if (mh.modificationType & SC_MOD_LEXERSTATE) { - if (paintState == painting) { - CheckForChangeOutsidePaint( - Range(mh.position, mh.position + mh.length)); - } else { - Redraw(); - } - } - if (mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) { - if (mh.modificationType & SC_MOD_CHANGESTYLE) { - pdoc->IncrementStyleClock(); - } - if (paintState == notPainting) { - if (mh.position < pdoc->LineStart(topLine)) { - // Styling performed before this view - Redraw(); - } else { - InvalidateRange(mh.position, mh.position + mh.length); - } - } - if (mh.modificationType & SC_MOD_CHANGESTYLE) { - view.llc.Invalidate(LineLayout::llCheckTextAndStyle); - } - } else { - // Move selection and brace highlights - if (mh.modificationType & SC_MOD_INSERTTEXT) { - sel.MovePositions(true, mh.position, mh.length); - braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length); - braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length); - } else if (mh.modificationType & SC_MOD_DELETETEXT) { - sel.MovePositions(false, mh.position, mh.length); - braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length); - braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length); - } - if ((mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) && cs.HiddenLines()) { - // Some lines are hidden so may need shown. - const int lineOfPos = pdoc->LineFromPosition(mh.position); - int endNeedShown = mh.position; - if (mh.modificationType & SC_MOD_BEFOREINSERT) { - if (pdoc->ContainsLineEnd(mh.text, mh.length) && (mh.position != pdoc->LineStart(lineOfPos))) - endNeedShown = pdoc->LineStart(lineOfPos+1); - } else if (mh.modificationType & SC_MOD_BEFOREDELETE) { - // Extend the need shown area over any folded lines - endNeedShown = mh.position + mh.length; - int lineLast = pdoc->LineFromPosition(mh.position+mh.length); - for (int line = lineOfPos; line <= lineLast; line++) { - const int lineMaxSubord = pdoc->GetLastChild(line, -1, -1); - if (lineLast < lineMaxSubord) { - lineLast = lineMaxSubord; - endNeedShown = pdoc->LineEnd(lineLast); - } - } - } - NeedShown(mh.position, endNeedShown - mh.position); - } - if (mh.linesAdded != 0) { - // Update contraction state for inserted and removed lines - // lineOfPos should be calculated in context of state before modification, shouldn't it - int lineOfPos = pdoc->LineFromPosition(mh.position); - if (mh.position > pdoc->LineStart(lineOfPos)) - lineOfPos++; // Affecting subsequent lines - if (mh.linesAdded > 0) { - cs.InsertLines(lineOfPos, mh.linesAdded); - } else { - cs.DeleteLines(lineOfPos, -mh.linesAdded); - } - view.LinesAddedOrRemoved(lineOfPos, mh.linesAdded); - } - if (mh.modificationType & SC_MOD_CHANGEANNOTATION) { - int lineDoc = pdoc->LineFromPosition(mh.position); - if (vs.annotationVisible) { - cs.SetHeight(lineDoc, cs.GetHeight(lineDoc) + mh.annotationLinesAdded); - Redraw(); - } - } - CheckModificationForWrap(mh); - if (mh.linesAdded != 0) { - // Avoid scrolling of display if change before current display - if (mh.position < posTopLine && !CanDeferToLastStep(mh)) { - int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos()); - if (newTop != topLine) { - SetTopLine(newTop); - SetVerticalScrollPos(); - } - } - - if (paintState == notPainting && !CanDeferToLastStep(mh)) { - QueueIdleWork(WorkNeeded::workStyle, pdoc->Length()); - Redraw(); - } - } else { - if (paintState == notPainting && mh.length && !CanEliminate(mh)) { - QueueIdleWork(WorkNeeded::workStyle, mh.position + mh.length); - InvalidateRange(mh.position, mh.position + mh.length); - } - } - } - - if (mh.linesAdded != 0 && !CanDeferToLastStep(mh)) { - SetScrollBars(); - } - - if ((mh.modificationType & SC_MOD_CHANGEMARKER) || (mh.modificationType & SC_MOD_CHANGEMARGIN)) { - if ((!willRedrawAll) && ((paintState == notPainting) || !PaintContainsMargin())) { - if (mh.modificationType & SC_MOD_CHANGEFOLD) { - // Fold changes can affect the drawing of following lines so redraw whole margin - RedrawSelMargin(marginView.highlightDelimiter.isEnabled ? -1 : mh.line - 1, true); - } else { - RedrawSelMargin(mh.line); - } - } - } - if ((mh.modificationType & SC_MOD_CHANGEFOLD) && (foldAutomatic & SC_AUTOMATICFOLD_CHANGE)) { - FoldChanged(mh.line, mh.foldLevelNow, mh.foldLevelPrev); - } - - // NOW pay the piper WRT "deferred" visual updates - if (IsLastStep(mh)) { - SetScrollBars(); - Redraw(); - } - - // If client wants to see this modification - if (mh.modificationType & modEventMask) { - if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) { - // Real modification made to text of document. - NotifyChange(); // Send EN_CHANGE - } - - SCNotification scn = {}; - scn.nmhdr.code = SCN_MODIFIED; - scn.position = mh.position; - scn.modificationType = mh.modificationType; - scn.text = mh.text; - scn.length = mh.length; - scn.linesAdded = mh.linesAdded; - scn.line = mh.line; - scn.foldLevelNow = mh.foldLevelNow; - scn.foldLevelPrev = mh.foldLevelPrev; - scn.token = mh.token; - scn.annotationLinesAdded = mh.annotationLinesAdded; - NotifyParent(scn); - } -} - -void Editor::NotifyDeleted(Document *, void *) { - /* Do nothing */ -} - -void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - - // Enumerates all macroable messages - switch (iMessage) { - case SCI_CUT: - case SCI_COPY: - case SCI_PASTE: - case SCI_CLEAR: - case SCI_REPLACESEL: - case SCI_ADDTEXT: - case SCI_INSERTTEXT: - case SCI_APPENDTEXT: - case SCI_CLEARALL: - case SCI_SELECTALL: - case SCI_GOTOLINE: - case SCI_GOTOPOS: - case SCI_SEARCHANCHOR: - case SCI_SEARCHNEXT: - case SCI_SEARCHPREV: - case SCI_LINEDOWN: - case SCI_LINEDOWNEXTEND: - case SCI_PARADOWN: - case SCI_PARADOWNEXTEND: - case SCI_LINEUP: - case SCI_LINEUPEXTEND: - case SCI_PARAUP: - case SCI_PARAUPEXTEND: - case SCI_CHARLEFT: - case SCI_CHARLEFTEXTEND: - case SCI_CHARRIGHT: - case SCI_CHARRIGHTEXTEND: - case SCI_WORDLEFT: - case SCI_WORDLEFTEXTEND: - case SCI_WORDRIGHT: - case SCI_WORDRIGHTEXTEND: - case SCI_WORDPARTLEFT: - case SCI_WORDPARTLEFTEXTEND: - case SCI_WORDPARTRIGHT: - case SCI_WORDPARTRIGHTEXTEND: - case SCI_WORDLEFTEND: - case SCI_WORDLEFTENDEXTEND: - case SCI_WORDRIGHTEND: - case SCI_WORDRIGHTENDEXTEND: - case SCI_HOME: - case SCI_HOMEEXTEND: - case SCI_LINEEND: - case SCI_LINEENDEXTEND: - case SCI_HOMEWRAP: - case SCI_HOMEWRAPEXTEND: - case SCI_LINEENDWRAP: - case SCI_LINEENDWRAPEXTEND: - case SCI_DOCUMENTSTART: - case SCI_DOCUMENTSTARTEXTEND: - case SCI_DOCUMENTEND: - case SCI_DOCUMENTENDEXTEND: - case SCI_STUTTEREDPAGEUP: - case SCI_STUTTEREDPAGEUPEXTEND: - case SCI_STUTTEREDPAGEDOWN: - case SCI_STUTTEREDPAGEDOWNEXTEND: - case SCI_PAGEUP: - case SCI_PAGEUPEXTEND: - case SCI_PAGEDOWN: - case SCI_PAGEDOWNEXTEND: - case SCI_EDITTOGGLEOVERTYPE: - case SCI_CANCEL: - case SCI_DELETEBACK: - case SCI_TAB: - case SCI_BACKTAB: - case SCI_FORMFEED: - case SCI_VCHOME: - case SCI_VCHOMEEXTEND: - case SCI_VCHOMEWRAP: - case SCI_VCHOMEWRAPEXTEND: - case SCI_VCHOMEDISPLAY: - case SCI_VCHOMEDISPLAYEXTEND: - case SCI_DELWORDLEFT: - case SCI_DELWORDRIGHT: - case SCI_DELWORDRIGHTEND: - case SCI_DELLINELEFT: - case SCI_DELLINERIGHT: - case SCI_LINECOPY: - case SCI_LINECUT: - case SCI_LINEDELETE: - case SCI_LINETRANSPOSE: - case SCI_LINEDUPLICATE: - case SCI_LOWERCASE: - case SCI_UPPERCASE: - case SCI_LINESCROLLDOWN: - case SCI_LINESCROLLUP: - case SCI_DELETEBACKNOTLINE: - case SCI_HOMEDISPLAY: - case SCI_HOMEDISPLAYEXTEND: - case SCI_LINEENDDISPLAY: - case SCI_LINEENDDISPLAYEXTEND: - case SCI_SETSELECTIONMODE: - case SCI_LINEDOWNRECTEXTEND: - case SCI_LINEUPRECTEXTEND: - case SCI_CHARLEFTRECTEXTEND: - case SCI_CHARRIGHTRECTEXTEND: - case SCI_HOMERECTEXTEND: - case SCI_VCHOMERECTEXTEND: - case SCI_LINEENDRECTEXTEND: - case SCI_PAGEUPRECTEXTEND: - case SCI_PAGEDOWNRECTEXTEND: - case SCI_SELECTIONDUPLICATE: - case SCI_COPYALLOWLINE: - case SCI_VERTICALCENTRECARET: - case SCI_MOVESELECTEDLINESUP: - case SCI_MOVESELECTEDLINESDOWN: - case SCI_SCROLLTOSTART: - case SCI_SCROLLTOEND: - break; - - // Filter out all others like display changes. Also, newlines are redundant - // with char insert messages. - case SCI_NEWLINE: - default: - // printf("Filtered out %ld of macro recording\n", iMessage); - return; - } - - // Send notification - SCNotification scn = {}; - scn.nmhdr.code = SCN_MACRORECORD; - scn.message = iMessage; - scn.wParam = wParam; - scn.lParam = lParam; - NotifyParent(scn); -} - -// Something has changed that the container should know about -void Editor::ContainerNeedsUpdate(int flags) { - needUpdateUI |= flags; -} - -/** - * Force scroll and keep position relative to top of window. - * - * If stuttered = true and not already at first/last row, move to first/last row of window. - * If stuttered = true and already at first/last row, scroll as normal. - */ -void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { - int topLineNew; - SelectionPosition newPos; - - int currentLine = pdoc->LineFromPosition(sel.MainCaret()); - int topStutterLine = topLine + caretYSlop; - int bottomStutterLine = - pdoc->LineFromPosition(PositionFromLocation( - Point::FromInts(lastXChosen - xOffset, direction * vs.lineHeight * LinesToScroll()))) - - caretYSlop - 1; - - if (stuttered && (direction < 0 && currentLine > topStutterLine)) { - topLineNew = topLine; - newPos = SPositionFromLocation(Point::FromInts(lastXChosen - xOffset, vs.lineHeight * caretYSlop), - false, false, UserVirtualSpace()); - - } else if (stuttered && (direction > 0 && currentLine < bottomStutterLine)) { - topLineNew = topLine; - newPos = SPositionFromLocation(Point::FromInts(lastXChosen - xOffset, vs.lineHeight * (LinesToScroll() - caretYSlop)), - false, false, UserVirtualSpace()); - - } else { - Point pt = LocationFromPosition(sel.MainCaret()); - - topLineNew = Platform::Clamp( - topLine + direction * LinesToScroll(), 0, MaxScrollPos()); - newPos = SPositionFromLocation( - Point::FromInts(lastXChosen - xOffset, static_cast(pt.y) + direction * (vs.lineHeight * LinesToScroll())), - false, false, UserVirtualSpace()); - } - - if (topLineNew != topLine) { - SetTopLine(topLineNew); - MovePositionTo(newPos, selt); - Redraw(); - SetVerticalScrollPos(); - } else { - MovePositionTo(newPos, selt); - } -} - -void Editor::ChangeCaseOfSelection(int caseMapping) { - UndoGroup ug(pdoc); - for (size_t r=0; r 0) { - std::string sText = RangeText(currentNoVS.Start().Position(), currentNoVS.End().Position()); - - std::string sMapped = CaseMapString(sText, caseMapping); - - if (sMapped != sText) { - size_t firstDifference = 0; - while (sMapped[firstDifference] == sText[firstDifference]) - firstDifference++; - size_t lastDifferenceText = sText.size() - 1; - size_t lastDifferenceMapped = sMapped.size() - 1; - while (sMapped[lastDifferenceMapped] == sText[lastDifferenceText]) { - lastDifferenceText--; - lastDifferenceMapped--; - } - size_t endDifferenceText = sText.size() - 1 - lastDifferenceText; - pdoc->DeleteChars( - static_cast(currentNoVS.Start().Position() + firstDifference), - static_cast(rangeBytes - firstDifference - endDifferenceText)); - const int lengthChange = static_cast(lastDifferenceMapped - firstDifference + 1); - const int lengthInserted = pdoc->InsertString( - static_cast(currentNoVS.Start().Position() + firstDifference), - sMapped.c_str() + firstDifference, - lengthChange); - // Automatic movement changes selection so reset to exactly the same as it was. - int diffSizes = static_cast(sMapped.size() - sText.size()) + lengthInserted - lengthChange; - if (diffSizes != 0) { - if (current.anchor > current.caret) - current.anchor.Add(diffSizes); - else - current.caret.Add(diffSizes); - } - sel.Range(r) = current; - } - } - } -} - -void Editor::LineTranspose() { - int line = pdoc->LineFromPosition(sel.MainCaret()); - if (line > 0) { - UndoGroup ug(pdoc); - - const int startPrevious = pdoc->LineStart(line - 1); - const std::string linePrevious = RangeText(startPrevious, pdoc->LineEnd(line - 1)); - - int startCurrent = pdoc->LineStart(line); - const std::string lineCurrent = RangeText(startCurrent, pdoc->LineEnd(line)); - - pdoc->DeleteChars(startCurrent, static_cast(lineCurrent.length())); - pdoc->DeleteChars(startPrevious, static_cast(linePrevious.length())); - startCurrent -= static_cast(linePrevious.length()); - - startCurrent += pdoc->InsertString(startPrevious, lineCurrent.c_str(), - static_cast(lineCurrent.length())); - pdoc->InsertString(startCurrent, linePrevious.c_str(), - static_cast(linePrevious.length())); - // Move caret to start of current line - MovePositionTo(SelectionPosition(startCurrent)); - } -} - -void Editor::Duplicate(bool forLine) { - if (sel.Empty()) { - forLine = true; - } - UndoGroup ug(pdoc); - const char *eol = ""; - int eolLen = 0; - if (forLine) { - eol = StringFromEOLMode(pdoc->eolMode); - eolLen = istrlen(eol); - } - for (size_t r=0; rLineFromPosition(sel.Range(r).caret.Position()); - start = SelectionPosition(pdoc->LineStart(line)); - end = SelectionPosition(pdoc->LineEnd(line)); - } - std::string text = RangeText(start.Position(), end.Position()); - int lengthInserted = eolLen; - if (forLine) - lengthInserted = pdoc->InsertString(end.Position(), eol, eolLen); - pdoc->InsertString(end.Position() + lengthInserted, text.c_str(), static_cast(text.length())); - } - if (sel.Count() && sel.IsRectangular()) { - SelectionPosition last = sel.Last(); - if (forLine) { - int line = pdoc->LineFromPosition(last.Position()); - last = SelectionPosition(last.Position() + pdoc->LineStart(line+1) - pdoc->LineStart(line)); - } - if (sel.Rectangular().anchor > sel.Rectangular().caret) - sel.Rectangular().anchor = last; - else - sel.Rectangular().caret = last; - SetRectangularRange(); - } -} - -void Editor::CancelModes() { - sel.SetMoveExtends(false); -} - -void Editor::NewLine() { - InvalidateWholeSelection(); - if (sel.IsRectangular() || !additionalSelectionTyping) { - // Remove non-main ranges - sel.DropAdditionalRanges(); - } - - UndoGroup ug(pdoc, !sel.Empty() || (sel.Count() > 1)); - - // Clear each range - if (!sel.Empty()) { - ClearSelection(); - } - - // Insert each line end - size_t countInsertions = 0; - for (size_t r = 0; r < sel.Count(); r++) { - sel.Range(r).ClearVirtualSpace(); - const char *eol = StringFromEOLMode(pdoc->eolMode); - const int positionInsert = sel.Range(r).caret.Position(); - const int insertLength = pdoc->InsertString(positionInsert, eol, istrlen(eol)); - if (insertLength > 0) { - sel.Range(r) = SelectionRange(positionInsert + insertLength); - countInsertions++; - } - } - - // Perform notifications after all the changes as the application may change the - // selections in response to the characters. - for (size_t i = 0; i < countInsertions; i++) { - const char *eol = StringFromEOLMode(pdoc->eolMode); - while (*eol) { - NotifyChar(*eol); - if (recordingMacro) { - char txt[2]; - txt[0] = *eol; - txt[1] = '\0'; - NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast(txt)); - } - eol++; - } - } - - SetLastXChosen(); - SetScrollBars(); - EnsureCaretVisible(); - // Avoid blinking during rapid typing: - ShowCaretAtCurrentPosition(); -} - -SelectionPosition Editor::PositionUpOrDown(SelectionPosition spStart, int direction, int lastX) { - const Point pt = LocationFromPosition(spStart); - int skipLines = 0; - - if (vs.annotationVisible) { - const int lineDoc = pdoc->LineFromPosition(spStart.Position()); - const Point ptStartLine = LocationFromPosition(pdoc->LineStart(lineDoc)); - const int subLine = static_cast(pt.y - ptStartLine.y) / vs.lineHeight; - - if (direction < 0 && subLine == 0) { - const int lineDisplay = cs.DisplayFromDoc(lineDoc); - if (lineDisplay > 0) { - skipLines = pdoc->AnnotationLines(cs.DocFromDisplay(lineDisplay - 1)); - } - } else if (direction > 0 && subLine >= (cs.GetHeight(lineDoc) - 1 - pdoc->AnnotationLines(lineDoc))) { - skipLines = pdoc->AnnotationLines(lineDoc); - } - } - - const int newY = static_cast(pt.y) + (1 + skipLines) * direction * vs.lineHeight; - if (lastX < 0) { - lastX = static_cast(pt.x) + xOffset; - } - SelectionPosition posNew = SPositionFromLocation( - Point::FromInts(lastX - xOffset, newY), false, false, UserVirtualSpace()); - - if (direction < 0) { - // Line wrapping may lead to a location on the same line, so - // seek back if that is the case. - Point ptNew = LocationFromPosition(posNew.Position()); - while ((posNew.Position() > 0) && (pt.y == ptNew.y)) { - posNew.Add(-1); - posNew.SetVirtualSpace(0); - ptNew = LocationFromPosition(posNew.Position()); - } - } else if (direction > 0 && posNew.Position() != pdoc->Length()) { - // There is an equivalent case when moving down which skips - // over a line. - Point ptNew = LocationFromPosition(posNew.Position()); - while ((posNew.Position() > spStart.Position()) && (ptNew.y > newY)) { - posNew.Add(-1); - posNew.SetVirtualSpace(0); - ptNew = LocationFromPosition(posNew.Position()); - } - } - return posNew; -} - -void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) { - SelectionPosition caretToUse = sel.Range(sel.Main()).caret; - if (sel.IsRectangular()) { - if (selt == Selection::noSel) { - caretToUse = (direction > 0) ? sel.Limits().end : sel.Limits().start; - } else { - caretToUse = sel.Rectangular().caret; - } - } - if (selt == Selection::selRectangle) { - const SelectionRange rangeBase = sel.IsRectangular() ? sel.Rectangular() : sel.RangeMain(); - if (!sel.IsRectangular()) { - InvalidateWholeSelection(); - sel.DropAdditionalRanges(); - } - const SelectionPosition posNew = MovePositionSoVisible( - PositionUpOrDown(caretToUse, direction, lastXChosen), direction); - sel.selType = Selection::selRectangle; - sel.Rectangular() = SelectionRange(posNew, rangeBase.anchor); - SetRectangularRange(); - MovedCaret(posNew, caretToUse, true); - } else { - InvalidateWholeSelection(); - if (!additionalSelectionTyping || (sel.IsRectangular())) { - sel.DropAdditionalRanges(); - } - sel.selType = Selection::selStream; - for (size_t r = 0; r < sel.Count(); r++) { - const int lastX = (r == sel.Main()) ? lastXChosen : -1; - const SelectionPosition spCaretNow = sel.Range(r).caret; - const SelectionPosition posNew = MovePositionSoVisible( - PositionUpOrDown(spCaretNow, direction, lastX), direction); - sel.Range(r) = selt == Selection::selStream ? - SelectionRange(posNew, sel.Range(r).anchor) : SelectionRange(posNew); - } - sel.RemoveDuplicates(); - MovedCaret(sel.RangeMain().caret, caretToUse, true); - } -} - -void Editor::ParaUpOrDown(int direction, Selection::selTypes selt) { - int lineDoc, savedPos = sel.MainCaret(); - do { - MovePositionTo(SelectionPosition(direction > 0 ? pdoc->ParaDown(sel.MainCaret()) : pdoc->ParaUp(sel.MainCaret())), selt); - lineDoc = pdoc->LineFromPosition(sel.MainCaret()); - if (direction > 0) { - if (sel.MainCaret() >= pdoc->Length() && !cs.GetVisible(lineDoc)) { - if (selt == Selection::noSel) { - MovePositionTo(SelectionPosition(pdoc->LineEndPosition(savedPos))); - } - break; - } - } - } while (!cs.GetVisible(lineDoc)); -} - -Range Editor::RangeDisplayLine(int lineVisible) { - RefreshStyleData(); - AutoSurface surface(this); - return view.RangeDisplayLine(surface, *this, lineVisible, vs); -} - -int Editor::StartEndDisplayLine(int pos, bool start) { - RefreshStyleData(); - AutoSurface surface(this); - int posRet = view.StartEndDisplayLine(surface, *this, pos, start, vs); - if (posRet == INVALID_POSITION) { - return pos; - } else { - return posRet; - } -} - -namespace { - -unsigned int WithExtends(unsigned int iMessage) { - switch (iMessage) { - case SCI_CHARLEFT: return SCI_CHARLEFTEXTEND; - case SCI_CHARRIGHT: return SCI_CHARRIGHTEXTEND; - - case SCI_WORDLEFT: return SCI_WORDLEFTEXTEND; - case SCI_WORDRIGHT: return SCI_WORDRIGHTEXTEND; - case SCI_WORDLEFTEND: return SCI_WORDLEFTENDEXTEND; - case SCI_WORDRIGHTEND: return SCI_WORDRIGHTENDEXTEND; - case SCI_WORDPARTLEFT: return SCI_WORDPARTLEFTEXTEND; - case SCI_WORDPARTRIGHT: return SCI_WORDPARTRIGHTEXTEND; - - case SCI_HOME: return SCI_HOMEEXTEND; - case SCI_HOMEDISPLAY: return SCI_HOMEDISPLAYEXTEND; - case SCI_HOMEWRAP: return SCI_HOMEWRAPEXTEND; - case SCI_VCHOME: return SCI_VCHOMEEXTEND; - case SCI_VCHOMEDISPLAY: return SCI_VCHOMEDISPLAYEXTEND; - case SCI_VCHOMEWRAP: return SCI_VCHOMEWRAPEXTEND; - - case SCI_LINEEND: return SCI_LINEENDEXTEND; - case SCI_LINEENDDISPLAY: return SCI_LINEENDDISPLAYEXTEND; - case SCI_LINEENDWRAP: return SCI_LINEENDWRAPEXTEND; - - default: return iMessage; - } -} - -int NaturalDirection(unsigned int iMessage) { - switch (iMessage) { - case SCI_CHARLEFT: - case SCI_CHARLEFTEXTEND: - case SCI_CHARLEFTRECTEXTEND: - case SCI_WORDLEFT: - case SCI_WORDLEFTEXTEND: - case SCI_WORDLEFTEND: - case SCI_WORDLEFTENDEXTEND: - case SCI_WORDPARTLEFT: - case SCI_WORDPARTLEFTEXTEND: - case SCI_HOME: - case SCI_HOMEEXTEND: - case SCI_HOMEDISPLAY: - case SCI_HOMEDISPLAYEXTEND: - case SCI_HOMEWRAP: - case SCI_HOMEWRAPEXTEND: - // VC_HOME* mostly goes back - case SCI_VCHOME: - case SCI_VCHOMEEXTEND: - case SCI_VCHOMEDISPLAY: - case SCI_VCHOMEDISPLAYEXTEND: - case SCI_VCHOMEWRAP: - case SCI_VCHOMEWRAPEXTEND: - return -1; - - default: - return 1; - } -} - -bool IsRectExtend(unsigned int iMessage) { - switch (iMessage) { - case SCI_CHARLEFTRECTEXTEND: - case SCI_CHARRIGHTRECTEXTEND: - case SCI_HOMERECTEXTEND: - case SCI_VCHOMERECTEXTEND: - case SCI_LINEENDRECTEXTEND: - return true; - default: - return false; - } -} - -} - -int Editor::VCHomeDisplayPosition(int position) { - const int homePos = pdoc->VCHomePosition(position); - const int viewLineStart = StartEndDisplayLine(position, true); - if (viewLineStart > homePos) - return viewLineStart; - else - return homePos; -} - -int Editor::VCHomeWrapPosition(int position) { - const int homePos = pdoc->VCHomePosition(position); - const int viewLineStart = StartEndDisplayLine(position, true); - if ((viewLineStart < position) && (viewLineStart > homePos)) - return viewLineStart; - else - return homePos; -} - -int Editor::LineEndWrapPosition(int position) { - const int endPos = StartEndDisplayLine(position, false); - const int realEndPos = pdoc->LineEndPosition(position); - if (endPos > realEndPos // if moved past visible EOLs - || position >= endPos) // if at end of display line already - return realEndPos; - else - return endPos; -} - -int Editor::HorizontalMove(unsigned int iMessage) { - if (sel.MoveExtends()) { - iMessage = WithExtends(iMessage); - } - - if (!multipleSelection && !sel.IsRectangular()) { - // Simplify selection down to 1 - sel.SetSelection(sel.RangeMain()); - } - - // Invalidate each of the current selections - InvalidateWholeSelection(); - - if (IsRectExtend(iMessage)) { - const SelectionRange rangeBase = sel.IsRectangular() ? sel.Rectangular() : sel.RangeMain(); - if (!sel.IsRectangular()) { - sel.DropAdditionalRanges(); - } - // Will change to rectangular if not currently rectangular - SelectionPosition spCaret = rangeBase.caret; - switch (iMessage) { - case SCI_CHARLEFTRECTEXTEND: - if (pdoc->IsLineEndPosition(spCaret.Position()) && spCaret.VirtualSpace()) { - spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); - } else if ((virtualSpaceOptions & SCVS_NOWRAPLINESTART) == 0 || pdoc->GetColumn(spCaret.Position()) > 0) { - spCaret = SelectionPosition(spCaret.Position() - 1); - } - break; - case SCI_CHARRIGHTRECTEXTEND: - if ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) && pdoc->IsLineEndPosition(sel.MainCaret())) { - spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); - } else { - spCaret = SelectionPosition(spCaret.Position() + 1); - } - break; - case SCI_HOMERECTEXTEND: - spCaret = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position()))); - break; - case SCI_VCHOMERECTEXTEND: - spCaret = SelectionPosition(pdoc->VCHomePosition(spCaret.Position())); - break; - case SCI_LINEENDRECTEXTEND: - spCaret = SelectionPosition(pdoc->LineEndPosition(spCaret.Position())); - break; - } - const int directionMove = (spCaret < rangeBase.caret) ? -1 : 1; - spCaret = MovePositionSoVisible(spCaret, directionMove); - sel.selType = Selection::selRectangle; - sel.Rectangular() = SelectionRange(spCaret, rangeBase.anchor); - SetRectangularRange(); - } else if (sel.IsRectangular()) { - // Not a rectangular extension so switch to stream. - const SelectionPosition selAtLimit = - (NaturalDirection(iMessage) > 0) ? sel.Limits().end : sel.Limits().start; - sel.selType = Selection::selStream; - sel.SetSelection(SelectionRange(selAtLimit)); - } else { - if (!additionalSelectionTyping) { - InvalidateWholeSelection(); - sel.DropAdditionalRanges(); - } - for (size_t r = 0; r < sel.Count(); r++) { - const SelectionPosition spCaretNow = sel.Range(r).caret; - SelectionPosition spCaret = spCaretNow; - switch (iMessage) { - case SCI_CHARLEFT: - case SCI_CHARLEFTEXTEND: - if (spCaret.VirtualSpace()) { - spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); - } else if ((virtualSpaceOptions & SCVS_NOWRAPLINESTART) == 0 || pdoc->GetColumn(spCaret.Position()) > 0) { - spCaret = SelectionPosition(spCaret.Position() - 1); - } - break; - case SCI_CHARRIGHT: - case SCI_CHARRIGHTEXTEND: - if ((virtualSpaceOptions & SCVS_USERACCESSIBLE) && pdoc->IsLineEndPosition(spCaret.Position())) { - spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); - } else { - spCaret = SelectionPosition(spCaret.Position() + 1); - } - break; - case SCI_WORDLEFT: - case SCI_WORDLEFTEXTEND: - spCaret = SelectionPosition(pdoc->NextWordStart(spCaret.Position(), -1)); - break; - case SCI_WORDRIGHT: - case SCI_WORDRIGHTEXTEND: - spCaret = SelectionPosition(pdoc->NextWordStart(spCaret.Position(), 1)); - break; - case SCI_WORDLEFTEND: - case SCI_WORDLEFTENDEXTEND: - spCaret = SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), -1)); - break; - case SCI_WORDRIGHTEND: - case SCI_WORDRIGHTENDEXTEND: - spCaret = SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), 1)); - break; - case SCI_WORDPARTLEFT: - case SCI_WORDPARTLEFTEXTEND: - spCaret = SelectionPosition(pdoc->WordPartLeft(spCaret.Position())); - break; - case SCI_WORDPARTRIGHT: - case SCI_WORDPARTRIGHTEXTEND: - spCaret = SelectionPosition(pdoc->WordPartRight(spCaret.Position())); - break; - case SCI_HOME: - case SCI_HOMEEXTEND: - spCaret = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position()))); - break; - case SCI_HOMEDISPLAY: - case SCI_HOMEDISPLAYEXTEND: - spCaret = SelectionPosition(StartEndDisplayLine(spCaret.Position(), true)); - break; - case SCI_HOMEWRAP: - case SCI_HOMEWRAPEXTEND: - spCaret = MovePositionSoVisible(StartEndDisplayLine(spCaret.Position(), true), -1); - if (spCaretNow <= spCaret) - spCaret = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position()))); - break; - case SCI_VCHOME: - case SCI_VCHOMEEXTEND: - // VCHome alternates between beginning of line and beginning of text so may move back or forwards - spCaret = SelectionPosition(pdoc->VCHomePosition(spCaret.Position())); - break; - case SCI_VCHOMEDISPLAY: - case SCI_VCHOMEDISPLAYEXTEND: - spCaret = SelectionPosition(VCHomeDisplayPosition(spCaret.Position())); - break; - case SCI_VCHOMEWRAP: - case SCI_VCHOMEWRAPEXTEND: - spCaret = SelectionPosition(VCHomeWrapPosition(spCaret.Position())); - break; - case SCI_LINEEND: - case SCI_LINEENDEXTEND: - spCaret = SelectionPosition(pdoc->LineEndPosition(spCaret.Position())); - break; - case SCI_LINEENDDISPLAY: - case SCI_LINEENDDISPLAYEXTEND: - spCaret = SelectionPosition(StartEndDisplayLine(spCaret.Position(), false)); - break; - case SCI_LINEENDWRAP: - case SCI_LINEENDWRAPEXTEND: - spCaret = SelectionPosition(LineEndWrapPosition(spCaret.Position())); - break; - - default: - PLATFORM_ASSERT(false); - } - - const int directionMove = (spCaret < spCaretNow) ? -1 : 1; - spCaret = MovePositionSoVisible(spCaret, directionMove); - - // Handle move versus extend, and special behaviour for non-empty left/right - switch (iMessage) { - case SCI_CHARLEFT: - case SCI_CHARRIGHT: - if (sel.Range(r).Empty()) { - sel.Range(r) = SelectionRange(spCaret); - } else { - sel.Range(r) = SelectionRange( - (iMessage == SCI_CHARLEFT) ? sel.Range(r).Start() : sel.Range(r).End()); - } - break; - - case SCI_WORDLEFT: - case SCI_WORDRIGHT: - case SCI_WORDLEFTEND: - case SCI_WORDRIGHTEND: - case SCI_WORDPARTLEFT: - case SCI_WORDPARTRIGHT: - case SCI_HOME: - case SCI_HOMEDISPLAY: - case SCI_HOMEWRAP: - case SCI_VCHOME: - case SCI_VCHOMEDISPLAY: - case SCI_VCHOMEWRAP: - case SCI_LINEEND: - case SCI_LINEENDDISPLAY: - case SCI_LINEENDWRAP: - sel.Range(r) = SelectionRange(spCaret); - break; - - case SCI_CHARLEFTEXTEND: - case SCI_CHARRIGHTEXTEND: - case SCI_WORDLEFTEXTEND: - case SCI_WORDRIGHTEXTEND: - case SCI_WORDLEFTENDEXTEND: - case SCI_WORDRIGHTENDEXTEND: - case SCI_WORDPARTLEFTEXTEND: - case SCI_WORDPARTRIGHTEXTEND: - case SCI_HOMEEXTEND: - case SCI_HOMEDISPLAYEXTEND: - case SCI_HOMEWRAPEXTEND: - case SCI_VCHOMEEXTEND: - case SCI_VCHOMEDISPLAYEXTEND: - case SCI_VCHOMEWRAPEXTEND: - case SCI_LINEENDEXTEND: - case SCI_LINEENDDISPLAYEXTEND: - case SCI_LINEENDWRAPEXTEND: { - SelectionRange rangeNew = SelectionRange(spCaret, sel.Range(r).anchor); - sel.TrimOtherSelections(r, SelectionRange(rangeNew)); - sel.Range(r) = rangeNew; - } - break; - - default: - PLATFORM_ASSERT(false); - } - } - } - - sel.RemoveDuplicates(); - - MovedCaret(sel.RangeMain().caret, SelectionPosition(INVALID_POSITION), true); - - // Invalidate the new state of the selection - InvalidateWholeSelection(); - - SetLastXChosen(); - // Need the line moving and so forth from MovePositionTo - return 0; -} - -int Editor::DelWordOrLine(unsigned int iMessage) { - // Virtual space may be realised for SCI_DELWORDRIGHT or SCI_DELWORDRIGHTEND - // which means 2 actions so wrap in an undo group. - - // Rightwards and leftwards deletions differ in treatment of virtual space. - // Clear virtual space for leftwards, realise for rightwards. - const bool leftwards = (iMessage == SCI_DELWORDLEFT) || (iMessage == SCI_DELLINELEFT); - - if (!additionalSelectionTyping) { - InvalidateWholeSelection(); - sel.DropAdditionalRanges(); - } - - UndoGroup ug0(pdoc, (sel.Count() > 1) || !leftwards); - - for (size_t r = 0; r < sel.Count(); r++) { - if (leftwards) { - // Delete to the left so first clear the virtual space. - sel.Range(r).ClearVirtualSpace(); - } else { - // Delete to the right so first realise the virtual space. - sel.Range(r) = SelectionRange( - RealizeVirtualSpace(sel.Range(r).caret)); - } - - Range rangeDelete; - switch (iMessage) { - case SCI_DELWORDLEFT: - rangeDelete = Range( - pdoc->NextWordStart(sel.Range(r).caret.Position(), -1), - sel.Range(r).caret.Position()); - break; - case SCI_DELWORDRIGHT: - rangeDelete = Range( - sel.Range(r).caret.Position(), - pdoc->NextWordStart(sel.Range(r).caret.Position(), 1)); - break; - case SCI_DELWORDRIGHTEND: - rangeDelete = Range( - sel.Range(r).caret.Position(), - pdoc->NextWordEnd(sel.Range(r).caret.Position(), 1)); - break; - case SCI_DELLINELEFT: - rangeDelete = Range( - pdoc->LineStart(pdoc->LineFromPosition(sel.Range(r).caret.Position())), - sel.Range(r).caret.Position()); - break; - case SCI_DELLINERIGHT: - rangeDelete = Range( - sel.Range(r).caret.Position(), - pdoc->LineEnd(pdoc->LineFromPosition(sel.Range(r).caret.Position()))); - break; - } - if (!RangeContainsProtected(rangeDelete.start, rangeDelete.end)) { - pdoc->DeleteChars(rangeDelete.start, rangeDelete.end - rangeDelete.start); - } - } - - // May need something stronger here: can selections overlap at this point? - sel.RemoveDuplicates(); - - MovedCaret(sel.RangeMain().caret, SelectionPosition(INVALID_POSITION), true); - - // Invalidate the new state of the selection - InvalidateWholeSelection(); - - SetLastXChosen(); - return 0; -} - -int Editor::KeyCommand(unsigned int iMessage) { - switch (iMessage) { - case SCI_LINEDOWN: - CursorUpOrDown(1, Selection::noSel); - break; - case SCI_LINEDOWNEXTEND: - CursorUpOrDown(1, Selection::selStream); - break; - case SCI_LINEDOWNRECTEXTEND: - CursorUpOrDown(1, Selection::selRectangle); - break; - case SCI_PARADOWN: - ParaUpOrDown(1, Selection::noSel); - break; - case SCI_PARADOWNEXTEND: - ParaUpOrDown(1, Selection::selStream); - break; - case SCI_LINESCROLLDOWN: - ScrollTo(topLine + 1); - MoveCaretInsideView(false); - break; - case SCI_LINEUP: - CursorUpOrDown(-1, Selection::noSel); - break; - case SCI_LINEUPEXTEND: - CursorUpOrDown(-1, Selection::selStream); - break; - case SCI_LINEUPRECTEXTEND: - CursorUpOrDown(-1, Selection::selRectangle); - break; - case SCI_PARAUP: - ParaUpOrDown(-1, Selection::noSel); - break; - case SCI_PARAUPEXTEND: - ParaUpOrDown(-1, Selection::selStream); - break; - case SCI_LINESCROLLUP: - ScrollTo(topLine - 1); - MoveCaretInsideView(false); - break; - - case SCI_CHARLEFT: - case SCI_CHARLEFTEXTEND: - case SCI_CHARLEFTRECTEXTEND: - case SCI_CHARRIGHT: - case SCI_CHARRIGHTEXTEND: - case SCI_CHARRIGHTRECTEXTEND: - case SCI_WORDLEFT: - case SCI_WORDLEFTEXTEND: - case SCI_WORDRIGHT: - case SCI_WORDRIGHTEXTEND: - case SCI_WORDLEFTEND: - case SCI_WORDLEFTENDEXTEND: - case SCI_WORDRIGHTEND: - case SCI_WORDRIGHTENDEXTEND: - case SCI_WORDPARTLEFT: - case SCI_WORDPARTLEFTEXTEND: - case SCI_WORDPARTRIGHT: - case SCI_WORDPARTRIGHTEXTEND: - case SCI_HOME: - case SCI_HOMEEXTEND: - case SCI_HOMERECTEXTEND: - case SCI_HOMEDISPLAY: - case SCI_HOMEDISPLAYEXTEND: - case SCI_HOMEWRAP: - case SCI_HOMEWRAPEXTEND: - case SCI_VCHOME: - case SCI_VCHOMEEXTEND: - case SCI_VCHOMERECTEXTEND: - case SCI_VCHOMEDISPLAY: - case SCI_VCHOMEDISPLAYEXTEND: - case SCI_VCHOMEWRAP: - case SCI_VCHOMEWRAPEXTEND: - case SCI_LINEEND: - case SCI_LINEENDEXTEND: - case SCI_LINEENDRECTEXTEND: - case SCI_LINEENDDISPLAY: - case SCI_LINEENDDISPLAYEXTEND: - case SCI_LINEENDWRAP: - case SCI_LINEENDWRAPEXTEND: - return HorizontalMove(iMessage); - - case SCI_DOCUMENTSTART: - MovePositionTo(0); - SetLastXChosen(); - break; - case SCI_DOCUMENTSTARTEXTEND: - MovePositionTo(0, Selection::selStream); - SetLastXChosen(); - break; - case SCI_DOCUMENTEND: - MovePositionTo(pdoc->Length()); - SetLastXChosen(); - break; - case SCI_DOCUMENTENDEXTEND: - MovePositionTo(pdoc->Length(), Selection::selStream); - SetLastXChosen(); - break; - case SCI_STUTTEREDPAGEUP: - PageMove(-1, Selection::noSel, true); - break; - case SCI_STUTTEREDPAGEUPEXTEND: - PageMove(-1, Selection::selStream, true); - break; - case SCI_STUTTEREDPAGEDOWN: - PageMove(1, Selection::noSel, true); - break; - case SCI_STUTTEREDPAGEDOWNEXTEND: - PageMove(1, Selection::selStream, true); - break; - case SCI_PAGEUP: - PageMove(-1); - break; - case SCI_PAGEUPEXTEND: - PageMove(-1, Selection::selStream); - break; - case SCI_PAGEUPRECTEXTEND: - PageMove(-1, Selection::selRectangle); - break; - case SCI_PAGEDOWN: - PageMove(1); - break; - case SCI_PAGEDOWNEXTEND: - PageMove(1, Selection::selStream); - break; - case SCI_PAGEDOWNRECTEXTEND: - PageMove(1, Selection::selRectangle); - break; - case SCI_EDITTOGGLEOVERTYPE: - inOverstrike = !inOverstrike; - ShowCaretAtCurrentPosition(); - ContainerNeedsUpdate(SC_UPDATE_CONTENT); - NotifyUpdateUI(); - break; - case SCI_CANCEL: // Cancel any modes - handled in subclass - // Also unselect text - CancelModes(); - if (sel.Count() > 1) { - // Drop additional selections - InvalidateWholeSelection(); - sel.DropAdditionalRanges(); - } - break; - case SCI_DELETEBACK: - DelCharBack(true); - if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) { - SetLastXChosen(); - } - EnsureCaretVisible(); - break; - case SCI_DELETEBACKNOTLINE: - DelCharBack(false); - if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) { - SetLastXChosen(); - } - EnsureCaretVisible(); - break; - case SCI_TAB: - Indent(true); - if (caretSticky == SC_CARETSTICKY_OFF) { - SetLastXChosen(); - } - EnsureCaretVisible(); - ShowCaretAtCurrentPosition(); // Avoid blinking - break; - case SCI_BACKTAB: - Indent(false); - if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) { - SetLastXChosen(); - } - EnsureCaretVisible(); - ShowCaretAtCurrentPosition(); // Avoid blinking - break; - case SCI_NEWLINE: - NewLine(); - break; - case SCI_FORMFEED: - AddChar('\f'); - break; - case SCI_ZOOMIN: - if (vs.zoomLevel < 20) { - vs.zoomLevel++; - InvalidateStyleRedraw(); - NotifyZoom(); - } - break; - case SCI_ZOOMOUT: - if (vs.zoomLevel > -10) { - vs.zoomLevel--; - InvalidateStyleRedraw(); - NotifyZoom(); - } - break; - - case SCI_DELWORDLEFT: - case SCI_DELWORDRIGHT: - case SCI_DELWORDRIGHTEND: - case SCI_DELLINELEFT: - case SCI_DELLINERIGHT: - return DelWordOrLine(iMessage); - - case SCI_LINECOPY: { - int lineStart = pdoc->LineFromPosition(SelectionStart().Position()); - int lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); - CopyRangeToClipboard(pdoc->LineStart(lineStart), - pdoc->LineStart(lineEnd + 1)); - } - break; - case SCI_LINECUT: { - int lineStart = pdoc->LineFromPosition(SelectionStart().Position()); - int lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); - int start = pdoc->LineStart(lineStart); - int end = pdoc->LineStart(lineEnd + 1); - SetSelection(start, end); - Cut(); - SetLastXChosen(); - } - break; - case SCI_LINEDELETE: { - int line = pdoc->LineFromPosition(sel.MainCaret()); - int start = pdoc->LineStart(line); - int end = pdoc->LineStart(line + 1); - pdoc->DeleteChars(start, end - start); - } - break; - case SCI_LINETRANSPOSE: - LineTranspose(); - break; - case SCI_LINEDUPLICATE: - Duplicate(true); - break; - case SCI_SELECTIONDUPLICATE: - Duplicate(false); - break; - case SCI_LOWERCASE: - ChangeCaseOfSelection(cmLower); - break; - case SCI_UPPERCASE: - ChangeCaseOfSelection(cmUpper); - break; - case SCI_SCROLLTOSTART: - ScrollTo(0); - break; - case SCI_SCROLLTOEND: - ScrollTo(MaxScrollPos()); - break; - } - return 0; -} - -int Editor::KeyDefault(int, int) { - return 0; -} - -int Editor::KeyDownWithModifiers(int key, int modifiers, bool *consumed) { - DwellEnd(false); - int msg = kmap.Find(key, modifiers); - if (msg) { - if (consumed) - *consumed = true; - return static_cast(WndProc(msg, 0, 0)); - } else { - if (consumed) - *consumed = false; - return KeyDefault(key, modifiers); - } -} - -int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) { - return KeyDownWithModifiers(key, ModifierFlags(shift, ctrl, alt), consumed); -} - -void Editor::Indent(bool forwards) { - UndoGroup ug(pdoc); - for (size_t r=0; rLineFromPosition(sel.Range(r).anchor.Position()); - int caretPosition = sel.Range(r).caret.Position(); - int lineCurrentPos = pdoc->LineFromPosition(caretPosition); - if (lineOfAnchor == lineCurrentPos) { - if (forwards) { - pdoc->DeleteChars(sel.Range(r).Start().Position(), sel.Range(r).Length()); - caretPosition = sel.Range(r).caret.Position(); - if (pdoc->GetColumn(caretPosition) <= pdoc->GetColumn(pdoc->GetLineIndentPosition(lineCurrentPos)) && - pdoc->tabIndents) { - int indentation = pdoc->GetLineIndentation(lineCurrentPos); - int indentationStep = pdoc->IndentSize(); - const int posSelect = pdoc->SetLineIndentation( - lineCurrentPos, indentation + indentationStep - indentation % indentationStep); - sel.Range(r) = SelectionRange(posSelect); - } else { - if (pdoc->useTabs) { - const int lengthInserted = pdoc->InsertString(caretPosition, "\t", 1); - sel.Range(r) = SelectionRange(caretPosition + lengthInserted); - } else { - int numSpaces = (pdoc->tabInChars) - - (pdoc->GetColumn(caretPosition) % (pdoc->tabInChars)); - if (numSpaces < 1) - numSpaces = pdoc->tabInChars; - const std::string spaceText(numSpaces, ' '); - const int lengthInserted = pdoc->InsertString(caretPosition, spaceText.c_str(), - static_cast(spaceText.length())); - sel.Range(r) = SelectionRange(caretPosition + lengthInserted); - } - } - } else { - if (pdoc->GetColumn(caretPosition) <= pdoc->GetLineIndentation(lineCurrentPos) && - pdoc->tabIndents) { - int indentation = pdoc->GetLineIndentation(lineCurrentPos); - int indentationStep = pdoc->IndentSize(); - const int posSelect = pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); - sel.Range(r) = SelectionRange(posSelect); - } else { - int newColumn = ((pdoc->GetColumn(caretPosition) - 1) / pdoc->tabInChars) * - pdoc->tabInChars; - if (newColumn < 0) - newColumn = 0; - int newPos = caretPosition; - while (pdoc->GetColumn(newPos) > newColumn) - newPos--; - sel.Range(r) = SelectionRange(newPos); - } - } - } else { // Multiline - int anchorPosOnLine = sel.Range(r).anchor.Position() - pdoc->LineStart(lineOfAnchor); - int currentPosPosOnLine = caretPosition - pdoc->LineStart(lineCurrentPos); - // Multiple lines selected so indent / dedent - int lineTopSel = Platform::Minimum(lineOfAnchor, lineCurrentPos); - int lineBottomSel = Platform::Maximum(lineOfAnchor, lineCurrentPos); - if (pdoc->LineStart(lineBottomSel) == sel.Range(r).anchor.Position() || pdoc->LineStart(lineBottomSel) == caretPosition) - lineBottomSel--; // If not selecting any characters on a line, do not indent - pdoc->Indent(forwards, lineBottomSel, lineTopSel); - if (lineOfAnchor < lineCurrentPos) { - if (currentPosPosOnLine == 0) - sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor)); - else - sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos + 1), pdoc->LineStart(lineOfAnchor)); - } else { - if (anchorPosOnLine == 0) - sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor)); - else - sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor + 1)); - } - } - } - ContainerNeedsUpdate(SC_UPDATE_SELECTION); -} - -class CaseFolderASCII : public CaseFolderTable { -public: - CaseFolderASCII() { - StandardASCII(); - } - ~CaseFolderASCII() { - } -}; - - -CaseFolder *Editor::CaseFolderForEncoding() { - // Simple default that only maps ASCII upper case to lower case. - return new CaseFolderASCII(); -} - -/** - * Search of a text in the document, in the given range. - * @return The position of the found text, -1 if not found. - */ -long Editor::FindText( - uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, - ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. - sptr_t lParam) { ///< @c Sci_TextToFind structure: The text to search for in the given range. - - Sci_TextToFind *ft = reinterpret_cast(lParam); - int lengthFound = istrlen(ft->lpstrText); - if (!pdoc->HasCaseFolder()) - pdoc->SetCaseFolder(CaseFolderForEncoding()); - try { - long pos = pdoc->FindText( - static_cast(ft->chrg.cpMin), - static_cast(ft->chrg.cpMax), - ft->lpstrText, - static_cast(wParam), - &lengthFound); - if (pos != -1) { - ft->chrgText.cpMin = pos; - ft->chrgText.cpMax = pos + lengthFound; - } - return static_cast(pos); - } catch (RegexError &) { - errorStatus = SC_STATUS_WARN_REGEX; - return -1; - } -} - -/** - * Relocatable search support : Searches relative to current selection - * point and sets the selection to the found text range with - * each search. - */ -/** - * Anchor following searches at current selection start: This allows - * multiple incremental interactive searches to be macro recorded - * while still setting the selection to found text so the find/select - * operation is self-contained. - */ -void Editor::SearchAnchor() { - searchAnchor = SelectionStart().Position(); -} - -/** - * Find text from current search anchor: Must call @c SearchAnchor first. - * Used for next text and previous text requests. - * @return The position of the found text, -1 if not found. - */ -long Editor::SearchText( - unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV. - uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, - ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. - sptr_t lParam) { ///< The text to search for. - - const char *txt = reinterpret_cast(lParam); - long pos; - int lengthFound = istrlen(txt); - if (!pdoc->HasCaseFolder()) - pdoc->SetCaseFolder(CaseFolderForEncoding()); - try { - if (iMessage == SCI_SEARCHNEXT) { - pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt, - static_cast(wParam), - &lengthFound); - } else { - pos = pdoc->FindText(searchAnchor, 0, txt, - static_cast(wParam), - &lengthFound); - } - } catch (RegexError &) { - errorStatus = SC_STATUS_WARN_REGEX; - return -1; - } - if (pos != -1) { - SetSelection(static_cast(pos), static_cast(pos + lengthFound)); - } - - return pos; -} - -std::string Editor::CaseMapString(const std::string &s, int caseMapping) { - std::string ret(s); - for (size_t i=0; i= 'a' && ret[i] <= 'z') - ret[i] = static_cast(ret[i] - 'a' + 'A'); - break; - case cmLower: - if (ret[i] >= 'A' && ret[i] <= 'Z') - ret[i] = static_cast(ret[i] - 'A' + 'a'); - break; - } - } - return ret; -} - -/** - * Search for text in the target range of the document. - * @return The position of the found text, -1 if not found. - */ -long Editor::SearchInTarget(const char *text, int length) { - int lengthFound = length; - - if (!pdoc->HasCaseFolder()) - pdoc->SetCaseFolder(CaseFolderForEncoding()); - try { - long pos = pdoc->FindText(targetStart, targetEnd, text, - searchFlags, - &lengthFound); - if (pos != -1) { - targetStart = static_cast(pos); - targetEnd = static_cast(pos + lengthFound); - } - return pos; - } catch (RegexError &) { - errorStatus = SC_STATUS_WARN_REGEX; - return -1; - } -} - -void Editor::GoToLine(int lineNo) { - if (lineNo > pdoc->LinesTotal()) - lineNo = pdoc->LinesTotal(); - if (lineNo < 0) - lineNo = 0; - SetEmptySelection(pdoc->LineStart(lineNo)); - ShowCaretAtCurrentPosition(); - EnsureCaretVisible(); -} - -static bool Close(Point pt1, Point pt2, Point threshold) { - if (std::abs(pt1.x - pt2.x) > threshold.x) - return false; - if (std::abs(pt1.y - pt2.y) > threshold.y) - return false; - return true; -} - -std::string Editor::RangeText(int start, int end) const { - if (start < end) { - int len = end - start; - std::string ret(len, '\0'); - for (int i = 0; i < len; i++) { - ret[i] = pdoc->CharAt(start + i); - } - return ret; - } - return std::string(); -} - -void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) { - if (sel.Empty()) { - if (allowLineCopy) { - int currentLine = pdoc->LineFromPosition(sel.MainCaret()); - int start = pdoc->LineStart(currentLine); - int end = pdoc->LineEnd(currentLine); - - std::string text = RangeText(start, end); - if (pdoc->eolMode != SC_EOL_LF) - text.push_back('\r'); - if (pdoc->eolMode != SC_EOL_CR) - text.push_back('\n'); - ss->Copy(text, pdoc->dbcsCodePage, - vs.styles[STYLE_DEFAULT].characterSet, false, true); - } - } else { - std::string text; - std::vector rangesInOrder = sel.RangesCopy(); - if (sel.selType == Selection::selRectangle) - std::sort(rangesInOrder.begin(), rangesInOrder.end()); - for (size_t r=0; reolMode != SC_EOL_LF) - text.push_back('\r'); - if (pdoc->eolMode != SC_EOL_CR) - text.push_back('\n'); - } - } - ss->Copy(text, pdoc->dbcsCodePage, - vs.styles[STYLE_DEFAULT].characterSet, sel.IsRectangular(), sel.selType == Selection::selLines); - } -} - -void Editor::CopyRangeToClipboard(int start, int end) { - start = pdoc->ClampPositionIntoDocument(start); - end = pdoc->ClampPositionIntoDocument(end); - SelectionText selectedText; - std::string text = RangeText(start, end); - selectedText.Copy(text, - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, false); - CopyToClipboard(selectedText); -} - -void Editor::CopyText(int length, const char *text) { - SelectionText selectedText; - selectedText.Copy(std::string(text, length), - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, false); - CopyToClipboard(selectedText); -} - -void Editor::SetDragPosition(SelectionPosition newPos) { - if (newPos.Position() >= 0) { - newPos = MovePositionOutsideChar(newPos, 1); - posDrop = newPos; - } - if (!(posDrag == newPos)) { - caret.on = true; - if (FineTickerAvailable()) { - FineTickerCancel(tickCaret); - if ((caret.active) && (caret.period > 0) && (newPos.Position() < 0)) - FineTickerStart(tickCaret, caret.period, caret.period/10); - } else { - SetTicking(true); - } - InvalidateCaret(); - posDrag = newPos; - InvalidateCaret(); - } -} - -void Editor::DisplayCursor(Window::Cursor c) { - if (cursorMode == SC_CURSORNORMAL) - wMain.SetCursor(c); - else - wMain.SetCursor(static_cast(cursorMode)); -} - -bool Editor::DragThreshold(Point ptStart, Point ptNow) { - int xMove = static_cast(ptStart.x - ptNow.x); - int yMove = static_cast(ptStart.y - ptNow.y); - int distanceSquared = xMove * xMove + yMove * yMove; - return distanceSquared > 16; -} - -void Editor::StartDrag() { - // Always handled by subclasses - //SetMouseCapture(true); - //DisplayCursor(Window::cursorArrow); -} - -void Editor::DropAt(SelectionPosition position, const char *value, size_t lengthValue, bool moving, bool rectangular) { - //Platform::DebugPrintf("DropAt %d %d\n", inDragDrop, position); - if (inDragDrop == ddDragging) - dropWentOutside = false; - - bool positionWasInSelection = PositionInSelection(position.Position()); - - bool positionOnEdgeOfSelection = - (position == SelectionStart()) || (position == SelectionEnd()); - - if ((inDragDrop != ddDragging) || !(positionWasInSelection) || - (positionOnEdgeOfSelection && !moving)) { - - SelectionPosition selStart = SelectionStart(); - SelectionPosition selEnd = SelectionEnd(); - - UndoGroup ug(pdoc); - - SelectionPosition positionAfterDeletion = position; - if ((inDragDrop == ddDragging) && moving) { - // Remove dragged out text - if (rectangular || sel.selType == Selection::selLines) { - for (size_t r=0; r= sel.Range(r).Start()) { - if (position > sel.Range(r).End()) { - positionAfterDeletion.Add(-sel.Range(r).Length()); - } else { - positionAfterDeletion.Add(-SelectionRange(position, sel.Range(r).Start()).Length()); - } - } - } - } else { - if (position > selStart) { - positionAfterDeletion.Add(-SelectionRange(selEnd, selStart).Length()); - } - } - ClearSelection(); - } - position = positionAfterDeletion; - - std::string convertedText = Document::TransformLineEnds(value, lengthValue, pdoc->eolMode); - - if (rectangular) { - PasteRectangular(position, convertedText.c_str(), static_cast(convertedText.length())); - // Should try to select new rectangle but it may not be a rectangle now so just select the drop position - SetEmptySelection(position); - } else { - position = MovePositionOutsideChar(position, sel.MainCaret() - position.Position()); - position = RealizeVirtualSpace(position); - const int lengthInserted = pdoc->InsertString( - position.Position(), convertedText.c_str(), static_cast(convertedText.length())); - if (lengthInserted > 0) { - SelectionPosition posAfterInsertion = position; - posAfterInsertion.Add(lengthInserted); - SetSelection(posAfterInsertion, position); - } - } - } else if (inDragDrop == ddDragging) { - SetEmptySelection(position); - } -} - -void Editor::DropAt(SelectionPosition position, const char *value, bool moving, bool rectangular) { - DropAt(position, value, strlen(value), moving, rectangular); -} - -/** - * @return true if given position is inside the selection, - */ -bool Editor::PositionInSelection(int pos) { - pos = MovePositionOutsideChar(pos, sel.MainCaret() - pos); - for (size_t r=0; r ptPos.x) { - hit = false; - } - } - if (hit) - return true; - } - } - return false; -} - -bool Editor::PointInSelMargin(Point pt) const { - // Really means: "Point in a margin" - if (vs.fixedColumnWidth > 0) { // There is a margin - PRectangle rcSelMargin = GetClientRectangle(); - rcSelMargin.right = static_cast(vs.textStart - vs.leftMarginWidth); - rcSelMargin.left = static_cast(vs.textStart - vs.fixedColumnWidth); - return rcSelMargin.ContainsWholePixel(pt); - } else { - return false; - } -} - -Window::Cursor Editor::GetMarginCursor(Point pt) const { - int x = 0; - for (size_t margin = 0; margin < vs.ms.size(); margin++) { - if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width)) - return static_cast(vs.ms[margin].cursor); - x += vs.ms[margin].width; - } - return Window::cursorReverseArrow; -} - -void Editor::TrimAndSetSelection(int currentPos_, int anchor_) { - sel.TrimSelection(SelectionRange(currentPos_, anchor_)); - SetSelection(currentPos_, anchor_); -} - -void Editor::LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine) { - int selCurrentPos, selAnchorPos; - if (wholeLine) { - int lineCurrent_ = pdoc->LineFromPosition(lineCurrentPos_); - int lineAnchor_ = pdoc->LineFromPosition(lineAnchorPos_); - if (lineAnchorPos_ < lineCurrentPos_) { - selCurrentPos = pdoc->LineStart(lineCurrent_ + 1); - selAnchorPos = pdoc->LineStart(lineAnchor_); - } else if (lineAnchorPos_ > lineCurrentPos_) { - selCurrentPos = pdoc->LineStart(lineCurrent_); - selAnchorPos = pdoc->LineStart(lineAnchor_ + 1); - } else { // Same line, select it - selCurrentPos = pdoc->LineStart(lineAnchor_ + 1); - selAnchorPos = pdoc->LineStart(lineAnchor_); - } - } else { - if (lineAnchorPos_ < lineCurrentPos_) { - selCurrentPos = StartEndDisplayLine(lineCurrentPos_, false) + 1; - selCurrentPos = pdoc->MovePositionOutsideChar(selCurrentPos, 1); - selAnchorPos = StartEndDisplayLine(lineAnchorPos_, true); - } else if (lineAnchorPos_ > lineCurrentPos_) { - selCurrentPos = StartEndDisplayLine(lineCurrentPos_, true); - selAnchorPos = StartEndDisplayLine(lineAnchorPos_, false) + 1; - selAnchorPos = pdoc->MovePositionOutsideChar(selAnchorPos, 1); - } else { // Same line, select it - selCurrentPos = StartEndDisplayLine(lineAnchorPos_, false) + 1; - selCurrentPos = pdoc->MovePositionOutsideChar(selCurrentPos, 1); - selAnchorPos = StartEndDisplayLine(lineAnchorPos_, true); - } - } - TrimAndSetSelection(selCurrentPos, selAnchorPos); -} - -void Editor::WordSelection(int pos) { - if (pos < wordSelectAnchorStartPos) { - // Extend backward to the word containing pos. - // Skip ExtendWordSelect if the line is empty or if pos is after the last character. - // This ensures that a series of empty lines isn't counted as a single "word". - if (!pdoc->IsLineEndPosition(pos)) - pos = pdoc->ExtendWordSelect(pdoc->MovePositionOutsideChar(pos + 1, 1), -1); - TrimAndSetSelection(pos, wordSelectAnchorEndPos); - } else if (pos > wordSelectAnchorEndPos) { - // Extend forward to the word containing the character to the left of pos. - // Skip ExtendWordSelect if the line is empty or if pos is the first position on the line. - // This ensures that a series of empty lines isn't counted as a single "word". - if (pos > pdoc->LineStart(pdoc->LineFromPosition(pos))) - pos = pdoc->ExtendWordSelect(pdoc->MovePositionOutsideChar(pos - 1, -1), 1); - TrimAndSetSelection(pos, wordSelectAnchorStartPos); - } else { - // Select only the anchored word - if (pos >= originalAnchorPos) - TrimAndSetSelection(wordSelectAnchorEndPos, wordSelectAnchorStartPos); - else - TrimAndSetSelection(wordSelectAnchorStartPos, wordSelectAnchorEndPos); - } -} - -void Editor::DwellEnd(bool mouseMoved) { - if (mouseMoved) - ticksToDwell = dwellDelay; - else - ticksToDwell = SC_TIME_FOREVER; - if (dwelling && (dwellDelay < SC_TIME_FOREVER)) { - dwelling = false; - NotifyDwelling(ptMouseLast, dwelling); - } - if (FineTickerAvailable()) { - FineTickerCancel(tickDwell); - if (mouseMoved && (dwellDelay < SC_TIME_FOREVER)) { - //FineTickerStart(tickDwell, dwellDelay, dwellDelay/10); - } - } -} - -void Editor::MouseLeave() { - SetHotSpotRange(NULL); - if (!HaveMouseCapture()) { - ptMouseLast = Point(-1,-1); - DwellEnd(true); - } -} - -static bool AllowVirtualSpace(int virtualSpaceOptions, bool rectangular) { - return (!rectangular && ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0)) - || (rectangular && ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) != 0)); -} - -void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) { - SetHoverIndicatorPoint(pt); - //Platform::DebugPrintf("ButtonDown %d %d = %d alt=%d %d\n", curTime, lastClickTime, curTime - lastClickTime, alt, inDragDrop); - ptMouseLast = pt; - const bool ctrl = (modifiers & SCI_CTRL) != 0; - const bool shift = (modifiers & SCI_SHIFT) != 0; - const bool alt = (modifiers & SCI_ALT) != 0; - SelectionPosition newPos = SPositionFromLocation(pt, false, false, AllowVirtualSpace(virtualSpaceOptions, alt)); - newPos = MovePositionOutsideChar(newPos, sel.MainCaret() - newPos.Position()); - SelectionPosition newCharPos = SPositionFromLocation(pt, false, true, false); - newCharPos = MovePositionOutsideChar(newCharPos, -1); - inDragDrop = ddNone; - sel.SetMoveExtends(false); - - if (NotifyMarginClick(pt, modifiers)) - return; - - NotifyIndicatorClick(true, newPos.Position(), modifiers); - - bool inSelMargin = PointInSelMargin(pt); - // In margin ctrl+(double)click should always select everything - if (ctrl && inSelMargin) { - SelectAll(); - lastClickTime = curTime; - lastClick = pt; - return; - } - if (shift && !inSelMargin) { - SetSelection(newPos); - } - if (((curTime - lastClickTime) < Platform::DoubleClickTime()) && Close(pt, lastClick, doubleClickCloseThreshold)) { - //Platform::DebugPrintf("Double click %d %d = %d\n", curTime, lastClickTime, curTime - lastClickTime); - SetMouseCapture(true); - if (FineTickerAvailable()) { - FineTickerStart(tickScroll, 100, 10); - } - if (!ctrl || !multipleSelection || (selectionType != selChar && selectionType != selWord)) - SetEmptySelection(newPos.Position()); - bool doubleClick = false; - // Stop mouse button bounce changing selection type - if (!Platform::MouseButtonBounce() || curTime != lastClickTime) { - if (inSelMargin) { - // Inside margin selection type should be either selSubLine or selWholeLine. - if (selectionType == selSubLine) { - // If it is selSubLine, we're inside a *double* click and word wrap is enabled, - // so we switch to selWholeLine in order to select whole line. - selectionType = selWholeLine; - } else if (selectionType != selSubLine && selectionType != selWholeLine) { - // If it is neither, reset selection type to line selection. - selectionType = (Wrapping() && (marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine; - } - } else { - if (selectionType == selChar) { - selectionType = selWord; - doubleClick = true; - } else if (selectionType == selWord) { - // Since we ended up here, we're inside a *triple* click, which should always select - // whole line regardless of word wrap being enabled or not. - selectionType = selWholeLine; - } else { - selectionType = selChar; - originalAnchorPos = sel.MainCaret(); - } - } - } - - if (selectionType == selWord) { - int charPos = originalAnchorPos; - if (sel.MainCaret() == originalAnchorPos) { - charPos = PositionFromLocation(pt, false, true); - charPos = MovePositionOutsideChar(charPos, -1); - } - - int startWord, endWord; - if ((sel.MainCaret() >= originalAnchorPos) && !pdoc->IsLineEndPosition(charPos)) { - startWord = pdoc->ExtendWordSelect(pdoc->MovePositionOutsideChar(charPos + 1, 1), -1); - endWord = pdoc->ExtendWordSelect(charPos, 1); - } else { - // Selecting backwards, or anchor beyond last character on line. In these cases, - // we select the word containing the character to the *left* of the anchor. - if (charPos > pdoc->LineStart(pdoc->LineFromPosition(charPos))) { - startWord = pdoc->ExtendWordSelect(charPos, -1); - endWord = pdoc->ExtendWordSelect(startWord, 1); - } else { - // Anchor at start of line; select nothing to begin with. - startWord = charPos; - endWord = charPos; - } - } - - wordSelectAnchorStartPos = startWord; - wordSelectAnchorEndPos = endWord; - wordSelectInitialCaretPos = sel.MainCaret(); - WordSelection(wordSelectInitialCaretPos); - } else if (selectionType == selSubLine || selectionType == selWholeLine) { - lineAnchorPos = newPos.Position(); - LineSelection(lineAnchorPos, lineAnchorPos, selectionType == selWholeLine); - //Platform::DebugPrintf("Triple click: %d - %d\n", anchor, currentPos); - } else { - SetEmptySelection(sel.MainCaret()); - } - //Platform::DebugPrintf("Double click: %d - %d\n", anchor, currentPos); - if (doubleClick) { - NotifyDoubleClick(pt, modifiers); - if (PositionIsHotspot(newCharPos.Position())) - NotifyHotSpotDoubleClicked(newCharPos.Position(), modifiers); - } - } else { // Single click - if (inSelMargin) { - if (sel.IsRectangular() || (sel.Count() > 1)) { - InvalidateWholeSelection(); - sel.Clear(); - } - sel.selType = Selection::selStream; - if (!shift) { - // Single click in margin: select whole line or only subline if word wrap is enabled - lineAnchorPos = newPos.Position(); - selectionType = (Wrapping() && (marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine; - LineSelection(lineAnchorPos, lineAnchorPos, selectionType == selWholeLine); - } else { - // Single shift+click in margin: select from line anchor to clicked line - if (sel.MainAnchor() > sel.MainCaret()) - lineAnchorPos = sel.MainAnchor() - 1; - else - lineAnchorPos = sel.MainAnchor(); - // Reset selection type if there is an empty selection. - // This ensures that we don't end up stuck in previous selection mode, which is no longer valid. - // Otherwise, if there's a non empty selection, reset selection type only if it differs from selSubLine and selWholeLine. - // This ensures that we continue selecting in the same selection mode. - if (sel.Empty() || (selectionType != selSubLine && selectionType != selWholeLine)) - selectionType = (Wrapping() && (marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine; - LineSelection(newPos.Position(), lineAnchorPos, selectionType == selWholeLine); - } - - SetDragPosition(SelectionPosition(invalidPosition)); - SetMouseCapture(true); - if (FineTickerAvailable()) { - FineTickerStart(tickScroll, 100, 10); - } - } else { - if (PointIsHotspot(pt)) { - NotifyHotSpotClicked(newCharPos.Position(), modifiers); - hotSpotClickPos = newCharPos.Position(); - } - if (!shift) { - if (PointInSelection(pt) && !SelectionEmpty()) - inDragDrop = ddInitial; - else - inDragDrop = ddNone; - } - SetMouseCapture(true); - if (FineTickerAvailable()) { - FineTickerStart(tickScroll, 100, 10); - } - if (inDragDrop != ddInitial) { - SetDragPosition(SelectionPosition(invalidPosition)); - if (!shift) { - if (ctrl && multipleSelection) { - SelectionRange range(newPos); - sel.TentativeSelection(range); - InvalidateSelection(range, true); - } else { - InvalidateSelection(SelectionRange(newPos), true); - if (sel.Count() > 1) - Redraw(); - if ((sel.Count() > 1) || (sel.selType != Selection::selStream)) - sel.Clear(); - sel.selType = alt ? Selection::selRectangle : Selection::selStream; - SetSelection(newPos, newPos); - } - } - SelectionPosition anchorCurrent = newPos; - if (shift) - anchorCurrent = sel.IsRectangular() ? - sel.Rectangular().anchor : sel.RangeMain().anchor; - sel.selType = alt ? Selection::selRectangle : Selection::selStream; - selectionType = selChar; - originalAnchorPos = sel.MainCaret(); - sel.Rectangular() = SelectionRange(newPos, anchorCurrent); - SetRectangularRange(); - } - } - } - lastClickTime = curTime; - lastClick = pt; - lastXChosen = static_cast(pt.x) + xOffset; - ShowCaretAtCurrentPosition(); -} - -void Editor::RightButtonDownWithModifiers(Point pt, unsigned int, int modifiers) { - if (NotifyMarginRightClick(pt, modifiers)) - return; -} - -void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { - return ButtonDownWithModifiers(pt, curTime, ModifierFlags(shift, ctrl, alt)); -} - -bool Editor::PositionIsHotspot(int position) const { - return vs.styles[pdoc->StyleIndexAt(position)].hotspot; -} - -bool Editor::PointIsHotspot(Point pt) { - int pos = PositionFromLocation(pt, true, true); - if (pos == INVALID_POSITION) - return false; - return PositionIsHotspot(pos); -} - -void Editor::SetHoverIndicatorPosition(int position) { - int hoverIndicatorPosPrev = hoverIndicatorPos; - hoverIndicatorPos = INVALID_POSITION; - if (vs.indicatorsDynamic == 0) - return; - if (position != INVALID_POSITION) { - for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { - if (vs.indicators[deco->indicator].IsDynamic()) { - if (pdoc->decorations.ValueAt(deco->indicator, position)) { - hoverIndicatorPos = position; - } - } - } - } - if (hoverIndicatorPosPrev != hoverIndicatorPos) { - Redraw(); - } -} - -void Editor::SetHoverIndicatorPoint(Point pt) { - if (vs.indicatorsDynamic == 0) { - SetHoverIndicatorPosition(INVALID_POSITION); - } else { - SetHoverIndicatorPosition(PositionFromLocation(pt, true, true)); - } -} - -void Editor::SetHotSpotRange(Point *pt) { - if (pt) { - int pos = PositionFromLocation(*pt, false, true); - - // If we don't limit this to word characters then the - // range can encompass more than the run range and then - // the underline will not be drawn properly. - Range hsNew; - hsNew.start = pdoc->ExtendStyleRange(pos, -1, vs.hotspotSingleLine); - hsNew.end = pdoc->ExtendStyleRange(pos, 1, vs.hotspotSingleLine); - - // Only invalidate the range if the hotspot range has changed... - if (!(hsNew == hotspot)) { - if (hotspot.Valid()) { - InvalidateRange(hotspot.start, hotspot.end); - } - hotspot = hsNew; - InvalidateRange(hotspot.start, hotspot.end); - } - } else { - if (hotspot.Valid()) { - InvalidateRange(hotspot.start, hotspot.end); - } - hotspot = Range(invalidPosition); - } -} - -Range Editor::GetHotSpotRange() const { - return hotspot; -} - -void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) { - if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) { - DwellEnd(true); - } - - SelectionPosition movePos = SPositionFromLocation(pt, false, false, - AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); - movePos = MovePositionOutsideChar(movePos, sel.MainCaret() - movePos.Position()); - - if (inDragDrop == ddInitial) { - if (DragThreshold(ptMouseLast, pt)) { - SetMouseCapture(false); - if (FineTickerAvailable()) { - FineTickerCancel(tickScroll); - } - SetDragPosition(movePos); - CopySelectionRange(&drag); - StartDrag(); - } - return; - } - - ptMouseLast = pt; - PRectangle rcClient = GetClientRectangle(); - Point ptOrigin = GetVisibleOriginInMain(); - rcClient.Move(0, -ptOrigin.y); - if (FineTickerAvailable() && (dwellDelay < SC_TIME_FOREVER) && rcClient.Contains(pt)) { - FineTickerStart(tickDwell, dwellDelay, dwellDelay/10); - } - //Platform::DebugPrintf("Move %d %d\n", pt.x, pt.y); - if (HaveMouseCapture()) { - - // Slow down autoscrolling/selection - autoScrollTimer.ticksToWait -= timer.tickSize; - if (autoScrollTimer.ticksToWait > 0) - return; - autoScrollTimer.ticksToWait = autoScrollDelay; - - // Adjust selection - if (posDrag.IsValid()) { - SetDragPosition(movePos); - } else { - if (selectionType == selChar) { - if (sel.selType == Selection::selStream && (modifiers & SCI_ALT) && mouseSelectionRectangularSwitch) { - sel.selType = Selection::selRectangle; - } - if (sel.IsRectangular()) { - sel.Rectangular() = SelectionRange(movePos, sel.Rectangular().anchor); - SetSelection(movePos, sel.RangeMain().anchor); - } else if (sel.Count() > 1) { - InvalidateSelection(sel.RangeMain(), false); - SelectionRange range(movePos, sel.RangeMain().anchor); - sel.TentativeSelection(range); - InvalidateSelection(range, true); - } else { - SetSelection(movePos, sel.RangeMain().anchor); - } - } else if (selectionType == selWord) { - // Continue selecting by word - if (movePos.Position() == wordSelectInitialCaretPos) { // Didn't move - // No need to do anything. Previously this case was lumped - // in with "Moved forward", but that can be harmful in this - // case: a handler for the NotifyDoubleClick re-adjusts - // the selection for a fancier definition of "word" (for - // example, in Perl it is useful to include the leading - // '$', '%' or '@' on variables for word selection). In this - // the ButtonMove() called via Tick() for auto-scrolling - // could result in the fancier word selection adjustment - // being unmade. - } else { - wordSelectInitialCaretPos = -1; - WordSelection(movePos.Position()); - } - } else { - // Continue selecting by line - LineSelection(movePos.Position(), lineAnchorPos, selectionType == selWholeLine); - } - } - - // Autoscroll - int lineMove = DisplayFromPosition(movePos.Position()); - if (pt.y > rcClient.bottom) { - ScrollTo(lineMove - LinesOnScreen() + 1); - Redraw(); - } else if (pt.y < rcClient.top) { - ScrollTo(lineMove); - Redraw(); - } - EnsureCaretVisible(false, false, true); - - if (hotspot.Valid() && !PointIsHotspot(pt)) - SetHotSpotRange(NULL); - - if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,true) != hotSpotClickPos) { - if (inDragDrop == ddNone) { - DisplayCursor(Window::cursorText); - } - hotSpotClickPos = INVALID_POSITION; - } - - } else { - if (vs.fixedColumnWidth > 0) { // There is a margin - if (PointInSelMargin(pt)) { - DisplayCursor(GetMarginCursor(pt)); - SetHotSpotRange(NULL); - return; // No need to test for selection - } - } - // Display regular (drag) cursor over selection - if (PointInSelection(pt) && !SelectionEmpty()) { - DisplayCursor(Window::cursorArrow); - } else { - SetHoverIndicatorPoint(pt); - if (PointIsHotspot(pt)) { - DisplayCursor(Window::cursorHand); - SetHotSpotRange(&pt); - } else { - if (hoverIndicatorPos != invalidPosition) - DisplayCursor(Window::cursorHand); - else - DisplayCursor(Window::cursorText); - SetHotSpotRange(NULL); - } - } - } -} - -void Editor::ButtonMove(Point pt) { - ButtonMoveWithModifiers(pt, 0); -} - -void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { - //Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop); - SelectionPosition newPos = SPositionFromLocation(pt, false, false, - AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); - if (hoverIndicatorPos != INVALID_POSITION) - InvalidateRange(newPos.Position(), newPos.Position() + 1); - newPos = MovePositionOutsideChar(newPos, sel.MainCaret() - newPos.Position()); - if (inDragDrop == ddInitial) { - inDragDrop = ddNone; - SetEmptySelection(newPos); - selectionType = selChar; - originalAnchorPos = sel.MainCaret(); - } - if (hotSpotClickPos != INVALID_POSITION && PointIsHotspot(pt)) { - hotSpotClickPos = INVALID_POSITION; - SelectionPosition newCharPos = SPositionFromLocation(pt, false, true, false); - newCharPos = MovePositionOutsideChar(newCharPos, -1); - NotifyHotSpotReleaseClick(newCharPos.Position(), ctrl ? SCI_CTRL : 0); - } - if (HaveMouseCapture()) { - if (PointInSelMargin(pt)) { - DisplayCursor(GetMarginCursor(pt)); - } else { - DisplayCursor(Window::cursorText); - SetHotSpotRange(NULL); - } - ptMouseLast = pt; - SetMouseCapture(false); - if (FineTickerAvailable()) { - FineTickerCancel(tickScroll); - } - NotifyIndicatorClick(false, newPos.Position(), 0); - if (inDragDrop == ddDragging) { - SelectionPosition selStart = SelectionStart(); - SelectionPosition selEnd = SelectionEnd(); - if (selStart < selEnd) { - if (drag.Length()) { - const int length = static_cast(drag.Length()); - if (ctrl) { - const int lengthInserted = pdoc->InsertString( - newPos.Position(), drag.Data(), length); - if (lengthInserted > 0) { - SetSelection(newPos.Position(), newPos.Position() + lengthInserted); - } - } else if (newPos < selStart) { - pdoc->DeleteChars(selStart.Position(), static_cast(drag.Length())); - const int lengthInserted = pdoc->InsertString( - newPos.Position(), drag.Data(), length); - if (lengthInserted > 0) { - SetSelection(newPos.Position(), newPos.Position() + lengthInserted); - } - } else if (newPos > selEnd) { - pdoc->DeleteChars(selStart.Position(), static_cast(drag.Length())); - newPos.Add(-static_cast(drag.Length())); - const int lengthInserted = pdoc->InsertString( - newPos.Position(), drag.Data(), length); - if (lengthInserted > 0) { - SetSelection(newPos.Position(), newPos.Position() + lengthInserted); - } - } else { - SetEmptySelection(newPos.Position()); - } - drag.Clear(); - } - selectionType = selChar; - } - } else { - if (selectionType == selChar) { - if (sel.Count() > 1) { - sel.RangeMain() = - SelectionRange(newPos, sel.Range(sel.Count() - 1).anchor); - InvalidateWholeSelection(); - } else { - SetSelection(newPos, sel.RangeMain().anchor); - } - } - sel.CommitTentative(); - } - SetRectangularRange(); - lastClickTime = curTime; - lastClick = pt; - lastXChosen = static_cast(pt.x) + xOffset; - if (sel.selType == Selection::selStream) { - SetLastXChosen(); - } - inDragDrop = ddNone; - EnsureCaretVisible(false); - } -} - -// Called frequently to perform background UI including -// caret blinking and automatic scrolling. -void Editor::Tick() { - if (HaveMouseCapture()) { - // Auto scroll - ButtonMove(ptMouseLast); - } - if (caret.period > 0) { - timer.ticksToWait -= timer.tickSize; - if (timer.ticksToWait <= 0) { - caret.on = !caret.on; - timer.ticksToWait = caret.period; - if (caret.active) { - InvalidateCaret(); - } - } - } - if (horizontalScrollBarVisible && trackLineWidth && (view.lineWidthMaxSeen > scrollWidth)) { - scrollWidth = view.lineWidthMaxSeen; - SetScrollBars(); - } - if ((dwellDelay < SC_TIME_FOREVER) && - (ticksToDwell > 0) && - (!HaveMouseCapture()) && - (ptMouseLast.y >= 0)) { - ticksToDwell -= timer.tickSize; - if (ticksToDwell <= 0) { - dwelling = true; - NotifyDwelling(ptMouseLast, dwelling); - } - } -} - -bool Editor::Idle() { - bool needWrap = Wrapping() && wrapPending.NeedsWrap(); - - if (needWrap) { - // Wrap lines during idle. - WrapLines(wsIdle); - // No more wrapping - needWrap = wrapPending.NeedsWrap(); - } else if (needIdleStyling) { - IdleStyling(); - } - - // Add more idle things to do here, but make sure idleDone is - // set correctly before the function returns. returning - // false will stop calling this idle function until SetIdle() is - // called again. - - const bool idleDone = !needWrap && !needIdleStyling; // && thatDone && theOtherThingDone... - - return !idleDone; -} - -void Editor::SetTicking(bool) { - // SetTicking is deprecated. In the past it was pure virtual and was overridden in each - // derived platform class but fine grained timers should now be implemented. - // Either way, execution should not arrive here so assert failure. - assert(false); -} - -void Editor::TickFor(TickReason reason) { - switch (reason) { - case tickCaret: - caret.on = !caret.on; - if (caret.active) { - InvalidateCaret(); - } - break; - case tickScroll: - // Auto scroll - ButtonMove(ptMouseLast); - break; - case tickWiden: - SetScrollBars(); - FineTickerCancel(tickWiden); - break; - case tickDwell: - if ((!HaveMouseCapture()) && - (ptMouseLast.y >= 0)) { - dwelling = true; - NotifyDwelling(ptMouseLast, dwelling); - } - FineTickerCancel(tickDwell); - break; - default: - // tickPlatform handled by subclass - break; - } -} - -bool Editor::FineTickerAvailable() { - return false; -} - -// FineTickerStart is be overridden by subclasses that support fine ticking so -// this method should never be called. -bool Editor::FineTickerRunning(TickReason) { - assert(false); - return false; -} - -// FineTickerStart is be overridden by subclasses that support fine ticking so -// this method should never be called. -void Editor::FineTickerStart(TickReason, int, int) { - assert(false); -} - -// FineTickerCancel is be overridden by subclasses that support fine ticking so -// this method should never be called. -void Editor::FineTickerCancel(TickReason) { - assert(false); -} - -void Editor::SetFocusState(bool focusState) { - hasFocus = focusState; - NotifyFocus(hasFocus); - if (!hasFocus) { - CancelModes(); - } - ShowCaretAtCurrentPosition(); -} - -int Editor::PositionAfterArea(PRectangle rcArea) const { - // The start of the document line after the display line after the area - // This often means that the line after a modification is restyled which helps - // detect multiline comment additions and heals single line comments - int lineAfter = TopLineOfMain() + static_cast(rcArea.bottom - 1) / vs.lineHeight + 1; - if (lineAfter < cs.LinesDisplayed()) - return pdoc->LineStart(cs.DocFromDisplay(lineAfter) + 1); - else - return pdoc->Length(); -} - -// Style to a position within the view. If this causes a change at end of last line then -// affects later lines so style all the viewed text. -void Editor::StyleToPositionInView(Position pos) { - int endWindow = PositionAfterArea(GetClientDrawingRectangle()); - if (pos > endWindow) - pos = endWindow; - const int styleAtEnd = pdoc->StyleIndexAt(pos-1); - pdoc->EnsureStyledTo(pos); - if ((endWindow > pos) && (styleAtEnd != pdoc->StyleIndexAt(pos-1))) { - // Style at end of line changed so is multi-line change like starting a comment - // so require rest of window to be styled. - DiscardOverdraw(); // Prepared bitmaps may be invalid - // DiscardOverdraw may have truncated client drawing area so recalculate endWindow - endWindow = PositionAfterArea(GetClientDrawingRectangle()); - pdoc->EnsureStyledTo(endWindow); - } -} - -int Editor::PositionAfterMaxStyling(int posMax, bool scrolling) const { - if ((idleStyling == SC_IDLESTYLING_NONE) || (idleStyling == SC_IDLESTYLING_AFTERVISIBLE)) { - // Both states do not limit styling - return posMax; - } - - // Try to keep time taken by styling reasonable so interaction remains smooth. - // When scrolling, allow less time to ensure responsive - const double secondsAllowed = scrolling ? 0.005 : 0.02; - - const int linesToStyle = Platform::Clamp(static_cast(secondsAllowed / pdoc->durationStyleOneLine), - 10, 0x10000); - const int stylingMaxLine = std::min( - static_cast(pdoc->LineFromPosition(pdoc->GetEndStyled()) + linesToStyle), - pdoc->LinesTotal()); - return std::min(static_cast(pdoc->LineStart(stylingMaxLine)), posMax); -} - -void Editor::StartIdleStyling(bool truncatedLastStyling) { - if ((idleStyling == SC_IDLESTYLING_ALL) || (idleStyling == SC_IDLESTYLING_AFTERVISIBLE)) { - if (pdoc->GetEndStyled() < pdoc->Length()) { - // Style remainder of document in idle time - needIdleStyling = true; - } - } else if (truncatedLastStyling) { - needIdleStyling = true; - } - - if (needIdleStyling) { - SetIdle(true); - } -} - -// Style for an area but bound the amount of styling to remain responsive -void Editor::StyleAreaBounded(PRectangle rcArea, bool scrolling) { - const int posAfterArea = PositionAfterArea(rcArea); - const int posAfterMax = PositionAfterMaxStyling(posAfterArea, scrolling); - if (posAfterMax < posAfterArea) { - // Idle styling may be performed before current visible area - // Style a bit now then style further in idle time - pdoc->StyleToAdjustingLineDuration(posAfterMax); - } else { - // Can style all wanted now. - StyleToPositionInView(posAfterArea); - } - StartIdleStyling(posAfterMax < posAfterArea); -} - -void Editor::IdleStyling() { - const int posAfterArea = PositionAfterArea(GetClientRectangle()); - const int endGoal = (idleStyling >= SC_IDLESTYLING_AFTERVISIBLE) ? - pdoc->Length() : posAfterArea; - const int posAfterMax = PositionAfterMaxStyling(endGoal, false); - pdoc->StyleToAdjustingLineDuration(posAfterMax); - if (pdoc->GetEndStyled() >= endGoal) { - needIdleStyling = false; - } -} - -void Editor::IdleWork() { - // Style the line after the modification as this allows modifications that change just the - // line of the modification to heal instead of propagating to the rest of the window. - if (workNeeded.items & WorkNeeded::workStyle) { - StyleToPositionInView(pdoc->LineStart(pdoc->LineFromPosition(workNeeded.upTo) + 2)); - } - NotifyUpdateUI(); - workNeeded.Reset(); -} - -void Editor::QueueIdleWork(WorkNeeded::workItems items, int upTo) { - workNeeded.Need(items, upTo); -} - -bool Editor::PaintContains(PRectangle rc) { - if (rc.Empty()) { - return true; - } else { - return rcPaint.Contains(rc); - } -} - -bool Editor::PaintContainsMargin() { - if (wMargin.GetID()) { - // With separate margin view, paint of text view - // never contains margin. - return false; - } - PRectangle rcSelMargin = GetClientRectangle(); - rcSelMargin.right = static_cast(vs.textStart); - return PaintContains(rcSelMargin); -} - -void Editor::CheckForChangeOutsidePaint(Range r) { - if (paintState == painting && !paintingAllText) { - //Platform::DebugPrintf("Checking range in paint %d-%d\n", r.start, r.end); - if (!r.Valid()) - return; - - PRectangle rcRange = RectangleFromRange(r, 0); - PRectangle rcText = GetTextRectangle(); - if (rcRange.top < rcText.top) { - rcRange.top = rcText.top; - } - if (rcRange.bottom > rcText.bottom) { - rcRange.bottom = rcText.bottom; - } - - if (!PaintContains(rcRange)) { - AbandonPaint(); - paintAbandonedByStyling = true; - } - } -} - -void Editor::SetBraceHighlight(Position pos0, Position pos1, int matchStyle) { - if ((pos0 != braces[0]) || (pos1 != braces[1]) || (matchStyle != bracesMatchStyle)) { - if ((braces[0] != pos0) || (matchStyle != bracesMatchStyle)) { - CheckForChangeOutsidePaint(Range(braces[0])); - CheckForChangeOutsidePaint(Range(pos0)); - braces[0] = pos0; - } - if ((braces[1] != pos1) || (matchStyle != bracesMatchStyle)) { - CheckForChangeOutsidePaint(Range(braces[1])); - CheckForChangeOutsidePaint(Range(pos1)); - braces[1] = pos1; - } - bracesMatchStyle = matchStyle; - if (paintState == notPainting) { - Redraw(); - } - } -} - -void Editor::SetAnnotationHeights(int start, int end) { - if (vs.annotationVisible) { - RefreshStyleData(); - bool changedHeight = false; - for (int line=start; lineLinesTotal(); line++) { - int linesWrapped = 1; - if (Wrapping()) { - AutoSurface surface(this); - AutoLineLayout ll(view.llc, view.RetrieveLineLayout(line, *this)); - if (surface && ll) { - view.LayoutLine(*this, line, surface, vs, ll, wrapWidth); - linesWrapped = ll->lines; - } - } - if (cs.SetHeight(line, pdoc->AnnotationLines(line) + linesWrapped)) - changedHeight = true; - } - if (changedHeight) { - Redraw(); - } - } -} - -void Editor::SetDocPointer(Document *document) { - //Platform::DebugPrintf("** %x setdoc to %x\n", pdoc, document); - pdoc->RemoveWatcher(this, 0); - pdoc->Release(); - if (document == NULL) { - pdoc = new Document(); - } else { - pdoc = document; - } - pdoc->AddRef(); - - // Ensure all positions within document - sel.Clear(); - targetStart = 0; - targetEnd = 0; - - braces[0] = invalidPosition; - braces[1] = invalidPosition; - - vs.ReleaseAllExtendedStyles(); - - SetRepresentations(); - - // Reset the contraction state to fully shown. - cs.Clear(); - cs.InsertLines(0, pdoc->LinesTotal() - 1); - SetAnnotationHeights(0, pdoc->LinesTotal()); - view.llc.Deallocate(); - NeedWrapping(); - - hotspot = Range(invalidPosition); - hoverIndicatorPos = invalidPosition; - - view.ClearAllTabstops(); - - pdoc->AddWatcher(this, 0); - SetScrollBars(); - Redraw(); -} - -void Editor::SetAnnotationVisible(int visible) { - if (vs.annotationVisible != visible) { - bool changedFromOrToHidden = ((vs.annotationVisible != 0) != (visible != 0)); - vs.annotationVisible = visible; - if (changedFromOrToHidden) { - int dir = vs.annotationVisible ? 1 : -1; - for (int line=0; lineLinesTotal(); line++) { - int annotationLines = pdoc->AnnotationLines(line); - if (annotationLines > 0) { - cs.SetHeight(line, cs.GetHeight(line) + annotationLines * dir); - } - } - } - Redraw(); - } -} - -/** - * Recursively expand a fold, making lines visible except where they have an unexpanded parent. - */ -int Editor::ExpandLine(int line) { - int lineMaxSubord = pdoc->GetLastChild(line); - line++; - while (line <= lineMaxSubord) { - cs.SetVisible(line, line, true); - int level = pdoc->GetLevel(line); - if (level & SC_FOLDLEVELHEADERFLAG) { - if (cs.GetExpanded(line)) { - line = ExpandLine(line); - } else { - line = pdoc->GetLastChild(line); - } - } - line++; - } - return lineMaxSubord; -} - -void Editor::SetFoldExpanded(int lineDoc, bool expanded) { - if (cs.SetExpanded(lineDoc, expanded)) { - RedrawSelMargin(); - } -} - -void Editor::FoldLine(int line, int action) { - if (line >= 0) { - if (action == SC_FOLDACTION_TOGGLE) { - if ((pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) == 0) { - line = pdoc->GetFoldParent(line); - if (line < 0) - return; - } - action = (cs.GetExpanded(line)) ? SC_FOLDACTION_CONTRACT : SC_FOLDACTION_EXPAND; - } - - if (action == SC_FOLDACTION_CONTRACT) { - int lineMaxSubord = pdoc->GetLastChild(line); - if (lineMaxSubord > line) { - cs.SetExpanded(line, 0); - cs.SetVisible(line + 1, lineMaxSubord, false); - - int lineCurrent = pdoc->LineFromPosition(sel.MainCaret()); - if (lineCurrent > line && lineCurrent <= lineMaxSubord) { - // This does not re-expand the fold - EnsureCaretVisible(); - } - } - - } else { - if (!(cs.GetVisible(line))) { - EnsureLineVisible(line, false); - GoToLine(line); - } - cs.SetExpanded(line, 1); - ExpandLine(line); - } - - SetScrollBars(); - Redraw(); - } -} - -void Editor::FoldExpand(int line, int action, int level) { - bool expanding = action == SC_FOLDACTION_EXPAND; - if (action == SC_FOLDACTION_TOGGLE) { - expanding = !cs.GetExpanded(line); - } - // Ensure child lines lexed and fold information extracted before - // flipping the state. - pdoc->GetLastChild(line, LevelNumber(level)); - SetFoldExpanded(line, expanding); - if (expanding && (cs.HiddenLines() == 0)) - // Nothing to do - return; - int lineMaxSubord = pdoc->GetLastChild(line, LevelNumber(level)); - line++; - cs.SetVisible(line, lineMaxSubord, expanding); - while (line <= lineMaxSubord) { - int levelLine = pdoc->GetLevel(line); - if (levelLine & SC_FOLDLEVELHEADERFLAG) { - SetFoldExpanded(line, expanding); - } - line++; - } - SetScrollBars(); - Redraw(); -} - -int Editor::ContractedFoldNext(int lineStart) const { - for (int line = lineStart; lineLinesTotal();) { - if (!cs.GetExpanded(line) && (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG)) - return line; - line = cs.ContractedNext(line+1); - if (line < 0) - return -1; - } - - return -1; -} - -/** - * Recurse up from this line to find any folds that prevent this line from being visible - * and unfold them all. - */ -void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) { - - // In case in need of wrapping to ensure DisplayFromDoc works. - if (lineDoc >= wrapPending.start) - WrapLines(wsAll); - - if (!cs.GetVisible(lineDoc)) { - // Back up to find a non-blank line - int lookLine = lineDoc; - int lookLineLevel = pdoc->GetLevel(lookLine); - while ((lookLine > 0) && (lookLineLevel & SC_FOLDLEVELWHITEFLAG)) { - lookLineLevel = pdoc->GetLevel(--lookLine); - } - int lineParent = pdoc->GetFoldParent(lookLine); - if (lineParent < 0) { - // Backed up to a top level line, so try to find parent of initial line - lineParent = pdoc->GetFoldParent(lineDoc); - } - if (lineParent >= 0) { - if (lineDoc != lineParent) - EnsureLineVisible(lineParent, enforcePolicy); - if (!cs.GetExpanded(lineParent)) { - cs.SetExpanded(lineParent, 1); - ExpandLine(lineParent); - } - } - SetScrollBars(); - Redraw(); - } - if (enforcePolicy) { - int lineDisplay = cs.DisplayFromDoc(lineDoc); - if (visiblePolicy & VISIBLE_SLOP) { - if ((topLine > lineDisplay) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > lineDisplay))) { - SetTopLine(Platform::Clamp(lineDisplay - visibleSlop, 0, MaxScrollPos())); - SetVerticalScrollPos(); - Redraw(); - } else if ((lineDisplay > topLine + LinesOnScreen() - 1) || - ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) { - SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos())); - SetVerticalScrollPos(); - Redraw(); - } - } else { - if ((topLine > lineDisplay) || (lineDisplay > topLine + LinesOnScreen() - 1) || (visiblePolicy & VISIBLE_STRICT)) { - SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() / 2 + 1, 0, MaxScrollPos())); - SetVerticalScrollPos(); - Redraw(); - } - } - } -} - -void Editor::FoldAll(int action) { - pdoc->EnsureStyledTo(pdoc->Length()); - int maxLine = pdoc->LinesTotal(); - bool expanding = action == SC_FOLDACTION_EXPAND; - if (action == SC_FOLDACTION_TOGGLE) { - // Discover current state - for (int lineSeek = 0; lineSeek < maxLine; lineSeek++) { - if (pdoc->GetLevel(lineSeek) & SC_FOLDLEVELHEADERFLAG) { - expanding = !cs.GetExpanded(lineSeek); - break; - } - } - } - if (expanding) { - cs.SetVisible(0, maxLine-1, true); - for (int line = 0; line < maxLine; line++) { - int levelLine = pdoc->GetLevel(line); - if (levelLine & SC_FOLDLEVELHEADERFLAG) { - SetFoldExpanded(line, true); - } - } - } else { - for (int line = 0; line < maxLine; line++) { - int level = pdoc->GetLevel(line); - if ((level & SC_FOLDLEVELHEADERFLAG) && - (SC_FOLDLEVELBASE == LevelNumber(level))) { - SetFoldExpanded(line, false); - int lineMaxSubord = pdoc->GetLastChild(line, -1); - if (lineMaxSubord > line) { - cs.SetVisible(line + 1, lineMaxSubord, false); - } - } - } - } - SetScrollBars(); - Redraw(); -} - -void Editor::FoldChanged(int line, int levelNow, int levelPrev) { - if (levelNow & SC_FOLDLEVELHEADERFLAG) { - if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) { - // Adding a fold point. - if (cs.SetExpanded(line, true)) { - RedrawSelMargin(); - } - FoldExpand(line, SC_FOLDACTION_EXPAND, levelPrev); - } - } else if (levelPrev & SC_FOLDLEVELHEADERFLAG) { - const int prevLine = line - 1; - const int prevLineLevel = pdoc->GetLevel(prevLine); - - // Combining two blocks where the first block is collapsed (e.g. by deleting the line(s) which separate(s) the two blocks) - if ((LevelNumber(prevLineLevel) == LevelNumber(levelNow)) && !cs.GetVisible(prevLine)) - FoldLine(pdoc->GetFoldParent(prevLine), SC_FOLDACTION_EXPAND); - - if (!cs.GetExpanded(line)) { - // Removing the fold from one that has been contracted so should expand - // otherwise lines are left invisible with no way to make them visible - if (cs.SetExpanded(line, true)) { - RedrawSelMargin(); - } - // Combining two blocks where the second one is collapsed (e.g. by adding characters in the line which separates the two blocks) - FoldExpand(line, SC_FOLDACTION_EXPAND, levelPrev); - } - } - if (!(levelNow & SC_FOLDLEVELWHITEFLAG) && - (LevelNumber(levelPrev) > LevelNumber(levelNow))) { - if (cs.HiddenLines()) { - // See if should still be hidden - int parentLine = pdoc->GetFoldParent(line); - if ((parentLine < 0) || (cs.GetExpanded(parentLine) && cs.GetVisible(parentLine))) { - cs.SetVisible(line, line, true); - SetScrollBars(); - Redraw(); - } - } - } - - // Combining two blocks where the first one is collapsed (e.g. by adding characters in the line which separates the two blocks) - if (!(levelNow & SC_FOLDLEVELWHITEFLAG) && (LevelNumber(levelPrev) < LevelNumber(levelNow))) { - if (cs.HiddenLines()) { - const int parentLine = pdoc->GetFoldParent(line); - if (!cs.GetExpanded(parentLine) && cs.GetExpanded(line)) - FoldLine(parentLine, SC_FOLDACTION_EXPAND); - } - } -} - -void Editor::NeedShown(int pos, int len) { - if (foldAutomatic & SC_AUTOMATICFOLD_SHOW) { - int lineStart = pdoc->LineFromPosition(pos); - int lineEnd = pdoc->LineFromPosition(pos+len); - for (int line = lineStart; line <= lineEnd; line++) { - EnsureLineVisible(line, false); - } - } else { - NotifyNeedShown(pos, len); - } -} - -int Editor::GetTag(char *tagValue, int tagNumber) { - const char *text = 0; - int length = 0; - if ((tagNumber >= 1) && (tagNumber <= 9)) { - char name[3] = "\\?"; - name[1] = static_cast(tagNumber + '0'); - length = 2; - text = pdoc->SubstituteByPosition(name, &length); - } - if (tagValue) { - if (text) - memcpy(tagValue, text, length + 1); - else - *tagValue = '\0'; - } - return length; -} - -int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) { - UndoGroup ug(pdoc); - if (length == -1) - length = istrlen(text); - if (replacePatterns) { - text = pdoc->SubstituteByPosition(text, &length); - if (!text) { - return 0; - } - } - if (targetStart != targetEnd) - pdoc->DeleteChars(targetStart, targetEnd - targetStart); - targetEnd = targetStart; - const int lengthInserted = pdoc->InsertString(targetStart, text, length); - targetEnd = targetStart + lengthInserted; - return length; -} - -bool Editor::IsUnicodeMode() const { - return pdoc && (SC_CP_UTF8 == pdoc->dbcsCodePage); -} - -int Editor::CodePage() const { - if (pdoc) - return pdoc->dbcsCodePage; - else - return 0; -} - -int Editor::WrapCount(int line) { - AutoSurface surface(this); - AutoLineLayout ll(view.llc, view.RetrieveLineLayout(line, *this)); - - if (surface && ll) { - view.LayoutLine(*this, line, surface, vs, ll, wrapWidth); - return ll->lines; - } else { - return 1; - } -} - -void Editor::AddStyledText(char *buffer, int appendLength) { - // The buffer consists of alternating character bytes and style bytes - int textLength = appendLength / 2; - std::string text(textLength, '\0'); - int i; - for (i = 0; i < textLength; i++) { - text[i] = buffer[i*2]; - } - const int lengthInserted = pdoc->InsertString(CurrentPosition(), text.c_str(), textLength); - for (i = 0; i < textLength; i++) { - text[i] = buffer[i*2+1]; - } - pdoc->StartStyling(CurrentPosition(), static_cast(0xff)); - pdoc->SetStyles(textLength, text.c_str()); - SetEmptySelection(sel.MainCaret() + lengthInserted); -} - -bool Editor::ValidMargin(uptr_t wParam) const { - return wParam < vs.ms.size(); -} - -static char *CharPtrFromSPtr(sptr_t lParam) { - return reinterpret_cast(lParam); -} - -void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - vs.EnsureStyle(wParam); - switch (iMessage) { - case SCI_STYLESETFORE: - vs.styles[wParam].fore = ColourDesired(static_cast(lParam)); - break; - case SCI_STYLESETBACK: - vs.styles[wParam].back = ColourDesired(static_cast(lParam)); - break; - case SCI_STYLESETBOLD: - vs.styles[wParam].weight = lParam != 0 ? SC_WEIGHT_BOLD : SC_WEIGHT_NORMAL; - break; - case SCI_STYLESETWEIGHT: - vs.styles[wParam].weight = static_cast(lParam); - break; - case SCI_STYLESETITALIC: - vs.styles[wParam].italic = lParam != 0; - break; - case SCI_STYLESETEOLFILLED: - vs.styles[wParam].eolFilled = lParam != 0; - break; - case SCI_STYLESETSIZE: - vs.styles[wParam].size = static_cast(lParam * SC_FONT_SIZE_MULTIPLIER); - break; - case SCI_STYLESETSIZEFRACTIONAL: - vs.styles[wParam].size = static_cast(lParam); - break; - case SCI_STYLESETFONT: - if (lParam != 0) { - vs.SetStyleFontName(static_cast(wParam), CharPtrFromSPtr(lParam)); - } - break; - case SCI_STYLESETUNDERLINE: - vs.styles[wParam].underline = lParam != 0; - break; - case SCI_STYLESETCASE: - vs.styles[wParam].caseForce = static_cast(lParam); - break; - case SCI_STYLESETCHARACTERSET: - vs.styles[wParam].characterSet = static_cast(lParam); - pdoc->SetCaseFolder(NULL); - break; - case SCI_STYLESETVISIBLE: - vs.styles[wParam].visible = lParam != 0; - break; - case SCI_STYLESETCHANGEABLE: - vs.styles[wParam].changeable = lParam != 0; - break; - case SCI_STYLESETHOTSPOT: - vs.styles[wParam].hotspot = lParam != 0; - break; - } - InvalidateStyleRedraw(); -} - -sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - vs.EnsureStyle(wParam); - switch (iMessage) { - case SCI_STYLEGETFORE: - return vs.styles[wParam].fore.AsLong(); - case SCI_STYLEGETBACK: - return vs.styles[wParam].back.AsLong(); - case SCI_STYLEGETBOLD: - return vs.styles[wParam].weight > SC_WEIGHT_NORMAL; - case SCI_STYLEGETWEIGHT: - return vs.styles[wParam].weight; - case SCI_STYLEGETITALIC: - return vs.styles[wParam].italic ? 1 : 0; - case SCI_STYLEGETEOLFILLED: - return vs.styles[wParam].eolFilled ? 1 : 0; - case SCI_STYLEGETSIZE: - return vs.styles[wParam].size / SC_FONT_SIZE_MULTIPLIER; - case SCI_STYLEGETSIZEFRACTIONAL: - return vs.styles[wParam].size; - case SCI_STYLEGETFONT: - return StringResult(lParam, vs.styles[wParam].fontName); - case SCI_STYLEGETUNDERLINE: - return vs.styles[wParam].underline ? 1 : 0; - case SCI_STYLEGETCASE: - return static_cast(vs.styles[wParam].caseForce); - case SCI_STYLEGETCHARACTERSET: - return vs.styles[wParam].characterSet; - case SCI_STYLEGETVISIBLE: - return vs.styles[wParam].visible ? 1 : 0; - case SCI_STYLEGETCHANGEABLE: - return vs.styles[wParam].changeable ? 1 : 0; - case SCI_STYLEGETHOTSPOT: - return vs.styles[wParam].hotspot ? 1 : 0; - } - return 0; -} - -void Editor::SetSelectionNMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - InvalidateRange(sel.Range(wParam).Start().Position(), sel.Range(wParam).End().Position()); - - switch (iMessage) { - case SCI_SETSELECTIONNCARET: - sel.Range(wParam).caret.SetPosition(static_cast(lParam)); - break; - - case SCI_SETSELECTIONNANCHOR: - sel.Range(wParam).anchor.SetPosition(static_cast(lParam)); - break; - - case SCI_SETSELECTIONNCARETVIRTUALSPACE: - sel.Range(wParam).caret.SetVirtualSpace(static_cast(lParam)); - break; - - case SCI_SETSELECTIONNANCHORVIRTUALSPACE: - sel.Range(wParam).anchor.SetVirtualSpace(static_cast(lParam)); - break; - - case SCI_SETSELECTIONNSTART: - sel.Range(wParam).anchor.SetPosition(static_cast(lParam)); - break; - - case SCI_SETSELECTIONNEND: - sel.Range(wParam).caret.SetPosition(static_cast(lParam)); - break; - } - - InvalidateRange(sel.Range(wParam).Start().Position(), sel.Range(wParam).End().Position()); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); -} - -sptr_t Editor::StringResult(sptr_t lParam, const char *val) { - const size_t len = val ? strlen(val) : 0; - if (lParam) { - char *ptr = CharPtrFromSPtr(lParam); - if (val) - memcpy(ptr, val, len+1); - else - *ptr = 0; - } - return len; // Not including NUL -} - -sptr_t Editor::BytesResult(sptr_t lParam, const unsigned char *val, size_t len) { - // No NUL termination: len is number of valid/displayed bytes - if ((lParam) && (len > 0)) { - char *ptr = CharPtrFromSPtr(lParam); - if (val) - memcpy(ptr, val, len); - else - *ptr = 0; - } - return val ? len : 0; -} - -sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - //Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam); - - // Optional macro recording hook - if (recordingMacro) - NotifyMacroRecord(iMessage, wParam, lParam); - - switch (iMessage) { - - case SCI_GETTEXT: { - if (lParam == 0) - return pdoc->Length() + 1; - if (wParam == 0) - return 0; - char *ptr = CharPtrFromSPtr(lParam); - unsigned int iChar = 0; - for (; iChar < wParam - 1; iChar++) - ptr[iChar] = pdoc->CharAt(iChar); - ptr[iChar] = '\0'; - return iChar; - } - - case SCI_SETTEXT: { - if (lParam == 0) - return 0; - UndoGroup ug(pdoc); - pdoc->DeleteChars(0, pdoc->Length()); - SetEmptySelection(0); - const char *text = CharPtrFromSPtr(lParam); - pdoc->InsertString(0, text, istrlen(text)); - return 1; - } - - case SCI_GETTEXTLENGTH: - return pdoc->Length(); - - case SCI_CUT: - Cut(); - SetLastXChosen(); - break; - - case SCI_COPY: - Copy(); - break; - - case SCI_COPYALLOWLINE: - CopyAllowLine(); - break; - - case SCI_VERTICALCENTRECARET: - VerticalCentreCaret(); - break; - - case SCI_MOVESELECTEDLINESUP: - MoveSelectedLinesUp(); - break; - - case SCI_MOVESELECTEDLINESDOWN: - MoveSelectedLinesDown(); - break; - - case SCI_COPYRANGE: - CopyRangeToClipboard(static_cast(wParam), static_cast(lParam)); - break; - - case SCI_COPYTEXT: - CopyText(static_cast(wParam), CharPtrFromSPtr(lParam)); - break; - - case SCI_PASTE: - Paste(); - if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) { - SetLastXChosen(); - } - EnsureCaretVisible(); - break; - - case SCI_CLEAR: - Clear(); - SetLastXChosen(); - EnsureCaretVisible(); - break; - - case SCI_UNDO: - Undo(); - SetLastXChosen(); - break; - - case SCI_CANUNDO: - return (pdoc->CanUndo() && !pdoc->IsReadOnly()) ? 1 : 0; - - case SCI_EMPTYUNDOBUFFER: - pdoc->DeleteUndoHistory(); - return 0; - - case SCI_GETFIRSTVISIBLELINE: - return topLine; - - case SCI_SETFIRSTVISIBLELINE: - ScrollTo(static_cast(wParam)); - break; - - case SCI_GETLINE: { // Risk of overwriting the end of the buffer - int lineStart = pdoc->LineStart(static_cast(wParam)); - int lineEnd = pdoc->LineStart(static_cast(wParam + 1)); - if (lParam == 0) { - return lineEnd - lineStart; - } - char *ptr = CharPtrFromSPtr(lParam); - int iPlace = 0; - for (int iChar = lineStart; iChar < lineEnd; iChar++) { - ptr[iPlace++] = pdoc->CharAt(iChar); - } - return iPlace; - } - - case SCI_GETLINECOUNT: - if (pdoc->LinesTotal() == 0) - return 1; - else - return pdoc->LinesTotal(); - - case SCI_GETMODIFY: - return !pdoc->IsSavePoint(); - - case SCI_SETSEL: { - int nStart = static_cast(wParam); - int nEnd = static_cast(lParam); - if (nEnd < 0) - nEnd = pdoc->Length(); - if (nStart < 0) - nStart = nEnd; // Remove selection - InvalidateSelection(SelectionRange(nStart, nEnd)); - sel.Clear(); - sel.selType = Selection::selStream; - SetSelection(nEnd, nStart); - EnsureCaretVisible(); - } - break; - - case SCI_GETSELTEXT: { - SelectionText selectedText; - CopySelectionRange(&selectedText); - if (lParam == 0) { - return selectedText.LengthWithTerminator(); - } else { - char *ptr = CharPtrFromSPtr(lParam); - unsigned int iChar = 0; - if (selectedText.Length()) { - for (; iChar < selectedText.LengthWithTerminator(); iChar++) - ptr[iChar] = selectedText.Data()[iChar]; - } else { - ptr[0] = '\0'; - } - return iChar; - } - } - - case SCI_LINEFROMPOSITION: - if (static_cast(wParam) < 0) - return 0; - return pdoc->LineFromPosition(static_cast(wParam)); - - case SCI_POSITIONFROMLINE: - if (static_cast(wParam) < 0) - wParam = pdoc->LineFromPosition(SelectionStart().Position()); - if (wParam == 0) - return 0; // Even if there is no text, there is a first line that starts at 0 - if (static_cast(wParam) > pdoc->LinesTotal()) - return -1; - //if (wParam > pdoc->LineFromPosition(pdoc->Length())) // Useful test, anyway... - // return -1; - return pdoc->LineStart(static_cast(wParam)); - - // Replacement of the old Scintilla interpretation of EM_LINELENGTH - case SCI_LINELENGTH: - if ((static_cast(wParam) < 0) || - (static_cast(wParam) > pdoc->LineFromPosition(pdoc->Length()))) - return 0; - return pdoc->LineStart(static_cast(wParam) + 1) - pdoc->LineStart(static_cast(wParam)); - - case SCI_REPLACESEL: { - if (lParam == 0) - return 0; - UndoGroup ug(pdoc); - ClearSelection(); - char *replacement = CharPtrFromSPtr(lParam); - const int lengthInserted = pdoc->InsertString( - sel.MainCaret(), replacement, istrlen(replacement)); - SetEmptySelection(sel.MainCaret() + lengthInserted); - EnsureCaretVisible(); - } - break; - - case SCI_SETTARGETSTART: - targetStart = static_cast(wParam); - break; - - case SCI_GETTARGETSTART: - return targetStart; - - case SCI_SETTARGETEND: - targetEnd = static_cast(wParam); - break; - - case SCI_GETTARGETEND: - return targetEnd; - - case SCI_SETTARGETRANGE: - targetStart = static_cast(wParam); - targetEnd = static_cast(lParam); - break; - - case SCI_TARGETWHOLEDOCUMENT: - targetStart = 0; - targetEnd = pdoc->Length(); - break; - - case SCI_TARGETFROMSELECTION: - if (sel.MainCaret() < sel.MainAnchor()) { - targetStart = sel.MainCaret(); - targetEnd = sel.MainAnchor(); - } else { - targetStart = sel.MainAnchor(); - targetEnd = sel.MainCaret(); - } - break; - - case SCI_GETTARGETTEXT: { - std::string text = RangeText(targetStart, targetEnd); - return BytesResult(lParam, reinterpret_cast(text.c_str()), text.length()); - } - - case SCI_REPLACETARGET: - PLATFORM_ASSERT(lParam); - return ReplaceTarget(false, CharPtrFromSPtr(lParam), static_cast(wParam)); - - case SCI_REPLACETARGETRE: - PLATFORM_ASSERT(lParam); - return ReplaceTarget(true, CharPtrFromSPtr(lParam), static_cast(wParam)); - - case SCI_SEARCHINTARGET: - PLATFORM_ASSERT(lParam); - return SearchInTarget(CharPtrFromSPtr(lParam), static_cast(wParam)); - - case SCI_SETSEARCHFLAGS: - searchFlags = static_cast(wParam); - break; - - case SCI_GETSEARCHFLAGS: - return searchFlags; - - case SCI_GETTAG: - return GetTag(CharPtrFromSPtr(lParam), static_cast(wParam)); - - case SCI_POSITIONBEFORE: - return pdoc->MovePositionOutsideChar(static_cast(wParam) - 1, -1, true); - - case SCI_POSITIONAFTER: - return pdoc->MovePositionOutsideChar(static_cast(wParam) + 1, 1, true); - - case SCI_POSITIONRELATIVE: - return Platform::Clamp(pdoc->GetRelativePosition(static_cast(wParam), static_cast(lParam)), 0, pdoc->Length()); - - case SCI_LINESCROLL: - ScrollTo(topLine + static_cast(lParam)); - HorizontalScrollTo(xOffset + static_cast(wParam)* static_cast(vs.spaceWidth)); - return 1; - - case SCI_SETXOFFSET: - xOffset = static_cast(wParam); - ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); - SetHorizontalScrollPos(); - Redraw(); - break; - - case SCI_GETXOFFSET: - return xOffset; - - case SCI_CHOOSECARETX: - SetLastXChosen(); - break; - - case SCI_SCROLLCARET: - EnsureCaretVisible(); - break; - - case SCI_SETREADONLY: - pdoc->SetReadOnly(wParam != 0); - return 1; - - case SCI_GETREADONLY: - return pdoc->IsReadOnly(); - - case SCI_CANPASTE: - return CanPaste(); - - case SCI_POINTXFROMPOSITION: - if (lParam < 0) { - return 0; - } else { - Point pt = LocationFromPosition(static_cast(lParam)); - // Convert to view-relative - return static_cast(pt.x) - vs.textStart + vs.fixedColumnWidth; - } - - case SCI_POINTYFROMPOSITION: - if (lParam < 0) { - return 0; - } else { - Point pt = LocationFromPosition(static_cast(lParam)); - return static_cast(pt.y); - } - - case SCI_FINDTEXT: - return FindText(wParam, lParam); - - case SCI_GETTEXTRANGE: { - if (lParam == 0) - return 0; - Sci_TextRange *tr = reinterpret_cast(lParam); - int cpMax = static_cast(tr->chrg.cpMax); - if (cpMax == -1) - cpMax = pdoc->Length(); - PLATFORM_ASSERT(cpMax <= pdoc->Length()); - int len = static_cast(cpMax - tr->chrg.cpMin); // No -1 as cpMin and cpMax are referring to inter character positions - pdoc->GetCharRange(tr->lpstrText, static_cast(tr->chrg.cpMin), len); - // Spec says copied text is terminated with a NUL - tr->lpstrText[len] = '\0'; - return len; // Not including NUL - } - - case SCI_HIDESELECTION: - view.hideSelection = wParam != 0; - Redraw(); - break; - - case SCI_FORMATRANGE: - return FormatRange(wParam != 0, reinterpret_cast(lParam)); - - case SCI_GETMARGINLEFT: - return vs.leftMarginWidth; - - case SCI_GETMARGINRIGHT: - return vs.rightMarginWidth; - - case SCI_SETMARGINLEFT: - lastXChosen += static_cast(lParam) - vs.leftMarginWidth; - vs.leftMarginWidth = static_cast(lParam); - InvalidateStyleRedraw(); - break; - - case SCI_SETMARGINRIGHT: - vs.rightMarginWidth = static_cast(lParam); - InvalidateStyleRedraw(); - break; - - // Control specific mesages - - case SCI_ADDTEXT: { - if (lParam == 0) - return 0; - const int lengthInserted = pdoc->InsertString( - CurrentPosition(), CharPtrFromSPtr(lParam), static_cast(wParam)); - SetEmptySelection(sel.MainCaret() + lengthInserted); - return 0; - } - - case SCI_ADDSTYLEDTEXT: - if (lParam) - AddStyledText(CharPtrFromSPtr(lParam), static_cast(wParam)); - return 0; - - case SCI_INSERTTEXT: { - if (lParam == 0) - return 0; - int insertPos = static_cast(wParam); - if (static_cast(wParam) == -1) - insertPos = CurrentPosition(); - int newCurrent = CurrentPosition(); - char *sz = CharPtrFromSPtr(lParam); - const int lengthInserted = pdoc->InsertString(insertPos, sz, istrlen(sz)); - if (newCurrent > insertPos) - newCurrent += lengthInserted; - SetEmptySelection(newCurrent); - return 0; - } - - case SCI_CHANGEINSERTION: - PLATFORM_ASSERT(lParam); - pdoc->ChangeInsertion(CharPtrFromSPtr(lParam), static_cast(wParam)); - return 0; - - case SCI_APPENDTEXT: - pdoc->InsertString(pdoc->Length(), CharPtrFromSPtr(lParam), static_cast(wParam)); - return 0; - - case SCI_CLEARALL: - ClearAll(); - return 0; - - case SCI_DELETERANGE: - pdoc->DeleteChars(static_cast(wParam), static_cast(lParam)); - return 0; - - case SCI_CLEARDOCUMENTSTYLE: - ClearDocumentStyle(); - return 0; - - case SCI_SETUNDOCOLLECTION: - pdoc->SetUndoCollection(wParam != 0); - return 0; - - case SCI_GETUNDOCOLLECTION: - return pdoc->IsCollectingUndo(); - - case SCI_BEGINUNDOACTION: - pdoc->BeginUndoAction(); - return 0; - - case SCI_ENDUNDOACTION: - pdoc->EndUndoAction(); - return 0; - - case SCI_GETCARETPERIOD: - return caret.period; - - case SCI_SETCARETPERIOD: - CaretSetPeriod(static_cast(wParam)); - break; - - case SCI_GETWORDCHARS: - return pdoc->GetCharsOfClass(CharClassify::ccWord, reinterpret_cast(lParam)); - - case SCI_SETWORDCHARS: { - pdoc->SetDefaultCharClasses(false); - if (lParam == 0) - return 0; - pdoc->SetCharClasses(reinterpret_cast(lParam), CharClassify::ccWord); - } - break; - - case SCI_GETWHITESPACECHARS: - return pdoc->GetCharsOfClass(CharClassify::ccSpace, reinterpret_cast(lParam)); - - case SCI_SETWHITESPACECHARS: { - if (lParam == 0) - return 0; - pdoc->SetCharClasses(reinterpret_cast(lParam), CharClassify::ccSpace); - } - break; - - case SCI_GETPUNCTUATIONCHARS: - return pdoc->GetCharsOfClass(CharClassify::ccPunctuation, reinterpret_cast(lParam)); - - case SCI_SETPUNCTUATIONCHARS: { - if (lParam == 0) - return 0; - pdoc->SetCharClasses(reinterpret_cast(lParam), CharClassify::ccPunctuation); - } - break; - - case SCI_SETCHARSDEFAULT: - pdoc->SetDefaultCharClasses(true); - break; - - case SCI_GETLENGTH: - return pdoc->Length(); - - case SCI_ALLOCATE: - pdoc->Allocate(static_cast(wParam)); - break; - - case SCI_GETCHARAT: - return pdoc->CharAt(static_cast(wParam)); - - case SCI_SETCURRENTPOS: - if (sel.IsRectangular()) { - sel.Rectangular().caret.SetPosition(static_cast(wParam)); - SetRectangularRange(); - Redraw(); - } else { - SetSelection(static_cast(wParam), sel.MainAnchor()); - } - break; - - case SCI_GETCURRENTPOS: - return sel.IsRectangular() ? sel.Rectangular().caret.Position() : sel.MainCaret(); - - case SCI_SETANCHOR: - if (sel.IsRectangular()) { - sel.Rectangular().anchor.SetPosition(static_cast(wParam)); - SetRectangularRange(); - Redraw(); - } else { - SetSelection(sel.MainCaret(), static_cast(wParam)); - } - break; - - case SCI_GETANCHOR: - return sel.IsRectangular() ? sel.Rectangular().anchor.Position() : sel.MainAnchor(); - - case SCI_SETSELECTIONSTART: - SetSelection(Platform::Maximum(sel.MainCaret(), static_cast(wParam)), static_cast(wParam)); - break; - - case SCI_GETSELECTIONSTART: - return sel.LimitsForRectangularElseMain().start.Position(); - - case SCI_SETSELECTIONEND: - SetSelection(static_cast(wParam), Platform::Minimum(sel.MainAnchor(), static_cast(wParam))); - break; - - case SCI_GETSELECTIONEND: - return sel.LimitsForRectangularElseMain().end.Position(); - - case SCI_SETEMPTYSELECTION: - SetEmptySelection(static_cast(wParam)); - break; - - case SCI_SETPRINTMAGNIFICATION: - view.printParameters.magnification = static_cast(wParam); - break; - - case SCI_GETPRINTMAGNIFICATION: - return view.printParameters.magnification; - - case SCI_SETPRINTCOLOURMODE: - view.printParameters.colourMode = static_cast(wParam); - break; - - case SCI_GETPRINTCOLOURMODE: - return view.printParameters.colourMode; - - case SCI_SETPRINTWRAPMODE: - view.printParameters.wrapState = (wParam == SC_WRAP_WORD) ? eWrapWord : eWrapNone; - break; - - case SCI_GETPRINTWRAPMODE: - return view.printParameters.wrapState; - - case SCI_GETSTYLEAT: - if (static_cast(wParam) >= pdoc->Length()) - return 0; - else - return pdoc->StyleAt(static_cast(wParam)); - - case SCI_REDO: - Redo(); - break; - - case SCI_SELECTALL: - SelectAll(); - break; - - case SCI_SETSAVEPOINT: - pdoc->SetSavePoint(); - break; - - case SCI_GETSTYLEDTEXT: { - if (lParam == 0) - return 0; - Sci_TextRange *tr = reinterpret_cast(lParam); - int iPlace = 0; - for (long iChar = tr->chrg.cpMin; iChar < tr->chrg.cpMax; iChar++) { - tr->lpstrText[iPlace++] = pdoc->CharAt(static_cast(iChar)); - tr->lpstrText[iPlace++] = pdoc->StyleAt(static_cast(iChar)); - } - tr->lpstrText[iPlace] = '\0'; - tr->lpstrText[iPlace + 1] = '\0'; - return iPlace; - } - - case SCI_CANREDO: - return (pdoc->CanRedo() && !pdoc->IsReadOnly()) ? 1 : 0; - - case SCI_MARKERLINEFROMHANDLE: - return pdoc->LineFromHandle(static_cast(wParam)); - - case SCI_MARKERDELETEHANDLE: - pdoc->DeleteMarkFromHandle(static_cast(wParam)); - break; - - case SCI_GETVIEWWS: - return vs.viewWhitespace; - - case SCI_SETVIEWWS: - vs.viewWhitespace = static_cast(wParam); - Redraw(); - break; - - case SCI_GETTABDRAWMODE: - return vs.tabDrawMode; - - case SCI_SETTABDRAWMODE: - vs.tabDrawMode = static_cast(wParam); - Redraw(); - break; - - case SCI_GETWHITESPACESIZE: - return vs.whitespaceSize; - - case SCI_SETWHITESPACESIZE: - vs.whitespaceSize = static_cast(wParam); - Redraw(); - break; - - case SCI_POSITIONFROMPOINT: - return PositionFromLocation(Point::FromInts(static_cast(wParam) - vs.ExternalMarginWidth(), static_cast(lParam)), - false, false); - - case SCI_POSITIONFROMPOINTCLOSE: - return PositionFromLocation(Point::FromInts(static_cast(wParam) - vs.ExternalMarginWidth(), static_cast(lParam)), - true, false); - - case SCI_CHARPOSITIONFROMPOINT: - return PositionFromLocation(Point::FromInts(static_cast(wParam) - vs.ExternalMarginWidth(), static_cast(lParam)), - false, true); - - case SCI_CHARPOSITIONFROMPOINTCLOSE: - return PositionFromLocation(Point::FromInts(static_cast(wParam) - vs.ExternalMarginWidth(), static_cast(lParam)), - true, true); - - case SCI_GOTOLINE: - GoToLine(static_cast(wParam)); - break; - - case SCI_GOTOPOS: - SetEmptySelection(static_cast(wParam)); - EnsureCaretVisible(); - break; - - case SCI_GETCURLINE: { - int lineCurrentPos = pdoc->LineFromPosition(sel.MainCaret()); - int lineStart = pdoc->LineStart(lineCurrentPos); - unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1); - if (lParam == 0) { - return 1 + lineEnd - lineStart; - } - PLATFORM_ASSERT(wParam > 0); - char *ptr = CharPtrFromSPtr(lParam); - unsigned int iPlace = 0; - for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) { - ptr[iPlace++] = pdoc->CharAt(iChar); - } - ptr[iPlace] = '\0'; - return sel.MainCaret() - lineStart; - } - - case SCI_GETENDSTYLED: - return pdoc->GetEndStyled(); - - case SCI_GETEOLMODE: - return pdoc->eolMode; - - case SCI_SETEOLMODE: - pdoc->eolMode = static_cast(wParam); - break; - - case SCI_SETLINEENDTYPESALLOWED: - if (pdoc->SetLineEndTypesAllowed(static_cast(wParam))) { - cs.Clear(); - cs.InsertLines(0, pdoc->LinesTotal() - 1); - SetAnnotationHeights(0, pdoc->LinesTotal()); - InvalidateStyleRedraw(); - } - break; - - case SCI_GETLINEENDTYPESALLOWED: - return pdoc->GetLineEndTypesAllowed(); - - case SCI_GETLINEENDTYPESACTIVE: - return pdoc->GetLineEndTypesActive(); - - case SCI_STARTSTYLING: - pdoc->StartStyling(static_cast(wParam), static_cast(lParam)); - break; - - case SCI_SETSTYLING: - if (static_cast(wParam) < 0) - errorStatus = SC_STATUS_FAILURE; - else - pdoc->SetStyleFor(static_cast(wParam), static_cast(lParam)); - break; - - case SCI_SETSTYLINGEX: // Specify a complete styling buffer - if (lParam == 0) - return 0; - pdoc->SetStyles(static_cast(wParam), CharPtrFromSPtr(lParam)); - break; - - case SCI_SETBUFFEREDDRAW: - view.bufferedDraw = wParam != 0; - break; - - case SCI_GETBUFFEREDDRAW: - return view.bufferedDraw; - - case SCI_GETTWOPHASEDRAW: - return view.phasesDraw == EditView::phasesTwo; - - case SCI_SETTWOPHASEDRAW: - if (view.SetTwoPhaseDraw(wParam != 0)) - InvalidateStyleRedraw(); - break; - - case SCI_GETPHASESDRAW: - return view.phasesDraw; - - case SCI_SETPHASESDRAW: - if (view.SetPhasesDraw(static_cast(wParam))) - InvalidateStyleRedraw(); - break; - - case SCI_SETFONTQUALITY: - vs.extraFontFlag &= ~SC_EFF_QUALITY_MASK; - vs.extraFontFlag |= (wParam & SC_EFF_QUALITY_MASK); - InvalidateStyleRedraw(); - break; - - case SCI_GETFONTQUALITY: - return (vs.extraFontFlag & SC_EFF_QUALITY_MASK); - - case SCI_SETTABWIDTH: - if (wParam > 0) { - pdoc->tabInChars = static_cast(wParam); - if (pdoc->indentInChars == 0) - pdoc->actualIndentInChars = pdoc->tabInChars; - } - InvalidateStyleRedraw(); - break; - - case SCI_GETTABWIDTH: - return pdoc->tabInChars; - - case SCI_CLEARTABSTOPS: - if (view.ClearTabstops(static_cast(wParam))) { - DocModification mh(SC_MOD_CHANGETABSTOPS, 0, 0, 0, 0, static_cast(wParam)); - NotifyModified(pdoc, mh, NULL); - } - break; - - case SCI_ADDTABSTOP: - if (view.AddTabstop(static_cast(wParam), static_cast(lParam))) { - DocModification mh(SC_MOD_CHANGETABSTOPS, 0, 0, 0, 0, static_cast(wParam)); - NotifyModified(pdoc, mh, NULL); - } - break; - - case SCI_GETNEXTTABSTOP: - return view.GetNextTabstop(static_cast(wParam), static_cast(lParam)); - - case SCI_SETINDENT: - pdoc->indentInChars = static_cast(wParam); - if (pdoc->indentInChars != 0) - pdoc->actualIndentInChars = pdoc->indentInChars; - else - pdoc->actualIndentInChars = pdoc->tabInChars; - InvalidateStyleRedraw(); - break; - - case SCI_GETINDENT: - return pdoc->indentInChars; - - case SCI_SETUSETABS: - pdoc->useTabs = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_GETUSETABS: - return pdoc->useTabs; - - case SCI_SETLINEINDENTATION: - pdoc->SetLineIndentation(static_cast(wParam), static_cast(lParam)); - break; - - case SCI_GETLINEINDENTATION: - return pdoc->GetLineIndentation(static_cast(wParam)); - - case SCI_GETLINEINDENTPOSITION: - return pdoc->GetLineIndentPosition(static_cast(wParam)); - - case SCI_SETTABINDENTS: - pdoc->tabIndents = wParam != 0; - break; - - case SCI_GETTABINDENTS: - return pdoc->tabIndents; - - case SCI_SETBACKSPACEUNINDENTS: - pdoc->backspaceUnindents = wParam != 0; - break; - - case SCI_GETBACKSPACEUNINDENTS: - return pdoc->backspaceUnindents; - - case SCI_SETMOUSEDWELLTIME: - dwellDelay = static_cast(wParam); - ticksToDwell = dwellDelay; - break; - - case SCI_GETMOUSEDWELLTIME: - return dwellDelay; - - case SCI_WORDSTARTPOSITION: - return pdoc->ExtendWordSelect(static_cast(wParam), -1, lParam != 0); - - case SCI_WORDENDPOSITION: - return pdoc->ExtendWordSelect(static_cast(wParam), 1, lParam != 0); - - case SCI_ISRANGEWORD: - return pdoc->IsWordAt(static_cast(wParam), static_cast(lParam)); - - case SCI_SETIDLESTYLING: - idleStyling = static_cast(wParam); - break; - - case SCI_GETIDLESTYLING: - return idleStyling; - - case SCI_SETWRAPMODE: - if (vs.SetWrapState(static_cast(wParam))) { - xOffset = 0; - ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); - InvalidateStyleRedraw(); - ReconfigureScrollBars(); - } - break; - - case SCI_GETWRAPMODE: - return vs.wrapState; - - case SCI_SETWRAPVISUALFLAGS: - if (vs.SetWrapVisualFlags(static_cast(wParam))) { - InvalidateStyleRedraw(); - ReconfigureScrollBars(); - } - break; - - case SCI_GETWRAPVISUALFLAGS: - return vs.wrapVisualFlags; - - case SCI_SETWRAPVISUALFLAGSLOCATION: - if (vs.SetWrapVisualFlagsLocation(static_cast(wParam))) { - InvalidateStyleRedraw(); - } - break; - - case SCI_GETWRAPVISUALFLAGSLOCATION: - return vs.wrapVisualFlagsLocation; - - case SCI_SETWRAPSTARTINDENT: - if (vs.SetWrapVisualStartIndent(static_cast(wParam))) { - InvalidateStyleRedraw(); - ReconfigureScrollBars(); - } - break; - - case SCI_GETWRAPSTARTINDENT: - return vs.wrapVisualStartIndent; - - case SCI_SETWRAPINDENTMODE: - if (vs.SetWrapIndentMode(static_cast(wParam))) { - InvalidateStyleRedraw(); - ReconfigureScrollBars(); - } - break; - - case SCI_GETWRAPINDENTMODE: - return vs.wrapIndentMode; - - case SCI_SETLAYOUTCACHE: - view.llc.SetLevel(static_cast(wParam)); - break; - - case SCI_GETLAYOUTCACHE: - return view.llc.GetLevel(); - - case SCI_SETPOSITIONCACHE: - view.posCache.SetSize(wParam); - break; - - case SCI_GETPOSITIONCACHE: - return view.posCache.GetSize(); - - case SCI_SETSCROLLWIDTH: - PLATFORM_ASSERT(wParam > 0); - if ((wParam > 0) && (wParam != static_cast(scrollWidth))) { - view.lineWidthMaxSeen = 0; - scrollWidth = static_cast(wParam); - SetScrollBars(); - } - break; - - case SCI_GETSCROLLWIDTH: - return scrollWidth; - - case SCI_SETSCROLLWIDTHTRACKING: - trackLineWidth = wParam != 0; - break; - - case SCI_GETSCROLLWIDTHTRACKING: - return trackLineWidth; - - case SCI_LINESJOIN: - LinesJoin(); - break; - - case SCI_LINESSPLIT: - LinesSplit(static_cast(wParam)); - break; - - case SCI_TEXTWIDTH: - PLATFORM_ASSERT(wParam < vs.styles.size()); - PLATFORM_ASSERT(lParam); - return TextWidth(static_cast(wParam), CharPtrFromSPtr(lParam)); - - case SCI_TEXTHEIGHT: - RefreshStyleData(); - return vs.lineHeight; - - case SCI_SETENDATLASTLINE: - PLATFORM_ASSERT((wParam == 0) || (wParam == 1)); - if (endAtLastLine != (wParam != 0)) { - endAtLastLine = wParam != 0; - SetScrollBars(); - } - break; - - case SCI_GETENDATLASTLINE: - return endAtLastLine; - - case SCI_SETCARETSTICKY: - PLATFORM_ASSERT(wParam <= SC_CARETSTICKY_WHITESPACE); - if (wParam <= SC_CARETSTICKY_WHITESPACE) { - caretSticky = static_cast(wParam); - } - break; - - case SCI_GETCARETSTICKY: - return caretSticky; - - case SCI_TOGGLECARETSTICKY: - caretSticky = !caretSticky; - break; - - case SCI_GETCOLUMN: - return pdoc->GetColumn(static_cast(wParam)); - - case SCI_FINDCOLUMN: - return pdoc->FindColumn(static_cast(wParam), static_cast(lParam)); - - case SCI_SETHSCROLLBAR : - if (horizontalScrollBarVisible != (wParam != 0)) { - horizontalScrollBarVisible = wParam != 0; - SetScrollBars(); - ReconfigureScrollBars(); - } - break; - - case SCI_GETHSCROLLBAR: - return horizontalScrollBarVisible; - - case SCI_SETVSCROLLBAR: - if (verticalScrollBarVisible != (wParam != 0)) { - verticalScrollBarVisible = wParam != 0; - SetScrollBars(); - ReconfigureScrollBars(); - if (verticalScrollBarVisible) - SetVerticalScrollPos(); - } - break; - - case SCI_GETVSCROLLBAR: - return verticalScrollBarVisible; - - case SCI_SETINDENTATIONGUIDES: - vs.viewIndentationGuides = IndentView(wParam); - Redraw(); - break; - - case SCI_GETINDENTATIONGUIDES: - return vs.viewIndentationGuides; - - case SCI_SETHIGHLIGHTGUIDE: - if ((highlightGuideColumn != static_cast(wParam)) || (wParam > 0)) { - highlightGuideColumn = static_cast(wParam); - Redraw(); - } - break; - - case SCI_GETHIGHLIGHTGUIDE: - return highlightGuideColumn; - - case SCI_GETLINEENDPOSITION: - return pdoc->LineEnd(static_cast(wParam)); - - case SCI_SETCODEPAGE: - if (ValidCodePage(static_cast(wParam))) { - if (pdoc->SetDBCSCodePage(static_cast(wParam))) { - cs.Clear(); - cs.InsertLines(0, pdoc->LinesTotal() - 1); - SetAnnotationHeights(0, pdoc->LinesTotal()); - InvalidateStyleRedraw(); - SetRepresentations(); - } - } - break; - - case SCI_GETCODEPAGE: - return pdoc->dbcsCodePage; - - case SCI_SETIMEINTERACTION: - imeInteraction = static_cast(wParam); - break; - - case SCI_GETIMEINTERACTION: - return imeInteraction; - - // Marker definition and setting - case SCI_MARKERDEFINE: - if (wParam <= MARKER_MAX) { - vs.markers[wParam].markType = static_cast(lParam); - vs.CalcLargestMarkerHeight(); - } - InvalidateStyleData(); - RedrawSelMargin(); - break; - - case SCI_MARKERSYMBOLDEFINED: - if (wParam <= MARKER_MAX) - return vs.markers[wParam].markType; - else - return 0; - - case SCI_MARKERSETFORE: - if (wParam <= MARKER_MAX) - vs.markers[wParam].fore = ColourDesired(static_cast(lParam)); - InvalidateStyleData(); - RedrawSelMargin(); - break; - case SCI_MARKERSETBACKSELECTED: - if (wParam <= MARKER_MAX) - vs.markers[wParam].backSelected = ColourDesired(static_cast(lParam)); - InvalidateStyleData(); - RedrawSelMargin(); - break; - case SCI_MARKERENABLEHIGHLIGHT: - marginView.highlightDelimiter.isEnabled = wParam == 1; - RedrawSelMargin(); - break; - case SCI_MARKERSETBACK: - if (wParam <= MARKER_MAX) - vs.markers[wParam].back = ColourDesired(static_cast(lParam)); - InvalidateStyleData(); - RedrawSelMargin(); - break; - case SCI_MARKERSETALPHA: - if (wParam <= MARKER_MAX) - vs.markers[wParam].alpha = static_cast(lParam); - InvalidateStyleRedraw(); - break; - case SCI_MARKERADD: { - int markerID = pdoc->AddMark(static_cast(wParam), static_cast(lParam)); - return markerID; - } - case SCI_MARKERADDSET: - if (lParam != 0) - pdoc->AddMarkSet(static_cast(wParam), static_cast(lParam)); - break; - - case SCI_MARKERDELETE: - pdoc->DeleteMark(static_cast(wParam), static_cast(lParam)); - break; - - case SCI_MARKERDELETEALL: - pdoc->DeleteAllMarks(static_cast(wParam)); - break; - - case SCI_MARKERGET: - return pdoc->GetMark(static_cast(wParam)); - - case SCI_MARKERNEXT: - return pdoc->MarkerNext(static_cast(wParam), static_cast(lParam)); - - case SCI_MARKERPREVIOUS: { - for (int iLine = static_cast(wParam); iLine >= 0; iLine--) { - if ((pdoc->GetMark(iLine) & lParam) != 0) - return iLine; - } - } - return -1; - - case SCI_MARKERDEFINEPIXMAP: - if (wParam <= MARKER_MAX) { - vs.markers[wParam].SetXPM(CharPtrFromSPtr(lParam)); - vs.CalcLargestMarkerHeight(); - } - InvalidateStyleData(); - RedrawSelMargin(); - break; - - case SCI_RGBAIMAGESETWIDTH: - sizeRGBAImage.x = static_cast(wParam); - break; - - case SCI_RGBAIMAGESETHEIGHT: - sizeRGBAImage.y = static_cast(wParam); - break; - - case SCI_RGBAIMAGESETSCALE: - scaleRGBAImage = static_cast(wParam); - break; - - case SCI_MARKERDEFINERGBAIMAGE: - if (wParam <= MARKER_MAX) { - vs.markers[wParam].SetRGBAImage(sizeRGBAImage, scaleRGBAImage / 100.0f, reinterpret_cast(lParam)); - vs.CalcLargestMarkerHeight(); - } - InvalidateStyleData(); - RedrawSelMargin(); - break; - - case SCI_SETMARGINTYPEN: - if (ValidMargin(wParam)) { - vs.ms[wParam].style = static_cast(lParam); - InvalidateStyleRedraw(); - } - break; - - case SCI_GETMARGINTYPEN: - if (ValidMargin(wParam)) - return vs.ms[wParam].style; - else - return 0; - - case SCI_SETMARGINWIDTHN: - if (ValidMargin(wParam)) { - // Short-circuit if the width is unchanged, to avoid unnecessary redraw. - if (vs.ms[wParam].width != lParam) { - lastXChosen += static_cast(lParam) - vs.ms[wParam].width; - vs.ms[wParam].width = static_cast(lParam); - InvalidateStyleRedraw(); - } - } - break; - - case SCI_GETMARGINWIDTHN: - if (ValidMargin(wParam)) - return vs.ms[wParam].width; - else - return 0; - - case SCI_SETMARGINMASKN: - if (ValidMargin(wParam)) { - vs.ms[wParam].mask = static_cast(lParam); - InvalidateStyleRedraw(); - } - break; - - case SCI_GETMARGINMASKN: - if (ValidMargin(wParam)) - return vs.ms[wParam].mask; - else - return 0; - - case SCI_SETMARGINSENSITIVEN: - if (ValidMargin(wParam)) { - vs.ms[wParam].sensitive = lParam != 0; - InvalidateStyleRedraw(); - } - break; - - case SCI_GETMARGINSENSITIVEN: - if (ValidMargin(wParam)) - return vs.ms[wParam].sensitive ? 1 : 0; - else - return 0; - - case SCI_SETMARGINCURSORN: - if (ValidMargin(wParam)) - vs.ms[wParam].cursor = static_cast(lParam); - break; - - case SCI_GETMARGINCURSORN: - if (ValidMargin(wParam)) - return vs.ms[wParam].cursor; - else - return 0; - - case SCI_SETMARGINBACKN: - if (ValidMargin(wParam)) { - vs.ms[wParam].back = ColourDesired(static_cast(lParam)); - InvalidateStyleRedraw(); - } - break; - - case SCI_GETMARGINBACKN: - if (ValidMargin(wParam)) - return vs.ms[wParam].back.AsLong(); - else - return 0; - - case SCI_SETMARGINS: - if (wParam < 1000) - vs.ms.resize(wParam); - break; - - case SCI_GETMARGINS: - return vs.ms.size(); - - case SCI_STYLECLEARALL: - vs.ClearStyles(); - InvalidateStyleRedraw(); - break; - - case SCI_STYLESETFORE: - case SCI_STYLESETBACK: - case SCI_STYLESETBOLD: - case SCI_STYLESETWEIGHT: - case SCI_STYLESETITALIC: - case SCI_STYLESETEOLFILLED: - case SCI_STYLESETSIZE: - case SCI_STYLESETSIZEFRACTIONAL: - case SCI_STYLESETFONT: - case SCI_STYLESETUNDERLINE: - case SCI_STYLESETCASE: - case SCI_STYLESETCHARACTERSET: - case SCI_STYLESETVISIBLE: - case SCI_STYLESETCHANGEABLE: - case SCI_STYLESETHOTSPOT: - StyleSetMessage(iMessage, wParam, lParam); - break; - - case SCI_STYLEGETFORE: - case SCI_STYLEGETBACK: - case SCI_STYLEGETBOLD: - case SCI_STYLEGETWEIGHT: - case SCI_STYLEGETITALIC: - case SCI_STYLEGETEOLFILLED: - case SCI_STYLEGETSIZE: - case SCI_STYLEGETSIZEFRACTIONAL: - case SCI_STYLEGETFONT: - case SCI_STYLEGETUNDERLINE: - case SCI_STYLEGETCASE: - case SCI_STYLEGETCHARACTERSET: - case SCI_STYLEGETVISIBLE: - case SCI_STYLEGETCHANGEABLE: - case SCI_STYLEGETHOTSPOT: - return StyleGetMessage(iMessage, wParam, lParam); - - case SCI_STYLERESETDEFAULT: - vs.ResetDefaultStyle(); - InvalidateStyleRedraw(); - break; - case SCI_SETSTYLEBITS: - vs.EnsureStyle(0xff); - break; - - case SCI_GETSTYLEBITS: - return 8; - - case SCI_SETLINESTATE: - return pdoc->SetLineState(static_cast(wParam), static_cast(lParam)); - - case SCI_GETLINESTATE: - return pdoc->GetLineState(static_cast(wParam)); - - case SCI_GETMAXLINESTATE: - return pdoc->GetMaxLineState(); - - case SCI_GETCARETLINEVISIBLE: - return vs.showCaretLineBackground; - case SCI_SETCARETLINEVISIBLE: - vs.showCaretLineBackground = wParam != 0; - InvalidateStyleRedraw(); - break; - case SCI_GETCARETLINEVISIBLEALWAYS: - return vs.alwaysShowCaretLineBackground; - case SCI_SETCARETLINEVISIBLEALWAYS: - vs.alwaysShowCaretLineBackground = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_GETCARETLINEBACK: - return vs.caretLineBackground.AsLong(); - case SCI_SETCARETLINEBACK: - vs.caretLineBackground = static_cast(wParam); - InvalidateStyleRedraw(); - break; - case SCI_GETCARETLINEBACKALPHA: - return vs.caretLineAlpha; - case SCI_SETCARETLINEBACKALPHA: - vs.caretLineAlpha = static_cast(wParam); - InvalidateStyleRedraw(); - break; - - // Folding messages - - case SCI_VISIBLEFROMDOCLINE: - return cs.DisplayFromDoc(static_cast(wParam)); - - case SCI_DOCLINEFROMVISIBLE: - return cs.DocFromDisplay(static_cast(wParam)); - - case SCI_WRAPCOUNT: - return WrapCount(static_cast(wParam)); - - case SCI_SETFOLDLEVEL: { - int prev = pdoc->SetLevel(static_cast(wParam), static_cast(lParam)); - if (prev != static_cast(lParam)) - RedrawSelMargin(); - return prev; - } - - case SCI_GETFOLDLEVEL: - return pdoc->GetLevel(static_cast(wParam)); - - case SCI_GETLASTCHILD: - return pdoc->GetLastChild(static_cast(wParam), static_cast(lParam)); - - case SCI_GETFOLDPARENT: - return pdoc->GetFoldParent(static_cast(wParam)); - - case SCI_SHOWLINES: - cs.SetVisible(static_cast(wParam), static_cast(lParam), true); - SetScrollBars(); - Redraw(); - break; - - case SCI_HIDELINES: - if (wParam > 0) - cs.SetVisible(static_cast(wParam), static_cast(lParam), false); - SetScrollBars(); - Redraw(); - break; - - case SCI_GETLINEVISIBLE: - return cs.GetVisible(static_cast(wParam)); - - case SCI_GETALLLINESVISIBLE: - return cs.HiddenLines() ? 0 : 1; - - case SCI_SETFOLDEXPANDED: - SetFoldExpanded(static_cast(wParam), lParam != 0); - break; - - case SCI_GETFOLDEXPANDED: - return cs.GetExpanded(static_cast(wParam)); - - case SCI_SETAUTOMATICFOLD: - foldAutomatic = static_cast(wParam); - break; - - case SCI_GETAUTOMATICFOLD: - return foldAutomatic; - - case SCI_SETFOLDFLAGS: - foldFlags = static_cast(wParam); - Redraw(); - break; - - case SCI_TOGGLEFOLDSHOWTEXT: - cs.SetFoldDisplayText(static_cast(wParam), CharPtrFromSPtr(lParam)); - FoldLine(static_cast(wParam), SC_FOLDACTION_TOGGLE); - break; - - case SCI_FOLDDISPLAYTEXTSETSTYLE: - foldDisplayTextStyle = static_cast(wParam); - Redraw(); - break; - - case SCI_TOGGLEFOLD: - FoldLine(static_cast(wParam), SC_FOLDACTION_TOGGLE); - break; - - case SCI_FOLDLINE: - FoldLine(static_cast(wParam), static_cast(lParam)); - break; - - case SCI_FOLDCHILDREN: - FoldExpand(static_cast(wParam), static_cast(lParam), pdoc->GetLevel(static_cast(wParam))); - break; - - case SCI_FOLDALL: - FoldAll(static_cast(wParam)); - break; - - case SCI_EXPANDCHILDREN: - FoldExpand(static_cast(wParam), SC_FOLDACTION_EXPAND, static_cast(lParam)); - break; - - case SCI_CONTRACTEDFOLDNEXT: - return ContractedFoldNext(static_cast(wParam)); - - case SCI_ENSUREVISIBLE: - EnsureLineVisible(static_cast(wParam), false); - break; - - case SCI_ENSUREVISIBLEENFORCEPOLICY: - EnsureLineVisible(static_cast(wParam), true); - break; - - case SCI_SCROLLRANGE: - ScrollRange(SelectionRange(static_cast(wParam), static_cast(lParam))); - break; - - case SCI_SEARCHANCHOR: - SearchAnchor(); - break; - - case SCI_SEARCHNEXT: - case SCI_SEARCHPREV: - return SearchText(iMessage, wParam, lParam); - - case SCI_SETXCARETPOLICY: - caretXPolicy = static_cast(wParam); - caretXSlop = static_cast(lParam); - break; - - case SCI_SETYCARETPOLICY: - caretYPolicy = static_cast(wParam); - caretYSlop = static_cast(lParam); - break; - - case SCI_SETVISIBLEPOLICY: - visiblePolicy = static_cast(wParam); - visibleSlop = static_cast(lParam); - break; - - case SCI_LINESONSCREEN: - return LinesOnScreen(); - - case SCI_SETSELFORE: - vs.selColours.fore = ColourOptional(wParam, lParam); - vs.selAdditionalForeground = ColourDesired(static_cast(lParam)); - InvalidateStyleRedraw(); - break; - - case SCI_SETSELBACK: - vs.selColours.back = ColourOptional(wParam, lParam); - vs.selAdditionalBackground = ColourDesired(static_cast(lParam)); - InvalidateStyleRedraw(); - break; - - case SCI_SETSELALPHA: - vs.selAlpha = static_cast(wParam); - vs.selAdditionalAlpha = static_cast(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETSELALPHA: - return vs.selAlpha; - - case SCI_GETSELEOLFILLED: - return vs.selEOLFilled; - - case SCI_SETSELEOLFILLED: - vs.selEOLFilled = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_SETWHITESPACEFORE: - vs.whitespaceColours.fore = ColourOptional(wParam, lParam); - InvalidateStyleRedraw(); - break; - - case SCI_SETWHITESPACEBACK: - vs.whitespaceColours.back = ColourOptional(wParam, lParam); - InvalidateStyleRedraw(); - break; - - case SCI_SETCARETFORE: - vs.caretcolour = ColourDesired(static_cast(wParam)); - InvalidateStyleRedraw(); - break; - - case SCI_GETCARETFORE: - return vs.caretcolour.AsLong(); - - case SCI_SETCARETSTYLE: - if (wParam <= CARETSTYLE_BLOCK) - vs.caretStyle = static_cast(wParam); - else - /* Default to the line caret */ - vs.caretStyle = CARETSTYLE_LINE; - InvalidateStyleRedraw(); - break; - - case SCI_GETCARETSTYLE: - return vs.caretStyle; - - case SCI_SETCARETWIDTH: - if (static_cast(wParam) <= 0) - vs.caretWidth = 0; - else if (wParam >= 3) - vs.caretWidth = 3; - else - vs.caretWidth = static_cast(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETCARETWIDTH: - return vs.caretWidth; - - case SCI_ASSIGNCMDKEY: - kmap.AssignCmdKey(Platform::LowShortFromLong(static_cast(wParam)), - Platform::HighShortFromLong(static_cast(wParam)), static_cast(lParam)); - break; - - case SCI_CLEARCMDKEY: - kmap.AssignCmdKey(Platform::LowShortFromLong(static_cast(wParam)), - Platform::HighShortFromLong(static_cast(wParam)), SCI_NULL); - break; - - case SCI_CLEARALLCMDKEYS: - kmap.Clear(); - break; - - case SCI_INDICSETSTYLE: - if (wParam <= INDIC_MAX) { - vs.indicators[wParam].sacNormal.style = static_cast(lParam); - vs.indicators[wParam].sacHover.style = static_cast(lParam); - InvalidateStyleRedraw(); - } - break; - - case SCI_INDICGETSTYLE: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacNormal.style : 0; - - case SCI_INDICSETFORE: - if (wParam <= INDIC_MAX) { - vs.indicators[wParam].sacNormal.fore = ColourDesired(static_cast(lParam)); - vs.indicators[wParam].sacHover.fore = ColourDesired(static_cast(lParam)); - InvalidateStyleRedraw(); - } - break; - - case SCI_INDICGETFORE: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacNormal.fore.AsLong() : 0; - - case SCI_INDICSETHOVERSTYLE: - if (wParam <= INDIC_MAX) { - vs.indicators[wParam].sacHover.style = static_cast(lParam); - InvalidateStyleRedraw(); - } - break; - - case SCI_INDICGETHOVERSTYLE: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacHover.style : 0; - - case SCI_INDICSETHOVERFORE: - if (wParam <= INDIC_MAX) { - vs.indicators[wParam].sacHover.fore = ColourDesired(static_cast(lParam)); - InvalidateStyleRedraw(); - } - break; - - case SCI_INDICGETHOVERFORE: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacHover.fore.AsLong() : 0; - - case SCI_INDICSETFLAGS: - if (wParam <= INDIC_MAX) { - vs.indicators[wParam].SetFlags(static_cast(lParam)); - InvalidateStyleRedraw(); - } - break; - - case SCI_INDICGETFLAGS: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].Flags() : 0; - - case SCI_INDICSETUNDER: - if (wParam <= INDIC_MAX) { - vs.indicators[wParam].under = lParam != 0; - InvalidateStyleRedraw(); - } - break; - - case SCI_INDICGETUNDER: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0; - - case SCI_INDICSETALPHA: - if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 255) { - vs.indicators[wParam].fillAlpha = static_cast(lParam); - InvalidateStyleRedraw(); - } - break; - - case SCI_INDICGETALPHA: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fillAlpha : 0; - - case SCI_INDICSETOUTLINEALPHA: - if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 255) { - vs.indicators[wParam].outlineAlpha = static_cast(lParam); - InvalidateStyleRedraw(); - } - break; - - case SCI_INDICGETOUTLINEALPHA: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].outlineAlpha : 0; - - case SCI_SETINDICATORCURRENT: - pdoc->decorations.SetCurrentIndicator(static_cast(wParam)); - break; - case SCI_GETINDICATORCURRENT: - return pdoc->decorations.GetCurrentIndicator(); - case SCI_SETINDICATORVALUE: - pdoc->decorations.SetCurrentValue(static_cast(wParam)); - break; - case SCI_GETINDICATORVALUE: - return pdoc->decorations.GetCurrentValue(); - - case SCI_INDICATORFILLRANGE: - pdoc->DecorationFillRange(static_cast(wParam), pdoc->decorations.GetCurrentValue(), static_cast(lParam)); - break; - - case SCI_INDICATORCLEARRANGE: - pdoc->DecorationFillRange(static_cast(wParam), 0, static_cast(lParam)); - break; - - case SCI_INDICATORALLONFOR: - return pdoc->decorations.AllOnFor(static_cast(wParam)); - - case SCI_INDICATORVALUEAT: - return pdoc->decorations.ValueAt(static_cast(wParam), static_cast(lParam)); - - case SCI_INDICATORSTART: - return pdoc->decorations.Start(static_cast(wParam), static_cast(lParam)); - - case SCI_INDICATOREND: - return pdoc->decorations.End(static_cast(wParam), static_cast(lParam)); - - case SCI_LINEDOWN: - case SCI_LINEDOWNEXTEND: - case SCI_PARADOWN: - case SCI_PARADOWNEXTEND: - case SCI_LINEUP: - case SCI_LINEUPEXTEND: - case SCI_PARAUP: - case SCI_PARAUPEXTEND: - case SCI_CHARLEFT: - case SCI_CHARLEFTEXTEND: - case SCI_CHARRIGHT: - case SCI_CHARRIGHTEXTEND: - case SCI_WORDLEFT: - case SCI_WORDLEFTEXTEND: - case SCI_WORDRIGHT: - case SCI_WORDRIGHTEXTEND: - case SCI_WORDLEFTEND: - case SCI_WORDLEFTENDEXTEND: - case SCI_WORDRIGHTEND: - case SCI_WORDRIGHTENDEXTEND: - case SCI_HOME: - case SCI_HOMEEXTEND: - case SCI_LINEEND: - case SCI_LINEENDEXTEND: - case SCI_HOMEWRAP: - case SCI_HOMEWRAPEXTEND: - case SCI_LINEENDWRAP: - case SCI_LINEENDWRAPEXTEND: - case SCI_DOCUMENTSTART: - case SCI_DOCUMENTSTARTEXTEND: - case SCI_DOCUMENTEND: - case SCI_DOCUMENTENDEXTEND: - case SCI_SCROLLTOSTART: - case SCI_SCROLLTOEND: - - case SCI_STUTTEREDPAGEUP: - case SCI_STUTTEREDPAGEUPEXTEND: - case SCI_STUTTEREDPAGEDOWN: - case SCI_STUTTEREDPAGEDOWNEXTEND: - - case SCI_PAGEUP: - case SCI_PAGEUPEXTEND: - case SCI_PAGEDOWN: - case SCI_PAGEDOWNEXTEND: - case SCI_EDITTOGGLEOVERTYPE: - case SCI_CANCEL: - case SCI_DELETEBACK: - case SCI_TAB: - case SCI_BACKTAB: - case SCI_NEWLINE: - case SCI_FORMFEED: - case SCI_VCHOME: - case SCI_VCHOMEEXTEND: - case SCI_VCHOMEWRAP: - case SCI_VCHOMEWRAPEXTEND: - case SCI_VCHOMEDISPLAY: - case SCI_VCHOMEDISPLAYEXTEND: - case SCI_ZOOMIN: - case SCI_ZOOMOUT: - case SCI_DELWORDLEFT: - case SCI_DELWORDRIGHT: - case SCI_DELWORDRIGHTEND: - case SCI_DELLINELEFT: - case SCI_DELLINERIGHT: - case SCI_LINECOPY: - case SCI_LINECUT: - case SCI_LINEDELETE: - case SCI_LINETRANSPOSE: - case SCI_LINEDUPLICATE: - case SCI_LOWERCASE: - case SCI_UPPERCASE: - case SCI_LINESCROLLDOWN: - case SCI_LINESCROLLUP: - case SCI_WORDPARTLEFT: - case SCI_WORDPARTLEFTEXTEND: - case SCI_WORDPARTRIGHT: - case SCI_WORDPARTRIGHTEXTEND: - case SCI_DELETEBACKNOTLINE: - case SCI_HOMEDISPLAY: - case SCI_HOMEDISPLAYEXTEND: - case SCI_LINEENDDISPLAY: - case SCI_LINEENDDISPLAYEXTEND: - case SCI_LINEDOWNRECTEXTEND: - case SCI_LINEUPRECTEXTEND: - case SCI_CHARLEFTRECTEXTEND: - case SCI_CHARRIGHTRECTEXTEND: - case SCI_HOMERECTEXTEND: - case SCI_VCHOMERECTEXTEND: - case SCI_LINEENDRECTEXTEND: - case SCI_PAGEUPRECTEXTEND: - case SCI_PAGEDOWNRECTEXTEND: - case SCI_SELECTIONDUPLICATE: - return KeyCommand(iMessage); - - case SCI_BRACEHIGHLIGHT: - SetBraceHighlight(static_cast(wParam), static_cast(lParam), STYLE_BRACELIGHT); - break; - - case SCI_BRACEHIGHLIGHTINDICATOR: - if (lParam >= 0 && lParam <= INDIC_MAX) { - vs.braceHighlightIndicatorSet = wParam != 0; - vs.braceHighlightIndicator = static_cast(lParam); - } - break; - - case SCI_BRACEBADLIGHT: - SetBraceHighlight(static_cast(wParam), -1, STYLE_BRACEBAD); - break; - - case SCI_BRACEBADLIGHTINDICATOR: - if (lParam >= 0 && lParam <= INDIC_MAX) { - vs.braceBadLightIndicatorSet = wParam != 0; - vs.braceBadLightIndicator = static_cast(lParam); - } - break; - - case SCI_BRACEMATCH: - // wParam is position of char to find brace for, - // lParam is maximum amount of text to restyle to find it - return pdoc->BraceMatch(static_cast(wParam), static_cast(lParam)); - - case SCI_GETVIEWEOL: - return vs.viewEOL; - - case SCI_SETVIEWEOL: - vs.viewEOL = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_SETZOOM: - vs.zoomLevel = static_cast(wParam); - InvalidateStyleRedraw(); - NotifyZoom(); - break; - - case SCI_GETZOOM: - return vs.zoomLevel; - - case SCI_GETEDGECOLUMN: - return vs.theEdge.column; - - case SCI_SETEDGECOLUMN: - vs.theEdge.column = static_cast(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETEDGEMODE: - return vs.edgeState; - - case SCI_SETEDGEMODE: - vs.edgeState = static_cast(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETEDGECOLOUR: - return vs.theEdge.colour.AsLong(); - - case SCI_SETEDGECOLOUR: - vs.theEdge.colour = ColourDesired(static_cast(wParam)); - InvalidateStyleRedraw(); - break; - - case SCI_MULTIEDGEADDLINE: - vs.theMultiEdge.push_back(EdgeProperties(wParam, lParam)); - InvalidateStyleRedraw(); - break; - - case SCI_MULTIEDGECLEARALL: - std::vector().swap(vs.theMultiEdge); // Free vector and memory, C++03 compatible - InvalidateStyleRedraw(); - break; - - case SCI_GETDOCPOINTER: - return reinterpret_cast(pdoc); - - case SCI_SETDOCPOINTER: - CancelModes(); - SetDocPointer(reinterpret_cast(lParam)); - return 0; - - case SCI_CREATEDOCUMENT: { - Document *doc = new Document(); - doc->AddRef(); - return reinterpret_cast(doc); - } - - case SCI_ADDREFDOCUMENT: - (reinterpret_cast(lParam))->AddRef(); - break; - - case SCI_RELEASEDOCUMENT: - (reinterpret_cast(lParam))->Release(); - break; - - case SCI_CREATELOADER: { - Document *doc = new Document(); - doc->AddRef(); - doc->Allocate(static_cast(wParam)); - doc->SetUndoCollection(false); - return reinterpret_cast(static_cast(doc)); - } - - case SCI_SETMODEVENTMASK: - modEventMask = static_cast(wParam); - return 0; - - case SCI_GETMODEVENTMASK: - return modEventMask; - - case SCI_CONVERTEOLS: - pdoc->ConvertLineEnds(static_cast(wParam)); - SetSelection(sel.MainCaret(), sel.MainAnchor()); // Ensure selection inside document - return 0; - - case SCI_SETLENGTHFORENCODE: - lengthForEncode = static_cast(wParam); - return 0; - - case SCI_SELECTIONISRECTANGLE: - return sel.selType == Selection::selRectangle ? 1 : 0; - - case SCI_SETSELECTIONMODE: { - switch (wParam) { - case SC_SEL_STREAM: - sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selStream)); - sel.selType = Selection::selStream; - break; - case SC_SEL_RECTANGLE: - sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selRectangle)); - sel.selType = Selection::selRectangle; - break; - case SC_SEL_LINES: - sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selLines)); - sel.selType = Selection::selLines; - break; - case SC_SEL_THIN: - sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selThin)); - sel.selType = Selection::selThin; - break; - default: - sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selStream)); - sel.selType = Selection::selStream; - } - InvalidateWholeSelection(); - break; - } - case SCI_GETSELECTIONMODE: - switch (sel.selType) { - case Selection::selStream: - return SC_SEL_STREAM; - case Selection::selRectangle: - return SC_SEL_RECTANGLE; - case Selection::selLines: - return SC_SEL_LINES; - case Selection::selThin: - return SC_SEL_THIN; - default: // ?! - return SC_SEL_STREAM; - } - case SCI_GETLINESELSTARTPOSITION: - case SCI_GETLINESELENDPOSITION: { - SelectionSegment segmentLine(SelectionPosition(pdoc->LineStart(static_cast(wParam))), - SelectionPosition(pdoc->LineEnd(static_cast(wParam)))); - for (size_t r=0; r(wParam); - break; - - case SCI_GETSTATUS: - return errorStatus; - - case SCI_SETMOUSEDOWNCAPTURES: - mouseDownCaptures = wParam != 0; - break; - - case SCI_GETMOUSEDOWNCAPTURES: - return mouseDownCaptures; - - case SCI_SETMOUSEWHEELCAPTURES: - mouseWheelCaptures = wParam != 0; - break; - - case SCI_GETMOUSEWHEELCAPTURES: - return mouseWheelCaptures; - - case SCI_SETCURSOR: - cursorMode = static_cast(wParam); - DisplayCursor(Window::cursorText); - break; - - case SCI_GETCURSOR: - return cursorMode; - - case SCI_SETCONTROLCHARSYMBOL: - vs.controlCharSymbol = static_cast(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETCONTROLCHARSYMBOL: - return vs.controlCharSymbol; - - case SCI_SETREPRESENTATION: - reprs.SetRepresentation(reinterpret_cast(wParam), CharPtrFromSPtr(lParam)); - break; - - case SCI_GETREPRESENTATION: { - const Representation *repr = reprs.RepresentationFromCharacter( - reinterpret_cast(wParam), UTF8MaxBytes); - if (repr) { - return StringResult(lParam, repr->stringRep.c_str()); - } - return 0; - } - - case SCI_CLEARREPRESENTATION: - reprs.ClearRepresentation(reinterpret_cast(wParam)); - break; - - case SCI_STARTRECORD: - recordingMacro = true; - return 0; - - case SCI_STOPRECORD: - recordingMacro = false; - return 0; - - case SCI_MOVECARETINSIDEVIEW: - MoveCaretInsideView(); - break; - - case SCI_SETFOLDMARGINCOLOUR: - vs.foldmarginColour = ColourOptional(wParam, lParam); - InvalidateStyleRedraw(); - break; - - case SCI_SETFOLDMARGINHICOLOUR: - vs.foldmarginHighlightColour = ColourOptional(wParam, lParam); - InvalidateStyleRedraw(); - break; - - case SCI_SETHOTSPOTACTIVEFORE: - vs.hotspotColours.fore = ColourOptional(wParam, lParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETHOTSPOTACTIVEFORE: - return vs.hotspotColours.fore.AsLong(); - - case SCI_SETHOTSPOTACTIVEBACK: - vs.hotspotColours.back = ColourOptional(wParam, lParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETHOTSPOTACTIVEBACK: - return vs.hotspotColours.back.AsLong(); - - case SCI_SETHOTSPOTACTIVEUNDERLINE: - vs.hotspotUnderline = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_GETHOTSPOTACTIVEUNDERLINE: - return vs.hotspotUnderline ? 1 : 0; - - case SCI_SETHOTSPOTSINGLELINE: - vs.hotspotSingleLine = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_GETHOTSPOTSINGLELINE: - return vs.hotspotSingleLine ? 1 : 0; - - case SCI_SETPASTECONVERTENDINGS: - convertPastes = wParam != 0; - break; - - case SCI_GETPASTECONVERTENDINGS: - return convertPastes ? 1 : 0; - - case SCI_GETCHARACTERPOINTER: - return reinterpret_cast(pdoc->BufferPointer()); - - case SCI_GETRANGEPOINTER: - return reinterpret_cast(pdoc->RangePointer(static_cast(wParam), static_cast(lParam))); - - case SCI_GETGAPPOSITION: - return pdoc->GapPosition(); - - case SCI_SETEXTRAASCENT: - vs.extraAscent = static_cast(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETEXTRAASCENT: - return vs.extraAscent; - - case SCI_SETEXTRADESCENT: - vs.extraDescent = static_cast(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETEXTRADESCENT: - return vs.extraDescent; - - case SCI_MARGINSETSTYLEOFFSET: - vs.marginStyleOffset = static_cast(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_MARGINGETSTYLEOFFSET: - return vs.marginStyleOffset; - - case SCI_SETMARGINOPTIONS: - marginOptions = static_cast(wParam); - break; - - case SCI_GETMARGINOPTIONS: - return marginOptions; - - case SCI_MARGINSETTEXT: - pdoc->MarginSetText(static_cast(wParam), CharPtrFromSPtr(lParam)); - break; - - case SCI_MARGINGETTEXT: { - const StyledText st = pdoc->MarginStyledText(static_cast(wParam)); - return BytesResult(lParam, reinterpret_cast(st.text), st.length); - } - - case SCI_MARGINSETSTYLE: - pdoc->MarginSetStyle(static_cast(wParam), static_cast(lParam)); - break; - - case SCI_MARGINGETSTYLE: { - const StyledText st = pdoc->MarginStyledText(static_cast(wParam)); - return st.style; - } - - case SCI_MARGINSETSTYLES: - pdoc->MarginSetStyles(static_cast(wParam), reinterpret_cast(lParam)); - break; - - case SCI_MARGINGETSTYLES: { - const StyledText st = pdoc->MarginStyledText(static_cast(wParam)); - return BytesResult(lParam, st.styles, st.length); - } - - case SCI_MARGINTEXTCLEARALL: - pdoc->MarginClearAll(); - break; - - case SCI_ANNOTATIONSETTEXT: - pdoc->AnnotationSetText(static_cast(wParam), CharPtrFromSPtr(lParam)); - break; - - case SCI_ANNOTATIONGETTEXT: { - const StyledText st = pdoc->AnnotationStyledText(static_cast(wParam)); - return BytesResult(lParam, reinterpret_cast(st.text), st.length); - } - - case SCI_ANNOTATIONGETSTYLE: { - const StyledText st = pdoc->AnnotationStyledText(static_cast(wParam)); - return st.style; - } - - case SCI_ANNOTATIONSETSTYLE: - pdoc->AnnotationSetStyle(static_cast(wParam), static_cast(lParam)); - break; - - case SCI_ANNOTATIONSETSTYLES: - pdoc->AnnotationSetStyles(static_cast(wParam), reinterpret_cast(lParam)); - break; - - case SCI_ANNOTATIONGETSTYLES: { - const StyledText st = pdoc->AnnotationStyledText(static_cast(wParam)); - return BytesResult(lParam, st.styles, st.length); - } - - case SCI_ANNOTATIONGETLINES: - return pdoc->AnnotationLines(static_cast(wParam)); - - case SCI_ANNOTATIONCLEARALL: - pdoc->AnnotationClearAll(); - break; - - case SCI_ANNOTATIONSETVISIBLE: - SetAnnotationVisible(static_cast(wParam)); - break; - - case SCI_ANNOTATIONGETVISIBLE: - return vs.annotationVisible; - - case SCI_ANNOTATIONSETSTYLEOFFSET: - vs.annotationStyleOffset = static_cast(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_ANNOTATIONGETSTYLEOFFSET: - return vs.annotationStyleOffset; - - case SCI_RELEASEALLEXTENDEDSTYLES: - vs.ReleaseAllExtendedStyles(); - break; - - case SCI_ALLOCATEEXTENDEDSTYLES: - return vs.AllocateExtendedStyles(static_cast(wParam)); - - case SCI_ADDUNDOACTION: - pdoc->AddUndoAction(static_cast(wParam), lParam & UNDO_MAY_COALESCE); - break; - - case SCI_SETMOUSESELECTIONRECTANGULARSWITCH: - mouseSelectionRectangularSwitch = wParam != 0; - break; - - case SCI_GETMOUSESELECTIONRECTANGULARSWITCH: - return mouseSelectionRectangularSwitch; - - case SCI_SETMULTIPLESELECTION: - multipleSelection = wParam != 0; - InvalidateCaret(); - break; - - case SCI_GETMULTIPLESELECTION: - return multipleSelection; - - case SCI_SETADDITIONALSELECTIONTYPING: - additionalSelectionTyping = wParam != 0; - InvalidateCaret(); - break; - - case SCI_GETADDITIONALSELECTIONTYPING: - return additionalSelectionTyping; - - case SCI_SETMULTIPASTE: - multiPasteMode = static_cast(wParam); - break; - - case SCI_GETMULTIPASTE: - return multiPasteMode; - - case SCI_SETADDITIONALCARETSBLINK: - view.additionalCaretsBlink = wParam != 0; - InvalidateCaret(); - break; - - case SCI_GETADDITIONALCARETSBLINK: - return view.additionalCaretsBlink; - - case SCI_SETADDITIONALCARETSVISIBLE: - view.additionalCaretsVisible = wParam != 0; - InvalidateCaret(); - break; - - case SCI_GETADDITIONALCARETSVISIBLE: - return view.additionalCaretsVisible; - - case SCI_GETSELECTIONS: - return sel.Count(); - - case SCI_GETSELECTIONEMPTY: - return sel.Empty(); - - case SCI_CLEARSELECTIONS: - sel.Clear(); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); - Redraw(); - break; - - case SCI_SETSELECTION: - sel.SetSelection(SelectionRange(static_cast(wParam), static_cast(lParam))); - Redraw(); - break; - - case SCI_ADDSELECTION: - sel.AddSelection(SelectionRange(static_cast(wParam), static_cast(lParam))); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); - Redraw(); - break; - - case SCI_DROPSELECTIONN: - sel.DropSelection(static_cast(wParam)); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); - Redraw(); - break; - - case SCI_SETMAINSELECTION: - sel.SetMain(static_cast(wParam)); - ContainerNeedsUpdate(SC_UPDATE_SELECTION); - Redraw(); - break; - - case SCI_GETMAINSELECTION: - return sel.Main(); - - case SCI_SETSELECTIONNCARET: - case SCI_SETSELECTIONNANCHOR: - case SCI_SETSELECTIONNCARETVIRTUALSPACE: - case SCI_SETSELECTIONNANCHORVIRTUALSPACE: - case SCI_SETSELECTIONNSTART: - case SCI_SETSELECTIONNEND: - SetSelectionNMessage(iMessage, wParam, lParam); - break; - - case SCI_GETSELECTIONNCARET: - return sel.Range(wParam).caret.Position(); - - case SCI_GETSELECTIONNANCHOR: - return sel.Range(wParam).anchor.Position(); - - case SCI_GETSELECTIONNCARETVIRTUALSPACE: - return sel.Range(wParam).caret.VirtualSpace(); - - case SCI_GETSELECTIONNANCHORVIRTUALSPACE: - return sel.Range(wParam).anchor.VirtualSpace(); - - case SCI_GETSELECTIONNSTART: - return sel.Range(wParam).Start().Position(); - - case SCI_GETSELECTIONNEND: - return sel.Range(wParam).End().Position(); - - case SCI_SETRECTANGULARSELECTIONCARET: - if (!sel.IsRectangular()) - sel.Clear(); - sel.selType = Selection::selRectangle; - sel.Rectangular().caret.SetPosition(static_cast(wParam)); - SetRectangularRange(); - Redraw(); - break; - - case SCI_GETRECTANGULARSELECTIONCARET: - return sel.Rectangular().caret.Position(); - - case SCI_SETRECTANGULARSELECTIONANCHOR: - if (!sel.IsRectangular()) - sel.Clear(); - sel.selType = Selection::selRectangle; - sel.Rectangular().anchor.SetPosition(static_cast(wParam)); - SetRectangularRange(); - Redraw(); - break; - - case SCI_GETRECTANGULARSELECTIONANCHOR: - return sel.Rectangular().anchor.Position(); - - case SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE: - if (!sel.IsRectangular()) - sel.Clear(); - sel.selType = Selection::selRectangle; - sel.Rectangular().caret.SetVirtualSpace(static_cast(wParam)); - SetRectangularRange(); - Redraw(); - break; - - case SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE: - return sel.Rectangular().caret.VirtualSpace(); - - case SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE: - if (!sel.IsRectangular()) - sel.Clear(); - sel.selType = Selection::selRectangle; - sel.Rectangular().anchor.SetVirtualSpace(static_cast(wParam)); - SetRectangularRange(); - Redraw(); - break; - - case SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE: - return sel.Rectangular().anchor.VirtualSpace(); - - case SCI_SETVIRTUALSPACEOPTIONS: - virtualSpaceOptions = static_cast(wParam); - break; - - case SCI_GETVIRTUALSPACEOPTIONS: - return virtualSpaceOptions; - - case SCI_SETADDITIONALSELFORE: - vs.selAdditionalForeground = ColourDesired(static_cast(wParam)); - InvalidateStyleRedraw(); - break; - - case SCI_SETADDITIONALSELBACK: - vs.selAdditionalBackground = ColourDesired(static_cast(wParam)); - InvalidateStyleRedraw(); - break; - - case SCI_SETADDITIONALSELALPHA: - vs.selAdditionalAlpha = static_cast(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETADDITIONALSELALPHA: - return vs.selAdditionalAlpha; - - case SCI_SETADDITIONALCARETFORE: - vs.additionalCaretColour = ColourDesired(static_cast(wParam)); - InvalidateStyleRedraw(); - break; - - case SCI_GETADDITIONALCARETFORE: - return vs.additionalCaretColour.AsLong(); - - case SCI_ROTATESELECTION: - sel.RotateMain(); - InvalidateWholeSelection(); - break; - - case SCI_SWAPMAINANCHORCARET: - InvalidateSelection(sel.RangeMain()); - sel.RangeMain().Swap(); - break; - - case SCI_MULTIPLESELECTADDNEXT: - MultipleSelectAdd(addOne); - break; - - case SCI_MULTIPLESELECTADDEACH: - MultipleSelectAdd(addEach); - break; - - case SCI_CHANGELEXERSTATE: - pdoc->ChangeLexerState(static_cast(wParam), static_cast(lParam)); - break; - - case SCI_SETIDENTIFIER: - SetCtrlID(static_cast(wParam)); - break; - - case SCI_GETIDENTIFIER: - return GetCtrlID(); - - case SCI_SETTECHNOLOGY: - // No action by default - break; - - case SCI_GETTECHNOLOGY: - return technology; - - case SCI_COUNTCHARACTERS: - return pdoc->CountCharacters(static_cast(wParam), static_cast(lParam)); - - default: - return DefWndProc(iMessage, wParam, lParam); - } - //Platform::DebugPrintf("end wnd proc\n"); - return 0l; -} diff --git a/qrenderdoc/3rdparty/scintilla/src/Editor.h b/qrenderdoc/3rdparty/scintilla/src/Editor.h deleted file mode 100644 index 864bac94f..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Editor.h +++ /dev/null @@ -1,642 +0,0 @@ -// Scintilla source code edit control -/** @file Editor.h - ** Defines the main editor class. - **/ -// Copyright 1998-2011 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef EDITOR_H -#define EDITOR_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class Timer { -public: - bool ticking; - int ticksToWait; - enum {tickSize = 100}; - TickerID tickerID; - - Timer(); -}; - -/** - */ -class Idler { -public: - bool state; - IdlerID idlerID; - - Idler(); -}; - -/** - * When platform has a way to generate an event before painting, - * accumulate needed styling range and other work items in - * WorkNeeded to avoid unnecessary work inside paint handler - */ -class WorkNeeded { -public: - enum workItems { - workNone=0, - workStyle=1, - workUpdateUI=2 - }; - enum workItems items; - Position upTo; - - WorkNeeded() : items(workNone), upTo(0) {} - void Reset() { - items = workNone; - upTo = 0; - } - void Need(workItems items_, Position pos) { - if ((items_ & workStyle) && (upTo < pos)) - upTo = pos; - items = static_cast(items | items_); - } -}; - -/** - * Hold a piece of text selected for copying or dragging, along with encoding and selection format information. - */ -class SelectionText { - std::string s; -public: - bool rectangular; - bool lineCopy; - int codePage; - int characterSet; - SelectionText() : rectangular(false), lineCopy(false), codePage(0), characterSet(0) {} - ~SelectionText() { - } - void Clear() { - s.clear(); - rectangular = false; - lineCopy = false; - codePage = 0; - characterSet = 0; - } - void Copy(const std::string &s_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) { - s = s_; - codePage = codePage_; - characterSet = characterSet_; - rectangular = rectangular_; - lineCopy = lineCopy_; - FixSelectionForClipboard(); - } - void Copy(const SelectionText &other) { - Copy(other.s, other.codePage, other.characterSet, other.rectangular, other.lineCopy); - } - const char *Data() const { - return s.c_str(); - } - size_t Length() const { - return s.length(); - } - size_t LengthWithTerminator() const { - return s.length() + 1; - } - bool Empty() const { - return s.empty(); - } -private: - void FixSelectionForClipboard() { - // To avoid truncating the contents of the clipboard when pasted where the - // clipboard contains NUL characters, replace NUL characters by spaces. - std::replace(s.begin(), s.end(), '\0', ' '); - } -}; - -struct WrapPending { - // The range of lines that need to be wrapped - enum { lineLarge = 0x7ffffff }; - int start; // When there are wraps pending, will be in document range - int end; // May be lineLarge to indicate all of document after start - WrapPending() { - start = lineLarge; - end = lineLarge; - } - void Reset() { - start = lineLarge; - end = lineLarge; - } - void Wrapped(int line) { - if (start == line) - start++; - } - bool NeedsWrap() const { - return start < end; - } - bool AddRange(int lineStart, int lineEnd) { - const bool neededWrap = NeedsWrap(); - bool changed = false; - if (start > lineStart) { - start = lineStart; - changed = true; - } - if ((end < lineEnd) || !neededWrap) { - end = lineEnd; - changed = true; - } - return changed; - } -}; - -/** - */ -class Editor : public EditModel, public DocWatcher { - // Private so Editor objects can not be copied - explicit Editor(const Editor &); - Editor &operator=(const Editor &); - -protected: // ScintillaBase subclass needs access to much of Editor - - /** On GTK+, Scintilla is a container widget holding two scroll bars - * whereas on Windows there is just one window with both scroll bars turned on. */ - Window wMain; ///< The Scintilla parent window - Window wMargin; ///< May be separate when using a scroll view for wMain - - /** Style resources may be expensive to allocate so are cached between uses. - * When a style attribute is changed, this cache is flushed. */ - bool stylesValid; - ViewStyle vs; - int technology; - Point sizeRGBAImage; - float scaleRGBAImage; - - MarginView marginView; - EditView view; - - int cursorMode; - - bool hasFocus; - bool mouseDownCaptures; - bool mouseWheelCaptures; - - int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret - bool horizontalScrollBarVisible; - int scrollWidth; - bool verticalScrollBarVisible; - bool endAtLastLine; - int caretSticky; - int marginOptions; - bool mouseSelectionRectangularSwitch; - bool multipleSelection; - bool additionalSelectionTyping; - int multiPasteMode; - - int virtualSpaceOptions; - - KeyMap kmap; - - Timer timer; - Timer autoScrollTimer; - enum { autoScrollDelay = 200 }; - - Idler idler; - - Point lastClick; - unsigned int lastClickTime; - Point doubleClickCloseThreshold; - int dwellDelay; - int ticksToDwell; - bool dwelling; - enum { selChar, selWord, selSubLine, selWholeLine } selectionType; - Point ptMouseLast; - enum { ddNone, ddInitial, ddDragging } inDragDrop; - bool dropWentOutside; - SelectionPosition posDrop; - int hotSpotClickPos; - int lastXChosen; - int lineAnchorPos; - int originalAnchorPos; - int wordSelectAnchorStartPos; - int wordSelectAnchorEndPos; - int wordSelectInitialCaretPos; - int targetStart; - int targetEnd; - int searchFlags; - int topLine; - int posTopLine; - int lengthForEncode; - - int needUpdateUI; - - enum { notPainting, painting, paintAbandoned } paintState; - bool paintAbandonedByStyling; - PRectangle rcPaint; - bool paintingAllText; - bool willRedrawAll; - WorkNeeded workNeeded; - int idleStyling; - bool needIdleStyling; - - int modEventMask; - - SelectionText drag; - - int caretXPolicy; - int caretXSlop; ///< Ensure this many pixels visible on both sides of caret - - int caretYPolicy; - int caretYSlop; ///< Ensure this many lines visible on both sides of caret - - int visiblePolicy; - int visibleSlop; - - int searchAnchor; - - bool recordingMacro; - - int foldAutomatic; - - // Wrapping support - WrapPending wrapPending; - - bool convertPastes; - - Editor(); - virtual ~Editor(); - virtual void Initialise() = 0; - virtual void Finalise(); - - void InvalidateStyleData(); - void InvalidateStyleRedraw(); - void RefreshStyleData(); - void SetRepresentations(); - void DropGraphics(bool freeObjects); - void AllocateGraphics(); - - // The top left visible point in main window coordinates. Will be 0,0 except for - // scroll views where it will be equivalent to the current scroll position. - virtual Point GetVisibleOriginInMain() const; - PointDocument DocumentPointFromView(Point ptView) const; // Convert a point from view space to document - int TopLineOfMain() const; // Return the line at Main's y coordinate 0 - virtual PRectangle GetClientRectangle() const; - virtual PRectangle GetClientDrawingRectangle(); - PRectangle GetTextRectangle() const; - - virtual int LinesOnScreen() const; - int LinesToScroll() const; - int MaxScrollPos() const; - SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const; - Point LocationFromPosition(SelectionPosition pos, PointEnd pe=peDefault); - Point LocationFromPosition(int pos, PointEnd pe=peDefault); - int XFromPosition(int pos); - int XFromPosition(SelectionPosition sp); - SelectionPosition SPositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false, bool virtualSpace=true); - int PositionFromLocation(Point pt, bool canReturnInvalid = false, bool charPosition = false); - SelectionPosition SPositionFromLineX(int lineDoc, int x); - int PositionFromLineX(int line, int x); - int LineFromLocation(Point pt) const; - void SetTopLine(int topLineNew); - - virtual bool AbandonPaint(); - virtual void RedrawRect(PRectangle rc); - virtual void DiscardOverdraw(); - virtual void Redraw(); - void RedrawSelMargin(int line=-1, bool allAfter=false); - PRectangle RectangleFromRange(Range r, int overlap); - void InvalidateRange(int start, int end); - - bool UserVirtualSpace() const { - return ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0); - } - int CurrentPosition() const; - bool SelectionEmpty() const; - SelectionPosition SelectionStart(); - SelectionPosition SelectionEnd(); - void SetRectangularRange(); - void ThinRectangularRange(); - void InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection=false); - void InvalidateWholeSelection(); - void SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_); - void SetSelection(int currentPos_, int anchor_); - void SetSelection(SelectionPosition currentPos_); - void SetSelection(int currentPos_); - void SetEmptySelection(SelectionPosition currentPos_); - void SetEmptySelection(int currentPos_); - enum AddNumber { addOne, addEach }; - void MultipleSelectAdd(AddNumber addNumber); - bool RangeContainsProtected(int start, int end) const; - bool SelectionContainsProtected(); - int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const; - SelectionPosition MovePositionOutsideChar(SelectionPosition pos, int moveDir, bool checkLineEnd=true) const; - void MovedCaret(SelectionPosition newPos, SelectionPosition previousPos, bool ensureVisible); - void MovePositionTo(SelectionPosition newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true); - void MovePositionTo(int newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true); - SelectionPosition MovePositionSoVisible(SelectionPosition pos, int moveDir); - SelectionPosition MovePositionSoVisible(int pos, int moveDir); - Point PointMainCaret(); - void SetLastXChosen(); - - void ScrollTo(int line, bool moveThumb=true); - virtual void ScrollText(int linesToMove); - void HorizontalScrollTo(int xPos); - void VerticalCentreCaret(); - void MoveSelectedLines(int lineDelta); - void MoveSelectedLinesUp(); - void MoveSelectedLinesDown(); - void MoveCaretInsideView(bool ensureVisible=true); - int DisplayFromPosition(int pos); - - struct XYScrollPosition { - int xOffset; - int topLine; - XYScrollPosition(int xOffset_, int topLine_) : xOffset(xOffset_), topLine(topLine_) {} - bool operator==(const XYScrollPosition &other) const { - return (xOffset == other.xOffset) && (topLine == other.topLine); - } - }; - enum XYScrollOptions { - xysUseMargin=0x1, - xysVertical=0x2, - xysHorizontal=0x4, - xysDefault=xysUseMargin|xysVertical|xysHorizontal}; - XYScrollPosition XYScrollToMakeVisible(const SelectionRange &range, const XYScrollOptions options); - void SetXYScroll(XYScrollPosition newXY); - void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true); - void ScrollRange(SelectionRange range); - void ShowCaretAtCurrentPosition(); - void DropCaret(); - void CaretSetPeriod(int period); - void InvalidateCaret(); - virtual void NotifyCaretMove(); - virtual void UpdateSystemCaret(); - - bool Wrapping() const; - void NeedWrapping(int docLineStart=0, int docLineEnd=WrapPending::lineLarge); - bool WrapOneLine(Surface *surface, int lineToWrap); - enum wrapScope {wsAll, wsVisible, wsIdle}; - bool WrapLines(enum wrapScope ws); - void LinesJoin(); - void LinesSplit(int pixelWidth); - - void PaintSelMargin(Surface *surface, PRectangle &rc); - void RefreshPixMaps(Surface *surfaceWindow); - void Paint(Surface *surfaceWindow, PRectangle rcArea); - long FormatRange(bool draw, Sci_RangeToFormat *pfr); - int TextWidth(int style, const char *text); - - virtual void SetVerticalScrollPos() = 0; - virtual void SetHorizontalScrollPos() = 0; - virtual bool ModifyScrollBars(int nMax, int nPage) = 0; - virtual void ReconfigureScrollBars(); - void SetScrollBars(); - void ChangeSize(); - - void FilterSelections(); - int RealizeVirtualSpace(int position, unsigned int virtualSpace); - SelectionPosition RealizeVirtualSpace(const SelectionPosition &position); - void AddChar(char ch); - virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); - void ClearBeforeTentativeStart(); - void InsertPaste(const char *text, int len); - enum PasteShape { pasteStream=0, pasteRectangular = 1, pasteLine = 2 }; - void InsertPasteShape(const char *text, int len, PasteShape shape); - void ClearSelection(bool retainMultipleSelections = false); - void ClearAll(); - void ClearDocumentStyle(); - void Cut(); - void PasteRectangular(SelectionPosition pos, const char *ptr, int len); - virtual void Copy() = 0; - virtual void CopyAllowLine(); - virtual bool CanPaste(); - virtual void Paste() = 0; - void Clear(); - void SelectAll(); - void Undo(); - void Redo(); - void DelCharBack(bool allowLineStartDeletion); - virtual void ClaimSelection() = 0; - - static int ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false, bool super=false); - virtual void NotifyChange() = 0; - virtual void NotifyFocus(bool focus); - virtual void SetCtrlID(int identifier); - virtual int GetCtrlID() { return ctrlID; } - virtual void NotifyParent(SCNotification scn) = 0; - virtual void NotifyStyleToNeeded(int endStyleNeeded); - void NotifyChar(int ch); - void NotifySavePoint(bool isSavePoint); - void NotifyModifyAttempt(); - virtual void NotifyDoubleClick(Point pt, int modifiers); - virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt); - void NotifyHotSpotClicked(int position, int modifiers); - void NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt); - void NotifyHotSpotDoubleClicked(int position, int modifiers); - void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt); - void NotifyHotSpotReleaseClick(int position, int modifiers); - void NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt); - bool NotifyUpdateUI(); - void NotifyPainted(); - void NotifyIndicatorClick(bool click, int position, int modifiers); - void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt); - bool NotifyMarginClick(Point pt, int modifiers); - bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt); - bool NotifyMarginRightClick(Point pt, int modifiers); - void NotifyNeedShown(int pos, int len); - void NotifyDwelling(Point pt, bool state); - void NotifyZoom(); - - void NotifyModifyAttempt(Document *document, void *userData); - void NotifySavePoint(Document *document, void *userData, bool atSavePoint); - void CheckModificationForWrap(DocModification mh); - void NotifyModified(Document *document, DocModification mh, void *userData); - void NotifyDeleted(Document *document, void *userData); - void NotifyStyleNeeded(Document *doc, void *userData, int endPos); - void NotifyLexerChanged(Document *doc, void *userData); - void NotifyErrorOccurred(Document *doc, void *userData, int status); - void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - - void ContainerNeedsUpdate(int flags); - void PageMove(int direction, Selection::selTypes selt=Selection::noSel, bool stuttered = false); - enum { cmSame, cmUpper, cmLower }; - virtual std::string CaseMapString(const std::string &s, int caseMapping); - void ChangeCaseOfSelection(int caseMapping); - void LineTranspose(); - void Duplicate(bool forLine); - virtual void CancelModes(); - void NewLine(); - SelectionPosition PositionUpOrDown(SelectionPosition spStart, int direction, int lastX); - void CursorUpOrDown(int direction, Selection::selTypes selt); - void ParaUpOrDown(int direction, Selection::selTypes selt); - Range RangeDisplayLine(int lineVisible); - int StartEndDisplayLine(int pos, bool start); - int VCHomeDisplayPosition(int position); - int VCHomeWrapPosition(int position); - int LineEndWrapPosition(int position); - int HorizontalMove(unsigned int iMessage); - int DelWordOrLine(unsigned int iMessage); - virtual int KeyCommand(unsigned int iMessage); - virtual int KeyDefault(int /* key */, int /*modifiers*/); - int KeyDownWithModifiers(int key, int modifiers, bool *consumed); - int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0); - - void Indent(bool forwards); - - virtual CaseFolder *CaseFolderForEncoding(); - long FindText(uptr_t wParam, sptr_t lParam); - void SearchAnchor(); - long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - long SearchInTarget(const char *text, int length); - void GoToLine(int lineNo); - - virtual void CopyToClipboard(const SelectionText &selectedText) = 0; - std::string RangeText(int start, int end) const; - void CopySelectionRange(SelectionText *ss, bool allowLineCopy=false); - void CopyRangeToClipboard(int start, int end); - void CopyText(int length, const char *text); - void SetDragPosition(SelectionPosition newPos); - virtual void DisplayCursor(Window::Cursor c); - virtual bool DragThreshold(Point ptStart, Point ptNow); - virtual void StartDrag(); - void DropAt(SelectionPosition position, const char *value, size_t lengthValue, bool moving, bool rectangular); - void DropAt(SelectionPosition position, const char *value, bool moving, bool rectangular); - /** PositionInSelection returns true if position in selection. */ - bool PositionInSelection(int pos); - bool PointInSelection(Point pt); - bool PointInSelMargin(Point pt) const; - Window::Cursor GetMarginCursor(Point pt) const; - void TrimAndSetSelection(int currentPos_, int anchor_); - void LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine); - void WordSelection(int pos); - void DwellEnd(bool mouseMoved); - void MouseLeave(); - virtual void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); - virtual void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); - virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); - void ButtonMoveWithModifiers(Point pt, int modifiers); - void ButtonMove(Point pt); - void ButtonUp(Point pt, unsigned int curTime, bool ctrl); - - void Tick(); - bool Idle(); - virtual void SetTicking(bool on); - enum TickReason { tickCaret, tickScroll, tickWiden, tickDwell, tickPlatform }; - virtual void TickFor(TickReason reason); - virtual bool FineTickerAvailable(); - virtual bool FineTickerRunning(TickReason reason); - virtual void FineTickerStart(TickReason reason, int millis, int tolerance); - virtual void FineTickerCancel(TickReason reason); - virtual bool SetIdle(bool) { return false; } - virtual void SetMouseCapture(bool on) = 0; - virtual bool HaveMouseCapture() = 0; - void SetFocusState(bool focusState); - - int PositionAfterArea(PRectangle rcArea) const; - void StyleToPositionInView(Position pos); - int PositionAfterMaxStyling(int posMax, bool scrolling) const; - void StartIdleStyling(bool truncatedLastStyling); - void StyleAreaBounded(PRectangle rcArea, bool scrolling); - void IdleStyling(); - virtual void IdleWork(); - virtual void QueueIdleWork(WorkNeeded::workItems items, int upTo=0); - - virtual bool PaintContains(PRectangle rc); - bool PaintContainsMargin(); - void CheckForChangeOutsidePaint(Range r); - void SetBraceHighlight(Position pos0, Position pos1, int matchStyle); - - void SetAnnotationHeights(int start, int end); - virtual void SetDocPointer(Document *document); - - void SetAnnotationVisible(int visible); - - int ExpandLine(int line); - void SetFoldExpanded(int lineDoc, bool expanded); - void FoldLine(int line, int action); - void FoldExpand(int line, int action, int level); - int ContractedFoldNext(int lineStart) const; - void EnsureLineVisible(int lineDoc, bool enforcePolicy); - void FoldChanged(int line, int levelNow, int levelPrev); - void NeedShown(int pos, int len); - void FoldAll(int action); - - int GetTag(char *tagValue, int tagNumber); - int ReplaceTarget(bool replacePatterns, const char *text, int length=-1); - - bool PositionIsHotspot(int position) const; - bool PointIsHotspot(Point pt); - void SetHotSpotRange(Point *pt); - Range GetHotSpotRange() const; - void SetHoverIndicatorPosition(int position); - void SetHoverIndicatorPoint(Point pt); - - int CodePage() const; - virtual bool ValidCodePage(int /* codePage */) const { return true; } - int WrapCount(int line); - void AddStyledText(char *buffer, int appendLength); - - virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; - bool ValidMargin(uptr_t wParam) const; - void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - void SetSelectionNMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - - static const char *StringFromEOLMode(int eolMode); - - static sptr_t StringResult(sptr_t lParam, const char *val); - static sptr_t BytesResult(sptr_t lParam, const unsigned char *val, size_t len); - -public: - // Public so the COM thunks can access it. - bool IsUnicodeMode() const; - // Public so scintilla_send_message can use it. - virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - // Public so scintilla_set_id can use it. - int ctrlID; - // Public so COM methods for drag and drop can set it. - int errorStatus; - friend class AutoSurface; - friend class SelectionLineIterator; -}; - -/** - * A smart pointer class to ensure Surfaces are set up and deleted correctly. - */ -class AutoSurface { -private: - Surface *surf; -public: - AutoSurface(Editor *ed, int technology = -1) : surf(0) { - if (ed->wMain.GetID()) { - surf = Surface::Allocate(technology != -1 ? technology : ed->technology); - if (surf) { - surf->Init(ed->wMain.GetID()); - surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); - surf->SetDBCSMode(ed->CodePage()); - } - } - } - AutoSurface(SurfaceID sid, Editor *ed, int technology = -1) : surf(0) { - if (ed->wMain.GetID()) { - surf = Surface::Allocate(technology != -1 ? technology : ed->technology); - if (surf) { - surf->Init(sid, ed->wMain.GetID()); - surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); - surf->SetDBCSMode(ed->CodePage()); - } - } - } - ~AutoSurface() { - delete surf; - } - Surface *operator->() const { - return surf; - } - operator Surface *() const { - return surf; - } -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/ExternalLexer.cxx b/qrenderdoc/3rdparty/scintilla/src/ExternalLexer.cxx deleted file mode 100644 index 2f81df7e0..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/ExternalLexer.cxx +++ /dev/null @@ -1,192 +0,0 @@ -// Scintilla source code edit control -/** @file ExternalLexer.cxx - ** Support external lexers in DLLs. - **/ -// Copyright 2001 Simon Steele , portions copyright Neil Hodgson. -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include -#include - -#include "Platform.h" - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "LexerModule.h" -#include "Catalogue.h" -#include "ExternalLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -LexerManager *LexerManager::theInstance = NULL; - -//------------------------------------------ -// -// ExternalLexerModule -// -//------------------------------------------ - -void ExternalLexerModule::SetExternal(GetLexerFactoryFunction fFactory, int index) { - fneFactory = fFactory; - fnFactory = fFactory(index); -} - -//------------------------------------------ -// -// LexerLibrary -// -//------------------------------------------ - -LexerLibrary::LexerLibrary(const char *ModuleName) { - // Initialise some members... - first = NULL; - last = NULL; - - // Load the DLL - lib = DynamicLibrary::Load(ModuleName); - if (lib->IsValid()) { - m_sModuleName = ModuleName; - //Cannot use reinterpret_cast because: ANSI C++ forbids casting between pointers to functions and objects - GetLexerCountFn GetLexerCount = (GetLexerCountFn)(sptr_t)lib->FindFunction("GetLexerCount"); - - if (GetLexerCount) { - ExternalLexerModule *lex; - LexerMinder *lm; - - // Find functions in the DLL - GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName"); - GetLexerFactoryFunction fnFactory = (GetLexerFactoryFunction)(sptr_t)lib->FindFunction("GetLexerFactory"); - - int nl = GetLexerCount(); - - for (int i = 0; i < nl; i++) { - // Assign a buffer for the lexer name. - char lexname[100] = ""; - GetLexerName(i, lexname, sizeof(lexname)); - lex = new ExternalLexerModule(SCLEX_AUTOMATIC, NULL, lexname, NULL); - Catalogue::AddLexerModule(lex); - - // Create a LexerMinder so we don't leak the ExternalLexerModule... - lm = new LexerMinder; - lm->self = lex; - lm->next = NULL; - if (first != NULL) { - last->next = lm; - last = lm; - } else { - first = lm; - last = lm; - } - - // The external lexer needs to know how to call into its DLL to - // do its lexing and folding, we tell it here. - lex->SetExternal(fnFactory, i); - } - } - } - next = NULL; -} - -LexerLibrary::~LexerLibrary() { - Release(); - delete lib; -} - -void LexerLibrary::Release() { - LexerMinder *lm; - LexerMinder *lmNext; - lm = first; - while (NULL != lm) { - lmNext = lm->next; - delete lm->self; - delete lm; - lm = lmNext; - } - - first = NULL; - last = NULL; -} - -//------------------------------------------ -// -// LexerManager -// -//------------------------------------------ - -/// Return the single LexerManager instance... -LexerManager *LexerManager::GetInstance() { - if (!theInstance) - theInstance = new LexerManager; - return theInstance; -} - -/// Delete any LexerManager instance... -void LexerManager::DeleteInstance() { - delete theInstance; - theInstance = NULL; -} - -/// protected constructor - this is a singleton... -LexerManager::LexerManager() { - first = NULL; - last = NULL; -} - -LexerManager::~LexerManager() { - Clear(); -} - -void LexerManager::Load(const char *path) { - LoadLexerLibrary(path); -} - -void LexerManager::LoadLexerLibrary(const char *module) { - for (LexerLibrary *ll = first; ll; ll= ll->next) { - if (strcmp(ll->m_sModuleName.c_str(), module) == 0) - return; - } - LexerLibrary *lib = new LexerLibrary(module); - if (NULL != first) { - last->next = lib; - last = lib; - } else { - first = lib; - last = lib; - } -} - -void LexerManager::Clear() { - if (NULL != first) { - LexerLibrary *cur = first; - LexerLibrary *next; - while (cur) { - next = cur->next; - delete cur; - cur = next; - } - first = NULL; - last = NULL; - } -} - -//------------------------------------------ -// -// LexerManager -// -//------------------------------------------ - -LMMinder::~LMMinder() { - LexerManager::DeleteInstance(); -} - -LMMinder minder; diff --git a/qrenderdoc/3rdparty/scintilla/src/ExternalLexer.h b/qrenderdoc/3rdparty/scintilla/src/ExternalLexer.h deleted file mode 100644 index a85213e31..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/ExternalLexer.h +++ /dev/null @@ -1,92 +0,0 @@ -// Scintilla source code edit control -/** @file ExternalLexer.h - ** Support external lexers in DLLs. - **/ -// Copyright 2001 Simon Steele , portions copyright Neil Hodgson. -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef EXTERNALLEXER_H -#define EXTERNALLEXER_H - -#if PLAT_WIN -#define EXT_LEXER_DECL __stdcall -#else -#define EXT_LEXER_DECL -#endif - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -typedef void*(EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index); -typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); -typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); -typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned int Index); - -/// Sub-class of LexerModule to use an external lexer. -class ExternalLexerModule : public LexerModule { -protected: - GetLexerFactoryFunction fneFactory; - std::string name; -public: - ExternalLexerModule(int language_, LexerFunction fnLexer_, - const char *languageName_=0, LexerFunction fnFolder_=0) : - LexerModule(language_, fnLexer_, 0, fnFolder_), - fneFactory(0), name(languageName_){ - languageName = name.c_str(); - } - virtual void SetExternal(GetLexerFactoryFunction fFactory, int index); -}; - -/// LexerMinder points to an ExternalLexerModule - so we don't leak them. -class LexerMinder { -public: - ExternalLexerModule *self; - LexerMinder *next; -}; - -/// LexerLibrary exists for every External Lexer DLL, contains LexerMinders. -class LexerLibrary { - DynamicLibrary *lib; - LexerMinder *first; - LexerMinder *last; - -public: - explicit LexerLibrary(const char *ModuleName); - ~LexerLibrary(); - void Release(); - - LexerLibrary *next; - std::string m_sModuleName; -}; - -/// LexerManager manages external lexers, contains LexerLibrarys. -class LexerManager { -public: - ~LexerManager(); - - static LexerManager *GetInstance(); - static void DeleteInstance(); - - void Load(const char *path); - void Clear(); - -private: - LexerManager(); - static LexerManager *theInstance; - - void LoadLexerLibrary(const char *module); - LexerLibrary *first; - LexerLibrary *last; -}; - -class LMMinder { -public: - ~LMMinder(); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/FontQuality.h b/qrenderdoc/3rdparty/scintilla/src/FontQuality.h deleted file mode 100644 index a0ae207f8..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/FontQuality.h +++ /dev/null @@ -1,31 +0,0 @@ -// Scintilla source code edit control -/** @file FontQuality.h - ** Definitions to control font anti-aliasing. - ** Redefine constants from Scintilla.h to avoid including Scintilla.h in PlatWin.cxx. - **/ -// Copyright 1998-2009 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef FONTQUALITY_H -#define FONTQUALITY_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -// These definitions match Scintilla.h -#define SC_EFF_QUALITY_MASK 0xF -#define SC_EFF_QUALITY_DEFAULT 0 -#define SC_EFF_QUALITY_NON_ANTIALIASED 1 -#define SC_EFF_QUALITY_ANTIALIASED 2 -#define SC_EFF_QUALITY_LCD_OPTIMIZED 3 - -// These definitions must match SC_TECHNOLOGY_* in Scintilla.h -#define SCWIN_TECH_GDI 0 -#define SCWIN_TECH_DIRECTWRITE 1 - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/Indicator.cxx b/qrenderdoc/3rdparty/scintilla/src/Indicator.cxx deleted file mode 100644 index c23ae4e17..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Indicator.cxx +++ /dev/null @@ -1,194 +0,0 @@ -// Scintilla source code edit control -/** @file Indicator.cxx - ** Defines the style of indicators which are text decorations such as underlining. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "Indicator.h" -#include "XPM.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static PRectangle PixelGridAlign(const PRectangle &rc) { - // Move left and right side to nearest pixel to avoid blurry visuals - return PRectangle::FromInts(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom)); -} - -void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, DrawState drawState, int value) const { - StyleAndColour sacDraw = sacNormal; - if (Flags() & SC_INDICFLAG_VALUEFORE) { - sacDraw.fore = value & SC_INDICVALUEMASK; - } - if (drawState == drawHover) { - sacDraw = sacHover; - } - surface->PenColour(sacDraw.fore); - int ymid = static_cast(rc.bottom + rc.top) / 2; - if (sacDraw.style == INDIC_SQUIGGLE) { - int x = int(rc.left+0.5); - int xLast = int(rc.right+0.5); - int y = 0; - surface->MoveTo(x, static_cast(rc.top) + y); - while (x < xLast) { - if ((x + 2) > xLast) { - if (xLast > x) - y = 1; - x = xLast; - } else { - x += 2; - y = 2 - y; - } - surface->LineTo(x, static_cast(rc.top) + y); - } - } else if (sacDraw.style == INDIC_SQUIGGLEPIXMAP) { - PRectangle rcSquiggle = PixelGridAlign(rc); - - int width = Platform::Minimum(4000, static_cast(rcSquiggle.Width())); - RGBAImage image(width, 3, 1.0, 0); - enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f }; - for (int x = 0; x < width; x++) { - if (x%2) { - // Two halfway columns have a full pixel in middle flanked by light pixels - image.SetPixel(x, 0, sacDraw.fore, alphaSide); - image.SetPixel(x, 1, sacDraw.fore, alphaFull); - image.SetPixel(x, 2, sacDraw.fore, alphaSide); - } else { - // Extreme columns have a full pixel at bottom or top and a mid-tone pixel in centre - image.SetPixel(x, (x % 4) ? 0 : 2, sacDraw.fore, alphaFull); - image.SetPixel(x, 1, sacDraw.fore, alphaSide2); - } - } - surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels()); - } else if (sacDraw.style == INDIC_SQUIGGLELOW) { - surface->MoveTo(static_cast(rc.left), static_cast(rc.top)); - int x = static_cast(rc.left) + 3; - int y = 0; - while (x < rc.right) { - surface->LineTo(x - 1, static_cast(rc.top) + y); - y = 1 - y; - surface->LineTo(x, static_cast(rc.top) + y); - x += 3; - } - surface->LineTo(static_cast(rc.right), static_cast(rc.top) + y); // Finish the line - } else if (sacDraw.style == INDIC_TT) { - surface->MoveTo(static_cast(rc.left), ymid); - int x = static_cast(rc.left) + 5; - while (x < rc.right) { - surface->LineTo(x, ymid); - surface->MoveTo(x-3, ymid); - surface->LineTo(x-3, ymid+2); - x++; - surface->MoveTo(x, ymid); - x += 5; - } - surface->LineTo(static_cast(rc.right), ymid); // Finish the line - if (x - 3 <= rc.right) { - surface->MoveTo(x-3, ymid); - surface->LineTo(x-3, ymid+2); - } - } else if (sacDraw.style == INDIC_DIAGONAL) { - int x = static_cast(rc.left); - while (x < rc.right) { - surface->MoveTo(x, static_cast(rc.top) + 2); - int endX = x+3; - int endY = static_cast(rc.top) - 1; - if (endX > rc.right) { - endY += endX - static_cast(rc.right); - endX = static_cast(rc.right); - } - surface->LineTo(endX, endY); - x += 4; - } - } else if (sacDraw.style == INDIC_STRIKE) { - surface->MoveTo(static_cast(rc.left), static_cast(rc.top) - 4); - surface->LineTo(static_cast(rc.right), static_cast(rc.top) - 4); - } else if ((sacDraw.style == INDIC_HIDDEN) || (sacDraw.style == INDIC_TEXTFORE)) { - // Draw nothing - } else if (sacDraw.style == INDIC_BOX) { - surface->MoveTo(static_cast(rc.left), ymid + 1); - surface->LineTo(static_cast(rc.right), ymid + 1); - surface->LineTo(static_cast(rc.right), static_cast(rcLine.top) + 1); - surface->LineTo(static_cast(rc.left), static_cast(rcLine.top) + 1); - surface->LineTo(static_cast(rc.left), ymid + 1); - } else if (sacDraw.style == INDIC_ROUNDBOX || - sacDraw.style == INDIC_STRAIGHTBOX || - sacDraw.style == INDIC_FULLBOX) { - PRectangle rcBox = rcLine; - if (sacDraw.style != INDIC_FULLBOX) - rcBox.top = rcLine.top + 1; - rcBox.left = rc.left; - rcBox.right = rc.right; - surface->AlphaRectangle(rcBox, (sacDraw.style == INDIC_ROUNDBOX) ? 1 : 0, - sacDraw.fore, fillAlpha, sacDraw.fore, outlineAlpha, 0); - } else if (sacDraw.style == INDIC_DOTBOX) { - PRectangle rcBox = PixelGridAlign(rc); - rcBox.top = rcLine.top + 1; - rcBox.bottom = rcLine.bottom; - // Cap width at 4000 to avoid large allocations when mistakes made - int width = Platform::Minimum(static_cast(rcBox.Width()), 4000); - RGBAImage image(width, static_cast(rcBox.Height()), 1.0, 0); - // Draw horizontal lines top and bottom - for (int x=0; x(rcBox.Height()); y += static_cast(rcBox.Height()) - 1) { - image.SetPixel(x, y, sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha); - } - } - // Draw vertical lines left and right - for (int y = 1; y(rcBox.Height()); y++) { - for (int x=0; xDrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels()); - } else if (sacDraw.style == INDIC_DASH) { - int x = static_cast(rc.left); - while (x < rc.right) { - surface->MoveTo(x, ymid); - surface->LineTo(Platform::Minimum(x + 4, static_cast(rc.right)), ymid); - x += 7; - } - } else if (sacDraw.style == INDIC_DOTS) { - int x = static_cast(rc.left); - while (x < static_cast(rc.right)) { - PRectangle rcDot = PRectangle::FromInts(x, ymid, x + 1, ymid + 1); - surface->FillRectangle(rcDot, sacDraw.fore); - x += 2; - } - } else if (sacDraw.style == INDIC_COMPOSITIONTHICK) { - PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom); - surface->FillRectangle(rcComposition, sacDraw.fore); - } else if (sacDraw.style == INDIC_COMPOSITIONTHIN) { - PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom-1); - surface->FillRectangle(rcComposition, sacDraw.fore); - } else if (sacDraw.style == INDIC_POINT || sacDraw.style == INDIC_POINTCHARACTER) { - if (rcCharacter.Width() >= 0.1) { - const int pixelHeight = static_cast(rc.Height() - 1.0f); // 1 pixel onto next line if multiphase - const XYPOSITION x = (sacDraw.style == INDIC_POINT) ? (rcCharacter.left) : ((rcCharacter.right + rcCharacter.left) / 2); - const int ix = static_cast(x + 0.5f); - const int iy = static_cast(rc.top + 1.0f); - Point pts[] = { - Point::FromInts(ix - pixelHeight, iy + pixelHeight), // Left - Point::FromInts(ix + pixelHeight, iy + pixelHeight), // Right - Point::FromInts(ix, iy) // Top - }; - surface->Polygon(pts, 3, sacDraw.fore, sacDraw.fore); - } - } else { // Either INDIC_PLAIN or unknown - surface->MoveTo(static_cast(rc.left), ymid); - surface->LineTo(static_cast(rc.right), ymid); - } -} - -void Indicator::SetFlags(int attributes_) { - attributes = attributes_; -} diff --git a/qrenderdoc/3rdparty/scintilla/src/Indicator.h b/qrenderdoc/3rdparty/scintilla/src/Indicator.h deleted file mode 100644 index 9b887df9d..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Indicator.h +++ /dev/null @@ -1,60 +0,0 @@ -// Scintilla source code edit control -/** @file Indicator.h - ** Defines the style of indicators which are text decorations such as underlining. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef INDICATOR_H -#define INDICATOR_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -struct StyleAndColour { - int style; - ColourDesired fore; - StyleAndColour() : style(INDIC_PLAIN), fore(0, 0, 0) { - } - StyleAndColour(int style_, ColourDesired fore_ = ColourDesired(0, 0, 0)) : style(style_), fore(fore_) { - } - bool operator==(const StyleAndColour &other) const { - return (style == other.style) && (fore == other.fore); - } -}; - -/** - */ -class Indicator { -public: - enum DrawState { drawNormal, drawHover }; - StyleAndColour sacNormal; - StyleAndColour sacHover; - bool under; - int fillAlpha; - int outlineAlpha; - int attributes; - Indicator() : under(false), fillAlpha(30), outlineAlpha(50), attributes(0) { - } - Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) : - sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(0) { - } - void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, DrawState drawState, int value) const; - bool IsDynamic() const { - return !(sacNormal == sacHover); - } - bool OverridesTextFore() const { - return sacNormal.style == INDIC_TEXTFORE || sacHover.style == INDIC_TEXTFORE; - } - int Flags() const { - return attributes; - } - void SetFlags(int attributes_); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/KeyMap.cxx b/qrenderdoc/3rdparty/scintilla/src/KeyMap.cxx deleted file mode 100644 index a6b1cf6c4..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/KeyMap.cxx +++ /dev/null @@ -1,161 +0,0 @@ -// Scintilla source code edit control -/** @file KeyMap.cxx - ** Defines a mapping between keystrokes and commands. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include - -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" - -#include "KeyMap.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -KeyMap::KeyMap() { - for (int i = 0; MapDefault[i].key; i++) { - AssignCmdKey(MapDefault[i].key, - MapDefault[i].modifiers, - MapDefault[i].msg); - } -} - -KeyMap::~KeyMap() { - Clear(); -} - -void KeyMap::Clear() { - kmap.clear(); -} - -void KeyMap::AssignCmdKey(int key, int modifiers, unsigned int msg) { - kmap[KeyModifiers(key, modifiers)] = msg; -} - -unsigned int KeyMap::Find(int key, int modifiers) const { - std::map::const_iterator it = kmap.find(KeyModifiers(key, modifiers)); - return (it == kmap.end()) ? 0 : it->second; -} - -#if PLAT_GTK_MACOSX -#define OS_X_KEYS 1 -#else -#define OS_X_KEYS 0 -#endif - -// Define a modifier that is exactly Ctrl key on all platforms -// Most uses of Ctrl map to Cmd on OS X but some can't so use SCI_[S]CTRL_META -#if OS_X_KEYS -#define SCI_CTRL_META SCI_META -#define SCI_SCTRL_META (SCI_META | SCI_SHIFT) -#else -#define SCI_CTRL_META SCI_CTRL -#define SCI_SCTRL_META (SCI_CTRL | SCI_SHIFT) -#endif - -const KeyToCommand KeyMap::MapDefault[] = { - -#if OS_X_KEYS - {SCK_DOWN, SCI_CTRL, SCI_DOCUMENTEND}, - {SCK_DOWN, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, - {SCK_UP, SCI_CTRL, SCI_DOCUMENTSTART}, - {SCK_UP, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, - {SCK_LEFT, SCI_CTRL, SCI_VCHOME}, - {SCK_LEFT, SCI_CSHIFT, SCI_VCHOMEEXTEND}, - {SCK_RIGHT, SCI_CTRL, SCI_LINEEND}, - {SCK_RIGHT, SCI_CSHIFT, SCI_LINEENDEXTEND}, -#endif - - {SCK_DOWN, SCI_NORM, SCI_LINEDOWN}, - {SCK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND}, - {SCK_DOWN, SCI_CTRL_META, SCI_LINESCROLLDOWN}, - {SCK_DOWN, SCI_ASHIFT, SCI_LINEDOWNRECTEXTEND}, - {SCK_UP, SCI_NORM, SCI_LINEUP}, - {SCK_UP, SCI_SHIFT, SCI_LINEUPEXTEND}, - {SCK_UP, SCI_CTRL_META, SCI_LINESCROLLUP}, - {SCK_UP, SCI_ASHIFT, SCI_LINEUPRECTEXTEND}, - {'[', SCI_CTRL, SCI_PARAUP}, - {'[', SCI_CSHIFT, SCI_PARAUPEXTEND}, - {']', SCI_CTRL, SCI_PARADOWN}, - {']', SCI_CSHIFT, SCI_PARADOWNEXTEND}, - {SCK_LEFT, SCI_NORM, SCI_CHARLEFT}, - {SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND}, - {SCK_LEFT, SCI_CTRL_META, SCI_WORDLEFT}, - {SCK_LEFT, SCI_SCTRL_META, SCI_WORDLEFTEXTEND}, - {SCK_LEFT, SCI_ASHIFT, SCI_CHARLEFTRECTEXTEND}, - {SCK_RIGHT, SCI_NORM, SCI_CHARRIGHT}, - {SCK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND}, - {SCK_RIGHT, SCI_CTRL_META, SCI_WORDRIGHT}, - {SCK_RIGHT, SCI_SCTRL_META, SCI_WORDRIGHTEXTEND}, - {SCK_RIGHT, SCI_ASHIFT, SCI_CHARRIGHTRECTEXTEND}, - {'/', SCI_CTRL, SCI_WORDPARTLEFT}, - {'/', SCI_CSHIFT, SCI_WORDPARTLEFTEXTEND}, - {'\\', SCI_CTRL, SCI_WORDPARTRIGHT}, - {'\\', SCI_CSHIFT, SCI_WORDPARTRIGHTEXTEND}, - {SCK_HOME, SCI_NORM, SCI_VCHOME}, - {SCK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND}, - {SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART}, - {SCK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, - {SCK_HOME, SCI_ALT, SCI_HOMEDISPLAY}, - {SCK_HOME, SCI_ASHIFT, SCI_VCHOMERECTEXTEND}, - {SCK_END, SCI_NORM, SCI_LINEEND}, - {SCK_END, SCI_SHIFT, SCI_LINEENDEXTEND}, - {SCK_END, SCI_CTRL, SCI_DOCUMENTEND}, - {SCK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, - {SCK_END, SCI_ALT, SCI_LINEENDDISPLAY}, - {SCK_END, SCI_ASHIFT, SCI_LINEENDRECTEXTEND}, - {SCK_PRIOR, SCI_NORM, SCI_PAGEUP}, - {SCK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND}, - {SCK_PRIOR, SCI_ASHIFT, SCI_PAGEUPRECTEXTEND}, - {SCK_NEXT, SCI_NORM, SCI_PAGEDOWN}, - {SCK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND}, - {SCK_NEXT, SCI_ASHIFT, SCI_PAGEDOWNRECTEXTEND}, - {SCK_DELETE, SCI_NORM, SCI_CLEAR}, - {SCK_DELETE, SCI_SHIFT, SCI_CUT}, - {SCK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT}, - {SCK_DELETE, SCI_CSHIFT, SCI_DELLINERIGHT}, - {SCK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE}, - {SCK_INSERT, SCI_SHIFT, SCI_PASTE}, - {SCK_INSERT, SCI_CTRL, SCI_COPY}, - {SCK_ESCAPE, SCI_NORM, SCI_CANCEL}, - {SCK_BACK, SCI_NORM, SCI_DELETEBACK}, - {SCK_BACK, SCI_SHIFT, SCI_DELETEBACK}, - {SCK_BACK, SCI_CTRL, SCI_DELWORDLEFT}, - {SCK_BACK, SCI_ALT, SCI_UNDO}, - {SCK_BACK, SCI_CSHIFT, SCI_DELLINELEFT}, - {'Z', SCI_CTRL, SCI_UNDO}, -#if OS_X_KEYS - {'Z', SCI_CSHIFT, SCI_REDO}, -#else - {'Y', SCI_CTRL, SCI_REDO}, -#endif - {'X', SCI_CTRL, SCI_CUT}, - {'C', SCI_CTRL, SCI_COPY}, - {'V', SCI_CTRL, SCI_PASTE}, - {'A', SCI_CTRL, SCI_SELECTALL}, - {SCK_TAB, SCI_NORM, SCI_TAB}, - {SCK_TAB, SCI_SHIFT, SCI_BACKTAB}, - {SCK_RETURN, SCI_NORM, SCI_NEWLINE}, - {SCK_RETURN, SCI_SHIFT, SCI_NEWLINE}, - {SCK_ADD, SCI_CTRL, SCI_ZOOMIN}, - {SCK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT}, - {SCK_DIVIDE, SCI_CTRL, SCI_SETZOOM}, - {'L', SCI_CTRL, SCI_LINECUT}, - {'L', SCI_CSHIFT, SCI_LINEDELETE}, - {'T', SCI_CSHIFT, SCI_LINECOPY}, - {'T', SCI_CTRL, SCI_LINETRANSPOSE}, - {'D', SCI_CTRL, SCI_SELECTIONDUPLICATE}, - {'U', SCI_CTRL, SCI_LOWERCASE}, - {'U', SCI_CSHIFT, SCI_UPPERCASE}, - {0,0,0}, -}; - diff --git a/qrenderdoc/3rdparty/scintilla/src/KeyMap.h b/qrenderdoc/3rdparty/scintilla/src/KeyMap.h deleted file mode 100644 index 7c4f80720..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/KeyMap.h +++ /dev/null @@ -1,67 +0,0 @@ -// Scintilla source code edit control -/** @file KeyMap.h - ** Defines a mapping between keystrokes and commands. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef KEYMAP_H -#define KEYMAP_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -#define SCI_NORM 0 -#define SCI_SHIFT SCMOD_SHIFT -#define SCI_CTRL SCMOD_CTRL -#define SCI_ALT SCMOD_ALT -#define SCI_META SCMOD_META -#define SCI_SUPER SCMOD_SUPER -#define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT) -#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT) - -/** - */ -class KeyModifiers { -public: - int key; - int modifiers; - KeyModifiers(int key_, int modifiers_) : key(key_), modifiers(modifiers_) { - } - bool operator<(const KeyModifiers &other) const { - if (key == other.key) - return modifiers < other.modifiers; - else - return key < other.key; - } -}; - -/** - */ -class KeyToCommand { -public: - int key; - int modifiers; - unsigned int msg; -}; - -/** - */ -class KeyMap { - std::map kmap; - static const KeyToCommand MapDefault[]; - -public: - KeyMap(); - ~KeyMap(); - void Clear(); - void AssignCmdKey(int key, int modifiers, unsigned int msg); - unsigned int Find(int key, int modifiers) const; // 0 returned on failure -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/LineMarker.cxx b/qrenderdoc/3rdparty/scintilla/src/LineMarker.cxx deleted file mode 100644 index 6239d1c9d..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/LineMarker.cxx +++ /dev/null @@ -1,399 +0,0 @@ -// Scintilla source code edit control -/** @file LineMarker.cxx - ** Defines the look of a line marker in the margin. - **/ -// Copyright 1998-2011 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include - -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" - -#include "StringCopy.h" -#include "XPM.h" -#include "LineMarker.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -void LineMarker::SetXPM(const char *textForm) { - delete pxpm; - pxpm = new XPM(textForm); - markType = SC_MARK_PIXMAP; -} - -void LineMarker::SetXPM(const char *const *linesForm) { - delete pxpm; - pxpm = new XPM(linesForm); - markType = SC_MARK_PIXMAP; -} - -void LineMarker::SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage) { - delete image; - image = new RGBAImage(static_cast(sizeRGBAImage.x), static_cast(sizeRGBAImage.y), scale, pixelsRGBAImage); - markType = SC_MARK_RGBAIMAGE; -} - -static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) { - PRectangle rc = PRectangle::FromInts( - centreX - armSize, - centreY - armSize, - centreX + armSize + 1, - centreY + armSize + 1); - surface->RectangleDraw(rc, back, fore); -} - -static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) { - PRectangle rcCircle = PRectangle::FromInts( - centreX - armSize, - centreY - armSize, - centreX + armSize + 1, - centreY + armSize + 1); - surface->Ellipse(rcCircle, back, fore); -} - -static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) { - PRectangle rcV = PRectangle::FromInts(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1); - surface->FillRectangle(rcV, fore); - PRectangle rcH = PRectangle::FromInts(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY + 1); - surface->FillRectangle(rcH, fore); -} - -static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) { - PRectangle rcH = PRectangle::FromInts(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY + 1); - surface->FillRectangle(rcH, fore); -} - -void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const { - if (customDraw != NULL) { - customDraw(surface, rcWhole, fontForCharacter, tFold, marginStyle, this); - return; - } - - ColourDesired colourHead = back; - ColourDesired colourBody = back; - ColourDesired colourTail = back; - - switch (tFold) { - case LineMarker::head : - case LineMarker::headWithTail : - colourHead = backSelected; - colourTail = backSelected; - break; - case LineMarker::body : - colourHead = backSelected; - colourBody = backSelected; - break; - case LineMarker::tail : - colourBody = backSelected; - colourTail = backSelected; - break; - default : - // LineMarker::undefined - break; - } - - if ((markType == SC_MARK_PIXMAP) && (pxpm)) { - pxpm->Draw(surface, rcWhole); - return; - } - if ((markType == SC_MARK_RGBAIMAGE) && (image)) { - // Make rectangle just large enough to fit image centred on centre of rcWhole - PRectangle rcImage; - rcImage.top = ((rcWhole.top + rcWhole.bottom) - image->GetScaledHeight()) / 2; - rcImage.bottom = rcImage.top + image->GetScaledHeight(); - rcImage.left = ((rcWhole.left + rcWhole.right) - image->GetScaledWidth()) / 2; - rcImage.right = rcImage.left + image->GetScaledWidth(); - surface->DrawRGBAImage(rcImage, image->GetWidth(), image->GetHeight(), image->Pixels()); - return; - } - // Restrict most shapes a bit - PRectangle rc = rcWhole; - rc.top++; - rc.bottom--; - int minDim = Platform::Minimum(static_cast(rc.Width()), static_cast(rc.Height())); - minDim--; // Ensure does not go beyond edge - int centreX = static_cast(floor((rc.right + rc.left) / 2.0)); - int centreY = static_cast(floor((rc.bottom + rc.top) / 2.0)); - int dimOn2 = minDim / 2; - int dimOn4 = minDim / 4; - int blobSize = dimOn2-1; - int armSize = dimOn2-2; - if (marginStyle == SC_MARGIN_NUMBER || marginStyle == SC_MARGIN_TEXT || marginStyle == SC_MARGIN_RTEXT) { - // On textual margins move marker to the left to try to avoid overlapping the text - centreX = static_cast(rc.left) + dimOn2 + 1; - } - if (markType == SC_MARK_ROUNDRECT) { - PRectangle rcRounded = rc; - rcRounded.left = rc.left + 1; - rcRounded.right = rc.right - 1; - surface->RoundedRectangle(rcRounded, fore, back); - } else if (markType == SC_MARK_CIRCLE) { - PRectangle rcCircle = PRectangle::FromInts( - centreX - dimOn2, - centreY - dimOn2, - centreX + dimOn2, - centreY + dimOn2); - surface->Ellipse(rcCircle, fore, back); - } else if (markType == SC_MARK_ARROW) { - Point pts[] = { - Point::FromInts(centreX - dimOn4, centreY - dimOn2), - Point::FromInts(centreX - dimOn4, centreY + dimOn2), - Point::FromInts(centreX + dimOn2 - dimOn4, centreY), - }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); - - } else if (markType == SC_MARK_ARROWDOWN) { - Point pts[] = { - Point::FromInts(centreX - dimOn2, centreY - dimOn4), - Point::FromInts(centreX + dimOn2, centreY - dimOn4), - Point::FromInts(centreX, centreY + dimOn2 - dimOn4), - }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); - - } else if (markType == SC_MARK_PLUS) { - Point pts[] = { - Point::FromInts(centreX - armSize, centreY - 1), - Point::FromInts(centreX - 1, centreY - 1), - Point::FromInts(centreX - 1, centreY - armSize), - Point::FromInts(centreX + 1, centreY - armSize), - Point::FromInts(centreX + 1, centreY - 1), - Point::FromInts(centreX + armSize, centreY -1), - Point::FromInts(centreX + armSize, centreY +1), - Point::FromInts(centreX + 1, centreY + 1), - Point::FromInts(centreX + 1, centreY + armSize), - Point::FromInts(centreX - 1, centreY + armSize), - Point::FromInts(centreX - 1, centreY + 1), - Point::FromInts(centreX - armSize, centreY + 1), - }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); - - } else if (markType == SC_MARK_MINUS) { - Point pts[] = { - Point::FromInts(centreX - armSize, centreY - 1), - Point::FromInts(centreX + armSize, centreY -1), - Point::FromInts(centreX + armSize, centreY +1), - Point::FromInts(centreX - armSize, centreY + 1), - }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); - - } else if (markType == SC_MARK_SMALLRECT) { - PRectangle rcSmall; - rcSmall.left = rc.left + 1; - rcSmall.top = rc.top + 2; - rcSmall.right = rc.right - 1; - rcSmall.bottom = rc.bottom - 2; - surface->RectangleDraw(rcSmall, fore, back); - - } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND || - markType == SC_MARK_UNDERLINE || markType == SC_MARK_AVAILABLE) { - // An invisible marker so don't draw anything - - } else if (markType == SC_MARK_VLINE) { - surface->PenColour(colourBody); - surface->MoveTo(centreX, static_cast(rcWhole.top)); - surface->LineTo(centreX, static_cast(rcWhole.bottom)); - - } else if (markType == SC_MARK_LCORNER) { - surface->PenColour(colourTail); - surface->MoveTo(centreX, static_cast(rcWhole.top)); - surface->LineTo(centreX, centreY); - surface->LineTo(static_cast(rc.right) - 1, centreY); - - } else if (markType == SC_MARK_TCORNER) { - surface->PenColour(colourTail); - surface->MoveTo(centreX, centreY); - surface->LineTo(static_cast(rc.right) - 1, centreY); - - surface->PenColour(colourBody); - surface->MoveTo(centreX, static_cast(rcWhole.top)); - surface->LineTo(centreX, centreY + 1); - - surface->PenColour(colourHead); - surface->LineTo(centreX, static_cast(rcWhole.bottom)); - - } else if (markType == SC_MARK_LCORNERCURVE) { - surface->PenColour(colourTail); - surface->MoveTo(centreX, static_cast(rcWhole.top)); - surface->LineTo(centreX, centreY-3); - surface->LineTo(centreX+3, centreY); - surface->LineTo(static_cast(rc.right) - 1, centreY); - - } else if (markType == SC_MARK_TCORNERCURVE) { - surface->PenColour(colourTail); - surface->MoveTo(centreX, centreY-3); - surface->LineTo(centreX+3, centreY); - surface->LineTo(static_cast(rc.right) - 1, centreY); - - surface->PenColour(colourBody); - surface->MoveTo(centreX, static_cast(rcWhole.top)); - surface->LineTo(centreX, centreY-2); - - surface->PenColour(colourHead); - surface->LineTo(centreX, static_cast(rcWhole.bottom)); - - } else if (markType == SC_MARK_BOXPLUS) { - DrawBox(surface, centreX, centreY, blobSize, fore, colourHead); - DrawPlus(surface, centreX, centreY, blobSize, colourTail); - - } else if (markType == SC_MARK_BOXPLUSCONNECTED) { - if (tFold == LineMarker::headWithTail) - surface->PenColour(colourTail); - else - surface->PenColour(colourBody); - surface->MoveTo(centreX, centreY + blobSize); - surface->LineTo(centreX, static_cast(rcWhole.bottom)); - - surface->PenColour(colourBody); - surface->MoveTo(centreX, static_cast(rcWhole.top)); - surface->LineTo(centreX, centreY - blobSize); - - DrawBox(surface, centreX, centreY, blobSize, fore, colourHead); - DrawPlus(surface, centreX, centreY, blobSize, colourTail); - - if (tFold == LineMarker::body) { - surface->PenColour(colourTail); - surface->MoveTo(centreX + 1, centreY + blobSize); - surface->LineTo(centreX + blobSize + 1, centreY + blobSize); - - surface->MoveTo(centreX + blobSize, centreY + blobSize); - surface->LineTo(centreX + blobSize, centreY - blobSize); - - surface->MoveTo(centreX + 1, centreY - blobSize); - surface->LineTo(centreX + blobSize + 1, centreY - blobSize); - } - } else if (markType == SC_MARK_BOXMINUS) { - DrawBox(surface, centreX, centreY, blobSize, fore, colourHead); - DrawMinus(surface, centreX, centreY, blobSize, colourTail); - - surface->PenColour(colourHead); - surface->MoveTo(centreX, centreY + blobSize); - surface->LineTo(centreX, static_cast(rcWhole.bottom)); - - } else if (markType == SC_MARK_BOXMINUSCONNECTED) { - DrawBox(surface, centreX, centreY, blobSize, fore, colourHead); - DrawMinus(surface, centreX, centreY, blobSize, colourTail); - - surface->PenColour(colourHead); - surface->MoveTo(centreX, centreY + blobSize); - surface->LineTo(centreX, static_cast(rcWhole.bottom)); - - surface->PenColour(colourBody); - surface->MoveTo(centreX, static_cast(rcWhole.top)); - surface->LineTo(centreX, centreY - blobSize); - - if (tFold == LineMarker::body) { - surface->PenColour(colourTail); - surface->MoveTo(centreX + 1, centreY + blobSize); - surface->LineTo(centreX + blobSize + 1, centreY + blobSize); - - surface->MoveTo(centreX + blobSize, centreY + blobSize); - surface->LineTo(centreX + blobSize, centreY - blobSize); - - surface->MoveTo(centreX + 1, centreY - blobSize); - surface->LineTo(centreX + blobSize + 1, centreY - blobSize); - } - } else if (markType == SC_MARK_CIRCLEPLUS) { - DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead); - DrawPlus(surface, centreX, centreY, blobSize, colourTail); - - } else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) { - if (tFold == LineMarker::headWithTail) - surface->PenColour(colourTail); - else - surface->PenColour(colourBody); - surface->MoveTo(centreX, centreY + blobSize); - surface->LineTo(centreX, static_cast(rcWhole.bottom)); - - surface->PenColour(colourBody); - surface->MoveTo(centreX, static_cast(rcWhole.top)); - surface->LineTo(centreX, centreY - blobSize); - - DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead); - DrawPlus(surface, centreX, centreY, blobSize, colourTail); - - } else if (markType == SC_MARK_CIRCLEMINUS) { - surface->PenColour(colourHead); - surface->MoveTo(centreX, centreY + blobSize); - surface->LineTo(centreX, static_cast(rcWhole.bottom)); - - DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead); - DrawMinus(surface, centreX, centreY, blobSize, colourTail); - - } else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) { - surface->PenColour(colourHead); - surface->MoveTo(centreX, centreY + blobSize); - surface->LineTo(centreX, static_cast(rcWhole.bottom)); - - surface->PenColour(colourBody); - surface->MoveTo(centreX, static_cast(rcWhole.top)); - surface->LineTo(centreX, centreY - blobSize); - - DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead); - DrawMinus(surface, centreX, centreY, blobSize, colourTail); - - } else if (markType >= SC_MARK_CHARACTER) { - char character[1]; - character[0] = static_cast(markType - SC_MARK_CHARACTER); - XYPOSITION width = surface->WidthText(fontForCharacter, character, 1); - rc.left += (rc.Width() - width) / 2; - rc.right = rc.left + width; - surface->DrawTextClipped(rc, fontForCharacter, rc.bottom - 2, - character, 1, fore, back); - - } else if (markType == SC_MARK_DOTDOTDOT) { - XYPOSITION right = static_cast(centreX - 6); - for (int b=0; b<3; b++) { - PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2); - surface->FillRectangle(rcBlob, fore); - right += 5.0f; - } - } else if (markType == SC_MARK_ARROWS) { - surface->PenColour(fore); - int right = centreX - 2; - const int armLength = dimOn2 - 1; - for (int b = 0; b<3; b++) { - surface->MoveTo(right, centreY); - surface->LineTo(right - armLength, centreY - armLength); - surface->MoveTo(right, centreY); - surface->LineTo(right - armLength, centreY + armLength); - right += 4; - } - } else if (markType == SC_MARK_SHORTARROW) { - Point pts[] = { - Point::FromInts(centreX, centreY + dimOn2), - Point::FromInts(centreX + dimOn2, centreY), - Point::FromInts(centreX, centreY - dimOn2), - Point::FromInts(centreX, centreY - dimOn4), - Point::FromInts(centreX - dimOn4, centreY - dimOn4), - Point::FromInts(centreX - dimOn4, centreY + dimOn4), - Point::FromInts(centreX, centreY + dimOn4), - Point::FromInts(centreX, centreY + dimOn2), - }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); - } else if (markType == SC_MARK_LEFTRECT) { - PRectangle rcLeft = rcWhole; - rcLeft.right = rcLeft.left + 4; - surface->FillRectangle(rcLeft, back); - } else if (markType == SC_MARK_BOOKMARK) { - int halfHeight = minDim / 3; - Point pts[] = { - Point::FromInts(static_cast(rc.left), centreY-halfHeight), - Point::FromInts(static_cast(rc.right) - 3, centreY - halfHeight), - Point::FromInts(static_cast(rc.right) - 3 - halfHeight, centreY), - Point::FromInts(static_cast(rc.right) - 3, centreY + halfHeight), - Point::FromInts(static_cast(rc.left), centreY + halfHeight), - }; - surface->Polygon(pts, ELEMENTS(pts), fore, back); - } else { // SC_MARK_FULLRECT - surface->FillRectangle(rcWhole, back); - } -} diff --git a/qrenderdoc/3rdparty/scintilla/src/LineMarker.h b/qrenderdoc/3rdparty/scintilla/src/LineMarker.h deleted file mode 100644 index 6a5fe7492..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/LineMarker.h +++ /dev/null @@ -1,86 +0,0 @@ -// Scintilla source code edit control -/** @file LineMarker.h - ** Defines the look of a line marker in the margin . - **/ -// Copyright 1998-2011 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef LINEMARKER_H -#define LINEMARKER_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -typedef void (*DrawLineMarkerFn)(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, int tFold, int marginStyle, const void *lineMarker); - -/** - */ -class LineMarker { -public: - enum typeOfFold { undefined, head, body, tail, headWithTail }; - - int markType; - ColourDesired fore; - ColourDesired back; - ColourDesired backSelected; - int alpha; - XPM *pxpm; - RGBAImage *image; - /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native - * Draw function for drawing line markers. Allow those platforms to override - * it instead of creating a new method(s) in the Surface class that existing - * platforms must implement as empty. */ - DrawLineMarkerFn customDraw; - LineMarker() { - markType = SC_MARK_CIRCLE; - fore = ColourDesired(0,0,0); - back = ColourDesired(0xff,0xff,0xff); - backSelected = ColourDesired(0xff,0x00,0x00); - alpha = SC_ALPHA_NOALPHA; - pxpm = NULL; - image = NULL; - customDraw = NULL; - } - LineMarker(const LineMarker &) { - // Defined to avoid pxpm being blindly copied, not as a complete copy constructor - markType = SC_MARK_CIRCLE; - fore = ColourDesired(0,0,0); - back = ColourDesired(0xff,0xff,0xff); - backSelected = ColourDesired(0xff,0x00,0x00); - alpha = SC_ALPHA_NOALPHA; - pxpm = NULL; - image = NULL; - customDraw = NULL; - } - ~LineMarker() { - delete pxpm; - delete image; - } - LineMarker &operator=(const LineMarker &other) { - // Defined to avoid pxpm being blindly copied, not as a complete assignment operator - if (this != &other) { - markType = SC_MARK_CIRCLE; - fore = ColourDesired(0,0,0); - back = ColourDesired(0xff,0xff,0xff); - backSelected = ColourDesired(0xff,0x00,0x00); - alpha = SC_ALPHA_NOALPHA; - delete pxpm; - pxpm = NULL; - delete image; - image = NULL; - customDraw = NULL; - } - return *this; - } - void SetXPM(const char *textForm); - void SetXPM(const char *const *linesForm); - void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage); - void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/MarginView.cxx b/qrenderdoc/3rdparty/scintilla/src/MarginView.cxx deleted file mode 100644 index 3ec70f01e..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/MarginView.cxx +++ /dev/null @@ -1,474 +0,0 @@ -// Scintilla source code edit control -/** @file MarginView.cxx - ** Defines the appearance of the editor margin. - **/ -// Copyright 1998-2014 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "ILexer.h" -#include "Scintilla.h" - -#include "StringCopy.h" -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" -#include "CellBuffer.h" -#include "KeyMap.h" -#include "Indicator.h" -#include "XPM.h" -#include "LineMarker.h" -#include "Style.h" -#include "ViewStyle.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "CaseFolder.h" -#include "Document.h" -#include "UniConversion.h" -#include "Selection.h" -#include "PositionCache.h" -#include "EditModel.h" -#include "MarginView.h" -#include "EditView.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -void DrawWrapMarker(Surface *surface, PRectangle rcPlace, - bool isEndMarker, ColourDesired wrapColour) { - surface->PenColour(wrapColour); - - enum { xa = 1 }; // gap before start - int w = static_cast(rcPlace.right - rcPlace.left) - xa - 1; - - bool xStraight = isEndMarker; // x-mirrored symbol for start marker - - int x0 = static_cast(xStraight ? rcPlace.left : rcPlace.right - 1); - int y0 = static_cast(rcPlace.top); - - int dy = static_cast(rcPlace.bottom - rcPlace.top) / 5; - int y = static_cast(rcPlace.bottom - rcPlace.top) / 2 + dy; - - struct Relative { - Surface *surface; - int xBase; - int xDir; - int yBase; - int yDir; - void MoveTo(int xRelative, int yRelative) { - surface->MoveTo(xBase + xDir * xRelative, yBase + yDir * yRelative); - } - void LineTo(int xRelative, int yRelative) { - surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative); - } - }; - Relative rel = { surface, x0, xStraight ? 1 : -1, y0, 1 }; - - // arrow head - rel.MoveTo(xa, y); - rel.LineTo(xa + 2 * w / 3, y - dy); - rel.MoveTo(xa, y); - rel.LineTo(xa + 2 * w / 3, y + dy); - - // arrow body - rel.MoveTo(xa, y); - rel.LineTo(xa + w, y); - rel.LineTo(xa + w, y - 2 * dy); - rel.LineTo(xa - 1, // on windows lineto is exclusive endpoint, perhaps GTK not... - y - 2 * dy); -} - -MarginView::MarginView() { - pixmapSelMargin = 0; - pixmapSelPattern = 0; - pixmapSelPatternOffset1 = 0; - wrapMarkerPaddingRight = 3; - customDrawWrapMarker = NULL; -} - -void MarginView::DropGraphics(bool freeObjects) { - if (freeObjects) { - delete pixmapSelMargin; - pixmapSelMargin = 0; - delete pixmapSelPattern; - pixmapSelPattern = 0; - delete pixmapSelPatternOffset1; - pixmapSelPatternOffset1 = 0; - } else { - if (pixmapSelMargin) - pixmapSelMargin->Release(); - if (pixmapSelPattern) - pixmapSelPattern->Release(); - if (pixmapSelPatternOffset1) - pixmapSelPatternOffset1->Release(); - } -} - -void MarginView::AllocateGraphics(const ViewStyle &vsDraw) { - if (!pixmapSelMargin) - pixmapSelMargin = Surface::Allocate(vsDraw.technology); - if (!pixmapSelPattern) - pixmapSelPattern = Surface::Allocate(vsDraw.technology); - if (!pixmapSelPatternOffset1) - pixmapSelPatternOffset1 = Surface::Allocate(vsDraw.technology); -} - -void MarginView::RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw) { - if (!pixmapSelPattern->Initialised()) { - const int patternSize = 8; - pixmapSelPattern->InitPixMap(patternSize, patternSize, surfaceWindow, wid); - pixmapSelPatternOffset1->InitPixMap(patternSize, patternSize, surfaceWindow, wid); - // This complex procedure is to reproduce the checkerboard dithered pattern used by windows - // for scroll bars and Visual Studio for its selection margin. The colour of this pattern is half - // way between the chrome colour and the chrome highlight colour making a nice transition - // between the window chrome and the content area. And it works in low colour depths. - PRectangle rcPattern = PRectangle::FromInts(0, 0, patternSize, patternSize); - - // Initialize default colours based on the chrome colour scheme. Typically the highlight is white. - ColourDesired colourFMFill = vsDraw.selbar; - ColourDesired colourFMStripes = vsDraw.selbarlight; - - if (!(vsDraw.selbarlight == ColourDesired(0xff, 0xff, 0xff))) { - // User has chosen an unusual chrome colour scheme so just use the highlight edge colour. - // (Typically, the highlight colour is white.) - colourFMFill = vsDraw.selbarlight; - } - - if (vsDraw.foldmarginColour.isSet) { - // override default fold margin colour - colourFMFill = vsDraw.foldmarginColour; - } - if (vsDraw.foldmarginHighlightColour.isSet) { - // override default fold margin highlight colour - colourFMStripes = vsDraw.foldmarginHighlightColour; - } - - pixmapSelPattern->FillRectangle(rcPattern, colourFMFill); - pixmapSelPatternOffset1->FillRectangle(rcPattern, colourFMStripes); - for (int y = 0; y < patternSize; y++) { - for (int x = y % 2; x < patternSize; x += 2) { - PRectangle rcPixel = PRectangle::FromInts(x, y, x + 1, y + 1); - pixmapSelPattern->FillRectangle(rcPixel, colourFMStripes); - pixmapSelPatternOffset1->FillRectangle(rcPixel, colourFMFill); - } - } - } -} - -static int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault, const ViewStyle &vs) { - if (vs.markers[markerCheck].markType == SC_MARK_EMPTY) - return markerDefault; - return markerCheck; -} - -void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRectangle rcMargin, - const EditModel &model, const ViewStyle &vs) { - - PRectangle rcSelMargin = rcMargin; - rcSelMargin.right = rcMargin.left; - if (rcSelMargin.bottom < rc.bottom) - rcSelMargin.bottom = rc.bottom; - - Point ptOrigin = model.GetVisibleOriginInMain(); - FontAlias fontLineNumber = vs.styles[STYLE_LINENUMBER].font; - for (size_t margin = 0; margin < vs.ms.size(); margin++) { - if (vs.ms[margin].width > 0) { - - rcSelMargin.left = rcSelMargin.right; - rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width; - - if (vs.ms[margin].style != SC_MARGIN_NUMBER) { - if (vs.ms[margin].mask & SC_MASK_FOLDERS) { - // Required because of special way brush is created for selection margin - // Ensure patterns line up when scrolling with separate margin view - // by choosing correctly aligned variant. - bool invertPhase = static_cast(ptOrigin.y) & 1; - surface->FillRectangle(rcSelMargin, - invertPhase ? *pixmapSelPattern : *pixmapSelPatternOffset1); - } else { - ColourDesired colour; - switch (vs.ms[margin].style) { - case SC_MARGIN_BACK: - colour = vs.styles[STYLE_DEFAULT].back; - break; - case SC_MARGIN_FORE: - colour = vs.styles[STYLE_DEFAULT].fore; - break; - case SC_MARGIN_COLOUR: - colour = vs.ms[margin].back; - break; - default: - colour = vs.styles[STYLE_LINENUMBER].back; - break; - } - surface->FillRectangle(rcSelMargin, colour); - } - } else { - surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back); - } - - const int lineStartPaint = static_cast(rcMargin.top + ptOrigin.y) / vs.lineHeight; - int visibleLine = model.TopLineOfMain() + lineStartPaint; - int yposScreen = lineStartPaint * vs.lineHeight - static_cast(ptOrigin.y); - // Work out whether the top line is whitespace located after a - // lessening of fold level which implies a 'fold tail' but which should not - // be displayed until the last of a sequence of whitespace. - bool needWhiteClosure = false; - if (vs.ms[margin].mask & SC_MASK_FOLDERS) { - int level = model.pdoc->GetLevel(model.cs.DocFromDisplay(visibleLine)); - if (level & SC_FOLDLEVELWHITEFLAG) { - int lineBack = model.cs.DocFromDisplay(visibleLine); - int levelPrev = level; - while ((lineBack > 0) && (levelPrev & SC_FOLDLEVELWHITEFLAG)) { - lineBack--; - levelPrev = model.pdoc->GetLevel(lineBack); - } - if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) { - if (LevelNumber(level) < LevelNumber(levelPrev)) - needWhiteClosure = true; - } - } - if (highlightDelimiter.isEnabled) { - int lastLine = model.cs.DocFromDisplay(topLine + model.LinesOnScreen()) + 1; - model.pdoc->GetHighlightDelimiters(highlightDelimiter, model.pdoc->LineFromPosition(model.sel.MainCaret()), lastLine); - } - } - - // Old code does not know about new markers needed to distinguish all cases - const int folderOpenMid = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEROPENMID, - SC_MARKNUM_FOLDEROPEN, vs); - const int folderEnd = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEREND, - SC_MARKNUM_FOLDER, vs); - - while ((visibleLine < model.cs.LinesDisplayed()) && yposScreen < rc.bottom) { - - PLATFORM_ASSERT(visibleLine < model.cs.LinesDisplayed()); - const int lineDoc = model.cs.DocFromDisplay(visibleLine); - PLATFORM_ASSERT(model.cs.GetVisible(lineDoc)); - const int firstVisibleLine = model.cs.DisplayFromDoc(lineDoc); - const int lastVisibleLine = model.cs.DisplayLastFromDoc(lineDoc); - const bool firstSubLine = visibleLine == firstVisibleLine; - const bool lastSubLine = visibleLine == lastVisibleLine; - - int marks = model.pdoc->GetMark(lineDoc); - if (!firstSubLine) - marks = 0; - - bool headWithTail = false; - - if (vs.ms[margin].mask & SC_MASK_FOLDERS) { - // Decide which fold indicator should be displayed - const int level = model.pdoc->GetLevel(lineDoc); - const int levelNext = model.pdoc->GetLevel(lineDoc + 1); - const int levelNum = LevelNumber(level); - const int levelNextNum = LevelNumber(levelNext); - if (level & SC_FOLDLEVELHEADERFLAG) { - if (firstSubLine) { - if (levelNum < levelNextNum) { - if (model.cs.GetExpanded(lineDoc)) { - if (levelNum == SC_FOLDLEVELBASE) - marks |= 1 << SC_MARKNUM_FOLDEROPEN; - else - marks |= 1 << folderOpenMid; - } else { - if (levelNum == SC_FOLDLEVELBASE) - marks |= 1 << SC_MARKNUM_FOLDER; - else - marks |= 1 << folderEnd; - } - } else if (levelNum > SC_FOLDLEVELBASE) { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } - } else { - if (levelNum < levelNextNum) { - if (model.cs.GetExpanded(lineDoc)) { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } else if (levelNum > SC_FOLDLEVELBASE) { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } - } else if (levelNum > SC_FOLDLEVELBASE) { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } - } - needWhiteClosure = false; - const int firstFollowupLine = model.cs.DocFromDisplay(model.cs.DisplayFromDoc(lineDoc + 1)); - const int firstFollowupLineLevel = model.pdoc->GetLevel(firstFollowupLine); - const int secondFollowupLineLevelNum = LevelNumber(model.pdoc->GetLevel(firstFollowupLine + 1)); - if (!model.cs.GetExpanded(lineDoc)) { - if ((firstFollowupLineLevel & SC_FOLDLEVELWHITEFLAG) && - (levelNum > secondFollowupLineLevelNum)) - needWhiteClosure = true; - - if (highlightDelimiter.IsFoldBlockHighlighted(firstFollowupLine)) - headWithTail = true; - } - } else if (level & SC_FOLDLEVELWHITEFLAG) { - if (needWhiteClosure) { - if (levelNext & SC_FOLDLEVELWHITEFLAG) { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } else if (levelNextNum > SC_FOLDLEVELBASE) { - marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; - needWhiteClosure = false; - } else { - marks |= 1 << SC_MARKNUM_FOLDERTAIL; - needWhiteClosure = false; - } - } else if (levelNum > SC_FOLDLEVELBASE) { - if (levelNextNum < levelNum) { - if (levelNextNum > SC_FOLDLEVELBASE) { - marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; - } else { - marks |= 1 << SC_MARKNUM_FOLDERTAIL; - } - } else { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } - } - } else if (levelNum > SC_FOLDLEVELBASE) { - if (levelNextNum < levelNum) { - needWhiteClosure = false; - if (levelNext & SC_FOLDLEVELWHITEFLAG) { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - needWhiteClosure = true; - } else if (lastSubLine) { - if (levelNextNum > SC_FOLDLEVELBASE) { - marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; - } else { - marks |= 1 << SC_MARKNUM_FOLDERTAIL; - } - } else { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } - } else { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } - } - } - - marks &= vs.ms[margin].mask; - - PRectangle rcMarker = rcSelMargin; - rcMarker.top = static_cast(yposScreen); - rcMarker.bottom = static_cast(yposScreen + vs.lineHeight); - if (vs.ms[margin].style == SC_MARGIN_NUMBER) { - if (firstSubLine) { - char number[100] = ""; - if (lineDoc >= 0) - sprintf(number, "%d", lineDoc + 1); - if (model.foldFlags & (SC_FOLDFLAG_LEVELNUMBERS | SC_FOLDFLAG_LINESTATE)) { - if (model.foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { - int lev = model.pdoc->GetLevel(lineDoc); - sprintf(number, "%c%c %03X %03X", - (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', - (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', - LevelNumber(lev), - lev >> 16 - ); - } else { - int state = model.pdoc->GetLineState(lineDoc); - sprintf(number, "%0X", state); - } - } - PRectangle rcNumber = rcMarker; - // Right justify - XYPOSITION width = surface->WidthText(fontLineNumber, number, static_cast(strlen(number))); - XYPOSITION xpos = rcNumber.right - width - vs.marginNumberPadding; - rcNumber.left = xpos; - DrawTextNoClipPhase(surface, rcNumber, vs.styles[STYLE_LINENUMBER], - rcNumber.top + vs.maxAscent, number, static_cast(strlen(number)), drawAll); - } else if (vs.wrapVisualFlags & SC_WRAPVISUALFLAG_MARGIN) { - PRectangle rcWrapMarker = rcMarker; - rcWrapMarker.right -= wrapMarkerPaddingRight; - rcWrapMarker.left = rcWrapMarker.right - vs.styles[STYLE_LINENUMBER].aveCharWidth; - if (customDrawWrapMarker == NULL) { - DrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore); - } else { - customDrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore); - } - } - } else if (vs.ms[margin].style == SC_MARGIN_TEXT || vs.ms[margin].style == SC_MARGIN_RTEXT) { - const StyledText stMargin = model.pdoc->MarginStyledText(lineDoc); - if (stMargin.text && ValidStyledText(vs, vs.marginStyleOffset, stMargin)) { - if (firstSubLine) { - surface->FillRectangle(rcMarker, - vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back); - if (vs.ms[margin].style == SC_MARGIN_RTEXT) { - int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin); - rcMarker.left = rcMarker.right - width - 3; - } - DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker, - stMargin, 0, stMargin.length, drawAll); - } else { - // if we're displaying annotation lines, color the margin to match the associated document line - const int annotationLines = model.pdoc->AnnotationLines(lineDoc); - if (annotationLines && (visibleLine > lastVisibleLine - annotationLines)) { - surface->FillRectangle(rcMarker, vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back); - } - } - } - } - - if (marks) { - for (int markBit = 0; (markBit < 32) && marks; markBit++) { - if (marks & 1) { - LineMarker::typeOfFold tFold = LineMarker::undefined; - if ((vs.ms[margin].mask & SC_MASK_FOLDERS) && highlightDelimiter.IsFoldBlockHighlighted(lineDoc)) { - if (highlightDelimiter.IsBodyOfFoldBlock(lineDoc)) { - tFold = LineMarker::body; - } else if (highlightDelimiter.IsHeadOfFoldBlock(lineDoc)) { - if (firstSubLine) { - tFold = headWithTail ? LineMarker::headWithTail : LineMarker::head; - } else { - if (model.cs.GetExpanded(lineDoc) || headWithTail) { - tFold = LineMarker::body; - } else { - tFold = LineMarker::undefined; - } - } - } else if (highlightDelimiter.IsTailOfFoldBlock(lineDoc)) { - tFold = LineMarker::tail; - } - } - vs.markers[markBit].Draw(surface, rcMarker, fontLineNumber, tFold, vs.ms[margin].style); - } - marks >>= 1; - } - } - - visibleLine++; - yposScreen += vs.lineHeight; - } - } - } - - PRectangle rcBlankMargin = rcMargin; - rcBlankMargin.left = rcSelMargin.right; - surface->FillRectangle(rcBlankMargin, vs.styles[STYLE_DEFAULT].back); -} - -#ifdef SCI_NAMESPACE -} -#endif - diff --git a/qrenderdoc/3rdparty/scintilla/src/MarginView.h b/qrenderdoc/3rdparty/scintilla/src/MarginView.h deleted file mode 100644 index ff5564676..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/MarginView.h +++ /dev/null @@ -1,50 +0,0 @@ -// Scintilla source code edit control -/** @file MarginView.h - ** Defines the appearance of the editor margin. - **/ -// Copyright 1998-2014 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef MARGINVIEW_H -#define MARGINVIEW_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour); - -typedef void (*DrawWrapMarkerFn)(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour); - -/** -* MarginView draws the margins. -*/ -class MarginView { -public: - Surface *pixmapSelMargin; - Surface *pixmapSelPattern; - Surface *pixmapSelPatternOffset1; - // Highlight current folding block - HighlightDelimiter highlightDelimiter; - - int wrapMarkerPaddingRight; // right-most pixel padding of wrap markers - /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native - * DrawWrapMarker function for drawing wrap markers. Allow those platforms to - * override it instead of creating a new method in the Surface class that - * existing platforms must implement as empty. */ - DrawWrapMarkerFn customDrawWrapMarker; - - MarginView(); - - void DropGraphics(bool freeObjects); - void AllocateGraphics(const ViewStyle &vsDraw); - void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw); - void PaintMargin(Surface *surface, int topLine, PRectangle rc, PRectangle rcMargin, - const EditModel &model, const ViewStyle &vs); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/Partitioning.h b/qrenderdoc/3rdparty/scintilla/src/Partitioning.h deleted file mode 100644 index 688b38d7d..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Partitioning.h +++ /dev/null @@ -1,198 +0,0 @@ -// Scintilla source code edit control -/** @file Partitioning.h - ** Data structure used to partition an interval. Used for holding line start/end positions. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef PARTITIONING_H -#define PARTITIONING_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/// A split vector of integers with a method for adding a value to all elements -/// in a range. -/// Used by the Partitioning class. - -class SplitVectorWithRangeAdd : public SplitVector { -public: - explicit SplitVectorWithRangeAdd(int growSize_) { - SetGrowSize(growSize_); - ReAllocate(growSize_); - } - ~SplitVectorWithRangeAdd() { - } - void RangeAddDelta(int start, int end, int delta) { - // end is 1 past end, so end-start is number of elements to change - int i = 0; - int rangeLength = end - start; - int range1Length = rangeLength; - int part1Left = part1Length - start; - if (range1Length > part1Left) - range1Length = part1Left; - while (i < range1Length) { - body[start++] += delta; - i++; - } - start += gapLength; - while (i < rangeLength) { - body[start++] += delta; - i++; - } - } -}; - -/// Divide an interval into multiple partitions. -/// Useful for breaking a document down into sections such as lines. -/// A 0 length interval has a single 0 length partition, numbered 0 -/// If interval not 0 length then each partition non-zero length -/// When needed, positions after the interval are considered part of the last partition -/// but the end of the last partition can be found with PositionFromPartition(last+1). - -class Partitioning { -private: - // To avoid calculating all the partition positions whenever any text is inserted - // there may be a step somewhere in the list. - int stepPartition; - int stepLength; - SplitVectorWithRangeAdd *body; - - // Move step forward - void ApplyStep(int partitionUpTo) { - if (stepLength != 0) { - body->RangeAddDelta(stepPartition+1, partitionUpTo + 1, stepLength); - } - stepPartition = partitionUpTo; - if (stepPartition >= body->Length()-1) { - stepPartition = body->Length()-1; - stepLength = 0; - } - } - - // Move step backward - void BackStep(int partitionDownTo) { - if (stepLength != 0) { - body->RangeAddDelta(partitionDownTo+1, stepPartition+1, -stepLength); - } - stepPartition = partitionDownTo; - } - - void Allocate(int growSize) { - body = new SplitVectorWithRangeAdd(growSize); - stepPartition = 0; - stepLength = 0; - body->Insert(0, 0); // This value stays 0 for ever - body->Insert(1, 0); // This is the end of the first partition and will be the start of the second - } - -public: - explicit Partitioning(int growSize) { - Allocate(growSize); - } - - ~Partitioning() { - delete body; - body = 0; - } - - int Partitions() const { - return body->Length()-1; - } - - void InsertPartition(int partition, int pos) { - if (stepPartition < partition) { - ApplyStep(partition); - } - body->Insert(partition, pos); - stepPartition++; - } - - void SetPartitionStartPosition(int partition, int pos) { - ApplyStep(partition+1); - if ((partition < 0) || (partition > body->Length())) { - return; - } - body->SetValueAt(partition, pos); - } - - void InsertText(int partitionInsert, int delta) { - // Point all the partitions after the insertion point further along in the buffer - if (stepLength != 0) { - if (partitionInsert >= stepPartition) { - // Fill in up to the new insertion point - ApplyStep(partitionInsert); - stepLength += delta; - } else if (partitionInsert >= (stepPartition - body->Length() / 10)) { - // Close to step but before so move step back - BackStep(partitionInsert); - stepLength += delta; - } else { - ApplyStep(body->Length()-1); - stepPartition = partitionInsert; - stepLength = delta; - } - } else { - stepPartition = partitionInsert; - stepLength = delta; - } - } - - void RemovePartition(int partition) { - if (partition > stepPartition) { - ApplyStep(partition); - stepPartition--; - } else { - stepPartition--; - } - body->Delete(partition); - } - - int PositionFromPartition(int partition) const { - PLATFORM_ASSERT(partition >= 0); - PLATFORM_ASSERT(partition < body->Length()); - if ((partition < 0) || (partition >= body->Length())) { - return 0; - } - int pos = body->ValueAt(partition); - if (partition > stepPartition) - pos += stepLength; - return pos; - } - - /// Return value in range [0 .. Partitions() - 1] even for arguments outside interval - int PartitionFromPosition(int pos) const { - if (body->Length() <= 1) - return 0; - if (pos >= (PositionFromPartition(body->Length()-1))) - return body->Length() - 1 - 1; - int lower = 0; - int upper = body->Length()-1; - do { - int middle = (upper + lower + 1) / 2; // Round high - int posMiddle = body->ValueAt(middle); - if (middle > stepPartition) - posMiddle += stepLength; - if (pos < posMiddle) { - upper = middle - 1; - } else { - lower = middle; - } - } while (lower < upper); - return lower; - } - - void DeleteAll() { - int growSize = body->GetGrowSize(); - delete body; - Allocate(growSize); - } -}; - - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/PerLine.cxx b/qrenderdoc/3rdparty/scintilla/src/PerLine.cxx deleted file mode 100644 index 6a3dd33dd..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/PerLine.cxx +++ /dev/null @@ -1,558 +0,0 @@ -// Scintilla source code edit control -/** @file PerLine.cxx - ** Manages data associated with each line of the document - **/ -// Copyright 1998-2009 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include - -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "CellBuffer.h" -#include "PerLine.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -MarkerHandleSet::MarkerHandleSet() { - root = 0; -} - -MarkerHandleSet::~MarkerHandleSet() { - MarkerHandleNumber *mhn = root; - while (mhn) { - MarkerHandleNumber *mhnToFree = mhn; - mhn = mhn->next; - delete mhnToFree; - } - root = 0; -} - -int MarkerHandleSet::Length() const { - int c = 0; - MarkerHandleNumber *mhn = root; - while (mhn) { - c++; - mhn = mhn->next; - } - return c; -} - -int MarkerHandleSet::MarkValue() const { - unsigned int m = 0; - MarkerHandleNumber *mhn = root; - while (mhn) { - m |= (1 << mhn->number); - mhn = mhn->next; - } - return m; -} - -bool MarkerHandleSet::Contains(int handle) const { - MarkerHandleNumber *mhn = root; - while (mhn) { - if (mhn->handle == handle) { - return true; - } - mhn = mhn->next; - } - return false; -} - -bool MarkerHandleSet::InsertHandle(int handle, int markerNum) { - MarkerHandleNumber *mhn = new MarkerHandleNumber; - mhn->handle = handle; - mhn->number = markerNum; - mhn->next = root; - root = mhn; - return true; -} - -void MarkerHandleSet::RemoveHandle(int handle) { - MarkerHandleNumber **pmhn = &root; - while (*pmhn) { - MarkerHandleNumber *mhn = *pmhn; - if (mhn->handle == handle) { - *pmhn = mhn->next; - delete mhn; - return; - } - pmhn = &((*pmhn)->next); - } -} - -bool MarkerHandleSet::RemoveNumber(int markerNum, bool all) { - bool performedDeletion = false; - MarkerHandleNumber **pmhn = &root; - while (*pmhn) { - MarkerHandleNumber *mhn = *pmhn; - if (mhn->number == markerNum) { - *pmhn = mhn->next; - delete mhn; - performedDeletion = true; - if (!all) - break; - } else { - pmhn = &((*pmhn)->next); - } - } - return performedDeletion; -} - -void MarkerHandleSet::CombineWith(MarkerHandleSet *other) { - MarkerHandleNumber **pmhn = &other->root; - while (*pmhn) { - pmhn = &((*pmhn)->next); - } - *pmhn = root; - root = other->root; - other->root = 0; -} - -LineMarkers::~LineMarkers() { - Init(); -} - -void LineMarkers::Init() { - for (int line = 0; line < markers.Length(); line++) { - delete markers[line]; - markers[line] = 0; - } - markers.DeleteAll(); -} - -void LineMarkers::InsertLine(int line) { - if (markers.Length()) { - markers.Insert(line, 0); - } -} - -void LineMarkers::RemoveLine(int line) { - // Retain the markers from the deleted line by oring them into the previous line - if (markers.Length()) { - if (line > 0) { - MergeMarkers(line - 1); - } - markers.Delete(line); - } -} - -int LineMarkers::LineFromHandle(int markerHandle) { - if (markers.Length()) { - for (int line = 0; line < markers.Length(); line++) { - if (markers[line]) { - if (markers[line]->Contains(markerHandle)) { - return line; - } - } - } - } - return -1; -} - -void LineMarkers::MergeMarkers(int pos) { - if (markers[pos + 1] != NULL) { - if (markers[pos] == NULL) - markers[pos] = new MarkerHandleSet; - markers[pos]->CombineWith(markers[pos + 1]); - delete markers[pos + 1]; - markers[pos + 1] = NULL; - } -} - -int LineMarkers::MarkValue(int line) { - if (markers.Length() && (line >= 0) && (line < markers.Length()) && markers[line]) - return markers[line]->MarkValue(); - else - return 0; -} - -int LineMarkers::MarkerNext(int lineStart, int mask) const { - if (lineStart < 0) - lineStart = 0; - int length = markers.Length(); - for (int iLine = lineStart; iLine < length; iLine++) { - MarkerHandleSet *onLine = markers[iLine]; - if (onLine && ((onLine->MarkValue() & mask) != 0)) - //if ((pdoc->GetMark(iLine) & lParam) != 0) - return iLine; - } - return -1; -} - -int LineMarkers::AddMark(int line, int markerNum, int lines) { - handleCurrent++; - if (!markers.Length()) { - // No existing markers so allocate one element per line - markers.InsertValue(0, lines, 0); - } - if (line >= markers.Length()) { - return -1; - } - if (!markers[line]) { - // Need new structure to hold marker handle - markers[line] = new MarkerHandleSet(); - } - markers[line]->InsertHandle(handleCurrent, markerNum); - - return handleCurrent; -} - -bool LineMarkers::DeleteMark(int line, int markerNum, bool all) { - bool someChanges = false; - if (markers.Length() && (line >= 0) && (line < markers.Length()) && markers[line]) { - if (markerNum == -1) { - someChanges = true; - delete markers[line]; - markers[line] = NULL; - } else { - someChanges = markers[line]->RemoveNumber(markerNum, all); - if (markers[line]->Length() == 0) { - delete markers[line]; - markers[line] = NULL; - } - } - } - return someChanges; -} - -void LineMarkers::DeleteMarkFromHandle(int markerHandle) { - int line = LineFromHandle(markerHandle); - if (line >= 0) { - markers[line]->RemoveHandle(markerHandle); - if (markers[line]->Length() == 0) { - delete markers[line]; - markers[line] = NULL; - } - } -} - -LineLevels::~LineLevels() { -} - -void LineLevels::Init() { - levels.DeleteAll(); -} - -void LineLevels::InsertLine(int line) { - if (levels.Length()) { - int level = (line < levels.Length()) ? levels[line] : SC_FOLDLEVELBASE; - levels.InsertValue(line, 1, level); - } -} - -void LineLevels::RemoveLine(int line) { - if (levels.Length()) { - // Move up following lines but merge header flag from this line - // to line before to avoid a temporary disappearence causing expansion. - int firstHeader = levels[line] & SC_FOLDLEVELHEADERFLAG; - levels.Delete(line); - if (line == levels.Length()-1) // Last line loses the header flag - levels[line-1] &= ~SC_FOLDLEVELHEADERFLAG; - else if (line > 0) - levels[line-1] |= firstHeader; - } -} - -void LineLevels::ExpandLevels(int sizeNew) { - levels.InsertValue(levels.Length(), sizeNew - levels.Length(), SC_FOLDLEVELBASE); -} - -void LineLevels::ClearLevels() { - levels.DeleteAll(); -} - -int LineLevels::SetLevel(int line, int level, int lines) { - int prev = 0; - if ((line >= 0) && (line < lines)) { - if (!levels.Length()) { - ExpandLevels(lines + 1); - } - prev = levels[line]; - if (prev != level) { - levels[line] = level; - } - } - return prev; -} - -int LineLevels::GetLevel(int line) const { - if (levels.Length() && (line >= 0) && (line < levels.Length())) { - return levels[line]; - } else { - return SC_FOLDLEVELBASE; - } -} - -LineState::~LineState() { -} - -void LineState::Init() { - lineStates.DeleteAll(); -} - -void LineState::InsertLine(int line) { - if (lineStates.Length()) { - lineStates.EnsureLength(line); - int val = (line < lineStates.Length()) ? lineStates[line] : 0; - lineStates.Insert(line, val); - } -} - -void LineState::RemoveLine(int line) { - if (lineStates.Length() > line) { - lineStates.Delete(line); - } -} - -int LineState::SetLineState(int line, int state) { - lineStates.EnsureLength(line + 1); - int stateOld = lineStates[line]; - lineStates[line] = state; - return stateOld; -} - -int LineState::GetLineState(int line) { - if (line < 0) - return 0; - lineStates.EnsureLength(line + 1); - return lineStates[line]; -} - -int LineState::GetMaxLineState() const { - return lineStates.Length(); -} - -static int NumberLines(const char *text) { - if (text) { - int newLines = 0; - while (*text) { - if (*text == '\n') - newLines++; - text++; - } - return newLines+1; - } else { - return 0; - } -} - -// Each allocated LineAnnotation is a char array which starts with an AnnotationHeader -// and then has text and optional styles. - -static const int IndividualStyles = 0x100; - -struct AnnotationHeader { - short style; // Style IndividualStyles implies array of styles - short lines; - int length; -}; - -LineAnnotation::~LineAnnotation() { - ClearAll(); -} - -void LineAnnotation::Init() { - ClearAll(); -} - -void LineAnnotation::InsertLine(int line) { - if (annotations.Length()) { - annotations.EnsureLength(line); - annotations.Insert(line, 0); - } -} - -void LineAnnotation::RemoveLine(int line) { - if (annotations.Length() && (line > 0) && (line <= annotations.Length())) { - delete []annotations[line-1]; - annotations.Delete(line-1); - } -} - -bool LineAnnotation::MultipleStyles(int line) const { - if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) - return reinterpret_cast(annotations[line])->style == IndividualStyles; - else - return 0; -} - -int LineAnnotation::Style(int line) const { - if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) - return reinterpret_cast(annotations[line])->style; - else - return 0; -} - -const char *LineAnnotation::Text(int line) const { - if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) - return annotations[line]+sizeof(AnnotationHeader); - else - return 0; -} - -const unsigned char *LineAnnotation::Styles(int line) const { - if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line] && MultipleStyles(line)) - return reinterpret_cast(annotations[line] + sizeof(AnnotationHeader) + Length(line)); - else - return 0; -} - -static char *AllocateAnnotation(int length, int style) { - size_t len = sizeof(AnnotationHeader) + length + ((style == IndividualStyles) ? length : 0); - char *ret = new char[len](); - return ret; -} - -void LineAnnotation::SetText(int line, const char *text) { - if (text && (line >= 0)) { - annotations.EnsureLength(line+1); - int style = Style(line); - if (annotations[line]) { - delete []annotations[line]; - } - annotations[line] = AllocateAnnotation(static_cast(strlen(text)), style); - AnnotationHeader *pah = reinterpret_cast(annotations[line]); - pah->style = static_cast(style); - pah->length = static_cast(strlen(text)); - pah->lines = static_cast(NumberLines(text)); - memcpy(annotations[line]+sizeof(AnnotationHeader), text, pah->length); - } else { - if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) { - delete []annotations[line]; - annotations[line] = 0; - } - } -} - -void LineAnnotation::ClearAll() { - for (int line = 0; line < annotations.Length(); line++) { - delete []annotations[line]; - annotations[line] = 0; - } - annotations.DeleteAll(); -} - -void LineAnnotation::SetStyle(int line, int style) { - annotations.EnsureLength(line+1); - if (!annotations[line]) { - annotations[line] = AllocateAnnotation(0, style); - } - reinterpret_cast(annotations[line])->style = static_cast(style); -} - -void LineAnnotation::SetStyles(int line, const unsigned char *styles) { - if (line >= 0) { - annotations.EnsureLength(line+1); - if (!annotations[line]) { - annotations[line] = AllocateAnnotation(0, IndividualStyles); - } else { - AnnotationHeader *pahSource = reinterpret_cast(annotations[line]); - if (pahSource->style != IndividualStyles) { - char *allocation = AllocateAnnotation(pahSource->length, IndividualStyles); - AnnotationHeader *pahAlloc = reinterpret_cast(allocation); - pahAlloc->length = pahSource->length; - pahAlloc->lines = pahSource->lines; - memcpy(allocation + sizeof(AnnotationHeader), annotations[line] + sizeof(AnnotationHeader), pahSource->length); - delete []annotations[line]; - annotations[line] = allocation; - } - } - AnnotationHeader *pah = reinterpret_cast(annotations[line]); - pah->style = IndividualStyles; - memcpy(annotations[line] + sizeof(AnnotationHeader) + pah->length, styles, pah->length); - } -} - -int LineAnnotation::Length(int line) const { - if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) - return reinterpret_cast(annotations[line])->length; - else - return 0; -} - -int LineAnnotation::Lines(int line) const { - if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) - return reinterpret_cast(annotations[line])->lines; - else - return 0; -} - -LineTabstops::~LineTabstops() { - Init(); -} - -void LineTabstops::Init() { - for (int line = 0; line < tabstops.Length(); line++) { - delete tabstops[line]; - } - tabstops.DeleteAll(); -} - -void LineTabstops::InsertLine(int line) { - if (tabstops.Length()) { - tabstops.EnsureLength(line); - tabstops.Insert(line, 0); - } -} - -void LineTabstops::RemoveLine(int line) { - if (tabstops.Length() > line) { - delete tabstops[line]; - tabstops.Delete(line); - } -} - -bool LineTabstops::ClearTabstops(int line) { - if (line < tabstops.Length()) { - TabstopList *tl = tabstops[line]; - if (tl) { - tl->clear(); - return true; - } - } - return false; -} - -bool LineTabstops::AddTabstop(int line, int x) { - tabstops.EnsureLength(line + 1); - if (!tabstops[line]) { - tabstops[line] = new TabstopList(); - } - - TabstopList *tl = tabstops[line]; - if (tl) { - // tabstop positions are kept in order - insert in the right place - std::vector::iterator it = std::lower_bound(tl->begin(), tl->end(), x); - // don't insert duplicates - if (it == tl->end() || *it != x) { - tl->insert(it, x); - return true; - } - } - return false; -} - -int LineTabstops::GetNextTabstop(int line, int x) const { - if (line < tabstops.Length()) { - TabstopList *tl = tabstops[line]; - if (tl) { - for (size_t i = 0; i < tl->size(); i++) { - if ((*tl)[i] > x) { - return (*tl)[i]; - } - } - } - } - return 0; -} diff --git a/qrenderdoc/3rdparty/scintilla/src/PerLine.h b/qrenderdoc/3rdparty/scintilla/src/PerLine.h deleted file mode 100644 index 4bf1c88fd..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/PerLine.h +++ /dev/null @@ -1,136 +0,0 @@ -// Scintilla source code edit control -/** @file PerLine.h - ** Manages data associated with each line of the document - **/ -// Copyright 1998-2009 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef PERLINE_H -#define PERLINE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - * This holds the marker identifier and the marker type to display. - * MarkerHandleNumbers are members of lists. - */ -struct MarkerHandleNumber { - int handle; - int number; - MarkerHandleNumber *next; -}; - -/** - * A marker handle set contains any number of MarkerHandleNumbers. - */ -class MarkerHandleSet { - MarkerHandleNumber *root; - -public: - MarkerHandleSet(); - ~MarkerHandleSet(); - int Length() const; - int MarkValue() const; ///< Bit set of marker numbers. - bool Contains(int handle) const; - bool InsertHandle(int handle, int markerNum); - void RemoveHandle(int handle); - bool RemoveNumber(int markerNum, bool all); - void CombineWith(MarkerHandleSet *other); -}; - -class LineMarkers : public PerLine { - SplitVector markers; - /// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big. - int handleCurrent; -public: - LineMarkers() : handleCurrent(0) { - } - virtual ~LineMarkers(); - virtual void Init(); - virtual void InsertLine(int line); - virtual void RemoveLine(int line); - - int MarkValue(int line); - int MarkerNext(int lineStart, int mask) const; - int AddMark(int line, int marker, int lines); - void MergeMarkers(int pos); - bool DeleteMark(int line, int markerNum, bool all); - void DeleteMarkFromHandle(int markerHandle); - int LineFromHandle(int markerHandle); -}; - -class LineLevels : public PerLine { - SplitVector levels; -public: - virtual ~LineLevels(); - virtual void Init(); - virtual void InsertLine(int line); - virtual void RemoveLine(int line); - - void ExpandLevels(int sizeNew=-1); - void ClearLevels(); - int SetLevel(int line, int level, int lines); - int GetLevel(int line) const; -}; - -class LineState : public PerLine { - SplitVector lineStates; -public: - LineState() { - } - virtual ~LineState(); - virtual void Init(); - virtual void InsertLine(int line); - virtual void RemoveLine(int line); - - int SetLineState(int line, int state); - int GetLineState(int line); - int GetMaxLineState() const; -}; - -class LineAnnotation : public PerLine { - SplitVector annotations; -public: - LineAnnotation() { - } - virtual ~LineAnnotation(); - virtual void Init(); - virtual void InsertLine(int line); - virtual void RemoveLine(int line); - - bool MultipleStyles(int line) const; - int Style(int line) const; - const char *Text(int line) const; - const unsigned char *Styles(int line) const; - void SetText(int line, const char *text); - void ClearAll(); - void SetStyle(int line, int style); - void SetStyles(int line, const unsigned char *styles); - int Length(int line) const; - int Lines(int line) const; -}; - -typedef std::vector TabstopList; - -class LineTabstops : public PerLine { - SplitVector tabstops; -public: - LineTabstops() { - } - virtual ~LineTabstops(); - virtual void Init(); - virtual void InsertLine(int line); - virtual void RemoveLine(int line); - - bool ClearTabstops(int line); - bool AddTabstop(int line, int x); - int GetNextTabstop(int line, int x) const; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/Position.h b/qrenderdoc/3rdparty/scintilla/src/Position.h deleted file mode 100644 index 120b92f62..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Position.h +++ /dev/null @@ -1,29 +0,0 @@ -// Scintilla source code edit control -/** @file Position.h - ** Defines global type name Position in the Sci internal namespace. - **/ -// Copyright 2015 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef POSITION_H -#define POSITION_H - -/** - * A Position is a position within a document between two characters or at the beginning or end. - * Sometimes used as a character index where it identifies the character after the position. - */ - -namespace Sci { - -typedef int Position; - -// A later version (4.x) of this file may: -//#if defined(SCI_LARGE_FILE_SUPPORT) -//typedef std::ptrdiff_t Position; -// or may allow runtime choice between different position sizes. - -const Position invalidPosition = -1; - -} - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/PositionCache.cxx b/qrenderdoc/3rdparty/scintilla/src/PositionCache.cxx deleted file mode 100644 index 45731601a..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/PositionCache.cxx +++ /dev/null @@ -1,710 +0,0 @@ -// Scintilla source code edit control -/** @file PositionCache.cxx - ** Classes for caching layout information. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "ILexer.h" -#include "Scintilla.h" - -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" -#include "CellBuffer.h" -#include "KeyMap.h" -#include "Indicator.h" -#include "XPM.h" -#include "LineMarker.h" -#include "Style.h" -#include "ViewStyle.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "CaseFolder.h" -#include "Document.h" -#include "UniConversion.h" -#include "Selection.h" -#include "PositionCache.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -LineLayout::LineLayout(int maxLineLength_) : - lineStarts(0), - lenLineStarts(0), - lineNumber(-1), - inCache(false), - maxLineLength(-1), - numCharsInLine(0), - numCharsBeforeEOL(0), - validity(llInvalid), - xHighlightGuide(0), - highlightColumn(0), - containsCaret(false), - edgeColumn(0), - chars(0), - styles(0), - positions(0), - hotspot(0,0), - widthLine(wrapWidthInfinite), - lines(1), - wrapIndent(0) { - bracePreviousStyles[0] = 0; - bracePreviousStyles[1] = 0; - Resize(maxLineLength_); -} - -LineLayout::~LineLayout() { - Free(); -} - -void LineLayout::Resize(int maxLineLength_) { - if (maxLineLength_ > maxLineLength) { - Free(); - chars = new char[maxLineLength_ + 1]; - styles = new unsigned char[maxLineLength_ + 1]; - // Extra position allocated as sometimes the Windows - // GetTextExtentExPoint API writes an extra element. - positions = new XYPOSITION[maxLineLength_ + 1 + 1]; - maxLineLength = maxLineLength_; - } -} - -void LineLayout::Free() { - delete []chars; - chars = 0; - delete []styles; - styles = 0; - delete []positions; - positions = 0; - delete []lineStarts; - lineStarts = 0; -} - -void LineLayout::Invalidate(validLevel validity_) { - if (validity > validity_) - validity = validity_; -} - -int LineLayout::LineStart(int line) const { - if (line <= 0) { - return 0; - } else if ((line >= lines) || !lineStarts) { - return numCharsInLine; - } else { - return lineStarts[line]; - } -} - -int LineLayout::LineLastVisible(int line) const { - if (line < 0) { - return 0; - } else if ((line >= lines-1) || !lineStarts) { - return numCharsBeforeEOL; - } else { - return lineStarts[line+1]; - } -} - -Range LineLayout::SubLineRange(int subLine) const { - return Range(LineStart(subLine), LineLastVisible(subLine)); -} - -bool LineLayout::InLine(int offset, int line) const { - return ((offset >= LineStart(line)) && (offset < LineStart(line + 1))) || - ((offset == numCharsInLine) && (line == (lines-1))); -} - -void LineLayout::SetLineStart(int line, int start) { - if ((line >= lenLineStarts) && (line != 0)) { - int newMaxLines = line + 20; - int *newLineStarts = new int[newMaxLines]; - for (int i = 0; i < newMaxLines; i++) { - if (i < lenLineStarts) - newLineStarts[i] = lineStarts[i]; - else - newLineStarts[i] = 0; - } - delete []lineStarts; - lineStarts = newLineStarts; - lenLineStarts = newMaxLines; - } - lineStarts[line] = start; -} - -void LineLayout::SetBracesHighlight(Range rangeLine, const Position braces[], - char bracesMatchStyle, int xHighlight, bool ignoreStyle) { - if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) { - int braceOffset = braces[0] - rangeLine.start; - if (braceOffset < numCharsInLine) { - bracePreviousStyles[0] = styles[braceOffset]; - styles[braceOffset] = bracesMatchStyle; - } - } - if (!ignoreStyle && rangeLine.ContainsCharacter(braces[1])) { - int braceOffset = braces[1] - rangeLine.start; - if (braceOffset < numCharsInLine) { - bracePreviousStyles[1] = styles[braceOffset]; - styles[braceOffset] = bracesMatchStyle; - } - } - if ((braces[0] >= rangeLine.start && braces[1] <= rangeLine.end) || - (braces[1] >= rangeLine.start && braces[0] <= rangeLine.end)) { - xHighlightGuide = xHighlight; - } -} - -void LineLayout::RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle) { - if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) { - int braceOffset = braces[0] - rangeLine.start; - if (braceOffset < numCharsInLine) { - styles[braceOffset] = bracePreviousStyles[0]; - } - } - if (!ignoreStyle && rangeLine.ContainsCharacter(braces[1])) { - int braceOffset = braces[1] - rangeLine.start; - if (braceOffset < numCharsInLine) { - styles[braceOffset] = bracePreviousStyles[1]; - } - } - xHighlightGuide = 0; -} - -int LineLayout::FindBefore(XYPOSITION x, int lower, int upper) const { - do { - int middle = (upper + lower + 1) / 2; // Round high - XYPOSITION posMiddle = positions[middle]; - if (x < posMiddle) { - upper = middle - 1; - } else { - lower = middle; - } - } while (lower < upper); - return lower; -} - - -int LineLayout::FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const { - int pos = FindBefore(x, range.start, range.end); - while (pos < range.end) { - if (charPosition) { - if (x < (positions[pos + 1])) { - return pos; - } - } else { - if (x < ((positions[pos] + positions[pos + 1]) / 2)) { - return pos; - } - } - pos++; - } - return range.end; -} - -Point LineLayout::PointFromPosition(int posInLine, int lineHeight, PointEnd pe) const { - Point pt; - // In case of very long line put x at arbitrary large position - if (posInLine > maxLineLength) { - pt.x = positions[maxLineLength] - positions[LineStart(lines)]; - } - - for (int subLine = 0; subLine < lines; subLine++) { - const Range rangeSubLine = SubLineRange(subLine); - if (posInLine >= rangeSubLine.start) { - pt.y = static_cast(subLine*lineHeight); - if (posInLine <= rangeSubLine.end) { - pt.x = positions[posInLine] - positions[rangeSubLine.start]; - if (rangeSubLine.start != 0) // Wrapped lines may be indented - pt.x += wrapIndent; - if (pe & peSubLineEnd) // Return end of first subline not start of next - break; - } else if ((pe & peLineEnd) && (subLine == (lines-1))) { - pt.x = positions[numCharsInLine] - positions[rangeSubLine.start]; - if (rangeSubLine.start != 0) // Wrapped lines may be indented - pt.x += wrapIndent; - } - } else { - break; - } - } - return pt; -} - -int LineLayout::EndLineStyle() const { - return styles[numCharsBeforeEOL > 0 ? numCharsBeforeEOL-1 : 0]; -} - -LineLayoutCache::LineLayoutCache() : - level(0), - allInvalidated(false), styleClock(-1), useCount(0) { - Allocate(0); -} - -LineLayoutCache::~LineLayoutCache() { - Deallocate(); -} - -void LineLayoutCache::Allocate(size_t length_) { - PLATFORM_ASSERT(cache.empty()); - allInvalidated = false; - cache.resize(length_); -} - -void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) { - PLATFORM_ASSERT(useCount == 0); - size_t lengthForLevel = 0; - if (level == llcCaret) { - lengthForLevel = 1; - } else if (level == llcPage) { - lengthForLevel = linesOnScreen + 1; - } else if (level == llcDocument) { - lengthForLevel = linesInDoc; - } - if (lengthForLevel > cache.size()) { - Deallocate(); - Allocate(lengthForLevel); - } else { - if (lengthForLevel < cache.size()) { - for (size_t i = lengthForLevel; i < cache.size(); i++) { - delete cache[i]; - cache[i] = 0; - } - } - cache.resize(lengthForLevel); - } - PLATFORM_ASSERT(cache.size() == lengthForLevel); -} - -void LineLayoutCache::Deallocate() { - PLATFORM_ASSERT(useCount == 0); - for (size_t i = 0; i < cache.size(); i++) - delete cache[i]; - cache.clear(); -} - -void LineLayoutCache::Invalidate(LineLayout::validLevel validity_) { - if (!cache.empty() && !allInvalidated) { - for (size_t i = 0; i < cache.size(); i++) { - if (cache[i]) { - cache[i]->Invalidate(validity_); - } - } - if (validity_ == LineLayout::llInvalid) { - allInvalidated = true; - } - } -} - -void LineLayoutCache::SetLevel(int level_) { - allInvalidated = false; - if ((level_ != -1) && (level != level_)) { - level = level_; - Deallocate(); - } -} - -LineLayout *LineLayoutCache::Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, - int linesOnScreen, int linesInDoc) { - AllocateForLevel(linesOnScreen, linesInDoc); - if (styleClock != styleClock_) { - Invalidate(LineLayout::llCheckTextAndStyle); - styleClock = styleClock_; - } - allInvalidated = false; - int pos = -1; - LineLayout *ret = 0; - if (level == llcCaret) { - pos = 0; - } else if (level == llcPage) { - if (lineNumber == lineCaret) { - pos = 0; - } else if (cache.size() > 1) { - pos = 1 + (lineNumber % (cache.size() - 1)); - } - } else if (level == llcDocument) { - pos = lineNumber; - } - if (pos >= 0) { - PLATFORM_ASSERT(useCount == 0); - if (!cache.empty() && (pos < static_cast(cache.size()))) { - if (cache[pos]) { - if ((cache[pos]->lineNumber != lineNumber) || - (cache[pos]->maxLineLength < maxChars)) { - delete cache[pos]; - cache[pos] = 0; - } - } - if (!cache[pos]) { - cache[pos] = new LineLayout(maxChars); - } - cache[pos]->lineNumber = lineNumber; - cache[pos]->inCache = true; - ret = cache[pos]; - useCount++; - } - } - - if (!ret) { - ret = new LineLayout(maxChars); - ret->lineNumber = lineNumber; - } - - return ret; -} - -void LineLayoutCache::Dispose(LineLayout *ll) { - allInvalidated = false; - if (ll) { - if (!ll->inCache) { - delete ll; - } else { - useCount--; - } - } -} - -// Simply pack the (maximum 4) character bytes into an int -static inline int KeyFromString(const char *charBytes, size_t len) { - PLATFORM_ASSERT(len <= 4); - int k=0; - for (size_t i=0; i(charBytes[i]); - } - return k; -} - -SpecialRepresentations::SpecialRepresentations() { - std::fill(startByteHasReprs, startByteHasReprs+0x100, 0); -} - -void SpecialRepresentations::SetRepresentation(const char *charBytes, const char *value) { - MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, UTF8MaxBytes)); - if (it == mapReprs.end()) { - // New entry so increment for first byte - startByteHasReprs[static_cast(charBytes[0])]++; - } - mapReprs[KeyFromString(charBytes, UTF8MaxBytes)] = Representation(value); -} - -void SpecialRepresentations::ClearRepresentation(const char *charBytes) { - MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, UTF8MaxBytes)); - if (it != mapReprs.end()) { - mapReprs.erase(it); - startByteHasReprs[static_cast(charBytes[0])]--; - } -} - -const Representation *SpecialRepresentations::RepresentationFromCharacter(const char *charBytes, size_t len) const { - PLATFORM_ASSERT(len <= 4); - if (!startByteHasReprs[static_cast(charBytes[0])]) - return 0; - MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes, len)); - if (it != mapReprs.end()) { - return &(it->second); - } - return 0; -} - -bool SpecialRepresentations::Contains(const char *charBytes, size_t len) const { - PLATFORM_ASSERT(len <= 4); - if (!startByteHasReprs[static_cast(charBytes[0])]) - return false; - MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes, len)); - return it != mapReprs.end(); -} - -void SpecialRepresentations::Clear() { - mapReprs.clear(); - std::fill(startByteHasReprs, startByteHasReprs+0x100, 0); -} - -void BreakFinder::Insert(int val) { - if (val > nextBreak) { - const std::vector::iterator it = std::lower_bound(selAndEdge.begin(), selAndEdge.end(), val); - if (it == selAndEdge.end()) { - selAndEdge.push_back(val); - } else if (*it != val) { - selAndEdge.insert(it, 1, val); - } - } -} - -BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, int posLineStart_, - int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw) : - ll(ll_), - lineRange(lineRange_), - posLineStart(posLineStart_), - nextBreak(lineRange_.start), - saeCurrentPos(0), - saeNext(0), - subBreak(-1), - pdoc(pdoc_), - encodingFamily(pdoc_->CodePageFamily()), - preprs(preprs_) { - - // Search for first visible break - // First find the first visible character - if (xStart > 0.0f) - nextBreak = ll->FindBefore(static_cast(xStart), lineRange.start, lineRange.end); - // Now back to a style break - while ((nextBreak > lineRange.start) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) { - nextBreak--; - } - - if (breakForSelection) { - SelectionPosition posStart(posLineStart); - SelectionPosition posEnd(posLineStart + lineRange.end); - SelectionSegment segmentLine(posStart, posEnd); - for (size_t r=0; rCount(); r++) { - SelectionSegment portion = psel->Range(r).Intersect(segmentLine); - if (!(portion.start == portion.end)) { - if (portion.start.IsValid()) - Insert(portion.start.Position() - posLineStart); - if (portion.end.IsValid()) - Insert(portion.end.Position() - posLineStart); - } - } - } - if (pvsDraw && pvsDraw->indicatorsSetFore > 0) { - for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { - if (pvsDraw->indicators[deco->indicator].OverridesTextFore()) { - int startPos = deco->rs.EndRun(posLineStart); - while (startPos < (posLineStart + lineRange.end)) { - Insert(startPos - posLineStart); - startPos = deco->rs.EndRun(startPos); - } - } - } - } - Insert(ll->edgeColumn); - Insert(lineRange.end); - saeNext = (!selAndEdge.empty()) ? selAndEdge[0] : -1; -} - -BreakFinder::~BreakFinder() { -} - -TextSegment BreakFinder::Next() { - if (subBreak == -1) { - int prev = nextBreak; - while (nextBreak < lineRange.end) { - int charWidth = 1; - if (encodingFamily == efUnicode) - charWidth = UTF8DrawBytes(reinterpret_cast(ll->chars) + nextBreak, lineRange.end - nextBreak); - else if (encodingFamily == efDBCS) - charWidth = pdoc->IsDBCSLeadByte(ll->chars[nextBreak]) ? 2 : 1; - const Representation *repr = preprs->RepresentationFromCharacter(ll->chars + nextBreak, charWidth); - if (((nextBreak > 0) && (ll->styles[nextBreak] != ll->styles[nextBreak - 1])) || - repr || - (nextBreak == saeNext)) { - while ((nextBreak >= saeNext) && (saeNext < lineRange.end)) { - saeCurrentPos++; - saeNext = (saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : lineRange.end; - } - if ((nextBreak > prev) || repr) { - // Have a segment to report - if (nextBreak == prev) { - nextBreak += charWidth; - } else { - repr = 0; // Optimize -> should remember repr - } - if ((nextBreak - prev) < lengthStartSubdivision) { - return TextSegment(prev, nextBreak - prev, repr); - } else { - break; - } - } - } - nextBreak += charWidth; - } - if ((nextBreak - prev) < lengthStartSubdivision) { - return TextSegment(prev, nextBreak - prev); - } - subBreak = prev; - } - // Splitting up a long run from prev to nextBreak in lots of approximately lengthEachSubdivision. - // For very long runs add extra breaks after spaces or if no spaces before low punctuation. - int startSegment = subBreak; - if ((nextBreak - subBreak) <= lengthEachSubdivision) { - subBreak = -1; - return TextSegment(startSegment, nextBreak - startSegment); - } else { - subBreak += pdoc->SafeSegment(ll->chars + subBreak, nextBreak-subBreak, lengthEachSubdivision); - if (subBreak >= nextBreak) { - subBreak = -1; - return TextSegment(startSegment, nextBreak - startSegment); - } else { - return TextSegment(startSegment, subBreak - startSegment); - } - } -} - -bool BreakFinder::More() const { - return (subBreak >= 0) || (nextBreak < lineRange.end); -} - -PositionCacheEntry::PositionCacheEntry() : - styleNumber(0), len(0), clock(0), positions(0) { -} - -void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_, - unsigned int len_, XYPOSITION *positions_, unsigned int clock_) { - Clear(); - styleNumber = styleNumber_; - len = len_; - clock = clock_; - if (s_ && positions_) { - positions = new XYPOSITION[len + (len / 4) + 1]; - for (unsigned int i=0; i(reinterpret_cast(positions + len)), s_, len); - } -} - -PositionCacheEntry::~PositionCacheEntry() { - Clear(); -} - -void PositionCacheEntry::Clear() { - delete []positions; - positions = 0; - styleNumber = 0; - len = 0; - clock = 0; -} - -bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, - unsigned int len_, XYPOSITION *positions_) const { - if ((styleNumber == styleNumber_) && (len == len_) && - (memcmp(reinterpret_cast(reinterpret_cast(positions + len)), s_, len)== 0)) { - for (unsigned int i=0; i other.clock; -} - -void PositionCacheEntry::ResetClock() { - if (clock > 0) { - clock = 1; - } -} - -PositionCache::PositionCache() { - clock = 1; - pces.resize(0x400); - allClear = true; -} - -PositionCache::~PositionCache() { - Clear(); -} - -void PositionCache::Clear() { - if (!allClear) { - for (size_t i=0; i BreakFinder::lengthStartSubdivision) { - // Break up into segments - unsigned int startSegment = 0; - XYPOSITION xStartSegment = 0; - while (startSegment < len) { - unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision); - FontAlias fontStyle = vstyle.styles[styleNumber].font; - surface->MeasureWidths(fontStyle, s + startSegment, lenSegment, positions + startSegment); - for (unsigned int inSeg = 0; inSeg < lenSegment; inSeg++) { - positions[startSegment + inSeg] += xStartSegment; - } - xStartSegment = positions[startSegment + lenSegment - 1]; - startSegment += lenSegment; - } - } else { - FontAlias fontStyle = vstyle.styles[styleNumber].font; - surface->MeasureWidths(fontStyle, s, len, positions); - } - if (probe < pces.size()) { - // Store into cache - clock++; - if (clock > 60000) { - // Since there are only 16 bits for the clock, wrap it round and - // reset all cache entries so none get stuck with a high clock. - for (size_t i=0; i -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef POSITIONCACHE_H -#define POSITIONCACHE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -static inline bool IsEOLChar(char ch) { - return (ch == '\r') || (ch == '\n'); -} - -/** -* A point in document space. -* Uses double for sufficient resolution in large (>20,000,000 line) documents. -*/ -class PointDocument { -public: - double x; - double y; - - explicit PointDocument(double x_ = 0, double y_ = 0) : x(x_), y(y_) { - } - - // Conversion from Point. - explicit PointDocument(Point pt) : x(pt.x), y(pt.y) { - } -}; - -// There are two points for some positions and this enumeration -// can choose between the end of the first line or subline -// and the start of the next line or subline. -enum PointEnd { - peDefault = 0x0, - peLineEnd = 0x1, - peSubLineEnd = 0x2 -}; - -/** - */ -class LineLayout { -private: - friend class LineLayoutCache; - int *lineStarts; - int lenLineStarts; - /// Drawing is only performed for @a maxLineLength characters on each line. - int lineNumber; - bool inCache; -public: - enum { wrapWidthInfinite = 0x7ffffff }; - - int maxLineLength; - int numCharsInLine; - int numCharsBeforeEOL; - enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity; - int xHighlightGuide; - bool highlightColumn; - bool containsCaret; - int edgeColumn; - char *chars; - unsigned char *styles; - XYPOSITION *positions; - char bracePreviousStyles[2]; - - // Hotspot support - Range hotspot; - - // Wrapped line support - int widthLine; - int lines; - XYPOSITION wrapIndent; // In pixels - - explicit LineLayout(int maxLineLength_); - virtual ~LineLayout(); - void Resize(int maxLineLength_); - void Free(); - void Invalidate(validLevel validity_); - int LineStart(int line) const; - int LineLastVisible(int line) const; - Range SubLineRange(int line) const; - bool InLine(int offset, int line) const; - void SetLineStart(int line, int start); - void SetBracesHighlight(Range rangeLine, const Position braces[], - char bracesMatchStyle, int xHighlight, bool ignoreStyle); - void RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle); - int FindBefore(XYPOSITION x, int lower, int upper) const; - int FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const; - Point PointFromPosition(int posInLine, int lineHeight, PointEnd pe) const; - int EndLineStyle() const; -}; - -/** - */ -class LineLayoutCache { - int level; - std::vectorcache; - bool allInvalidated; - int styleClock; - int useCount; - void Allocate(size_t length_); - void AllocateForLevel(int linesOnScreen, int linesInDoc); -public: - LineLayoutCache(); - virtual ~LineLayoutCache(); - void Deallocate(); - enum { - llcNone=SC_CACHE_NONE, - llcCaret=SC_CACHE_CARET, - llcPage=SC_CACHE_PAGE, - llcDocument=SC_CACHE_DOCUMENT - }; - void Invalidate(LineLayout::validLevel validity_); - void SetLevel(int level_); - int GetLevel() const { return level; } - LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, - int linesOnScreen, int linesInDoc); - void Dispose(LineLayout *ll); -}; - -class PositionCacheEntry { - unsigned int styleNumber:8; - unsigned int len:8; - unsigned int clock:16; - XYPOSITION *positions; -public: - PositionCacheEntry(); - ~PositionCacheEntry(); - void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock_); - void Clear(); - bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_) const; - static unsigned int Hash(unsigned int styleNumber_, const char *s, unsigned int len); - bool NewerThan(const PositionCacheEntry &other) const; - void ResetClock(); -}; - -class Representation { -public: - std::string stringRep; - explicit Representation(const char *value="") : stringRep(value) { - } -}; - -typedef std::map MapRepresentation; - -class SpecialRepresentations { - MapRepresentation mapReprs; - short startByteHasReprs[0x100]; -public: - SpecialRepresentations(); - void SetRepresentation(const char *charBytes, const char *value); - void ClearRepresentation(const char *charBytes); - const Representation *RepresentationFromCharacter(const char *charBytes, size_t len) const; - bool Contains(const char *charBytes, size_t len) const; - void Clear(); -}; - -struct TextSegment { - int start; - int length; - const Representation *representation; - TextSegment(int start_=0, int length_=0, const Representation *representation_=0) : - start(start_), length(length_), representation(representation_) { - } - int end() const { - return start + length; - } -}; - -// Class to break a line of text into shorter runs at sensible places. -class BreakFinder { - const LineLayout *ll; - Range lineRange; - int posLineStart; - int nextBreak; - std::vector selAndEdge; - unsigned int saeCurrentPos; - int saeNext; - int subBreak; - const Document *pdoc; - EncodingFamily encodingFamily; - const SpecialRepresentations *preprs; - void Insert(int val); - // Private so BreakFinder objects can not be copied - BreakFinder(const BreakFinder &); -public: - // If a whole run is longer than lengthStartSubdivision then subdivide - // into smaller runs at spaces or punctuation. - enum { lengthStartSubdivision = 300 }; - // Try to make each subdivided run lengthEachSubdivision or shorter. - enum { lengthEachSubdivision = 100 }; - BreakFinder(const LineLayout *ll_, const Selection *psel, Range rangeLine_, int posLineStart_, - int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw); - ~BreakFinder(); - TextSegment Next(); - bool More() const; -}; - -class PositionCache { - std::vector pces; - unsigned int clock; - bool allClear; - // Private so PositionCache objects can not be copied - PositionCache(const PositionCache &); -public: - PositionCache(); - ~PositionCache(); - void Clear(); - void SetSize(size_t size_); - size_t GetSize() const { return pces.size(); } - void MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber, - const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc); -}; - -inline bool IsSpaceOrTab(int ch) { - return ch == ' ' || ch == '\t'; -} - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/RESearch.cxx b/qrenderdoc/3rdparty/scintilla/src/RESearch.cxx deleted file mode 100644 index 4e290309c..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/RESearch.cxx +++ /dev/null @@ -1,962 +0,0 @@ -// Scintilla source code edit control -/** @file RESearch.cxx - ** Regular expression search library. - **/ - -/* - * regex - Regular expression pattern matching and replacement - * - * By: Ozan S. Yigit (oz) - * Dept. of Computer Science - * York University - * - * Original code available from http://www.cs.yorku.ca/~oz/ - * Translation to C++ by Neil Hodgson neilh@scintilla.org - * Removed all use of register. - * Converted to modern function prototypes. - * Put all global/static variables into an object so this code can be - * used from multiple threads, etc. - * Some extensions by Philippe Lhoste PhiLho(a)GMX.net - * '?' extensions by Michael Mullin masmullin@gmail.com - * - * These routines are the PUBLIC DOMAIN equivalents of regex - * routines as found in 4.nBSD UN*X, with minor extensions. - * - * These routines are derived from various implementations found - * in software tools books, and Conroy's grep. They are NOT derived - * from licensed/restricted software. - * For more interesting/academic/complicated implementations, - * see Henry Spencer's regexp routines, or GNU Emacs pattern - * matching module. - * - * Modification history removed. - * - * Interfaces: - * RESearch::Compile: compile a regular expression into a NFA. - * - * const char *RESearch::Compile(const char *pattern, int length, - * bool caseSensitive, bool posix) - * - * Returns a short error string if they fail. - * - * RESearch::Execute: execute the NFA to match a pattern. - * - * int RESearch::Execute(characterIndexer &ci, int lp, int endp) - * - * re_fail: failure routine for RESearch::Execute. (no longer used) - * - * void re_fail(char *msg, char op) - * - * Regular Expressions: - * - * [1] char matches itself, unless it is a special - * character (metachar): . \ [ ] * + ? ^ $ - * and ( ) if posix option. - * - * [2] . matches any character. - * - * [3] \ matches the character following it, except: - * - \a, \b, \f, \n, \r, \t, \v match the corresponding C - * escape char, respectively BEL, BS, FF, LF, CR, TAB and VT; - * Note that \r and \n are never matched because Scintilla - * regex searches are made line per line - * (stripped of end-of-line chars). - * - if not in posix mode, when followed by a - * left or right round bracket (see [8]); - * - when followed by a digit 1 to 9 (see [9]); - * - when followed by a left or right angle bracket - * (see [10]); - * - when followed by d, D, s, S, w or W (see [11]); - * - when followed by x and two hexa digits (see [12]. - * Backslash is used as an escape character for all - * other meta-characters, and itself. - * - * [4] [set] matches one of the characters in the set. - * If the first character in the set is "^", - * it matches the characters NOT in the set, i.e. - * complements the set. A shorthand S-E (start dash end) - * is used to specify a set of characters S up to - * E, inclusive. S and E must be characters, otherwise - * the dash is taken literally (eg. in expression [\d-a]). - * The special characters "]" and "-" have no special - * meaning if they appear as the first chars in the set. - * To include both, put - first: [-]A-Z] - * (or just backslash them). - * examples: match: - * - * [-]|] matches these 3 chars, - * - * []-|] matches from ] to | chars - * - * [a-z] any lowercase alpha - * - * [^-]] any char except - and ] - * - * [^A-Z] any char except uppercase - * alpha - * - * [a-zA-Z] any alpha - * - * [5] * any regular expression form [1] to [4] - * (except [8], [9] and [10] forms of [3]), - * followed by closure char (*) - * matches zero or more matches of that form. - * - * [6] + same as [5], except it matches one or more. - * - * [5-6] Both [5] and [6] are greedy (they match as much as possible). - * Unless they are followed by the 'lazy' quantifier (?) - * In which case both [5] and [6] try to match as little as possible - * - * [7] ? same as [5] except it matches zero or one. - * - * [8] a regular expression in the form [1] to [13], enclosed - * as \(form\) (or (form) with posix flag) matches what - * form matches. The enclosure creates a set of tags, - * used for [9] and for pattern substitution. - * The tagged forms are numbered starting from 1. - * - * [9] a \ followed by a digit 1 to 9 matches whatever a - * previously tagged regular expression ([8]) matched. - * - * [10] \< a regular expression starting with a \< construct - * \> and/or ending with a \> construct, restricts the - * pattern matching to the beginning of a word, and/or - * the end of a word. A word is defined to be a character - * string beginning and/or ending with the characters - * A-Z a-z 0-9 and _. Scintilla extends this definition - * by user setting. The word must also be preceded and/or - * followed by any character outside those mentioned. - * - * [11] \l a backslash followed by d, D, s, S, w or W, - * becomes a character class (both inside and - * outside sets []). - * d: decimal digits - * D: any char except decimal digits - * s: whitespace (space, \t \n \r \f \v) - * S: any char except whitespace (see above) - * w: alphanumeric & underscore (changed by user setting) - * W: any char except alphanumeric & underscore (see above) - * - * [12] \xHH a backslash followed by x and two hexa digits, - * becomes the character whose Ascii code is equal - * to these digits. If not followed by two digits, - * it is 'x' char itself. - * - * [13] a composite regular expression xy where x and y - * are in the form [1] to [12] matches the longest - * match of x followed by a match for y. - * - * [14] ^ a regular expression starting with a ^ character - * $ and/or ending with a $ character, restricts the - * pattern matching to the beginning of the line, - * or the end of line. [anchors] Elsewhere in the - * pattern, ^ and $ are treated as ordinary characters. - * - * - * Acknowledgements: - * - * HCR's Hugh Redelmeier has been most helpful in various - * stages of development. He convinced me to include BOW - * and EOW constructs, originally invented by Rob Pike at - * the University of Toronto. - * - * References: - * Software tools Kernighan & Plauger - * Software tools in Pascal Kernighan & Plauger - * Grep [rsx-11 C dist] David Conroy - * ed - text editor Un*x Programmer's Manual - * Advanced editing on Un*x B. W. Kernighan - * RegExp routines Henry Spencer - * - * Notes: - * - * This implementation uses a bit-set representation for character - * classes for speed and compactness. Each character is represented - * by one bit in a 256-bit block. Thus, CCL always takes a - * constant 32 bytes in the internal nfa, and RESearch::Execute does a single - * bit comparison to locate the character in the set. - * - * Examples: - * - * pattern: foo*.* - * compile: CHR f CHR o CLO CHR o END CLO ANY END END - * matches: fo foo fooo foobar fobar foxx ... - * - * pattern: fo[ob]a[rz] - * compile: CHR f CHR o CCL bitset CHR a CCL bitset END - * matches: fobar fooar fobaz fooaz - * - * pattern: foo\\+ - * compile: CHR f CHR o CHR o CHR \ CLO CHR \ END END - * matches: foo\ foo\\ foo\\\ ... - * - * pattern: \(foo\)[1-3]\1 (same as foo[1-3]foo) - * compile: BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END - * matches: foo1foo foo2foo foo3foo - * - * pattern: \(fo.*\)-\1 - * compile: BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END - * matches: foo-foo fo-fo fob-fob foobar-foobar ... - */ - -#include - -#include -#include -#include - -#include "Position.h" -#include "CharClassify.h" -#include "RESearch.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -#define OKP 1 -#define NOP 0 - -#define CHR 1 -#define ANY 2 -#define CCL 3 -#define BOL 4 -#define EOL 5 -#define BOT 6 -#define EOT 7 -#define BOW 8 -#define EOW 9 -#define REF 10 -#define CLO 11 -#define CLQ 12 /* 0 to 1 closure */ -#define LCLO 13 /* lazy closure */ - -#define END 0 - -/* - * The following defines are not meant to be changeable. - * They are for readability only. - */ -#define BLKIND 0370 -#define BITIND 07 - -const char bitarr[] = { 1, 2, 4, 8, 16, 32, 64, '\200' }; - -#define badpat(x) (*nfa = END, x) - -/* - * Character classification table for word boundary operators BOW - * and EOW is passed in by the creator of this object (Scintilla - * Document). The Document default state is that word chars are: - * 0-9, a-z, A-Z and _ - */ - -RESearch::RESearch(CharClassify *charClassTable) { - failure = 0; - charClass = charClassTable; - sta = NOP; /* status of lastpat */ - bol = 0; - std::fill(bittab, bittab + BITBLK, 0); - std::fill(tagstk, tagstk + MAXTAG, 0); - std::fill(nfa, nfa + MAXNFA, 0); - Clear(); -} - -RESearch::~RESearch() { - Clear(); -} - -void RESearch::Clear() { - for (int i = 0; i < MAXTAG; i++) { - pat[i].clear(); - bopat[i] = NOTFOUND; - eopat[i] = NOTFOUND; - } -} - -void RESearch::GrabMatches(CharacterIndexer &ci) { - for (unsigned int i = 0; i < MAXTAG; i++) { - if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) { - unsigned int len = eopat[i] - bopat[i]; - pat[i].resize(len); - for (unsigned int j = 0; j < len; j++) - pat[i][j] = ci.CharAt(bopat[i] + j); - } - } -} - -void RESearch::ChSet(unsigned char c) { - bittab[((c) & BLKIND) >> 3] |= bitarr[(c) & BITIND]; -} - -void RESearch::ChSetWithCase(unsigned char c, bool caseSensitive) { - if (caseSensitive) { - ChSet(c); - } else { - if ((c >= 'a') && (c <= 'z')) { - ChSet(c); - ChSet(static_cast(c - 'a' + 'A')); - } else if ((c >= 'A') && (c <= 'Z')) { - ChSet(c); - ChSet(static_cast(c - 'A' + 'a')); - } else { - ChSet(c); - } - } -} - -static unsigned char escapeValue(unsigned char ch) { - switch (ch) { - case 'a': return '\a'; - case 'b': return '\b'; - case 'f': return '\f'; - case 'n': return '\n'; - case 'r': return '\r'; - case 't': return '\t'; - case 'v': return '\v'; - } - return 0; -} - -static int GetHexaChar(unsigned char hd1, unsigned char hd2) { - int hexValue = 0; - if (hd1 >= '0' && hd1 <= '9') { - hexValue += 16 * (hd1 - '0'); - } else if (hd1 >= 'A' && hd1 <= 'F') { - hexValue += 16 * (hd1 - 'A' + 10); - } else if (hd1 >= 'a' && hd1 <= 'f') { - hexValue += 16 * (hd1 - 'a' + 10); - } else { - return -1; - } - if (hd2 >= '0' && hd2 <= '9') { - hexValue += hd2 - '0'; - } else if (hd2 >= 'A' && hd2 <= 'F') { - hexValue += hd2 - 'A' + 10; - } else if (hd2 >= 'a' && hd2 <= 'f') { - hexValue += hd2 - 'a' + 10; - } else { - return -1; - } - return hexValue; -} - -/** - * Called when the parser finds a backslash not followed - * by a valid expression (like \( in non-Posix mode). - * @param pattern : pointer on the char after the backslash. - * @param incr : (out) number of chars to skip after expression evaluation. - * @return the char if it resolves to a simple char, - * or -1 for a char class. In this case, bittab is changed. - */ -int RESearch::GetBackslashExpression( - const char *pattern, - int &incr) { - // Since error reporting is primitive and messages are not used anyway, - // I choose to interpret unexpected syntax in a logical way instead - // of reporting errors. Otherwise, we can stick on, eg., PCRE behavior. - incr = 0; // Most of the time, will skip the char "naturally". - int c; - int result = -1; - unsigned char bsc = *pattern; - if (!bsc) { - // Avoid overrun - result = '\\'; // \ at end of pattern, take it literally - return result; - } - - switch (bsc) { - case 'a': - case 'b': - case 'n': - case 'f': - case 'r': - case 't': - case 'v': - result = escapeValue(bsc); - break; - case 'x': { - unsigned char hd1 = *(pattern + 1); - unsigned char hd2 = *(pattern + 2); - int hexValue = GetHexaChar(hd1, hd2); - if (hexValue >= 0) { - result = hexValue; - incr = 2; // Must skip the digits - } else { - result = 'x'; // \x without 2 digits: see it as 'x' - } - } - break; - case 'd': - for (c = '0'; c <= '9'; c++) { - ChSet(static_cast(c)); - } - break; - case 'D': - for (c = 0; c < MAXCHR; c++) { - if (c < '0' || c > '9') { - ChSet(static_cast(c)); - } - } - break; - case 's': - ChSet(' '); - ChSet('\t'); - ChSet('\n'); - ChSet('\r'); - ChSet('\f'); - ChSet('\v'); - break; - case 'S': - for (c = 0; c < MAXCHR; c++) { - if (c != ' ' && !(c >= 0x09 && c <= 0x0D)) { - ChSet(static_cast(c)); - } - } - break; - case 'w': - for (c = 0; c < MAXCHR; c++) { - if (iswordc(static_cast(c))) { - ChSet(static_cast(c)); - } - } - break; - case 'W': - for (c = 0; c < MAXCHR; c++) { - if (!iswordc(static_cast(c))) { - ChSet(static_cast(c)); - } - } - break; - default: - result = bsc; - } - return result; -} - -const char *RESearch::Compile(const char *pattern, int length, bool caseSensitive, bool posix) { - char *mp=nfa; /* nfa pointer */ - char *lp; /* saved pointer */ - char *sp=nfa; /* another one */ - char *mpMax = mp + MAXNFA - BITBLK - 10; - - int tagi = 0; /* tag stack index */ - int tagc = 1; /* actual tag count */ - - int n; - char mask; /* xor mask -CCL/NCL */ - int c1, c2, prevChar; - - if (!pattern || !length) { - if (sta) - return 0; - else - return badpat("No previous regular expression"); - } - sta = NOP; - - const char *p=pattern; /* pattern pointer */ - for (int i=0; i mpMax) - return badpat("Pattern too long"); - lp = mp; - switch (*p) { - - case '.': /* match any char */ - *mp++ = ANY; - break; - - case '^': /* match beginning */ - if (p == pattern) { - *mp++ = BOL; - } else { - *mp++ = CHR; - *mp++ = *p; - } - break; - - case '$': /* match endofline */ - if (!*(p+1)) { - *mp++ = EOL; - } else { - *mp++ = CHR; - *mp++ = *p; - } - break; - - case '[': /* match char class */ - *mp++ = CCL; - prevChar = 0; - - i++; - if (*++p == '^') { - mask = '\377'; - i++; - p++; - } else { - mask = 0; - } - - if (*p == '-') { /* real dash */ - i++; - prevChar = *p; - ChSet(*p++); - } - if (*p == ']') { /* real brace */ - i++; - prevChar = *p; - ChSet(*p++); - } - while (*p && *p != ']') { - if (*p == '-') { - if (prevChar < 0) { - // Previous def. was a char class like \d, take dash literally - prevChar = *p; - ChSet(*p); - } else if (*(p+1)) { - if (*(p+1) != ']') { - c1 = prevChar + 1; - i++; - c2 = static_cast(*++p); - if (c2 == '\\') { - if (!*(p+1)) { // End of RE - return badpat("Missing ]"); - } else { - i++; - p++; - int incr; - c2 = GetBackslashExpression(p, incr); - i += incr; - p += incr; - if (c2 >= 0) { - // Convention: \c (c is any char) is case sensitive, whatever the option - ChSet(static_cast(c2)); - prevChar = c2; - } else { - // bittab is already changed - prevChar = -1; - } - } - } - if (prevChar < 0) { - // Char after dash is char class like \d, take dash literally - prevChar = '-'; - ChSet('-'); - } else { - // Put all chars between c1 and c2 included in the char set - while (c1 <= c2) { - ChSetWithCase(static_cast(c1++), caseSensitive); - } - } - } else { - // Dash before the ], take it literally - prevChar = *p; - ChSet(*p); - } - } else { - return badpat("Missing ]"); - } - } else if (*p == '\\' && *(p+1)) { - i++; - p++; - int incr; - int c = GetBackslashExpression(p, incr); - i += incr; - p += incr; - if (c >= 0) { - // Convention: \c (c is any char) is case sensitive, whatever the option - ChSet(static_cast(c)); - prevChar = c; - } else { - // bittab is already changed - prevChar = -1; - } - } else { - prevChar = static_cast(*p); - ChSetWithCase(*p, caseSensitive); - } - i++; - p++; - } - if (!*p) - return badpat("Missing ]"); - - for (n = 0; n < BITBLK; bittab[n++] = 0) - *mp++ = static_cast(mask ^ bittab[n]); - - break; - - case '*': /* match 0 or more... */ - case '+': /* match 1 or more... */ - case '?': - if (p == pattern) - return badpat("Empty closure"); - lp = sp; /* previous opcode */ - if (*lp == CLO || *lp == LCLO) /* equivalence... */ - break; - switch (*lp) { - - case BOL: - case BOT: - case EOT: - case BOW: - case EOW: - case REF: - return badpat("Illegal closure"); - default: - break; - } - - if (*p == '+') - for (sp = mp; lp < sp; lp++) - *mp++ = *lp; - - *mp++ = END; - *mp++ = END; - sp = mp; - - while (--mp > lp) - *mp = mp[-1]; - if (*p == '?') *mp = CLQ; - else if (*(p+1) == '?') *mp = LCLO; - else *mp = CLO; - - mp = sp; - break; - - case '\\': /* tags, backrefs... */ - i++; - switch (*++p) { - case '<': - *mp++ = BOW; - break; - case '>': - if (*sp == BOW) - return badpat("Null pattern inside \\<\\>"); - *mp++ = EOW; - break; - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - n = *p-'0'; - if (tagi > 0 && tagstk[tagi] == n) - return badpat("Cyclical reference"); - if (tagc > n) { - *mp++ = static_cast(REF); - *mp++ = static_cast(n); - } else { - return badpat("Undetermined reference"); - } - break; - default: - if (!posix && *p == '(') { - if (tagc < MAXTAG) { - tagstk[++tagi] = tagc; - *mp++ = BOT; - *mp++ = static_cast(tagc++); - } else { - return badpat("Too many \\(\\) pairs"); - } - } else if (!posix && *p == ')') { - if (*sp == BOT) - return badpat("Null pattern inside \\(\\)"); - if (tagi > 0) { - *mp++ = static_cast(EOT); - *mp++ = static_cast(tagstk[tagi--]); - } else { - return badpat("Unmatched \\)"); - } - } else { - int incr; - int c = GetBackslashExpression(p, incr); - i += incr; - p += incr; - if (c >= 0) { - *mp++ = CHR; - *mp++ = static_cast(c); - } else { - *mp++ = CCL; - mask = 0; - for (n = 0; n < BITBLK; bittab[n++] = 0) - *mp++ = static_cast(mask ^ bittab[n]); - } - } - } - break; - - default : /* an ordinary char */ - if (posix && *p == '(') { - if (tagc < MAXTAG) { - tagstk[++tagi] = tagc; - *mp++ = BOT; - *mp++ = static_cast(tagc++); - } else { - return badpat("Too many () pairs"); - } - } else if (posix && *p == ')') { - if (*sp == BOT) - return badpat("Null pattern inside ()"); - if (tagi > 0) { - *mp++ = static_cast(EOT); - *mp++ = static_cast(tagstk[tagi--]); - } else { - return badpat("Unmatched )"); - } - } else { - unsigned char c = *p; - if (!c) // End of RE - c = '\\'; // We take it as raw backslash - if (caseSensitive || !iswordc(c)) { - *mp++ = CHR; - *mp++ = c; - } else { - *mp++ = CCL; - mask = 0; - ChSetWithCase(c, false); - for (n = 0; n < BITBLK; bittab[n++] = 0) - *mp++ = static_cast(mask ^ bittab[n]); - } - } - break; - } - sp = lp; - } - if (tagi > 0) - return badpat((posix ? "Unmatched (" : "Unmatched \\(")); - *mp = END; - sta = OKP; - return 0; -} - -/* - * RESearch::Execute: - * execute nfa to find a match. - * - * special cases: (nfa[0]) - * BOL - * Match only once, starting from the - * beginning. - * CHR - * First locate the character without - * calling PMatch, and if found, call - * PMatch for the remaining string. - * END - * RESearch::Compile failed, poor luser did not - * check for it. Fail fast. - * - * If a match is found, bopat[0] and eopat[0] are set - * to the beginning and the end of the matched fragment, - * respectively. - * - */ -int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) { - unsigned char c; - int ep = NOTFOUND; - char *ap = nfa; - - bol = lp; - failure = 0; - - Clear(); - - switch (*ap) { - - case BOL: /* anchored: match from BOL only */ - ep = PMatch(ci, lp, endp, ap); - break; - case EOL: /* just searching for end of line normal path doesn't work */ - if (*(ap+1) == END) { - lp = endp; - ep = lp; - break; - } else { - return 0; - } - case CHR: /* ordinary char: locate it fast */ - c = *(ap+1); - while ((lp < endp) && (static_cast(ci.CharAt(lp)) != c)) - lp++; - if (lp >= endp) /* if EOS, fail, else fall through. */ - return 0; - default: /* regular matching all the way. */ - while (lp < endp) { - ep = PMatch(ci, lp, endp, ap); - if (ep != NOTFOUND) - break; - lp++; - } - break; - case END: /* munged automaton. fail always */ - return 0; - } - if (ep == NOTFOUND) - return 0; - - bopat[0] = lp; - eopat[0] = ep; - return 1; -} - -/* - * PMatch: internal routine for the hard part - * - * This code is partly snarfed from an early grep written by - * David Conroy. The backref and tag stuff, and various other - * innovations are by oz. - * - * special case optimizations: (nfa[n], nfa[n+1]) - * CLO ANY - * We KNOW .* will match everything up to the - * end of line. Thus, directly go to the end of - * line, without recursive PMatch calls. As in - * the other closure cases, the remaining pattern - * must be matched by moving backwards on the - * string recursively, to find a match for xy - * (x is ".*" and y is the remaining pattern) - * where the match satisfies the LONGEST match for - * x followed by a match for y. - * CLO CHR - * We can again scan the string forward for the - * single char and at the point of failure, we - * execute the remaining nfa recursively, same as - * above. - * - * At the end of a successful match, bopat[n] and eopat[n] - * are set to the beginning and end of subpatterns matched - * by tagged expressions (n = 1 to 9). - */ - -extern void re_fail(char *,char); - -#define isinset(x,y) ((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND]) - -/* - * skip values for CLO XXX to skip past the closure - */ - -#define ANYSKIP 2 /* [CLO] ANY END */ -#define CHRSKIP 3 /* [CLO] CHR chr END */ -#define CCLSKIP 34 /* [CLO] CCL 32 bytes END */ - -int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) { - int op, c, n; - int e; /* extra pointer for CLO */ - int bp; /* beginning of subpat... */ - int ep; /* ending of subpat... */ - int are; /* to save the line ptr. */ - int llp; /* lazy lp for LCLO */ - - while ((op = *ap++) != END) - switch (op) { - - case CHR: - if (ci.CharAt(lp++) != *ap++) - return NOTFOUND; - break; - case ANY: - if (lp++ >= endp) - return NOTFOUND; - break; - case CCL: - if (lp >= endp) - return NOTFOUND; - c = ci.CharAt(lp++); - if (!isinset(ap,c)) - return NOTFOUND; - ap += BITBLK; - break; - case BOL: - if (lp != bol) - return NOTFOUND; - break; - case EOL: - if (lp < endp) - return NOTFOUND; - break; - case BOT: - bopat[static_cast(*ap++)] = lp; - break; - case EOT: - eopat[static_cast(*ap++)] = lp; - break; - case BOW: - if ((lp!=bol && iswordc(ci.CharAt(lp-1))) || !iswordc(ci.CharAt(lp))) - return NOTFOUND; - break; - case EOW: - if (lp==bol || !iswordc(ci.CharAt(lp-1)) || iswordc(ci.CharAt(lp))) - return NOTFOUND; - break; - case REF: - n = *ap++; - bp = bopat[n]; - ep = eopat[n]; - while (bp < ep) - if (ci.CharAt(bp++) != ci.CharAt(lp++)) - return NOTFOUND; - break; - case LCLO: - case CLQ: - case CLO: - are = lp; - switch (*ap) { - - case ANY: - if (op == CLO || op == LCLO) - while (lp < endp) - lp++; - else if (lp < endp) - lp++; - - n = ANYSKIP; - break; - case CHR: - c = *(ap+1); - if (op == CLO || op == LCLO) - while ((lp < endp) && (c == ci.CharAt(lp))) - lp++; - else if ((lp < endp) && (c == ci.CharAt(lp))) - lp++; - n = CHRSKIP; - break; - case CCL: - while ((lp < endp) && isinset(ap+1,ci.CharAt(lp))) - lp++; - n = CCLSKIP; - break; - default: - failure = true; - //re_fail("closure: bad nfa.", *ap); - return NOTFOUND; - } - ap += n; - - llp = lp; - e = NOTFOUND; - while (llp >= are) { - int q; - if ((q = PMatch(ci, llp, endp, ap)) != NOTFOUND) { - e = q; - lp = llp; - if (op != LCLO) return e; - } - if (*ap == END) return e; - --llp; - } - if (*ap == EOT) - PMatch(ci, lp, endp, ap); - return e; - default: - //re_fail("RESearch::Execute: bad nfa.", static_cast(op)); - return NOTFOUND; - } - return lp; -} - - diff --git a/qrenderdoc/3rdparty/scintilla/src/RESearch.h b/qrenderdoc/3rdparty/scintilla/src/RESearch.h deleted file mode 100644 index 23795babe..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/RESearch.h +++ /dev/null @@ -1,73 +0,0 @@ -// Scintilla source code edit control -/** @file RESearch.h - ** Interface to the regular expression search library. - **/ -// Written by Neil Hodgson -// Based on the work of Ozan S. Yigit. -// This file is in the public domain. - -#ifndef RESEARCH_H -#define RESEARCH_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/* - * The following defines are not meant to be changeable. - * They are for readability only. - */ -#define MAXCHR 256 -#define CHRBIT 8 -#define BITBLK MAXCHR/CHRBIT - -class CharacterIndexer { -public: - virtual char CharAt(int index)=0; - virtual ~CharacterIndexer() { - } -}; - -class RESearch { - -public: - explicit RESearch(CharClassify *charClassTable); - ~RESearch(); - void Clear(); - void GrabMatches(CharacterIndexer &ci); - const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix); - int Execute(CharacterIndexer &ci, int lp, int endp); - - enum { MAXTAG=10 }; - enum { MAXNFA=4096 }; - enum { NOTFOUND=-1 }; - - int bopat[MAXTAG]; - int eopat[MAXTAG]; - std::string pat[MAXTAG]; - -private: - void ChSet(unsigned char c); - void ChSetWithCase(unsigned char c, bool caseSensitive); - int GetBackslashExpression(const char *pattern, int &incr); - - int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap); - - int bol; - int tagstk[MAXTAG]; /* subpat tag stack */ - char nfa[MAXNFA]; /* automaton */ - int sta; - unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */ - int failure; - CharClassify *charClass; - bool iswordc(unsigned char x) const { - return charClass->IsWord(x); - } -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif - diff --git a/qrenderdoc/3rdparty/scintilla/src/RunStyles.cxx b/qrenderdoc/3rdparty/scintilla/src/RunStyles.cxx deleted file mode 100644 index a136f022a..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/RunStyles.cxx +++ /dev/null @@ -1,289 +0,0 @@ -/** @file RunStyles.cxx - ** Data structure used to store sparse styles. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -// Find the first run at a position -int RunStyles::RunFromPosition(int position) const { - int run = starts->PartitionFromPosition(position); - // Go to first element with this position - while ((run > 0) && (position == starts->PositionFromPartition(run-1))) { - run--; - } - return run; -} - -// If there is no run boundary at position, insert one continuing style. -int RunStyles::SplitRun(int position) { - int run = RunFromPosition(position); - int posRun = starts->PositionFromPartition(run); - if (posRun < position) { - int runStyle = ValueAt(position); - run++; - starts->InsertPartition(run, position); - styles->InsertValue(run, 1, runStyle); - } - return run; -} - -void RunStyles::RemoveRun(int run) { - starts->RemovePartition(run); - styles->DeleteRange(run, 1); -} - -void RunStyles::RemoveRunIfEmpty(int run) { - if ((run < starts->Partitions()) && (starts->Partitions() > 1)) { - if (starts->PositionFromPartition(run) == starts->PositionFromPartition(run+1)) { - RemoveRun(run); - } - } -} - -void RunStyles::RemoveRunIfSameAsPrevious(int run) { - if ((run > 0) && (run < starts->Partitions())) { - if (styles->ValueAt(run-1) == styles->ValueAt(run)) { - RemoveRun(run); - } - } -} - -RunStyles::RunStyles() { - starts = new Partitioning(8); - styles = new SplitVector(); - styles->InsertValue(0, 2, 0); -} - -RunStyles::~RunStyles() { - delete starts; - starts = NULL; - delete styles; - styles = NULL; -} - -int RunStyles::Length() const { - return starts->PositionFromPartition(starts->Partitions()); -} - -int RunStyles::ValueAt(int position) const { - return styles->ValueAt(starts->PartitionFromPosition(position)); -} - -int RunStyles::FindNextChange(int position, int end) const { - int run = starts->PartitionFromPosition(position); - if (run < starts->Partitions()) { - int runChange = starts->PositionFromPartition(run); - if (runChange > position) - return runChange; - int nextChange = starts->PositionFromPartition(run + 1); - if (nextChange > position) { - return nextChange; - } else if (position < end) { - return end; - } else { - return end + 1; - } - } else { - return end + 1; - } -} - -int RunStyles::StartRun(int position) const { - return starts->PositionFromPartition(starts->PartitionFromPosition(position)); -} - -int RunStyles::EndRun(int position) const { - return starts->PositionFromPartition(starts->PartitionFromPosition(position) + 1); -} - -bool RunStyles::FillRange(int &position, int value, int &fillLength) { - if (fillLength <= 0) { - return false; - } - int end = position + fillLength; - if (end > Length()) { - return false; - } - int runEnd = RunFromPosition(end); - if (styles->ValueAt(runEnd) == value) { - // End already has value so trim range. - end = starts->PositionFromPartition(runEnd); - if (position >= end) { - // Whole range is already same as value so no action - return false; - } - fillLength = end - position; - } else { - runEnd = SplitRun(end); - } - int runStart = RunFromPosition(position); - if (styles->ValueAt(runStart) == value) { - // Start is in expected value so trim range. - runStart++; - position = starts->PositionFromPartition(runStart); - fillLength = end - position; - } else { - if (starts->PositionFromPartition(runStart) < position) { - runStart = SplitRun(position); - runEnd++; - } - } - if (runStart < runEnd) { - styles->SetValueAt(runStart, value); - // Remove each old run over the range - for (int run=runStart+1; runPositionFromPartition(runStart) == position) { - int runStyle = ValueAt(position); - // Inserting at start of run so make previous longer - if (runStart == 0) { - // Inserting at start of document so ensure 0 - if (runStyle) { - styles->SetValueAt(0, 0); - starts->InsertPartition(1, 0); - styles->InsertValue(1, 1, runStyle); - starts->InsertText(0, insertLength); - } else { - starts->InsertText(runStart, insertLength); - } - } else { - if (runStyle) { - starts->InsertText(runStart-1, insertLength); - } else { - // Insert at end of run so do not extend style - starts->InsertText(runStart, insertLength); - } - } - } else { - starts->InsertText(runStart, insertLength); - } -} - -void RunStyles::DeleteAll() { - delete starts; - starts = NULL; - delete styles; - styles = NULL; - starts = new Partitioning(8); - styles = new SplitVector(); - styles->InsertValue(0, 2, 0); -} - -void RunStyles::DeleteRange(int position, int deleteLength) { - int end = position + deleteLength; - int runStart = RunFromPosition(position); - int runEnd = RunFromPosition(end); - if (runStart == runEnd) { - // Deleting from inside one run - starts->InsertText(runStart, -deleteLength); - RemoveRunIfEmpty(runStart); - } else { - runStart = SplitRun(position); - runEnd = SplitRun(end); - starts->InsertText(runStart, -deleteLength); - // Remove each old run over the range - for (int run=runStart; runPartitions(); -} - -bool RunStyles::AllSame() const { - for (int run = 1; run < starts->Partitions(); run++) { - if (styles->ValueAt(run) != styles->ValueAt(run - 1)) - return false; - } - return true; -} - -bool RunStyles::AllSameAs(int value) const { - return AllSame() && (styles->ValueAt(0) == value); -} - -int RunStyles::Find(int value, int start) const { - if (start < Length()) { - int run = start ? RunFromPosition(start) : 0; - if (styles->ValueAt(run) == value) - return start; - run++; - while (run < starts->Partitions()) { - if (styles->ValueAt(run) == value) - return starts->PositionFromPartition(run); - run++; - } - } - return -1; -} - -void RunStyles::Check() const { - if (Length() < 0) { - throw std::runtime_error("RunStyles: Length can not be negative."); - } - if (starts->Partitions() < 1) { - throw std::runtime_error("RunStyles: Must always have 1 or more partitions."); - } - if (starts->Partitions() != styles->Length()-1) { - throw std::runtime_error("RunStyles: Partitions and styles different lengths."); - } - int start=0; - while (start < Length()) { - int end = EndRun(start); - if (start >= end) { - throw std::runtime_error("RunStyles: Partition is 0 length."); - } - start = end; - } - if (styles->ValueAt(styles->Length()-1) != 0) { - throw std::runtime_error("RunStyles: Unused style at end changed."); - } - for (int j=1; jLength()-1; j++) { - if (styles->ValueAt(j) == styles->ValueAt(j-1)) { - throw std::runtime_error("RunStyles: Style of a partition same as previous."); - } - } -} diff --git a/qrenderdoc/3rdparty/scintilla/src/RunStyles.h b/qrenderdoc/3rdparty/scintilla/src/RunStyles.h deleted file mode 100644 index b096ad800..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/RunStyles.h +++ /dev/null @@ -1,54 +0,0 @@ -/** @file RunStyles.h - ** Data structure used to store sparse styles. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -/// Styling buffer using one element for each run rather than using -/// a filled buffer. - -#ifndef RUNSTYLES_H -#define RUNSTYLES_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class RunStyles { -private: - Partitioning *starts; - SplitVector *styles; - int RunFromPosition(int position) const; - int SplitRun(int position); - void RemoveRun(int run); - void RemoveRunIfEmpty(int run); - void RemoveRunIfSameAsPrevious(int run); - // Private so RunStyles objects can not be copied - RunStyles(const RunStyles &); -public: - RunStyles(); - ~RunStyles(); - int Length() const; - int ValueAt(int position) const; - int FindNextChange(int position, int end) const; - int StartRun(int position) const; - int EndRun(int position) const; - // Returns true if some values may have changed - bool FillRange(int &position, int value, int &fillLength); - void SetValueAt(int position, int value); - void InsertSpace(int position, int insertLength); - void DeleteAll(); - void DeleteRange(int position, int deleteLength); - int Runs() const; - bool AllSame() const; - bool AllSameAs(int value) const; - int Find(int value, int start) const; - - void Check() const; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/ScintillaBase.cxx b/qrenderdoc/3rdparty/scintilla/src/ScintillaBase.cxx deleted file mode 100644 index 08b9fe829..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/ScintillaBase.cxx +++ /dev/null @@ -1,1088 +0,0 @@ -// Scintilla source code edit control -/** @file ScintillaBase.cxx - ** An enhanced subclass of Editor with calltips, autocomplete and context menu. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "ILexer.h" -#include "Scintilla.h" - -#ifdef SCI_LEXER -#include "SciLexer.h" -#endif - -#include "PropSetSimple.h" - -#ifdef SCI_LEXER -#include "LexerModule.h" -#include "Catalogue.h" -#endif - -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" -#include "CellBuffer.h" -#include "CallTip.h" -#include "KeyMap.h" -#include "Indicator.h" -#include "XPM.h" -#include "LineMarker.h" -#include "Style.h" -#include "ViewStyle.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "CaseFolder.h" -#include "Document.h" -#include "Selection.h" -#include "PositionCache.h" -#include "EditModel.h" -#include "MarginView.h" -#include "EditView.h" -#include "Editor.h" -#include "AutoComplete.h" -#include "ScintillaBase.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -ScintillaBase::ScintillaBase() { - displayPopupMenu = SC_POPUP_ALL; - listType = 0; - maxListWidth = 0; - multiAutoCMode = SC_MULTIAUTOC_ONCE; -} - -ScintillaBase::~ScintillaBase() { -} - -void ScintillaBase::Finalise() { - Editor::Finalise(); - popup.Destroy(); -} - -void ScintillaBase::AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS) { - bool isFillUp = ac.Active() && ac.IsFillUpChar(*s); - if (!isFillUp) { - Editor::AddCharUTF(s, len, treatAsDBCS); - } - if (ac.Active()) { - AutoCompleteCharacterAdded(s[0]); - // For fill ups add the character after the autocompletion has - // triggered so containers see the key so can display a calltip. - if (isFillUp) { - Editor::AddCharUTF(s, len, treatAsDBCS); - } - } -} - -void ScintillaBase::Command(int cmdId) { - - switch (cmdId) { - - case idAutoComplete: // Nothing to do - - break; - - case idCallTip: // Nothing to do - - break; - - case idcmdUndo: - WndProc(SCI_UNDO, 0, 0); - break; - - case idcmdRedo: - WndProc(SCI_REDO, 0, 0); - break; - - case idcmdCut: - WndProc(SCI_CUT, 0, 0); - break; - - case idcmdCopy: - WndProc(SCI_COPY, 0, 0); - break; - - case idcmdPaste: - WndProc(SCI_PASTE, 0, 0); - break; - - case idcmdDelete: - WndProc(SCI_CLEAR, 0, 0); - break; - - case idcmdSelectAll: - WndProc(SCI_SELECTALL, 0, 0); - break; - } -} - -int ScintillaBase::KeyCommand(unsigned int iMessage) { - // Most key commands cancel autocompletion mode - if (ac.Active()) { - switch (iMessage) { - // Except for these - case SCI_LINEDOWN: - AutoCompleteMove(1); - return 0; - case SCI_LINEUP: - AutoCompleteMove(-1); - return 0; - case SCI_PAGEDOWN: - AutoCompleteMove(ac.lb->GetVisibleRows()); - return 0; - case SCI_PAGEUP: - AutoCompleteMove(-ac.lb->GetVisibleRows()); - return 0; - case SCI_VCHOME: - AutoCompleteMove(-5000); - return 0; - case SCI_LINEEND: - AutoCompleteMove(5000); - return 0; - case SCI_DELETEBACK: - DelCharBack(true); - AutoCompleteCharacterDeleted(); - EnsureCaretVisible(); - return 0; - case SCI_DELETEBACKNOTLINE: - DelCharBack(false); - AutoCompleteCharacterDeleted(); - EnsureCaretVisible(); - return 0; - case SCI_TAB: - AutoCompleteCompleted(0, SC_AC_TAB); - return 0; - case SCI_NEWLINE: - AutoCompleteCompleted(0, SC_AC_NEWLINE); - return 0; - - default: - AutoCompleteCancel(); - } - } - - if (ct.inCallTipMode) { - if ( - (iMessage != SCI_CHARLEFT) && - (iMessage != SCI_CHARLEFTEXTEND) && - (iMessage != SCI_CHARRIGHT) && - (iMessage != SCI_CHARRIGHTEXTEND) && - (iMessage != SCI_EDITTOGGLEOVERTYPE) && - (iMessage != SCI_DELETEBACK) && - (iMessage != SCI_DELETEBACKNOTLINE) - ) { - ct.CallTipCancel(); - } - if ((iMessage == SCI_DELETEBACK) || (iMessage == SCI_DELETEBACKNOTLINE)) { - if (sel.MainCaret() <= ct.posStartCallTip) { - ct.CallTipCancel(); - } - } - } - return Editor::KeyCommand(iMessage); -} - -void ScintillaBase::AutoCompleteDoubleClick(void *p) { - ScintillaBase *sci = reinterpret_cast(p); - sci->AutoCompleteCompleted(0, SC_AC_DOUBLECLICK); -} - -void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) { - UndoGroup ug(pdoc); - if (multiAutoCMode == SC_MULTIAUTOC_ONCE) { - pdoc->DeleteChars(startPos, removeLen); - const int lengthInserted = pdoc->InsertString(startPos, text, textLen); - SetEmptySelection(startPos + lengthInserted); - } else { - // SC_MULTIAUTOC_EACH - for (size_t r=0; r= 0) { - positionInsert -= removeLen; - pdoc->DeleteChars(positionInsert, removeLen); - } - const int lengthInserted = pdoc->InsertString(positionInsert, text, textLen); - if (lengthInserted > 0) { - sel.Range(r).caret.SetPosition(positionInsert + lengthInserted); - sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted); - } - sel.Range(r).ClearVirtualSpace(); - } - } - } -} - -void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { - //Platform::DebugPrintf("AutoComplete %s\n", list); - ct.CallTipCancel(); - - if (ac.chooseSingle && (listType == 0)) { - if (list && !strchr(list, ac.GetSeparator())) { - const char *typeSep = strchr(list, ac.GetTypesep()); - int lenInsert = typeSep ? - static_cast(typeSep-list) : static_cast(strlen(list)); - if (ac.ignoreCase) { - // May need to convert the case before invocation, so remove lenEntered characters - AutoCompleteInsert(sel.MainCaret() - lenEntered, lenEntered, list, lenInsert); - } else { - AutoCompleteInsert(sel.MainCaret(), 0, list + lenEntered, lenInsert - lenEntered); - } - ac.Cancel(); - return; - } - } - ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(), - lenEntered, vs.lineHeight, IsUnicodeMode(), technology); - - PRectangle rcClient = GetClientRectangle(); - Point pt = LocationFromPosition(sel.MainCaret() - lenEntered); - PRectangle rcPopupBounds = wMain.GetMonitorRect(pt); - if (rcPopupBounds.Height() == 0) - rcPopupBounds = rcClient; - - int heightLB = ac.heightLBDefault; - int widthLB = ac.widthLBDefault; - if (pt.x >= rcClient.right - widthLB) { - HorizontalScrollTo(static_cast(xOffset + pt.x - rcClient.right + widthLB)); - Redraw(); - pt = PointMainCaret(); - } - if (wMargin.GetID()) { - Point ptOrigin = GetVisibleOriginInMain(); - pt.x += ptOrigin.x; - pt.y += ptOrigin.y; - } - PRectangle rcac; - rcac.left = pt.x - ac.lb->CaretFromEdge(); - if (pt.y >= rcPopupBounds.bottom - heightLB && // Won't fit below. - pt.y >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2) { // and there is more room above. - rcac.top = pt.y - heightLB; - if (rcac.top < rcPopupBounds.top) { - heightLB -= static_cast(rcPopupBounds.top - rcac.top); - rcac.top = rcPopupBounds.top; - } - } else { - rcac.top = pt.y + vs.lineHeight; - } - rcac.right = rcac.left + widthLB; - rcac.bottom = static_cast(Platform::Minimum(static_cast(rcac.top) + heightLB, static_cast(rcPopupBounds.bottom))); - ac.lb->SetPositionRelative(rcac, wMain); - ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font); - unsigned int aveCharWidth = static_cast(vs.styles[STYLE_DEFAULT].aveCharWidth); - ac.lb->SetAverageCharWidth(aveCharWidth); - ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this); - - ac.SetList(list ? list : ""); - - // Fiddle the position of the list so it is right next to the target and wide enough for all its strings - PRectangle rcList = ac.lb->GetDesiredRect(); - int heightAlloced = static_cast(rcList.bottom - rcList.top); - widthLB = Platform::Maximum(widthLB, static_cast(rcList.right - rcList.left)); - if (maxListWidth != 0) - widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth); - // Make an allowance for large strings in list - rcList.left = pt.x - ac.lb->CaretFromEdge(); - rcList.right = rcList.left + widthLB; - if (((pt.y + vs.lineHeight) >= (rcPopupBounds.bottom - heightAlloced)) && // Won't fit below. - ((pt.y + vs.lineHeight / 2) >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2)) { // and there is more room above. - rcList.top = pt.y - heightAlloced; - } else { - rcList.top = pt.y + vs.lineHeight; - } - rcList.bottom = rcList.top + heightAlloced; - ac.lb->SetPositionRelative(rcList, wMain); - ac.Show(true); - if (lenEntered != 0) { - AutoCompleteMoveToCurrentWord(); - } -} - -void ScintillaBase::AutoCompleteCancel() { - if (ac.Active()) { - SCNotification scn = {}; - scn.nmhdr.code = SCN_AUTOCCANCELLED; - scn.wParam = 0; - scn.listType = 0; - NotifyParent(scn); - } - ac.Cancel(); -} - -void ScintillaBase::AutoCompleteMove(int delta) { - ac.Move(delta); -} - -void ScintillaBase::AutoCompleteMoveToCurrentWord() { - std::string wordCurrent = RangeText(ac.posStart - ac.startLen, sel.MainCaret()); - ac.Select(wordCurrent.c_str()); -} - -void ScintillaBase::AutoCompleteCharacterAdded(char ch) { - if (ac.IsFillUpChar(ch)) { - AutoCompleteCompleted(ch, SC_AC_FILLUP); - } else if (ac.IsStopChar(ch)) { - AutoCompleteCancel(); - } else { - AutoCompleteMoveToCurrentWord(); - } -} - -void ScintillaBase::AutoCompleteCharacterDeleted() { - if (sel.MainCaret() < ac.posStart - ac.startLen) { - AutoCompleteCancel(); - } else if (ac.cancelAtStartPos && (sel.MainCaret() <= ac.posStart)) { - AutoCompleteCancel(); - } else { - AutoCompleteMoveToCurrentWord(); - } - SCNotification scn = {}; - scn.nmhdr.code = SCN_AUTOCCHARDELETED; - scn.wParam = 0; - scn.listType = 0; - NotifyParent(scn); -} - -void ScintillaBase::AutoCompleteCompleted(char ch, unsigned int completionMethod) { - int item = ac.GetSelection(); - if (item == -1) { - AutoCompleteCancel(); - return; - } - const std::string selected = ac.GetValue(item); - - ac.Show(false); - - SCNotification scn = {}; - scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION; - scn.message = 0; - scn.ch = ch; - scn.listCompletionMethod = completionMethod; - scn.wParam = listType; - scn.listType = listType; - Position firstPos = ac.posStart - ac.startLen; - scn.position = firstPos; - scn.lParam = firstPos; - scn.text = selected.c_str(); - NotifyParent(scn); - - if (!ac.Active()) - return; - ac.Cancel(); - - if (listType > 0) - return; - - Position endPos = sel.MainCaret(); - if (ac.dropRestOfWord) - endPos = pdoc->ExtendWordSelect(endPos, 1, true); - if (endPos < firstPos) - return; - AutoCompleteInsert(firstPos, endPos - firstPos, selected.c_str(), static_cast(selected.length())); - SetLastXChosen(); - - scn.nmhdr.code = SCN_AUTOCCOMPLETED; - NotifyParent(scn); - -} - -int ScintillaBase::AutoCompleteGetCurrent() const { - if (!ac.Active()) - return -1; - return ac.GetSelection(); -} - -int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) const { - if (ac.Active()) { - int item = ac.GetSelection(); - if (item != -1) { - const std::string selected = ac.GetValue(item); - if (buffer != NULL) - memcpy(buffer, selected.c_str(), selected.length()+1); - return static_cast(selected.length()); - } - } - if (buffer != NULL) - *buffer = '\0'; - return 0; -} - -void ScintillaBase::CallTipShow(Point pt, const char *defn) { - ac.Cancel(); - // If container knows about STYLE_CALLTIP then use it in place of the - // STYLE_DEFAULT for the face name, size and character set. Also use it - // for the foreground and background colour. - int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT; - if (ct.UseStyleCallTip()) { - ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back); - } - if (wMargin.GetID()) { - Point ptOrigin = GetVisibleOriginInMain(); - pt.x += ptOrigin.x; - pt.y += ptOrigin.y; - } - PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt, - vs.lineHeight, - defn, - vs.styles[ctStyle].fontName, - vs.styles[ctStyle].sizeZoomed, - CodePage(), - vs.styles[ctStyle].characterSet, - vs.technology, - wMain); - // If the call-tip window would be out of the client - // space - PRectangle rcClient = GetClientRectangle(); - int offset = vs.lineHeight + static_cast(rc.Height()); - // adjust so it displays above the text. - if (rc.bottom > rcClient.bottom && rc.Height() < rcClient.Height()) { - rc.top -= offset; - rc.bottom -= offset; - } - // adjust so it displays below the text. - if (rc.top < rcClient.top && rc.Height() < rcClient.Height()) { - rc.top += offset; - rc.bottom += offset; - } - // Now display the window. - CreateCallTipWindow(rc); - ct.wCallTip.SetPositionRelative(rc, wMain); - ct.wCallTip.Show(); -} - -void ScintillaBase::CallTipClick() { - SCNotification scn = {}; - scn.nmhdr.code = SCN_CALLTIPCLICK; - scn.position = ct.clickPlace; - NotifyParent(scn); -} - -bool ScintillaBase::ShouldDisplayPopup(Point ptInWindowCoordinates) const { - return (displayPopupMenu == SC_POPUP_ALL || - (displayPopupMenu == SC_POPUP_TEXT && !PointInSelMargin(ptInWindowCoordinates))); -} - -void ScintillaBase::ContextMenu(Point pt) { - if (displayPopupMenu) { - bool writable = !WndProc(SCI_GETREADONLY, 0, 0); - popup.CreatePopUp(); - AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo()); - AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo()); - AddToPopUp(""); - AddToPopUp("Cut", idcmdCut, writable && !sel.Empty()); - AddToPopUp("Copy", idcmdCopy, !sel.Empty()); - AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0)); - AddToPopUp("Delete", idcmdDelete, writable && !sel.Empty()); - AddToPopUp(""); - AddToPopUp("Select All", idcmdSelectAll); - popup.Show(pt, wMain); - } -} - -void ScintillaBase::CancelModes() { - AutoCompleteCancel(); - ct.CallTipCancel(); - Editor::CancelModes(); -} - -void ScintillaBase::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) { - CancelModes(); - Editor::ButtonDownWithModifiers(pt, curTime, modifiers); -} - -void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { - ButtonDownWithModifiers(pt, curTime, ModifierFlags(shift, ctrl, alt)); -} - -void ScintillaBase::RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) { - CancelModes(); - Editor::RightButtonDownWithModifiers(pt, curTime, modifiers); -} - -#ifdef SCI_LEXER - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class LexState : public LexInterface { - const LexerModule *lexCurrent; - void SetLexerModule(const LexerModule *lex); - PropSetSimple props; - int interfaceVersion; -public: - int lexLanguage; - - explicit LexState(Document *pdoc_); - virtual ~LexState(); - void SetLexer(uptr_t wParam); - void SetLexerLanguage(const char *languageName); - const char *DescribeWordListSets(); - void SetWordList(int n, const char *wl); - const char *GetName() const; - void *PrivateCall(int operation, void *pointer); - const char *PropertyNames(); - int PropertyType(const char *name); - const char *DescribeProperty(const char *name); - void PropSet(const char *key, const char *val); - const char *PropGet(const char *key) const; - int PropGetInt(const char *key, int defaultValue=0) const; - int PropGetExpanded(const char *key, char *result) const; - - int LineEndTypesSupported(); - int AllocateSubStyles(int styleBase, int numberStyles); - int SubStylesStart(int styleBase); - int SubStylesLength(int styleBase); - int StyleFromSubStyle(int subStyle); - int PrimaryStyleFromStyle(int style); - void FreeSubStyles(); - void SetIdentifiers(int style, const char *identifiers); - int DistanceToSecondaryStyles(); - const char *GetSubStyleBases(); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -LexState::LexState(Document *pdoc_) : LexInterface(pdoc_) { - lexCurrent = 0; - performingStyle = false; - interfaceVersion = lvOriginal; - lexLanguage = SCLEX_CONTAINER; -} - -LexState::~LexState() { - if (instance) { - instance->Release(); - instance = 0; - } -} - -LexState *ScintillaBase::DocumentLexState() { - if (!pdoc->pli) { - pdoc->pli = new LexState(pdoc); - } - return static_cast(pdoc->pli); -} - -void LexState::SetLexerModule(const LexerModule *lex) { - if (lex != lexCurrent) { - if (instance) { - instance->Release(); - instance = 0; - } - interfaceVersion = lvOriginal; - lexCurrent = lex; - if (lexCurrent) { - instance = lexCurrent->Create(); - interfaceVersion = instance->Version(); - } - pdoc->LexerChanged(); - } -} - -void LexState::SetLexer(uptr_t wParam) { - lexLanguage = static_cast(wParam); - if (lexLanguage == SCLEX_CONTAINER) { - SetLexerModule(0); - } else { - const LexerModule *lex = Catalogue::Find(lexLanguage); - if (!lex) - lex = Catalogue::Find(SCLEX_NULL); - SetLexerModule(lex); - } -} - -void LexState::SetLexerLanguage(const char *languageName) { - const LexerModule *lex = Catalogue::Find(languageName); - if (!lex) - lex = Catalogue::Find(SCLEX_NULL); - if (lex) - lexLanguage = lex->GetLanguage(); - SetLexerModule(lex); -} - -const char *LexState::DescribeWordListSets() { - if (instance) { - return instance->DescribeWordListSets(); - } else { - return 0; - } -} - -void LexState::SetWordList(int n, const char *wl) { - if (instance) { - int firstModification = instance->WordListSet(n, wl); - if (firstModification >= 0) { - pdoc->ModifiedAt(firstModification); - } - } -} - -const char *LexState::GetName() const { - return lexCurrent ? lexCurrent->languageName : ""; -} - -void *LexState::PrivateCall(int operation, void *pointer) { - if (pdoc && instance) { - return instance->PrivateCall(operation, pointer); - } else { - return 0; - } -} - -const char *LexState::PropertyNames() { - if (instance) { - return instance->PropertyNames(); - } else { - return 0; - } -} - -int LexState::PropertyType(const char *name) { - if (instance) { - return instance->PropertyType(name); - } else { - return SC_TYPE_BOOLEAN; - } -} - -const char *LexState::DescribeProperty(const char *name) { - if (instance) { - return instance->DescribeProperty(name); - } else { - return 0; - } -} - -void LexState::PropSet(const char *key, const char *val) { - props.Set(key, val); - if (instance) { - int firstModification = instance->PropertySet(key, val); - if (firstModification >= 0) { - pdoc->ModifiedAt(firstModification); - } - } -} - -const char *LexState::PropGet(const char *key) const { - return props.Get(key); -} - -int LexState::PropGetInt(const char *key, int defaultValue) const { - return props.GetInt(key, defaultValue); -} - -int LexState::PropGetExpanded(const char *key, char *result) const { - return props.GetExpanded(key, result); -} - -int LexState::LineEndTypesSupported() { - if (instance && (interfaceVersion >= lvSubStyles)) { - return static_cast(instance)->LineEndTypesSupported(); - } - return 0; -} - -int LexState::AllocateSubStyles(int styleBase, int numberStyles) { - if (instance && (interfaceVersion >= lvSubStyles)) { - return static_cast(instance)->AllocateSubStyles(styleBase, numberStyles); - } - return -1; -} - -int LexState::SubStylesStart(int styleBase) { - if (instance && (interfaceVersion >= lvSubStyles)) { - return static_cast(instance)->SubStylesStart(styleBase); - } - return -1; -} - -int LexState::SubStylesLength(int styleBase) { - if (instance && (interfaceVersion >= lvSubStyles)) { - return static_cast(instance)->SubStylesLength(styleBase); - } - return 0; -} - -int LexState::StyleFromSubStyle(int subStyle) { - if (instance && (interfaceVersion >= lvSubStyles)) { - return static_cast(instance)->StyleFromSubStyle(subStyle); - } - return 0; -} - -int LexState::PrimaryStyleFromStyle(int style) { - if (instance && (interfaceVersion >= lvSubStyles)) { - return static_cast(instance)->PrimaryStyleFromStyle(style); - } - return 0; -} - -void LexState::FreeSubStyles() { - if (instance && (interfaceVersion >= lvSubStyles)) { - static_cast(instance)->FreeSubStyles(); - } -} - -void LexState::SetIdentifiers(int style, const char *identifiers) { - if (instance && (interfaceVersion >= lvSubStyles)) { - static_cast(instance)->SetIdentifiers(style, identifiers); - pdoc->ModifiedAt(0); - } -} - -int LexState::DistanceToSecondaryStyles() { - if (instance && (interfaceVersion >= lvSubStyles)) { - return static_cast(instance)->DistanceToSecondaryStyles(); - } - return 0; -} - -const char *LexState::GetSubStyleBases() { - if (instance && (interfaceVersion >= lvSubStyles)) { - return static_cast(instance)->GetSubStyleBases(); - } - return ""; -} - -#endif - -void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) { -#ifdef SCI_LEXER - if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) { - int lineEndStyled = pdoc->LineFromPosition(pdoc->GetEndStyled()); - int endStyled = pdoc->LineStart(lineEndStyled); - DocumentLexState()->Colourise(endStyled, endStyleNeeded); - return; - } -#endif - Editor::NotifyStyleToNeeded(endStyleNeeded); -} - -void ScintillaBase::NotifyLexerChanged(Document *, void *) { -#ifdef SCI_LEXER - vs.EnsureStyle(0xff); -#endif -} - -sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - switch (iMessage) { - case SCI_AUTOCSHOW: - listType = 0; - AutoCompleteStart(static_cast(wParam), reinterpret_cast(lParam)); - break; - - case SCI_AUTOCCANCEL: - ac.Cancel(); - break; - - case SCI_AUTOCACTIVE: - return ac.Active(); - - case SCI_AUTOCPOSSTART: - return ac.posStart; - - case SCI_AUTOCCOMPLETE: - AutoCompleteCompleted(0, SC_AC_COMMAND); - break; - - case SCI_AUTOCSETSEPARATOR: - ac.SetSeparator(static_cast(wParam)); - break; - - case SCI_AUTOCGETSEPARATOR: - return ac.GetSeparator(); - - case SCI_AUTOCSTOPS: - ac.SetStopChars(reinterpret_cast(lParam)); - break; - - case SCI_AUTOCSELECT: - ac.Select(reinterpret_cast(lParam)); - break; - - case SCI_AUTOCGETCURRENT: - return AutoCompleteGetCurrent(); - - case SCI_AUTOCGETCURRENTTEXT: - return AutoCompleteGetCurrentText(reinterpret_cast(lParam)); - - case SCI_AUTOCSETCANCELATSTART: - ac.cancelAtStartPos = wParam != 0; - break; - - case SCI_AUTOCGETCANCELATSTART: - return ac.cancelAtStartPos; - - case SCI_AUTOCSETFILLUPS: - ac.SetFillUpChars(reinterpret_cast(lParam)); - break; - - case SCI_AUTOCSETCHOOSESINGLE: - ac.chooseSingle = wParam != 0; - break; - - case SCI_AUTOCGETCHOOSESINGLE: - return ac.chooseSingle; - - case SCI_AUTOCSETIGNORECASE: - ac.ignoreCase = wParam != 0; - break; - - case SCI_AUTOCGETIGNORECASE: - return ac.ignoreCase; - - case SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR: - ac.ignoreCaseBehaviour = static_cast(wParam); - break; - - case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR: - return ac.ignoreCaseBehaviour; - - case SCI_AUTOCSETMULTI: - multiAutoCMode = static_cast(wParam); - break; - - case SCI_AUTOCGETMULTI: - return multiAutoCMode; - - case SCI_AUTOCSETORDER: - ac.autoSort = static_cast(wParam); - break; - - case SCI_AUTOCGETORDER: - return ac.autoSort; - - case SCI_USERLISTSHOW: - listType = static_cast(wParam); - AutoCompleteStart(0, reinterpret_cast(lParam)); - break; - - case SCI_AUTOCSETAUTOHIDE: - ac.autoHide = wParam != 0; - break; - - case SCI_AUTOCGETAUTOHIDE: - return ac.autoHide; - - case SCI_AUTOCSETDROPRESTOFWORD: - ac.dropRestOfWord = wParam != 0; - break; - - case SCI_AUTOCGETDROPRESTOFWORD: - return ac.dropRestOfWord; - - case SCI_AUTOCSETMAXHEIGHT: - ac.lb->SetVisibleRows(static_cast(wParam)); - break; - - case SCI_AUTOCGETMAXHEIGHT: - return ac.lb->GetVisibleRows(); - - case SCI_AUTOCSETMAXWIDTH: - maxListWidth = static_cast(wParam); - break; - - case SCI_AUTOCGETMAXWIDTH: - return maxListWidth; - - case SCI_REGISTERIMAGE: - ac.lb->RegisterImage(static_cast(wParam), reinterpret_cast(lParam)); - break; - - case SCI_REGISTERRGBAIMAGE: - ac.lb->RegisterRGBAImage(static_cast(wParam), static_cast(sizeRGBAImage.x), static_cast(sizeRGBAImage.y), - reinterpret_cast(lParam)); - break; - - case SCI_CLEARREGISTEREDIMAGES: - ac.lb->ClearRegisteredImages(); - break; - - case SCI_AUTOCSETTYPESEPARATOR: - ac.SetTypesep(static_cast(wParam)); - break; - - case SCI_AUTOCGETTYPESEPARATOR: - return ac.GetTypesep(); - - case SCI_CALLTIPSHOW: - CallTipShow(LocationFromPosition(static_cast(wParam)), - reinterpret_cast(lParam)); - break; - - case SCI_CALLTIPCANCEL: - ct.CallTipCancel(); - break; - - case SCI_CALLTIPACTIVE: - return ct.inCallTipMode; - - case SCI_CALLTIPPOSSTART: - return ct.posStartCallTip; - - case SCI_CALLTIPSETPOSSTART: - ct.posStartCallTip = static_cast(wParam); - break; - - case SCI_CALLTIPSETHLT: - ct.SetHighlight(static_cast(wParam), static_cast(lParam)); - break; - - case SCI_CALLTIPSETBACK: - ct.colourBG = ColourDesired(static_cast(wParam)); - vs.styles[STYLE_CALLTIP].back = ct.colourBG; - InvalidateStyleRedraw(); - break; - - case SCI_CALLTIPSETFORE: - ct.colourUnSel = ColourDesired(static_cast(wParam)); - vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel; - InvalidateStyleRedraw(); - break; - - case SCI_CALLTIPSETFOREHLT: - ct.colourSel = ColourDesired(static_cast(wParam)); - InvalidateStyleRedraw(); - break; - - case SCI_CALLTIPUSESTYLE: - ct.SetTabSize(static_cast(wParam)); - InvalidateStyleRedraw(); - break; - - case SCI_CALLTIPSETPOSITION: - ct.SetPosition(wParam != 0); - InvalidateStyleRedraw(); - break; - - case SCI_USEPOPUP: - displayPopupMenu = static_cast(wParam); - break; - -#ifdef SCI_LEXER - case SCI_SETLEXER: - DocumentLexState()->SetLexer(static_cast(wParam)); - break; - - case SCI_GETLEXER: - return DocumentLexState()->lexLanguage; - - case SCI_COLOURISE: - if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) { - pdoc->ModifiedAt(static_cast(wParam)); - NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : static_cast(lParam)); - } else { - DocumentLexState()->Colourise(static_cast(wParam), static_cast(lParam)); - } - Redraw(); - break; - - case SCI_SETPROPERTY: - DocumentLexState()->PropSet(reinterpret_cast(wParam), - reinterpret_cast(lParam)); - break; - - case SCI_GETPROPERTY: - return StringResult(lParam, DocumentLexState()->PropGet(reinterpret_cast(wParam))); - - case SCI_GETPROPERTYEXPANDED: - return DocumentLexState()->PropGetExpanded(reinterpret_cast(wParam), - reinterpret_cast(lParam)); - - case SCI_GETPROPERTYINT: - return DocumentLexState()->PropGetInt(reinterpret_cast(wParam), static_cast(lParam)); - - case SCI_SETKEYWORDS: - DocumentLexState()->SetWordList(static_cast(wParam), reinterpret_cast(lParam)); - break; - - case SCI_SETLEXERLANGUAGE: - DocumentLexState()->SetLexerLanguage(reinterpret_cast(lParam)); - break; - - case SCI_GETLEXERLANGUAGE: - return StringResult(lParam, DocumentLexState()->GetName()); - - case SCI_PRIVATELEXERCALL: - return reinterpret_cast( - DocumentLexState()->PrivateCall(static_cast(wParam), reinterpret_cast(lParam))); - - case SCI_GETSTYLEBITSNEEDED: - return 8; - - case SCI_PROPERTYNAMES: - return StringResult(lParam, DocumentLexState()->PropertyNames()); - - case SCI_PROPERTYTYPE: - return DocumentLexState()->PropertyType(reinterpret_cast(wParam)); - - case SCI_DESCRIBEPROPERTY: - return StringResult(lParam, - DocumentLexState()->DescribeProperty(reinterpret_cast(wParam))); - - case SCI_DESCRIBEKEYWORDSETS: - return StringResult(lParam, DocumentLexState()->DescribeWordListSets()); - - case SCI_GETLINEENDTYPESSUPPORTED: - return DocumentLexState()->LineEndTypesSupported(); - - case SCI_ALLOCATESUBSTYLES: - return DocumentLexState()->AllocateSubStyles(static_cast(wParam), static_cast(lParam)); - - case SCI_GETSUBSTYLESSTART: - return DocumentLexState()->SubStylesStart(static_cast(wParam)); - - case SCI_GETSUBSTYLESLENGTH: - return DocumentLexState()->SubStylesLength(static_cast(wParam)); - - case SCI_GETSTYLEFROMSUBSTYLE: - return DocumentLexState()->StyleFromSubStyle(static_cast(wParam)); - - case SCI_GETPRIMARYSTYLEFROMSTYLE: - return DocumentLexState()->PrimaryStyleFromStyle(static_cast(wParam)); - - case SCI_FREESUBSTYLES: - DocumentLexState()->FreeSubStyles(); - break; - - case SCI_SETIDENTIFIERS: - DocumentLexState()->SetIdentifiers(static_cast(wParam), - reinterpret_cast(lParam)); - break; - - case SCI_DISTANCETOSECONDARYSTYLES: - return DocumentLexState()->DistanceToSecondaryStyles(); - - case SCI_GETSUBSTYLEBASES: - return StringResult(lParam, DocumentLexState()->GetSubStyleBases()); -#endif - - default: - return Editor::WndProc(iMessage, wParam, lParam); - } - return 0l; -} diff --git a/qrenderdoc/3rdparty/scintilla/src/ScintillaBase.h b/qrenderdoc/3rdparty/scintilla/src/ScintillaBase.h deleted file mode 100644 index e66403367..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/ScintillaBase.h +++ /dev/null @@ -1,106 +0,0 @@ -// Scintilla source code edit control -/** @file ScintillaBase.h - ** Defines an enhanced subclass of Editor with calltips, autocomplete and context menu. - **/ -// Copyright 1998-2002 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef SCINTILLABASE_H -#define SCINTILLABASE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -#ifdef SCI_LEXER -class LexState; -#endif - -/** - */ -class ScintillaBase : public Editor { - // Private so ScintillaBase objects can not be copied - explicit ScintillaBase(const ScintillaBase &); - ScintillaBase &operator=(const ScintillaBase &); - -protected: - /** Enumeration of commands and child windows. */ - enum { - idCallTip=1, - idAutoComplete=2, - - idcmdUndo=10, - idcmdRedo=11, - idcmdCut=12, - idcmdCopy=13, - idcmdPaste=14, - idcmdDelete=15, - idcmdSelectAll=16 - }; - - enum { maxLenInputIME = 200 }; - - int displayPopupMenu; - Menu popup; - AutoComplete ac; - - CallTip ct; - - int listType; ///< 0 is an autocomplete list - int maxListWidth; /// Maximum width of list, in average character widths - int multiAutoCMode; /// Mode for autocompleting when multiple selections are present - -#ifdef SCI_LEXER - LexState *DocumentLexState(); - void SetLexer(uptr_t wParam); - void SetLexerLanguage(const char *languageName); - void Colourise(int start, int end); -#endif - - ScintillaBase(); - virtual ~ScintillaBase(); - virtual void Initialise() = 0; - virtual void Finalise(); - - virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); - void Command(int cmdId); - virtual void CancelModes(); - virtual int KeyCommand(unsigned int iMessage); - - void AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen); - void AutoCompleteStart(int lenEntered, const char *list); - void AutoCompleteCancel(); - void AutoCompleteMove(int delta); - int AutoCompleteGetCurrent() const; - int AutoCompleteGetCurrentText(char *buffer) const; - void AutoCompleteCharacterAdded(char ch); - void AutoCompleteCharacterDeleted(); - void AutoCompleteCompleted(char ch, unsigned int completionMethod); - void AutoCompleteMoveToCurrentWord(); - static void AutoCompleteDoubleClick(void *p); - - void CallTipClick(); - void CallTipShow(Point pt, const char *defn); - virtual void CreateCallTipWindow(PRectangle rc) = 0; - - virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0; - bool ShouldDisplayPopup(Point ptInWindowCoordinates) const; - void ContextMenu(Point pt); - - virtual void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); - virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); - virtual void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); - - void NotifyStyleToNeeded(int endStyleNeeded); - void NotifyLexerChanged(Document *doc, void *userData); - -public: - // Public so scintilla_send_message can use it - virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/Selection.cxx b/qrenderdoc/3rdparty/scintilla/src/Selection.cxx deleted file mode 100644 index d58a03980..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Selection.cxx +++ /dev/null @@ -1,436 +0,0 @@ -// Scintilla source code edit control -/** @file Selection.cxx - ** Classes maintaining the selection. - **/ -// Copyright 2009 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include - -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" - -#include "Position.h" -#include "Selection.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -void SelectionPosition::MoveForInsertDelete(bool insertion, int startChange, int length) { - if (insertion) { - if (position == startChange) { - int virtualLengthRemove = std::min(length, virtualSpace); - virtualSpace -= virtualLengthRemove; - position += virtualLengthRemove; - } else if (position > startChange) { - position += length; - } - } else { - if (position == startChange) { - virtualSpace = 0; - } - if (position > startChange) { - int endDeletion = startChange + length; - if (position > endDeletion) { - position -= length; - } else { - position = startChange; - virtualSpace = 0; - } - } - } -} - -bool SelectionPosition::operator <(const SelectionPosition &other) const { - if (position == other.position) - return virtualSpace < other.virtualSpace; - else - return position < other.position; -} - -bool SelectionPosition::operator >(const SelectionPosition &other) const { - if (position == other.position) - return virtualSpace > other.virtualSpace; - else - return position > other.position; -} - -bool SelectionPosition::operator <=(const SelectionPosition &other) const { - if (position == other.position && virtualSpace == other.virtualSpace) - return true; - else - return other > *this; -} - -bool SelectionPosition::operator >=(const SelectionPosition &other) const { - if (position == other.position && virtualSpace == other.virtualSpace) - return true; - else - return *this > other; -} - -int SelectionRange::Length() const { - if (anchor > caret) { - return anchor.Position() - caret.Position(); - } else { - return caret.Position() - anchor.Position(); - } -} - -void SelectionRange::MoveForInsertDelete(bool insertion, int startChange, int length) { - caret.MoveForInsertDelete(insertion, startChange, length); - anchor.MoveForInsertDelete(insertion, startChange, length); -} - -bool SelectionRange::Contains(int pos) const { - if (anchor > caret) - return (pos >= caret.Position()) && (pos <= anchor.Position()); - else - return (pos >= anchor.Position()) && (pos <= caret.Position()); -} - -bool SelectionRange::Contains(SelectionPosition sp) const { - if (anchor > caret) - return (sp >= caret) && (sp <= anchor); - else - return (sp >= anchor) && (sp <= caret); -} - -bool SelectionRange::ContainsCharacter(int posCharacter) const { - if (anchor > caret) - return (posCharacter >= caret.Position()) && (posCharacter < anchor.Position()); - else - return (posCharacter >= anchor.Position()) && (posCharacter < caret.Position()); -} - -SelectionSegment SelectionRange::Intersect(SelectionSegment check) const { - SelectionSegment inOrder(caret, anchor); - if ((inOrder.start <= check.end) || (inOrder.end >= check.start)) { - SelectionSegment portion = check; - if (portion.start < inOrder.start) - portion.start = inOrder.start; - if (portion.end > inOrder.end) - portion.end = inOrder.end; - if (portion.start > portion.end) - return SelectionSegment(); - else - return portion; - } else { - return SelectionSegment(); - } -} - -void SelectionRange::Swap() { - std::swap(caret, anchor); -} - -bool SelectionRange::Trim(SelectionRange range) { - SelectionPosition startRange = range.Start(); - SelectionPosition endRange = range.End(); - SelectionPosition start = Start(); - SelectionPosition end = End(); - PLATFORM_ASSERT(start <= end); - PLATFORM_ASSERT(startRange <= endRange); - if ((startRange <= end) && (endRange >= start)) { - if ((start > startRange) && (end < endRange)) { - // Completely covered by range -> empty at start - end = start; - } else if ((start < startRange) && (end > endRange)) { - // Completely covers range -> empty at start - end = start; - } else if (start <= startRange) { - // Trim end - end = startRange; - } else { // - PLATFORM_ASSERT(end >= endRange); - // Trim start - start = endRange; - } - if (anchor > caret) { - caret = start; - anchor = end; - } else { - anchor = start; - caret = end; - } - return Empty(); - } else { - return false; - } -} - -// If range is all virtual collapse to start of virtual space -void SelectionRange::MinimizeVirtualSpace() { - if (caret.Position() == anchor.Position()) { - int virtualSpace = caret.VirtualSpace(); - if (virtualSpace > anchor.VirtualSpace()) - virtualSpace = anchor.VirtualSpace(); - caret.SetVirtualSpace(virtualSpace); - anchor.SetVirtualSpace(virtualSpace); - } -} - -Selection::Selection() : mainRange(0), moveExtends(false), tentativeMain(false), selType(selStream) { - AddSelection(SelectionRange(SelectionPosition(0))); -} - -Selection::~Selection() { -} - -bool Selection::IsRectangular() const { - return (selType == selRectangle) || (selType == selThin); -} - -int Selection::MainCaret() const { - return ranges[mainRange].caret.Position(); -} - -int Selection::MainAnchor() const { - return ranges[mainRange].anchor.Position(); -} - -SelectionRange &Selection::Rectangular() { - return rangeRectangular; -} - -SelectionSegment Selection::Limits() const { - if (ranges.empty()) { - return SelectionSegment(); - } else { - SelectionSegment sr(ranges[0].anchor, ranges[0].caret); - for (size_t i=1; i 1) && (r < ranges.size())) { - size_t mainNew = mainRange; - if (mainNew >= r) { - if (mainNew == 0) { - mainNew = ranges.size() - 2; - } else { - mainNew--; - } - } - ranges.erase(ranges.begin() + r); - mainRange = mainNew; - } -} - -void Selection::DropAdditionalRanges() { - SetSelection(RangeMain()); -} - -void Selection::TentativeSelection(SelectionRange range) { - if (!tentativeMain) { - rangesSaved = ranges; - } - ranges = rangesSaved; - AddSelection(range); - TrimSelection(ranges[mainRange]); - tentativeMain = true; -} - -void Selection::CommitTentative() { - rangesSaved.clear(); - tentativeMain = false; -} - -int Selection::CharacterInSelection(int posCharacter) const { - for (size_t i=0; i ranges[i].Start().Position()) && (pos <= ranges[i].End().Position())) - return i == mainRange ? 1 : 2; - } - return 0; -} - -int Selection::VirtualSpaceFor(int pos) const { - int virtualSpace = 0; - for (size_t i=0; i= j) - mainRange--; - } else { - j++; - } - } - } - } -} - -void Selection::RotateMain() { - mainRange = (mainRange + 1) % ranges.size(); -} - diff --git a/qrenderdoc/3rdparty/scintilla/src/Selection.h b/qrenderdoc/3rdparty/scintilla/src/Selection.h deleted file mode 100644 index 5ec5c5424..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Selection.h +++ /dev/null @@ -1,196 +0,0 @@ -// Scintilla source code edit control -/** @file Selection.h - ** Classes maintaining the selection. - **/ -// Copyright 2009 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef SELECTION_H -#define SELECTION_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class SelectionPosition { - int position; - int virtualSpace; -public: - explicit SelectionPosition(int position_=INVALID_POSITION, int virtualSpace_=0) : position(position_), virtualSpace(virtualSpace_) { - PLATFORM_ASSERT(virtualSpace < 800000); - if (virtualSpace < 0) - virtualSpace = 0; - } - void Reset() { - position = 0; - virtualSpace = 0; - } - void MoveForInsertDelete(bool insertion, int startChange, int length); - bool operator ==(const SelectionPosition &other) const { - return position == other.position && virtualSpace == other.virtualSpace; - } - bool operator <(const SelectionPosition &other) const; - bool operator >(const SelectionPosition &other) const; - bool operator <=(const SelectionPosition &other) const; - bool operator >=(const SelectionPosition &other) const; - int Position() const { - return position; - } - void SetPosition(int position_) { - position = position_; - virtualSpace = 0; - } - int VirtualSpace() const { - return virtualSpace; - } - void SetVirtualSpace(int virtualSpace_) { - PLATFORM_ASSERT(virtualSpace_ < 800000); - if (virtualSpace_ >= 0) - virtualSpace = virtualSpace_; - } - void Add(int increment) { - position = position + increment; - } - bool IsValid() const { - return position >= 0; - } -}; - -// Ordered range to make drawing simpler -struct SelectionSegment { - SelectionPosition start; - SelectionPosition end; - SelectionSegment() : start(), end() { - } - SelectionSegment(SelectionPosition a, SelectionPosition b) { - if (a < b) { - start = a; - end = b; - } else { - start = b; - end = a; - } - } - bool Empty() const { - return start == end; - } - void Extend(SelectionPosition p) { - if (start > p) - start = p; - if (end < p) - end = p; - } -}; - -struct SelectionRange { - SelectionPosition caret; - SelectionPosition anchor; - - SelectionRange() : caret(), anchor() { - } - explicit SelectionRange(SelectionPosition single) : caret(single), anchor(single) { - } - explicit SelectionRange(int single) : caret(single), anchor(single) { - } - SelectionRange(SelectionPosition caret_, SelectionPosition anchor_) : caret(caret_), anchor(anchor_) { - } - SelectionRange(int caret_, int anchor_) : caret(caret_), anchor(anchor_) { - } - bool Empty() const { - return anchor == caret; - } - int Length() const; - // int Width() const; // Like Length but takes virtual space into account - bool operator ==(const SelectionRange &other) const { - return caret == other.caret && anchor == other.anchor; - } - bool operator <(const SelectionRange &other) const { - return caret < other.caret || ((caret == other.caret) && (anchor < other.anchor)); - } - void Reset() { - anchor.Reset(); - caret.Reset(); - } - void ClearVirtualSpace() { - anchor.SetVirtualSpace(0); - caret.SetVirtualSpace(0); - } - void MoveForInsertDelete(bool insertion, int startChange, int length); - bool Contains(int pos) const; - bool Contains(SelectionPosition sp) const; - bool ContainsCharacter(int posCharacter) const; - SelectionSegment Intersect(SelectionSegment check) const; - SelectionPosition Start() const { - return (anchor < caret) ? anchor : caret; - } - SelectionPosition End() const { - return (anchor < caret) ? caret : anchor; - } - void Swap(); - bool Trim(SelectionRange range); - // If range is all virtual collapse to start of virtual space - void MinimizeVirtualSpace(); -}; - -class Selection { - std::vector ranges; - std::vector rangesSaved; - SelectionRange rangeRectangular; - size_t mainRange; - bool moveExtends; - bool tentativeMain; -public: - enum selTypes { noSel, selStream, selRectangle, selLines, selThin }; - selTypes selType; - - Selection(); - ~Selection(); - bool IsRectangular() const; - int MainCaret() const; - int MainAnchor() const; - SelectionRange &Rectangular(); - SelectionSegment Limits() const; - // This is for when you want to move the caret in response to a - // user direction command - for rectangular selections, use the range - // that covers all selected text otherwise return the main selection. - SelectionSegment LimitsForRectangularElseMain() const; - size_t Count() const; - size_t Main() const; - void SetMain(size_t r); - SelectionRange &Range(size_t r); - const SelectionRange &Range(size_t r) const; - SelectionRange &RangeMain(); - const SelectionRange &RangeMain() const; - SelectionPosition Start() const; - bool MoveExtends() const; - void SetMoveExtends(bool moveExtends_); - bool Empty() const; - SelectionPosition Last() const; - int Length() const; - void MovePositions(bool insertion, int startChange, int length); - void TrimSelection(SelectionRange range); - void TrimOtherSelections(size_t r, SelectionRange range); - void SetSelection(SelectionRange range); - void AddSelection(SelectionRange range); - void AddSelectionWithoutTrim(SelectionRange range); - void DropSelection(size_t r); - void DropAdditionalRanges(); - void TentativeSelection(SelectionRange range); - void CommitTentative(); - int CharacterInSelection(int posCharacter) const; - int InSelectionForEOL(int pos) const; - int VirtualSpaceFor(int pos) const; - void Clear(); - void RemoveDuplicates(); - void RotateMain(); - bool Tentative() const { return tentativeMain; } - std::vector RangesCopy() const { - return ranges; - } -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/SparseVector.h b/qrenderdoc/3rdparty/scintilla/src/SparseVector.h deleted file mode 100644 index f96b36b8b..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/SparseVector.h +++ /dev/null @@ -1,186 +0,0 @@ -// Scintilla source code edit control -/** @file SparseVector.h - ** Hold data sparsely associated with elements in a range. - **/ -// Copyright 2016 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef SPARSEVECTOR_H -#define SPARSEVECTOR_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -// SparseVector is similar to RunStyles but is more efficient for cases where values occur -// for one position instead of over a range of positions. -template -class SparseVector { -private: - Partitioning *starts; - SplitVector *values; - // Private so SparseVector objects can not be copied - SparseVector(const SparseVector &); - void ClearValue(int partition) { - values->SetValueAt(partition, T()); - } - void CommonSetValueAt(int position, T value) { - // Do the work of setting the value to allow for specialization of SetValueAt. - assert(position < Length()); - const int partition = starts->PartitionFromPosition(position); - const int startPartition = starts->PositionFromPartition(partition); - if (value == T()) { - // Setting the empty value is equivalent to deleting the position - if (position == 0) { - ClearValue(partition); - } else if (position == startPartition) { - // Currently an element at this position, so remove - ClearValue(partition); - starts->RemovePartition(partition); - values->Delete(partition); - } - // Else element remains empty - } else { - if (position == startPartition) { - // Already a value at this position, so replace - ClearValue(partition); - values->SetValueAt(partition, value); - } else { - // Insert a new element - starts->InsertPartition(partition + 1, position); - values->InsertValue(partition + 1, 1, value); - } - } - } -public: - SparseVector() { - starts = new Partitioning(8); - values = new SplitVector(); - values->InsertValue(0, 2, T()); - } - ~SparseVector() { - delete starts; - starts = NULL; - // starts dead here but not used by ClearValue. - for (int part = 0; part < values->Length(); part++) { - ClearValue(part); - } - delete values; - values = NULL; - } - int Length() const { - return starts->PositionFromPartition(starts->Partitions()); - } - int Elements() const { - return starts->Partitions(); - } - int PositionOfElement(int element) const { - return starts->PositionFromPartition(element); - } - T ValueAt(int position) const { - assert(position < Length()); - const int partition = starts->PartitionFromPosition(position); - const int startPartition = starts->PositionFromPartition(partition); - if (startPartition == position) { - return values->ValueAt(partition); - } else { - return T(); - } - } - void SetValueAt(int position, T value) { - CommonSetValueAt(position, value); - } - void InsertSpace(int position, int insertLength) { - assert(position <= Length()); // Only operation that works at end. - const int partition = starts->PartitionFromPosition(position); - const int startPartition = starts->PositionFromPartition(partition); - if (startPartition == position) { - T valueCurrent = values->ValueAt(partition); - // Inserting at start of run so make previous longer - if (partition == 0) { - // Inserting at start of document so ensure 0 - if (valueCurrent != T()) { - ClearValue(0); - starts->InsertPartition(1, 0); - values->InsertValue(1, 1, valueCurrent); - starts->InsertText(0, insertLength); - } else { - starts->InsertText(partition, insertLength); - } - } else { - if (valueCurrent != T()) { - starts->InsertText(partition - 1, insertLength); - } else { - // Insert at end of run so do not extend style - starts->InsertText(partition, insertLength); - } - } - } else { - starts->InsertText(partition, insertLength); - } - } - void DeletePosition(int position) { - assert(position < Length()); - int partition = starts->PartitionFromPosition(position); - const int startPartition = starts->PositionFromPartition(partition); - if (startPartition == position) { - if (partition == 0) { - ClearValue(0); - } else if (partition == starts->Partitions()) { - // This should not be possible - ClearValue(partition); - throw std::runtime_error("SparseVector: deleting end partition."); - } else { - ClearValue(partition); - starts->RemovePartition(partition); - values->Delete(partition); - // Its the previous partition now that gets smaller - partition--; - } - } - starts->InsertText(partition, -1); - } - void Check() const { - if (Length() < 0) { - throw std::runtime_error("SparseVector: Length can not be negative."); - } - if (starts->Partitions() < 1) { - throw std::runtime_error("SparseVector: Must always have 1 or more partitions."); - } - if (starts->Partitions() != values->Length() - 1) { - throw std::runtime_error("SparseVector: Partitions and values different lengths."); - } - // The final element can not be set - if (values->ValueAt(values->Length() - 1) != T()) { - throw std::runtime_error("SparseVector: Unused style at end changed."); - } - } -}; - -// The specialization for const char * makes copies and deletes them as needed. - -template<> -inline void SparseVector::ClearValue(int partition) { - const char *value = values->ValueAt(partition); - delete []value; - values->SetValueAt(partition, NULL); -} - -template<> -inline void SparseVector::SetValueAt(int position, const char *value) { - // Make a copy of the string - if (value) { - const size_t len = strlen(value); - char *valueCopy = new char[len + 1](); - std::copy(value, value + len, valueCopy); - CommonSetValueAt(position, valueCopy); - } else { - CommonSetValueAt(position, NULL); - } -} - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/SplitVector.h b/qrenderdoc/3rdparty/scintilla/src/SplitVector.h deleted file mode 100644 index df722530e..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/SplitVector.h +++ /dev/null @@ -1,296 +0,0 @@ -// Scintilla source code edit control -/** @file SplitVector.h - ** Main data structure for holding arrays that handle insertions - ** and deletions efficiently. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef SPLITVECTOR_H -#define SPLITVECTOR_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -template -class SplitVector { -protected: - T *body; - int size; - int lengthBody; - int part1Length; - int gapLength; /// invariant: gapLength == size - lengthBody - int growSize; - - /// Move the gap to a particular position so that insertion and - /// deletion at that point will not require much copying and - /// hence be fast. - void GapTo(int position) { - if (position != part1Length) { - if (position < part1Length) { - // Moving the gap towards start so moving elements towards end - std::copy_backward( - body + position, - body + part1Length, - body + gapLength + part1Length); - } else { // position > part1Length - // Moving the gap towards end so moving elements towards start - std::copy( - body + part1Length + gapLength, - body + gapLength + position, - body + part1Length); - } - part1Length = position; - } - } - - /// Check that there is room in the buffer for an insertion, - /// reallocating if more space needed. - void RoomFor(int insertionLength) { - if (gapLength <= insertionLength) { - while (growSize < size / 6) - growSize *= 2; - ReAllocate(size + insertionLength + growSize); - } - } - - void Init() { - body = NULL; - growSize = 8; - size = 0; - lengthBody = 0; - part1Length = 0; - gapLength = 0; - } - -public: - /// Construct a split buffer. - SplitVector() { - Init(); - } - - ~SplitVector() { - delete []body; - body = 0; - } - - int GetGrowSize() const { - return growSize; - } - - void SetGrowSize(int growSize_) { - growSize = growSize_; - } - - /// Reallocate the storage for the buffer to be newSize and - /// copy exisiting contents to the new buffer. - /// Must not be used to decrease the size of the buffer. - void ReAllocate(int newSize) { - if (newSize < 0) - throw std::runtime_error("SplitVector::ReAllocate: negative size."); - - if (newSize > size) { - // Move the gap to the end - GapTo(lengthBody); - T *newBody = new T[newSize]; - if ((size != 0) && (body != 0)) { - std::copy(body, body + lengthBody, newBody); - delete []body; - } - body = newBody; - gapLength += newSize - size; - size = newSize; - } - } - - /// Retrieve the character at a particular position. - /// Retrieving positions outside the range of the buffer returns 0. - /// The assertions here are disabled since calling code can be - /// simpler if out of range access works and returns 0. - T ValueAt(int position) const { - if (position < part1Length) { - //PLATFORM_ASSERT(position >= 0); - if (position < 0) { - return 0; - } else { - return body[position]; - } - } else { - //PLATFORM_ASSERT(position < lengthBody); - if (position >= lengthBody) { - return 0; - } else { - return body[gapLength + position]; - } - } - } - - void SetValueAt(int position, T v) { - if (position < part1Length) { - PLATFORM_ASSERT(position >= 0); - if (position < 0) { - ; - } else { - body[position] = v; - } - } else { - PLATFORM_ASSERT(position < lengthBody); - if (position >= lengthBody) { - ; - } else { - body[gapLength + position] = v; - } - } - } - - T &operator[](int position) const { - PLATFORM_ASSERT(position >= 0 && position < lengthBody); - if (position < part1Length) { - return body[position]; - } else { - return body[gapLength + position]; - } - } - - /// Retrieve the length of the buffer. - int Length() const { - return lengthBody; - } - - /// Insert a single value into the buffer. - /// Inserting at positions outside the current range fails. - void Insert(int position, T v) { - PLATFORM_ASSERT((position >= 0) && (position <= lengthBody)); - if ((position < 0) || (position > lengthBody)) { - return; - } - RoomFor(1); - GapTo(position); - body[part1Length] = v; - lengthBody++; - part1Length++; - gapLength--; - } - - /// Insert a number of elements into the buffer setting their value. - /// Inserting at positions outside the current range fails. - void InsertValue(int position, int insertLength, T v) { - PLATFORM_ASSERT((position >= 0) && (position <= lengthBody)); - if (insertLength > 0) { - if ((position < 0) || (position > lengthBody)) { - return; - } - RoomFor(insertLength); - GapTo(position); - std::fill(&body[part1Length], &body[part1Length + insertLength], v); - lengthBody += insertLength; - part1Length += insertLength; - gapLength -= insertLength; - } - } - - /// Ensure at least length elements allocated, - /// appending zero valued elements if needed. - void EnsureLength(int wantedLength) { - if (Length() < wantedLength) { - InsertValue(Length(), wantedLength - Length(), 0); - } - } - - /// Insert text into the buffer from an array. - void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) { - PLATFORM_ASSERT((positionToInsert >= 0) && (positionToInsert <= lengthBody)); - if (insertLength > 0) { - if ((positionToInsert < 0) || (positionToInsert > lengthBody)) { - return; - } - RoomFor(insertLength); - GapTo(positionToInsert); - std::copy(s + positionFrom, s + positionFrom + insertLength, body + part1Length); - lengthBody += insertLength; - part1Length += insertLength; - gapLength -= insertLength; - } - } - - /// Delete one element from the buffer. - void Delete(int position) { - PLATFORM_ASSERT((position >= 0) && (position < lengthBody)); - if ((position < 0) || (position >= lengthBody)) { - return; - } - DeleteRange(position, 1); - } - - /// Delete a range from the buffer. - /// Deleting positions outside the current range fails. - void DeleteRange(int position, int deleteLength) { - PLATFORM_ASSERT((position >= 0) && (position + deleteLength <= lengthBody)); - if ((position < 0) || ((position + deleteLength) > lengthBody)) { - return; - } - if ((position == 0) && (deleteLength == lengthBody)) { - // Full deallocation returns storage and is faster - delete []body; - Init(); - } else if (deleteLength > 0) { - GapTo(position); - lengthBody -= deleteLength; - gapLength += deleteLength; - } - } - - /// Delete all the buffer contents. - void DeleteAll() { - DeleteRange(0, lengthBody); - } - - // Retrieve a range of elements into an array - void GetRange(T *buffer, int position, int retrieveLength) const { - // Split into up to 2 ranges, before and after the split then use memcpy on each. - int range1Length = 0; - if (position < part1Length) { - int part1AfterPosition = part1Length - position; - range1Length = retrieveLength; - if (range1Length > part1AfterPosition) - range1Length = part1AfterPosition; - } - std::copy(body + position, body + position + range1Length, buffer); - buffer += range1Length; - position = position + range1Length + gapLength; - int range2Length = retrieveLength - range1Length; - std::copy(body + position, body + position + range2Length, buffer); - } - - T *BufferPointer() { - RoomFor(1); - GapTo(lengthBody); - body[lengthBody] = 0; - return body; - } - - T *RangePointer(int position, int rangeLength) { - if (position < part1Length) { - if ((position + rangeLength) > part1Length) { - // Range overlaps gap, so move gap to start of range. - GapTo(position); - return body + position + gapLength; - } else { - return body + position; - } - } else { - return body + position + gapLength; - } - } - - int GapPosition() const { - return part1Length; - } -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/Style.cxx b/qrenderdoc/3rdparty/scintilla/src/Style.cxx deleted file mode 100644 index d8efd0ece..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Style.cxx +++ /dev/null @@ -1,169 +0,0 @@ -// Scintilla source code edit control -/** @file Style.cxx - ** Defines the font and colour style for a class of text. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include - -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "Style.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -FontAlias::FontAlias() { -} - -FontAlias::FontAlias(const FontAlias &other) : Font() { - SetID(other.fid); -} - -FontAlias::~FontAlias() { - SetID(0); - // ~Font will not release the actual font resource since it is now 0 -} - -void FontAlias::MakeAlias(Font &fontOrigin) { - SetID(fontOrigin.GetID()); -} - -void FontAlias::ClearFont() { - SetID(0); -} - -bool FontSpecification::operator==(const FontSpecification &other) const { - return fontName == other.fontName && - weight == other.weight && - italic == other.italic && - size == other.size && - characterSet == other.characterSet && - extraFontFlag == other.extraFontFlag; -} - -bool FontSpecification::operator<(const FontSpecification &other) const { - if (fontName != other.fontName) - return fontName < other.fontName; - if (weight != other.weight) - return weight < other.weight; - if (italic != other.italic) - return italic == false; - if (size != other.size) - return size < other.size; - if (characterSet != other.characterSet) - return characterSet < other.characterSet; - if (extraFontFlag != other.extraFontFlag) - return extraFontFlag < other.extraFontFlag; - return false; -} - -FontMeasurements::FontMeasurements() { - Clear(); -} - -void FontMeasurements::Clear() { - ascent = 1; - descent = 1; - aveCharWidth = 1; - spaceWidth = 1; - sizeZoomed = 2; -} - -Style::Style() : FontSpecification() { - Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff), - Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER, 0, SC_CHARSET_DEFAULT, - SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false); -} - -Style::Style(const Style &source) : FontSpecification(), FontMeasurements() { - Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff), - 0, 0, 0, - SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false); - fore = source.fore; - back = source.back; - characterSet = source.characterSet; - weight = source.weight; - italic = source.italic; - size = source.size; - fontName = source.fontName; - eolFilled = source.eolFilled; - underline = source.underline; - caseForce = source.caseForce; - visible = source.visible; - changeable = source.changeable; - hotspot = source.hotspot; -} - -Style::~Style() { -} - -Style &Style::operator=(const Style &source) { - if (this == &source) - return * this; - Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff), - 0, 0, SC_CHARSET_DEFAULT, - SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false); - fore = source.fore; - back = source.back; - characterSet = source.characterSet; - weight = source.weight; - italic = source.italic; - size = source.size; - fontName = source.fontName; - eolFilled = source.eolFilled; - underline = source.underline; - caseForce = source.caseForce; - visible = source.visible; - changeable = source.changeable; - return *this; -} - -void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_, - const char *fontName_, int characterSet_, - int weight_, bool italic_, bool eolFilled_, - bool underline_, ecaseForced caseForce_, - bool visible_, bool changeable_, bool hotspot_) { - fore = fore_; - back = back_; - characterSet = characterSet_; - weight = weight_; - italic = italic_; - size = size_; - fontName = fontName_; - eolFilled = eolFilled_; - underline = underline_; - caseForce = caseForce_; - visible = visible_; - changeable = changeable_; - hotspot = hotspot_; - font.ClearFont(); - FontMeasurements::Clear(); -} - -void Style::ClearTo(const Style &source) { - Clear( - source.fore, - source.back, - source.size, - source.fontName, - source.characterSet, - source.weight, - source.italic, - source.eolFilled, - source.underline, - source.caseForce, - source.visible, - source.changeable, - source.hotspot); -} - -void Style::Copy(Font &font_, const FontMeasurements &fm_) { - font.MakeAlias(font_); - (FontMeasurements &)(*this) = fm_; -} diff --git a/qrenderdoc/3rdparty/scintilla/src/Style.h b/qrenderdoc/3rdparty/scintilla/src/Style.h deleted file mode 100644 index cc9148af6..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/Style.h +++ /dev/null @@ -1,91 +0,0 @@ -// Scintilla source code edit control -/** @file Style.h - ** Defines the font and colour style for a class of text. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef STYLE_H -#define STYLE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -struct FontSpecification { - const char *fontName; - int weight; - bool italic; - int size; - int characterSet; - int extraFontFlag; - FontSpecification() : - fontName(0), - weight(SC_WEIGHT_NORMAL), - italic(false), - size(10 * SC_FONT_SIZE_MULTIPLIER), - characterSet(0), - extraFontFlag(0) { - } - bool operator==(const FontSpecification &other) const; - bool operator<(const FontSpecification &other) const; -}; - -// Just like Font but only has a copy of the FontID so should not delete it -class FontAlias : public Font { - // Private so FontAlias objects can not be assigned except for intiialization - FontAlias &operator=(const FontAlias &); -public: - FontAlias(); - FontAlias(const FontAlias &); - virtual ~FontAlias(); - void MakeAlias(Font &fontOrigin); - void ClearFont(); -}; - -struct FontMeasurements { - unsigned int ascent; - unsigned int descent; - XYPOSITION aveCharWidth; - XYPOSITION spaceWidth; - int sizeZoomed; - FontMeasurements(); - void Clear(); -}; - -/** - */ -class Style : public FontSpecification, public FontMeasurements { -public: - ColourDesired fore; - ColourDesired back; - bool eolFilled; - bool underline; - enum ecaseForced {caseMixed, caseUpper, caseLower, caseCamel}; - ecaseForced caseForce; - bool visible; - bool changeable; - bool hotspot; - - FontAlias font; - - Style(); - Style(const Style &source); - ~Style(); - Style &operator=(const Style &source); - void Clear(ColourDesired fore_, ColourDesired back_, - int size_, - const char *fontName_, int characterSet_, - int weight_, bool italic_, bool eolFilled_, - bool underline_, ecaseForced caseForce_, - bool visible_, bool changeable_, bool hotspot_); - void ClearTo(const Style &source); - void Copy(Font &font_, const FontMeasurements &fm_); - bool IsProtected() const { return !(changeable && visible);} -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/UniConversion.cxx b/qrenderdoc/3rdparty/scintilla/src/UniConversion.cxx deleted file mode 100644 index 4da9e102a..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/UniConversion.cxx +++ /dev/null @@ -1,309 +0,0 @@ -// Scintilla source code edit control -/** @file UniConversion.cxx - ** Functions to handle UTF-8 and UTF-16 strings. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include - -#include - -#include "UniConversion.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) { - unsigned int len = 0; - for (unsigned int i = 0; i < tlen && uptr[i];) { - unsigned int uch = uptr[i]; - if (uch < 0x80) { - len++; - } else if (uch < 0x800) { - len += 2; - } else if ((uch >= SURROGATE_LEAD_FIRST) && - (uch <= SURROGATE_TRAIL_LAST)) { - len += 4; - i++; - } else { - len += 3; - } - i++; - } - return len; -} - -void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) { - unsigned int k = 0; - for (unsigned int i = 0; i < tlen && uptr[i];) { - unsigned int uch = uptr[i]; - if (uch < 0x80) { - putf[k++] = static_cast(uch); - } else if (uch < 0x800) { - putf[k++] = static_cast(0xC0 | (uch >> 6)); - putf[k++] = static_cast(0x80 | (uch & 0x3f)); - } else if ((uch >= SURROGATE_LEAD_FIRST) && - (uch <= SURROGATE_TRAIL_LAST)) { - // Half a surrogate pair - i++; - unsigned int xch = 0x10000 + ((uch & 0x3ff) << 10) + (uptr[i] & 0x3ff); - putf[k++] = static_cast(0xF0 | (xch >> 18)); - putf[k++] = static_cast(0x80 | ((xch >> 12) & 0x3f)); - putf[k++] = static_cast(0x80 | ((xch >> 6) & 0x3f)); - putf[k++] = static_cast(0x80 | (xch & 0x3f)); - } else { - putf[k++] = static_cast(0xE0 | (uch >> 12)); - putf[k++] = static_cast(0x80 | ((uch >> 6) & 0x3f)); - putf[k++] = static_cast(0x80 | (uch & 0x3f)); - } - i++; - } - if (k < len) - putf[k] = '\0'; -} - -unsigned int UTF8CharLength(unsigned char ch) { - if (ch < 0x80) { - return 1; - } else if (ch < 0x80 + 0x40 + 0x20) { - return 2; - } else if (ch < 0x80 + 0x40 + 0x20 + 0x10) { - return 3; - } else { - return 4; - } -} - -size_t UTF16Length(const char *s, size_t len) { - size_t ulen = 0; - size_t charLen; - for (size_t i = 0; i(s[i]); - if (ch < 0x80) { - charLen = 1; - } else if (ch < 0x80 + 0x40 + 0x20) { - charLen = 2; - } else if (ch < 0x80 + 0x40 + 0x20 + 0x10) { - charLen = 3; - } else { - charLen = 4; - ulen++; - } - i += charLen; - ulen++; - } - return ulen; -} - -size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen) { - size_t ui = 0; - const unsigned char *us = reinterpret_cast(s); - size_t i = 0; - while ((i((ch & 0x1F) << 6); - ch = us[i++]; - tbuf[ui] = static_cast(tbuf[ui] + (ch & 0x7F)); - } else if (ch < 0x80 + 0x40 + 0x20 + 0x10) { - tbuf[ui] = static_cast((ch & 0xF) << 12); - ch = us[i++]; - tbuf[ui] = static_cast(tbuf[ui] + ((ch & 0x7F) << 6)); - ch = us[i++]; - tbuf[ui] = static_cast(tbuf[ui] + (ch & 0x7F)); - } else { - // Outside the BMP so need two surrogates - int val = (ch & 0x7) << 18; - ch = us[i++]; - val += (ch & 0x3F) << 12; - ch = us[i++]; - val += (ch & 0x3F) << 6; - ch = us[i++]; - val += (ch & 0x3F); - tbuf[ui] = static_cast(((val - 0x10000) >> 10) + SURROGATE_LEAD_FIRST); - ui++; - tbuf[ui] = static_cast((val & 0x3ff) + SURROGATE_TRAIL_FIRST); - } - ui++; - } - return ui; -} - -unsigned int UTF32FromUTF8(const char *s, unsigned int len, unsigned int *tbuf, unsigned int tlen) { - unsigned int ui=0; - const unsigned char *us = reinterpret_cast(s); - unsigned int i=0; - while ((i= 1) && (ch < 0x80 + 0x40 + 0x20)) { - value = (ch & 0x1F) << 6; - ch = us[i++]; - value += ch & 0x7F; - } else if (((len-i) >= 2) && (ch < 0x80 + 0x40 + 0x20 + 0x10)) { - value = (ch & 0xF) << 12; - ch = us[i++]; - value += (ch & 0x7F) << 6; - ch = us[i++]; - value += ch & 0x7F; - } else if ((len-i) >= 3) { - value = (ch & 0x7) << 18; - ch = us[i++]; - value += (ch & 0x3F) << 12; - ch = us[i++]; - value += (ch & 0x3F) << 6; - ch = us[i++]; - value += ch & 0x3F; - } - tbuf[ui] = value; - ui++; - } - return ui; -} - -unsigned int UTF16FromUTF32Character(unsigned int val, wchar_t *tbuf) { - if (val < SUPPLEMENTAL_PLANE_FIRST) { - tbuf[0] = static_cast(val); - return 1; - } else { - tbuf[0] = static_cast(((val - SUPPLEMENTAL_PLANE_FIRST) >> 10) + SURROGATE_LEAD_FIRST); - tbuf[1] = static_cast((val & 0x3ff) + SURROGATE_TRAIL_FIRST); - return 2; - } -} - -int UTF8BytesOfLead[256]; -static bool initialisedBytesOfLead = false; - -static int BytesFromLead(int leadByte) { - if (leadByte < 0xC2) { - // Single byte or invalid - return 1; - } else if (leadByte < 0xE0) { - return 2; - } else if (leadByte < 0xF0) { - return 3; - } else if (leadByte < 0xF5) { - return 4; - } else { - // Characters longer than 4 bytes not possible in current UTF-8 - return 1; - } -} - -void UTF8BytesOfLeadInitialise() { - if (!initialisedBytesOfLead) { - for (int i=0; i<256; i++) { - UTF8BytesOfLead[i] = BytesFromLead(i); - } - initialisedBytesOfLead = true; - } -} - -// Return both the width of the first character in the string and a status -// saying whether it is valid or invalid. -// Most invalid sequences return a width of 1 so are treated as isolated bytes but -// the non-characters *FFFE, *FFFF and FDD0 .. FDEF return 3 or 4 as they can be -// reasonably treated as code points in some circumstances. They will, however, -// not have associated glyphs. -int UTF8Classify(const unsigned char *us, int len) { - // For the rules: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - if (*us < 0x80) { - // Single bytes easy - return 1; - } else if (*us > 0xf4) { - // Characters longer than 4 bytes not possible in current UTF-8 - return UTF8MaskInvalid | 1; - } else if (*us >= 0xf0) { - // 4 bytes - if (len < 4) - return UTF8MaskInvalid | 1; - if (UTF8IsTrailByte(us[1]) && UTF8IsTrailByte(us[2]) && UTF8IsTrailByte(us[3])) { - if (((us[1] & 0xf) == 0xf) && (us[2] == 0xbf) && ((us[3] == 0xbe) || (us[3] == 0xbf))) { - // *FFFE or *FFFF non-character - return UTF8MaskInvalid | 4; - } - if (*us == 0xf4) { - // Check if encoding a value beyond the last Unicode character 10FFFF - if (us[1] > 0x8f) { - return UTF8MaskInvalid | 1; - } else if (us[1] == 0x8f) { - if (us[2] > 0xbf) { - return UTF8MaskInvalid | 1; - } else if (us[2] == 0xbf) { - if (us[3] > 0xbf) { - return UTF8MaskInvalid | 1; - } - } - } - } else if ((*us == 0xf0) && ((us[1] & 0xf0) == 0x80)) { - // Overlong - return UTF8MaskInvalid | 1; - } - return 4; - } else { - return UTF8MaskInvalid | 1; - } - } else if (*us >= 0xe0) { - // 3 bytes - if (len < 3) - return UTF8MaskInvalid | 1; - if (UTF8IsTrailByte(us[1]) && UTF8IsTrailByte(us[2])) { - if ((*us == 0xe0) && ((us[1] & 0xe0) == 0x80)) { - // Overlong - return UTF8MaskInvalid | 1; - } - if ((*us == 0xed) && ((us[1] & 0xe0) == 0xa0)) { - // Surrogate - return UTF8MaskInvalid | 1; - } - if ((*us == 0xef) && (us[1] == 0xbf) && (us[2] == 0xbe)) { - // U+FFFE non-character - 3 bytes long - return UTF8MaskInvalid | 3; - } - if ((*us == 0xef) && (us[1] == 0xbf) && (us[2] == 0xbf)) { - // U+FFFF non-character - 3 bytes long - return UTF8MaskInvalid | 3; - } - if ((*us == 0xef) && (us[1] == 0xb7) && (((us[2] & 0xf0) == 0x90) || ((us[2] & 0xf0) == 0xa0))) { - // U+FDD0 .. U+FDEF - return UTF8MaskInvalid | 3; - } - return 3; - } else { - return UTF8MaskInvalid | 1; - } - } else if (*us >= 0xc2) { - // 2 bytes - if (len < 2) - return UTF8MaskInvalid | 1; - if (UTF8IsTrailByte(us[1])) { - return 2; - } else { - return UTF8MaskInvalid | 1; - } - } else { - // 0xc0 .. 0xc1 is overlong encoding - // 0x80 .. 0xbf is trail byte - return UTF8MaskInvalid | 1; - } -} - -int UTF8DrawBytes(const unsigned char *us, int len) { - int utf8StatusNext = UTF8Classify(us, len); - return (utf8StatusNext & UTF8MaskInvalid) ? 1 : (utf8StatusNext & UTF8MaskWidth); -} - -#ifdef SCI_NAMESPACE -} -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/UniConversion.h b/qrenderdoc/3rdparty/scintilla/src/UniConversion.h deleted file mode 100644 index aeb13f0c2..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/UniConversion.h +++ /dev/null @@ -1,72 +0,0 @@ -// Scintilla source code edit control -/** @file UniConversion.h - ** Functions to handle UTF-8 and UTF-16 strings. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef UNICONVERSION_H -#define UNICONVERSION_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -const int UTF8MaxBytes = 4; - -const int unicodeReplacementChar = 0xFFFD; - -unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen); -void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len); -unsigned int UTF8CharLength(unsigned char ch); -size_t UTF16Length(const char *s, size_t len); -size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen); -unsigned int UTF32FromUTF8(const char *s, unsigned int len, unsigned int *tbuf, unsigned int tlen); -unsigned int UTF16FromUTF32Character(unsigned int val, wchar_t *tbuf); - -extern int UTF8BytesOfLead[256]; -void UTF8BytesOfLeadInitialise(); - -inline bool UTF8IsTrailByte(int ch) { - return (ch >= 0x80) && (ch < 0xc0); -} - -inline bool UTF8IsAscii(int ch) { - return ch < 0x80; -} - -enum { UTF8MaskWidth=0x7, UTF8MaskInvalid=0x8 }; -int UTF8Classify(const unsigned char *us, int len); - -// Similar to UTF8Classify but returns a length of 1 for invalid bytes -// instead of setting the invalid flag -int UTF8DrawBytes(const unsigned char *us, int len); - -// Line separator is U+2028 \xe2\x80\xa8 -// Paragraph separator is U+2029 \xe2\x80\xa9 -const int UTF8SeparatorLength = 3; -inline bool UTF8IsSeparator(const unsigned char *us) { - return (us[0] == 0xe2) && (us[1] == 0x80) && ((us[2] == 0xa8) || (us[2] == 0xa9)); -} - -// NEL is U+0085 \xc2\x85 -const int UTF8NELLength = 2; -inline bool UTF8IsNEL(const unsigned char *us) { - return (us[0] == 0xc2) && (us[1] == 0x85); -} - -enum { SURROGATE_LEAD_FIRST = 0xD800 }; -enum { SURROGATE_LEAD_LAST = 0xDBFF }; -enum { SURROGATE_TRAIL_FIRST = 0xDC00 }; -enum { SURROGATE_TRAIL_LAST = 0xDFFF }; -enum { SUPPLEMENTAL_PLANE_FIRST = 0x10000 }; - -inline unsigned int UTF16CharLength(wchar_t uch) { - return ((uch >= SURROGATE_LEAD_FIRST) && (uch <= SURROGATE_LEAD_LAST)) ? 2 : 1; -} - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/UnicodeFromUTF8.h b/qrenderdoc/3rdparty/scintilla/src/UnicodeFromUTF8.h deleted file mode 100644 index ae66cb0a9..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/UnicodeFromUTF8.h +++ /dev/null @@ -1,32 +0,0 @@ -// Scintilla source code edit control -/** @file UnicodeFromUTF8.h - ** Lexer infrastructure. - **/ -// Copyright 2013 by Neil Hodgson -// This file is in the public domain. - -#ifndef UNICODEFROMUTF8_H -#define UNICODEFROMUTF8_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -inline int UnicodeFromUTF8(const unsigned char *us) { - if (us[0] < 0xC2) { - return us[0]; - } else if (us[0] < 0xE0) { - return ((us[0] & 0x1F) << 6) + (us[1] & 0x3F); - } else if (us[0] < 0xF0) { - return ((us[0] & 0xF) << 12) + ((us[1] & 0x3F) << 6) + (us[2] & 0x3F); - } else if (us[0] < 0xF5) { - return ((us[0] & 0x7) << 18) + ((us[1] & 0x3F) << 12) + ((us[2] & 0x3F) << 6) + (us[3] & 0x3F); - } - return us[0]; -} - -#ifdef SCI_NAMESPACE -} -#endif - -#endif diff --git a/qrenderdoc/3rdparty/scintilla/src/ViewStyle.cxx b/qrenderdoc/3rdparty/scintilla/src/ViewStyle.cxx deleted file mode 100644 index b694a62e3..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/ViewStyle.cxx +++ /dev/null @@ -1,623 +0,0 @@ -// Scintilla source code edit control -/** @file ViewStyle.cxx - ** Store information on how the document is to be viewed. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include - -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "Position.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "Indicator.h" -#include "XPM.h" -#include "LineMarker.h" -#include "Style.h" -#include "ViewStyle.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -MarginStyle::MarginStyle() : - style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false), cursor(SC_CURSORREVERSEARROW) { -} - -// A list of the fontnames - avoids wasting space in each style -FontNames::FontNames() { -} - -FontNames::~FontNames() { - Clear(); -} - -void FontNames::Clear() { - for (std::vector::const_iterator it=names.begin(); it != names.end(); ++it) { - delete []*it; - } - names.clear(); -} - -const char *FontNames::Save(const char *name) { - if (!name) - return 0; - - for (std::vector::const_iterator it=names.begin(); it != names.end(); ++it) { - if (strcmp(*it, name) == 0) { - return *it; - } - } - const size_t lenName = strlen(name) + 1; - char *nameSave = new char[lenName]; - memcpy(nameSave, name, lenName); - names.push_back(nameSave); - return nameSave; -} - -FontRealised::FontRealised() { -} - -FontRealised::~FontRealised() { - font.Release(); -} - -void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs) { - PLATFORM_ASSERT(fs.fontName); - sizeZoomed = fs.size + zoomLevel * SC_FONT_SIZE_MULTIPLIER; - if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1 - sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER; - - float deviceHeight = static_cast(surface.DeviceHeightFont(sizeZoomed)); - FontParameters fp(fs.fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, fs.weight, fs.italic, fs.extraFontFlag, technology, fs.characterSet); - font.Create(fp); - - ascent = static_cast(surface.Ascent(font)); - descent = static_cast(surface.Descent(font)); - aveCharWidth = surface.AverageCharWidth(font); - spaceWidth = surface.WidthChar(font, ' '); -} - -ViewStyle::ViewStyle() { - Init(); -} - -ViewStyle::ViewStyle(const ViewStyle &source) { - Init(source.styles.size()); - for (unsigned int sty=0; stysecond; - } - fonts.clear(); -} - -void ViewStyle::CalculateMarginWidthAndMask() { - fixedColumnWidth = marginInside ? leftMarginWidth : 0; - maskInLine = 0xffffffff; - int maskDefinedMarkers = 0; - for (size_t margin = 0; margin < ms.size(); margin++) { - fixedColumnWidth += ms[margin].width; - if (ms[margin].width > 0) - maskInLine &= ~ms[margin].mask; - maskDefinedMarkers |= ms[margin].mask; - } - maskDrawInText = 0; - for (int markBit = 0; markBit < 32; markBit++) { - const int maskBit = 1 << markBit; - switch (markers[markBit].markType) { - case SC_MARK_EMPTY: - maskInLine &= ~maskBit; - break; - case SC_MARK_BACKGROUND: - case SC_MARK_UNDERLINE: - maskInLine &= ~maskBit; - maskDrawInText |= maskDefinedMarkers & maskBit; - break; - } - } -} - -void ViewStyle::Init(size_t stylesSize_) { - AllocStyles(stylesSize_); - nextExtendedStyle = 256; - fontNames.Clear(); - ResetDefaultStyle(); - - // There are no image markers by default, so no need for calling CalcLargestMarkerHeight() - largestMarkerHeight = 0; - - indicators[0] = Indicator(INDIC_SQUIGGLE, ColourDesired(0, 0x7f, 0)); - indicators[1] = Indicator(INDIC_TT, ColourDesired(0, 0, 0xff)); - indicators[2] = Indicator(INDIC_PLAIN, ColourDesired(0xff, 0, 0)); - - technology = SC_TECHNOLOGY_DEFAULT; - indicatorsDynamic = 0; - indicatorsSetFore = 0; - lineHeight = 1; - lineOverlap = 0; - maxAscent = 1; - maxDescent = 1; - aveCharWidth = 8; - spaceWidth = 8; - tabWidth = spaceWidth * 8; - - selColours.fore = ColourOptional(ColourDesired(0xff, 0, 0)); - selColours.back = ColourOptional(ColourDesired(0xc0, 0xc0, 0xc0), true); - selAdditionalForeground = ColourDesired(0xff, 0, 0); - selAdditionalBackground = ColourDesired(0xd7, 0xd7, 0xd7); - selBackground2 = ColourDesired(0xb0, 0xb0, 0xb0); - selAlpha = SC_ALPHA_NOALPHA; - selAdditionalAlpha = SC_ALPHA_NOALPHA; - selEOLFilled = false; - - foldmarginColour = ColourOptional(ColourDesired(0xff, 0, 0)); - foldmarginHighlightColour = ColourOptional(ColourDesired(0xc0, 0xc0, 0xc0)); - - whitespaceColours.fore = ColourOptional(); - whitespaceColours.back = ColourOptional(ColourDesired(0xff, 0xff, 0xff)); - controlCharSymbol = 0; /* Draw the control characters */ - controlCharWidth = 0; - selbar = Platform::Chrome(); - selbarlight = Platform::ChromeHighlight(); - styles[STYLE_LINENUMBER].fore = ColourDesired(0, 0, 0); - styles[STYLE_LINENUMBER].back = Platform::Chrome(); - caretcolour = ColourDesired(0, 0, 0); - additionalCaretColour = ColourDesired(0x7f, 0x7f, 0x7f); - showCaretLineBackground = false; - alwaysShowCaretLineBackground = false; - caretLineBackground = ColourDesired(0xff, 0xff, 0); - caretLineAlpha = SC_ALPHA_NOALPHA; - caretStyle = CARETSTYLE_LINE; - caretWidth = 1; - someStylesProtected = false; - someStylesForceCase = false; - - hotspotColours.fore = ColourOptional(ColourDesired(0, 0, 0xff)); - hotspotColours.back = ColourOptional(ColourDesired(0xff, 0xff, 0xff)); - hotspotUnderline = true; - hotspotSingleLine = true; - - leftMarginWidth = 1; - rightMarginWidth = 1; - ms.resize(SC_MAX_MARGIN + 1); - ms[0].style = SC_MARGIN_NUMBER; - ms[0].width = 0; - ms[0].mask = 0; - ms[1].style = SC_MARGIN_SYMBOL; - ms[1].width = 16; - ms[1].mask = ~SC_MASK_FOLDERS; - ms[2].style = SC_MARGIN_SYMBOL; - ms[2].width = 0; - ms[2].mask = 0; - marginInside = true; - CalculateMarginWidthAndMask(); - textStart = marginInside ? fixedColumnWidth : leftMarginWidth; - zoomLevel = 0; - viewWhitespace = wsInvisible; - tabDrawMode = tdLongArrow; - whitespaceSize = 1; - viewIndentationGuides = ivNone; - viewEOL = false; - extraFontFlag = 0; - extraAscent = 0; - extraDescent = 0; - marginStyleOffset = 0; - annotationVisible = ANNOTATION_HIDDEN; - annotationStyleOffset = 0; - braceHighlightIndicatorSet = false; - braceHighlightIndicator = 0; - braceBadLightIndicatorSet = false; - braceBadLightIndicator = 0; - - edgeState = EDGE_NONE; - theEdge = EdgeProperties(0, ColourDesired(0xc0, 0xc0, 0xc0)); - - marginNumberPadding = 3; - ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side - lastSegItalicsOffset = 2; - - wrapState = eWrapNone; - wrapVisualFlags = 0; - wrapVisualFlagsLocation = 0; - wrapVisualStartIndent = 0; - wrapIndentMode = SC_WRAPINDENT_FIXED; -} - -void ViewStyle::Refresh(Surface &surface, int tabInChars) { - for (FontMap::iterator it = fonts.begin(); it != fonts.end(); ++it) { - delete it->second; - } - fonts.clear(); - - selbar = Platform::Chrome(); - selbarlight = Platform::ChromeHighlight(); - - for (unsigned int i=0; isecond->Realise(surface, zoomLevel, technology, it->first); - } - - for (unsigned int k=0; kfont, *fr); - } - indicatorsDynamic = 0; - indicatorsSetFore = 0; - for (int ind = 0; ind <= INDIC_MAX; ind++) { - if (indicators[ind].IsDynamic()) - indicatorsDynamic++; - if (indicators[ind].OverridesTextFore()) - indicatorsSetFore++; - } - maxAscent = 1; - maxDescent = 1; - FindMaxAscentDescent(); - maxAscent += extraAscent; - maxDescent += extraDescent; - lineHeight = maxAscent + maxDescent; - lineOverlap = lineHeight / 10; - if (lineOverlap < 2) - lineOverlap = 2; - if (lineOverlap > lineHeight) - lineOverlap = lineHeight; - - someStylesProtected = false; - someStylesForceCase = false; - for (unsigned int l=0; l= 32) { - controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, static_cast(controlCharSymbol)); - } - - CalculateMarginWidthAndMask(); - textStart = marginInside ? fixedColumnWidth : leftMarginWidth; -} - -void ViewStyle::ReleaseAllExtendedStyles() { - nextExtendedStyle = 256; -} - -int ViewStyle::AllocateExtendedStyles(int numberStyles) { - int startRange = static_cast(nextExtendedStyle); - nextExtendedStyle += numberStyles; - EnsureStyle(nextExtendedStyle); - for (size_t i=startRange; i= styles.size()) { - AllocStyles(index+1); - } -} - -void ViewStyle::ResetDefaultStyle() { - styles[STYLE_DEFAULT].Clear(ColourDesired(0,0,0), - ColourDesired(0xff,0xff,0xff), - Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER, fontNames.Save(Platform::DefaultFont()), - SC_CHARSET_DEFAULT, - SC_WEIGHT_NORMAL, false, false, false, Style::caseMixed, true, true, false); -} - -void ViewStyle::ClearStyles() { - // Reset all styles to be like the default style - for (unsigned int i=0; i= x) && (pt.x < x + ms[i].width)) - margin = static_cast(i); - x += ms[i].width; - } - return margin; -} - -bool ViewStyle::ValidStyle(size_t styleIndex) const { - return styleIndex < styles.size(); -} - -void ViewStyle::CalcLargestMarkerHeight() { - largestMarkerHeight = 0; - for (int m = 0; m <= MARKER_MAX; ++m) { - switch (markers[m].markType) { - case SC_MARK_PIXMAP: - if (markers[m].pxpm && markers[m].pxpm->GetHeight() > largestMarkerHeight) - largestMarkerHeight = markers[m].pxpm->GetHeight(); - break; - case SC_MARK_RGBAIMAGE: - if (markers[m].image && markers[m].image->GetHeight() > largestMarkerHeight) - largestMarkerHeight = markers[m].image->GetHeight(); - break; - } - } -} - -// See if something overrides the line background color: Either if caret is on the line -// and background color is set for that, or if a marker is defined that forces its background -// color onto the line, or if a marker is defined but has no selection margin in which to -// display itself (as long as it's not an SC_MARK_EMPTY marker). These are checked in order -// with the earlier taking precedence. When multiple markers cause background override, -// the color for the highest numbered one is used. -ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const { - ColourOptional background; - if ((caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground && (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret) { - background = ColourOptional(caretLineBackground, true); - } - if (!background.isSet && marksOfLine) { - int marks = marksOfLine; - for (int markBit = 0; (markBit < 32) && marks; markBit++) { - if ((marks & 1) && (markers[markBit].markType == SC_MARK_BACKGROUND) && - (markers[markBit].alpha == SC_ALPHA_NOALPHA)) { - background = ColourOptional(markers[markBit].back, true); - } - marks >>= 1; - } - } - if (!background.isSet && maskInLine) { - int marksMasked = marksOfLine & maskInLine; - if (marksMasked) { - for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { - if ((marksMasked & 1) && - (markers[markBit].alpha == SC_ALPHA_NOALPHA)) { - background = ColourOptional(markers[markBit].back, true); - } - marksMasked >>= 1; - } - } - } - return background; -} - -bool ViewStyle::SelectionBackgroundDrawn() const { - return selColours.back.isSet && - ((selAlpha == SC_ALPHA_NOALPHA) || (selAdditionalAlpha == SC_ALPHA_NOALPHA)); -} - -bool ViewStyle::WhitespaceBackgroundDrawn() const { - return (viewWhitespace != wsInvisible) && (whitespaceColours.back.isSet); -} - -bool ViewStyle::WhiteSpaceVisible(bool inIndent) const { - return (!inIndent && viewWhitespace == wsVisibleAfterIndent) || - (inIndent && viewWhitespace == wsVisibleOnlyInIndent) || - viewWhitespace == wsVisibleAlways; -} - -ColourDesired ViewStyle::WrapColour() const { - if (whitespaceColours.fore.isSet) - return whitespaceColours.fore; - else - return styles[STYLE_DEFAULT].fore; -} - -bool ViewStyle::SetWrapState(int wrapState_) { - WrapMode wrapStateWanted; - switch (wrapState_) { - case SC_WRAP_WORD: - wrapStateWanted = eWrapWord; - break; - case SC_WRAP_CHAR: - wrapStateWanted = eWrapChar; - break; - case SC_WRAP_WHITESPACE: - wrapStateWanted = eWrapWhitespace; - break; - default: - wrapStateWanted = eWrapNone; - break; - } - bool changed = wrapState != wrapStateWanted; - wrapState = wrapStateWanted; - return changed; -} - -bool ViewStyle::SetWrapVisualFlags(int wrapVisualFlags_) { - bool changed = wrapVisualFlags != wrapVisualFlags_; - wrapVisualFlags = wrapVisualFlags_; - return changed; -} - -bool ViewStyle::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_) { - bool changed = wrapVisualFlagsLocation != wrapVisualFlagsLocation_; - wrapVisualFlagsLocation = wrapVisualFlagsLocation_; - return changed; -} - -bool ViewStyle::SetWrapVisualStartIndent(int wrapVisualStartIndent_) { - bool changed = wrapVisualStartIndent != wrapVisualStartIndent_; - wrapVisualStartIndent = wrapVisualStartIndent_; - return changed; -} - -bool ViewStyle::SetWrapIndentMode(int wrapIndentMode_) { - bool changed = wrapIndentMode != wrapIndentMode_; - wrapIndentMode = wrapIndentMode_; - return changed; -} - -void ViewStyle::AllocStyles(size_t sizeNew) { - size_t i=styles.size(); - styles.resize(sizeNew); - if (styles.size() > STYLE_DEFAULT) { - for (; isecond; - FontMap::iterator it = fonts.find(fs); - if (it != fonts.end()) { - // Should always reach here since map was just set for all styles - return it->second; - } - return 0; -} - -void ViewStyle::FindMaxAscentDescent() { - for (FontMap::const_iterator it = fonts.begin(); it != fonts.end(); ++it) { - if (maxAscent < it->second->ascent) - maxAscent = it->second->ascent; - if (maxDescent < it->second->descent) - maxDescent = it->second->descent; - } -} diff --git a/qrenderdoc/3rdparty/scintilla/src/ViewStyle.h b/qrenderdoc/3rdparty/scintilla/src/ViewStyle.h deleted file mode 100644 index 1a876f85e..000000000 --- a/qrenderdoc/3rdparty/scintilla/src/ViewStyle.h +++ /dev/null @@ -1,219 +0,0 @@ -// Scintilla source code edit control -/** @file ViewStyle.h - ** Store information on how the document is to be viewed. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef VIEWSTYLE_H -#define VIEWSTYLE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class MarginStyle { -public: - int style; - ColourDesired back; - int width; - int mask; - bool sensitive; - int cursor; - MarginStyle(); -}; - -/** - */ -class FontNames { -private: - std::vector names; - - // Private so FontNames objects can not be copied - FontNames(const FontNames &); -public: - FontNames(); - ~FontNames(); - void Clear(); - const char *Save(const char *name); -}; - -class FontRealised : public FontMeasurements { - // Private so FontRealised objects can not be copied - FontRealised(const FontRealised &); - FontRealised &operator=(const FontRealised &); -public: - Font font; - FontRealised(); - virtual ~FontRealised(); - void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs); -}; - -enum IndentView {ivNone, ivReal, ivLookForward, ivLookBoth}; - -enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2, wsVisibleOnlyInIndent=3}; - -enum TabDrawMode {tdLongArrow=0, tdStrikeOut=1}; - -typedef std::map FontMap; - -enum WrapMode { eWrapNone, eWrapWord, eWrapChar, eWrapWhitespace }; - -class ColourOptional : public ColourDesired { -public: - bool isSet; - ColourOptional(ColourDesired colour_=ColourDesired(0,0,0), bool isSet_=false) : ColourDesired(colour_), isSet(isSet_) { - } - ColourOptional(uptr_t wParam, sptr_t lParam) : ColourDesired(static_cast(lParam)), isSet(wParam != 0) { - } -}; - -struct ForeBackColours { - ColourOptional fore; - ColourOptional back; -}; - -struct EdgeProperties { - int column; - ColourDesired colour; - EdgeProperties(int column_ = 0, ColourDesired colour_ = ColourDesired(0)) : - column(column_), colour(colour_) { - } - EdgeProperties(uptr_t wParam, sptr_t lParam) : - column(static_cast(wParam)), colour(static_cast(lParam)) { - } -}; - -/** - */ -class ViewStyle { - FontNames fontNames; - FontMap fonts; -public: - std::vector - - xml.writeEndElement(); // - } - - { - xml.writeStartElement(lit("body")); - - xml.writeStartElement(lit("h1")); - xml.writeCharacters(title); - xml.writeEndElement(); - - xml.writeStartElement(lit("h3")); - { - QString context = tr("Frame %1").arg(m_Ctx.FrameInfo().frameNumber); - - const DrawcallDescription *draw = m_Ctx.CurDrawcall(); - - QList drawstack; - const DrawcallDescription *parent = m_Ctx.GetDrawcall(draw->parent); - while(parent) - { - drawstack.push_front(parent); - parent = m_Ctx.GetDrawcall(parent->parent); - } - - for(const DrawcallDescription *d : drawstack) - { - context += QFormatStr(" > %1").arg(ToQStr(d->name)); - } - - context += QFormatStr(" => %1").arg(ToQStr(draw->name)); - - xml.writeCharacters(context); - } - xml.writeEndElement(); // - } - - // body is open - - return xmlptr; - } - - RDDialog::critical( - this, tr("Error exporting pipeline state"), - tr("Couldn't open path %1 for write.\n%2").arg(filename).arg(f->errorString())); - - delete f; - - return NULL; - } - else - { - RDDialog::critical(this, tr("Invalid directory"), - tr("Cannot find target directory to save to")); - return NULL; - } - } - - return NULL; -} - -void PipelineStateViewer::exportHTMLTable(QXmlStreamWriter &xml, const QStringList &cols, - const QList &rows) -{ - xml.writeStartElement(lit("table")); - - { - xml.writeStartElement(lit("thead")); - xml.writeStartElement(lit("tr")); - - for(const QString &col : cols) - { - xml.writeStartElement(lit("th")); - xml.writeCharacters(col); - xml.writeEndElement(); - } - - xml.writeEndElement(); - xml.writeEndElement(); - } - - { - xml.writeStartElement(lit("tbody")); - - if(rows.isEmpty()) - { - xml.writeStartElement(lit("tr")); - - for(int i = 0; i < cols.count(); i++) - { - xml.writeStartElement(lit("td")); - xml.writeCharacters(lit("-")); - xml.writeEndElement(); - } - - xml.writeEndElement(); - } - else - { - for(const QVariantList &row : rows) - { - xml.writeStartElement(lit("tr")); - - for(const QVariant &el : row) - { - xml.writeStartElement(lit("td")); - - QMetaType::Type type = (QMetaType::Type)el.type(); - - if(type == QMetaType::Bool) - xml.writeCharacters(el.toBool() ? tr("True") : tr("False")); - else - xml.writeCharacters(el.toString()); - - xml.writeEndElement(); - } - - xml.writeEndElement(); - } - } - - xml.writeEndElement(); - } - - xml.writeEndElement(); -} - -void PipelineStateViewer::exportHTMLTable(QXmlStreamWriter &xml, const QStringList &cols, - const QVariantList &row) -{ - exportHTMLTable(xml, cols, QList({row})); -} - -void PipelineStateViewer::endHTMLExport(QXmlStreamWriter *xml) -{ - xml->writeEndElement(); // - - xml->writeEndElement(); // - - xml->writeEndDocument(); - - // delete the file the writer was writing to - QFile *f = qobject_cast(xml->device()); - delete f; - - delete xml; -} - -void PipelineStateViewer::setTopologyDiagram(QLabel *diagram, Topology topo) -{ - int idx = qMin((int)topo, (int)Topology::PatchList); - - if(m_TopoPixmaps[idx].isNull()) - { - QSvgRenderer svg; - switch(topo) - { - case Topology::PointList: svg.load(lit(":/topologies/topo_pointlist.svg")); break; - case Topology::LineList: svg.load(lit(":/topologies/topo_linelist.svg")); break; - case Topology::LineStrip: svg.load(lit(":/topologies/topo_linestrip.svg")); break; - case Topology::TriangleList: svg.load(lit(":/topologies/topo_trilist.svg")); break; - case Topology::TriangleStrip: svg.load(lit(":/topologies/topo_tristrip.svg")); break; - case Topology::LineList_Adj: svg.load(lit(":/topologies/topo_linelist_adj.svg")); break; - case Topology::LineStrip_Adj: svg.load(lit(":/topologies/topo_linestrip_adj.svg")); break; - case Topology::TriangleList_Adj: svg.load(lit(":/topologies/topo_trilist_adj.svg")); break; - case Topology::TriangleStrip_Adj: svg.load(lit(":/topologies/topo_tristrip_adj.svg")); break; - default: svg.load(lit(":/topologies/topo_patch.svg")); break; - } - - QRect rect = svg.viewBox(); - - QImage im(rect.size() * diagram->devicePixelRatio(), QImage::Format_ARGB32); - - im.fill(QColor(0, 0, 0, 0)); - - QPainter p(&im); - - svg.render(&p); - - // convert the colors - black maps to Text (foreground) and white maps to Base (background) - QColor white = diagram->palette().color(QPalette::Active, QPalette::Base); - QColor black = diagram->palette().color(QPalette::Active, QPalette::Text); - - const float br = black.redF(); - const float bg = black.greenF(); - const float bb = black.blueF(); - - const float wr = white.redF(); - const float wg = white.greenF(); - const float wb = white.blueF(); - - for(int y = 0; y < im.height(); y++) - { - QRgb *line = (QRgb *)im.scanLine(y); - - for(int x = 0; x < im.width(); x++) - { - // delta of 0 is black, delta of 255 is white - const float delta = float(qRed(*line)); - const float bd = 255.0f - delta; - const float wd = delta; - - const int r = int(br * bd + wr * wd); - const int g = int(bg * bd + wg * wd); - const int b = int(bb * bd + wb * wd); - - *line = qRgba(r, g, b, qAlpha(*line)); - - line++; - } - } - - m_TopoPixmaps[idx] = QPixmap::fromImage(im); - m_TopoPixmaps[idx].setDevicePixelRatio(diagram->devicePixelRatioF()); - } - - diagram->setPixmap(m_TopoPixmaps[idx]); -} - -void PipelineStateViewer::setMeshViewPixmap(RDLabel *meshView) -{ - QImage meshIcon = Pixmaps::wireframe_mesh(meshView->devicePixelRatio()).toImage(); - QImage colSwapped(meshIcon.size(), QImage::Format_ARGB32); - colSwapped.fill(meshView->palette().color(QPalette::WindowText)); - - for(int y = 0; y < meshIcon.height(); y++) - { - const QRgb *in = (const QRgb *)meshIcon.constScanLine(y); - QRgb *out = (QRgb *)colSwapped.scanLine(y); - - for(int x = 0; x < meshIcon.width(); x++) - { - *out = qRgba(qRed(*out), qGreen(*out), qBlue(*out), qAlpha(*in)); - - in++; - out++; - } - } - - QPixmap p = QPixmap::fromImage(colSwapped); - p.setDevicePixelRatio(meshView->devicePixelRatioF()); - - meshView->setPixmap(p); - meshView->setPreserveAspectRatio(true); - - QPalette pal = meshView->palette(); - pal.setColor(QPalette::Shadow, pal.color(QPalette::Window).darker(120)); - meshView->setPalette(pal); - meshView->setBackgroundRole(QPalette::Window); - meshView->setMouseTracking(true); - - QObject::connect(meshView, &RDLabel::mouseMoved, [meshView](QMouseEvent *) { - meshView->setBackgroundRole(QPalette::Shadow); - meshView->setAutoFillBackground(true); - }); - QObject::connect(meshView, &RDLabel::leave, [meshView]() { - meshView->setBackgroundRole(QPalette::Window); - meshView->setAutoFillBackground(false); - }); -} - -bool PipelineStateViewer::PrepareShaderEditing(const ShaderReflection *shaderDetails, - QString &entryFunc, QStringMap &files, - QString &mainfile) -{ - if(!shaderDetails->DebugInfo.files.empty()) - { - entryFunc = ToQStr(shaderDetails->EntryPoint); - - QStringList uniqueFiles; - - for(auto &s : shaderDetails->DebugInfo.files) - { - QString filename = ToQStr(s.first); - if(uniqueFiles.contains(filename.toLower())) - { - qWarning() << lit("Duplicate full filename") << ToQStr(s.first); - continue; - } - uniqueFiles.push_back(filename.toLower()); - - files[filename] = ToQStr(s.second); - } - - mainfile = ToQStr(shaderDetails->DebugInfo.files[0].first); - - return true; - } - - return false; -} - -void PipelineStateViewer::MakeShaderVariablesHLSL(bool cbufferContents, - const rdctype::array &vars, - QString &struct_contents, QString &struct_defs) -{ - for(const ShaderConstant &v : vars) - { - if(v.type.members.count > 0) - { - QString def = lit("struct %1 {\n").arg(ToQStr(v.type.descriptor.name)); - - if(!struct_defs.contains(def)) - { - QString contents; - MakeShaderVariablesHLSL(false, v.type.members, contents, struct_defs); - - struct_defs += def + contents + lit("};\n\n"); - } - } - - struct_contents += lit("\t%1 %2").arg(ToQStr(v.type.descriptor.name)).arg(ToQStr(v.name)); - - char comp = 'x'; - if(v.reg.comp == 1) - comp = 'y'; - if(v.reg.comp == 2) - comp = 'z'; - if(v.reg.comp == 3) - comp = 'w'; - - if(cbufferContents) - struct_contents += lit(" : packoffset(c%1.%2);").arg(v.reg.vec).arg(QLatin1Char(comp)); - else - struct_contents += lit(";"); - - struct_contents += lit("\n"); - } -} - -QString PipelineStateViewer::GenerateHLSLStub(const ShaderReflection *shaderDetails, - const QString &entryFunc) -{ - QString hlsl = lit("// No HLSL available - function stub generated\n\n"); - - const QString textureDim[ENUM_ARRAY_SIZE(TextureDim)] = { - lit("Unknown"), lit("Buffer"), lit("Texture1D"), lit("Texture1DArray"), - lit("Texture2D"), lit("TextureRect"), lit("Texture2DArray"), lit("Texture2DMS"), - lit("Texture2DMSArray"), lit("Texture3D"), lit("TextureCube"), lit("TextureCubeArray"), - }; - - for(int i = 0; i < 2; i++) - { - const rdctype::array &resources = - (i == 0 ? shaderDetails->ReadOnlyResources : shaderDetails->ReadWriteResources); - for(const ShaderResource &res : resources) - { - if(res.IsSampler) - { - hlsl += lit("//SamplerComparisonState %1 : register(s%2); // can't disambiguate\n" - "SamplerState %1 : register(s%2); // can't disambiguate\n") - .arg(ToQStr(res.name)) - .arg(res.bindPoint); - } - else - { - char regChar = 't'; - - if(i == 1) - { - hlsl += lit("RW"); - regChar = 'u'; - } - - if(res.IsTexture) - { - hlsl += lit("%1<%2> %3 : register(%4%5);\n") - .arg(textureDim[(size_t)res.resType]) - .arg(ToQStr(res.variableType.descriptor.name)) - .arg(ToQStr(res.name)) - .arg(QLatin1Char(regChar)) - .arg(res.bindPoint); - } - else - { - if(res.variableType.descriptor.rows > 1) - hlsl += lit("Structured"); - - hlsl += lit("Buffer<%1> %2 : register(%3%4);\n") - .arg(ToQStr(res.variableType.descriptor.name)) - .arg(ToQStr(res.name)) - .arg(QLatin1Char(regChar)) - .arg(res.bindPoint); - } - } - } - } - - hlsl += lit("\n\n"); - - QString cbuffers; - - int cbufIdx = 0; - for(const ConstantBlock &cbuf : shaderDetails->ConstantBlocks) - { - if(cbuf.name.count > 0 && cbuf.variables.count > 0) - { - QString cbufName = ToQStr(cbuf.name); - if(cbufName == lit("$Globals")) - cbufName = lit("_Globals"); - cbuffers += lit("cbuffer %1 : register(b%2) {\n").arg(cbufName).arg(cbuf.bindPoint); - MakeShaderVariablesHLSL(true, cbuf.variables, cbuffers, hlsl); - cbuffers += lit("};\n\n"); - } - cbufIdx++; - } - - hlsl += cbuffers; - - hlsl += lit("\n\n"); - - hlsl += lit("struct InputStruct {\n"); - for(const SigParameter &sig : shaderDetails->InputSig) - hlsl += lit("\t%1 %2 : %3;\n") - .arg(TypeString(sig)) - .arg(sig.varName.count > 0 ? ToQStr(sig.varName) : lit("param%1").arg(sig.regIndex)) - .arg(D3DSemanticString(sig)); - hlsl += lit("};\n\n"); - - hlsl += lit("struct OutputStruct {\n"); - for(const SigParameter &sig : shaderDetails->OutputSig) - hlsl += lit("\t%1 %2 : %3;\n") - .arg(TypeString(sig)) - .arg(sig.varName.count > 0 ? ToQStr(sig.varName) : lit("param%1").arg(sig.regIndex)) - .arg(D3DSemanticString(sig)); - hlsl += lit("};\n\n"); - - hlsl += lit("OutputStruct %1(in InputStruct IN)\n" - "{\n" - "\tOutputStruct OUT = (OutputStruct)0;\n" - "\n" - "\t// ...\n" - "\n" - "\treturn OUT;\n" - "}\n") - .arg(entryFunc); - - return hlsl; -} - -void PipelineStateViewer::EditShader(ShaderStage shaderType, ResourceId id, - const ShaderReflection *shaderDetails, const QString &entryFunc, - const QStringMap &files, const QString &mainfile) -{ - IShaderViewer *sv = m_Ctx.EditShader( - false, entryFunc, files, - // save callback - [entryFunc, mainfile, shaderType, id, shaderDetails]( - ICaptureContext *ctx, IShaderViewer *viewer, const QStringMap &updatedfiles) { - QString compileSource = updatedfiles[mainfile]; - - // try and match up #includes against the files that we have. This isn't always - // possible as fxc only seems to include the source for files if something in - // that file was included in the compiled output. So you might end up with - // dangling #includes - we just have to ignore them - int offs = compileSource.indexOf(lit("#include")); - - while(offs >= 0) - { - // search back to ensure this is a valid #include (ie. not in a comment). - // Must only see whitespace before, then a newline. - int ws = qMax(0, offs - 1); - while(ws >= 0 && - (compileSource[ws] == QLatin1Char(' ') || compileSource[ws] == QLatin1Char('\t'))) - ws--; - - // not valid? jump to next. - if(ws > 0 && compileSource[ws] != QLatin1Char('\n')) - { - offs = compileSource.indexOf(lit("#include"), offs + 1); - continue; - } - - int start = ws + 1; - - bool tail = true; - - int lineEnd = compileSource.indexOf(QLatin1Char('\n'), start + 1); - if(lineEnd == -1) - { - lineEnd = compileSource.length(); - tail = false; - } - - ws = offs + sizeof("#include") - 1; - while(compileSource[ws] == QLatin1Char(' ') || compileSource[ws] == QLatin1Char('\t')) - ws++; - - QString line = compileSource.mid(offs, lineEnd - offs + 1); - - if(compileSource[ws] != QLatin1Char('<') && compileSource[ws] != QLatin1Char('"')) - { - viewer->ShowErrors(lit("Invalid #include directive found:\r\n") + line); - return; - } - - // find matching char, either <> or ""; - int end = compileSource.indexOf( - compileSource[ws] == QLatin1Char('"') ? QLatin1Char('"') : QLatin1Char('>'), ws + 1); - - if(end == -1) - { - viewer->ShowErrors(lit("Invalid #include directive found:\r\n") + line); - return; - } - - QString fname = compileSource.mid(ws + 1, end - ws - 1); - - QString fileText; - - // look for exact match first - if(updatedfiles.contains(fname)) - { - fileText = updatedfiles[fname]; - } - else - { - QString search = QFileInfo(fname).fileName(); - // if not, try and find the same filename (this is not proper include handling!) - for(const QString &k : updatedfiles.keys()) - { - if(QFileInfo(k).fileName().compare(search, Qt::CaseInsensitive) == 0) - { - fileText = updatedfiles[k]; - break; - } - } - - if(fileText.isEmpty()) - fileText = QFormatStr("// Can't find file %1\n").arg(fname); - } - - compileSource = compileSource.left(offs) + lit("\n\n") + fileText + lit("\n\n") + - (tail ? compileSource.mid(lineEnd + 1) : QString()); - - // need to start searching from the beginning - wasteful but allows nested includes to - // work - offs = compileSource.indexOf(lit("#include")); - } - - if(updatedfiles.contains(lit("@cmdline"))) - compileSource = updatedfiles[lit("@cmdline")] + lit("\n\n") + compileSource; - - // invoke off to the ReplayController to replace the log's shader - // with our edited one - ctx->Replay().AsyncInvoke([ctx, entryFunc, compileSource, shaderType, id, shaderDetails, - viewer](IReplayController *r) { - rdctype::str errs; - - uint flags = shaderDetails->DebugInfo.compileFlags; - - ResourceId from = id; - ResourceId to; - - std::tie(to, errs) = r->BuildTargetShader( - entryFunc.toUtf8().data(), compileSource.toUtf8().data(), flags, shaderType); - - GUIInvoke::call([viewer, errs]() { viewer->ShowErrors(ToQStr(errs)); }); - if(to == ResourceId()) - { - r->RemoveReplacement(from); - GUIInvoke::call([ctx]() { ctx->RefreshStatus(); }); - } - else - { - r->ReplaceResource(from, to); - GUIInvoke::call([ctx]() { ctx->RefreshStatus(); }); - } - }); - }, - - // Close Callback - [id](ICaptureContext *ctx) { - // remove the replacement on close (we could make this more sophisticated if there - // was a place to control replaced resources/shaders). - ctx->Replay().AsyncInvoke([ctx, id](IReplayController *r) { - r->RemoveReplacement(id); - GUIInvoke::call([ctx] { ctx->RefreshStatus(); }); - }); - }); - - m_Ctx.AddDockWindow(sv->Widget(), DockReference::AddTo, this); -} - -bool PipelineStateViewer::SaveShaderFile(const ShaderReflection *shader) -{ - if(!shader) - return false; - - QString filter; - - if(m_Ctx.CurPipelineState().IsLogD3D11() || m_Ctx.CurPipelineState().IsLogD3D12()) - { - filter = tr("DXBC Shader files (*.dxbc)"); - } - else if(m_Ctx.CurPipelineState().IsLogGL()) - { - filter = tr("GLSL files (*.glsl)"); - } - else if(m_Ctx.CurPipelineState().IsLogVK()) - { - filter = tr("SPIR-V files (*.spv)"); - } - - QString filename = RDDialog::getSaveFileName(this, tr("Save Shader As"), QString(), filter); - - if(!filename.isEmpty()) - { - QDir dirinfo = QFileInfo(filename).dir(); - if(dirinfo.exists()) - { - QFile f(filename); - if(f.open(QIODevice::WriteOnly | QIODevice::Truncate)) - { - f.write((const char *)shader->RawBytes.elems, (qint64)shader->RawBytes.count); - } - else - { - RDDialog::critical( - this, tr("Error saving shader"), - tr("Couldn't open path %1 for write.\n%2").arg(filename).arg(f.errorString())); - return false; - } - } - else - { - RDDialog::critical(this, tr("Invalid directory"), - tr("Cannot find target directory to save to")); - return false; - } - } - - return true; -} diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h deleted file mode 100644 index 416cb46cb..000000000 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h +++ /dev/null @@ -1,105 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2016-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. - ******************************************************************************/ - -#pragma once - -#include -#include "Code/CaptureContext.h" - -namespace Ui -{ -class PipelineStateViewer; -} - -class QXmlStreamWriter; - -class RDLabel; - -class D3D11PipelineStateViewer; -class D3D12PipelineStateViewer; -class GLPipelineStateViewer; -class VulkanPipelineStateViewer; - -class PipelineStateViewer : public QFrame, public IPipelineStateViewer, public ILogViewer -{ - Q_OBJECT - - Q_PROPERTY(QVariant persistData READ persistData WRITE setPersistData DESIGNABLE false SCRIPTABLE false) - -public: - explicit PipelineStateViewer(ICaptureContext &ctx, QWidget *parent = 0); - ~PipelineStateViewer(); - - // IPipelineStateViewer - QWidget *Widget() override { return this; } - bool SaveShaderFile(const ShaderReflection *shader) override; - - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; - void OnSelectedEventChanged(uint32_t eventID) override {} - void OnEventChanged(uint32_t eventID) override; - - QVariant persistData(); - - void setPersistData(const QVariant &persistData); - - bool PrepareShaderEditing(const ShaderReflection *shaderDetails, QString &entryFunc, - QStringMap &files, QString &mainfile); - QString GenerateHLSLStub(const ShaderReflection *shaderDetails, const QString &entryFunc); - void EditShader(ShaderStage shaderType, ResourceId id, const ShaderReflection *shaderDetails, - const QString &entryFunc, const QStringMap &files, const QString &mainfile); - - void setTopologyDiagram(QLabel *diagram, Topology topo); - void setMeshViewPixmap(RDLabel *meshView); - - QXmlStreamWriter *beginHTMLExport(); - void exportHTMLTable(QXmlStreamWriter &xml, const QStringList &cols, - const QList &rows); - void exportHTMLTable(QXmlStreamWriter &xml, const QStringList &cols, const QVariantList &row); - void endHTMLExport(QXmlStreamWriter *xml); - -private: - Ui::PipelineStateViewer *ui; - ICaptureContext &m_Ctx; - - void MakeShaderVariablesHLSL(bool cbufferContents, const rdctype::array &vars, - QString &struct_contents, QString &struct_defs); - - QPixmap m_TopoPixmaps[(int)Topology::PatchList + 1]; - - void setToD3D11(); - void setToD3D12(); - void setToGL(); - void setToVulkan(); - void reset(); - - QString GetCurrentAPI(); - - D3D11PipelineStateViewer *m_D3D11; - D3D12PipelineStateViewer *m_D3D12; - GLPipelineStateViewer *m_GL; - VulkanPipelineStateViewer *m_Vulkan; - ILogViewer *m_Current; -}; diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.ui b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.ui deleted file mode 100644 index 59bf84763..000000000 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.ui +++ /dev/null @@ -1,36 +0,0 @@ - - - PipelineStateViewer - - - - 0 - 0 - 400 - 300 - - - - Pipeline State - - - - 0 - - - 3 - - - 3 - - - 3 - - - 3 - - - - - - diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp deleted file mode 100644 index 70af8ab12..000000000 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ /dev/null @@ -1,3268 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2016-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. - ******************************************************************************/ - -#include "VulkanPipelineStateViewer.h" -#include -#include -#include -#include -#include "3rdparty/toolwindowmanager/ToolWindowManager.h" -#include "Code/Resources.h" -#include "Widgets/Extended/RDHeaderView.h" -#include "PipelineStateViewer.h" -#include "ui_VulkanPipelineStateViewer.h" - -Q_DECLARE_METATYPE(ResourceId); -Q_DECLARE_METATYPE(SamplerData); - -struct VulkanVBIBTag -{ - VulkanVBIBTag() { offset = 0; } - VulkanVBIBTag(ResourceId i, uint64_t offs) - { - id = i; - offset = offs; - } - - ResourceId id; - uint64_t offset; -}; - -Q_DECLARE_METATYPE(VulkanVBIBTag); - -struct VulkanCBufferTag -{ - VulkanCBufferTag() { slotIdx = arrayIdx = 0; } - VulkanCBufferTag(uint32_t s, uint32_t i) - { - slotIdx = s; - arrayIdx = i; - } - uint32_t slotIdx; - uint32_t arrayIdx; -}; - -Q_DECLARE_METATYPE(VulkanCBufferTag); - -struct VulkanBufferTag -{ - VulkanBufferTag() - { - rwRes = false; - bindPoint = 0; - offset = size = 0; - } - VulkanBufferTag(bool rw, uint32_t b, ResourceId id, uint64_t offs, uint64_t sz) - { - rwRes = rw; - bindPoint = b; - ID = id; - offset = offs; - size = sz; - } - bool rwRes; - uint32_t bindPoint; - ResourceId ID; - uint64_t offset; - uint64_t size; -}; - -Q_DECLARE_METATYPE(VulkanBufferTag); - -VulkanPipelineStateViewer::VulkanPipelineStateViewer(ICaptureContext &ctx, - PipelineStateViewer &common, QWidget *parent) - : QFrame(parent), ui(new Ui::VulkanPipelineStateViewer), m_Ctx(ctx), m_Common(common) -{ - ui->setupUi(this); - - const QIcon &action = Icons::action(); - const QIcon &action_hover = Icons::action_hover(); - - RDLabel *shaderLabels[] = { - ui->vsShader, ui->tcsShader, ui->tesShader, ui->gsShader, ui->fsShader, ui->csShader, - }; - - QToolButton *viewButtons[] = { - ui->vsShaderViewButton, ui->tcsShaderViewButton, ui->tesShaderViewButton, - ui->gsShaderViewButton, ui->fsShaderViewButton, ui->csShaderViewButton, - }; - - QToolButton *editButtons[] = { - ui->vsShaderEditButton, ui->tcsShaderEditButton, ui->tesShaderEditButton, - ui->gsShaderEditButton, ui->fsShaderEditButton, ui->csShaderEditButton, - }; - - QToolButton *saveButtons[] = { - ui->vsShaderSaveButton, ui->tcsShaderSaveButton, ui->tesShaderSaveButton, - ui->gsShaderSaveButton, ui->fsShaderSaveButton, ui->csShaderSaveButton, - }; - - RDTreeWidget *resources[] = { - ui->vsResources, ui->tcsResources, ui->tesResources, - ui->gsResources, ui->fsResources, ui->csResources, - }; - - RDTreeWidget *ubos[] = { - ui->vsUBOs, ui->tcsUBOs, ui->tesUBOs, ui->gsUBOs, ui->fsUBOs, ui->csUBOs, - }; - - for(QToolButton *b : viewButtons) - QObject::connect(b, &QToolButton::clicked, this, &VulkanPipelineStateViewer::shaderView_clicked); - - for(RDLabel *b : shaderLabels) - { - QObject::connect(b, &RDLabel::clicked, this, &VulkanPipelineStateViewer::shaderLabel_clicked); - b->setAutoFillBackground(true); - b->setBackgroundRole(QPalette::ToolTipBase); - b->setForegroundRole(QPalette::ToolTipText); - } - - for(QToolButton *b : editButtons) - QObject::connect(b, &QToolButton::clicked, this, &VulkanPipelineStateViewer::shaderEdit_clicked); - - for(QToolButton *b : saveButtons) - QObject::connect(b, &QToolButton::clicked, this, &VulkanPipelineStateViewer::shaderSave_clicked); - - QObject::connect(ui->viAttrs, &RDTreeWidget::leave, this, &VulkanPipelineStateViewer::vertex_leave); - QObject::connect(ui->viBuffers, &RDTreeWidget::leave, this, - &VulkanPipelineStateViewer::vertex_leave); - - QObject::connect(ui->framebuffer, &RDTreeWidget::itemActivated, this, - &VulkanPipelineStateViewer::resource_itemActivated); - - for(RDTreeWidget *res : resources) - QObject::connect(res, &RDTreeWidget::itemActivated, this, - &VulkanPipelineStateViewer::resource_itemActivated); - - for(RDTreeWidget *ubo : ubos) - QObject::connect(ubo, &RDTreeWidget::itemActivated, this, - &VulkanPipelineStateViewer::ubo_itemActivated); - - addGridLines(ui->rasterizerGridLayout, palette().color(QPalette::WindowText)); - addGridLines(ui->MSAAGridLayout, palette().color(QPalette::WindowText)); - addGridLines(ui->blendStateGridLayout, palette().color(QPalette::WindowText)); - addGridLines(ui->depthStateGridLayout, palette().color(QPalette::WindowText)); - - { - RDHeaderView *header = new RDHeaderView(Qt::Horizontal, this); - ui->viAttrs->setHeader(header); - - ui->viAttrs->setColumns({tr("Index"), tr("Name"), tr("Location"), tr("Binding"), tr("Format"), - tr("Offset"), tr("Go")}); - header->setColumnStretchHints({1, 4, 1, 2, 3, 2, -1}); - - ui->viAttrs->setHoverIconColumn(6, action, action_hover); - ui->viAttrs->setClearSelectionOnFocusLoss(true); - ui->viAttrs->setInstantTooltips(true); - } - - { - RDHeaderView *header = new RDHeaderView(Qt::Horizontal, this); - ui->viBuffers->setHeader(header); - - ui->viBuffers->setColumns({tr("Slot"), tr("Buffer"), tr("Rate"), tr("Offset"), tr("Stride"), - tr("Byte Length"), tr("Go")}); - header->setColumnStretchHints({1, 4, 2, 2, 2, 3, -1}); - - ui->viBuffers->setHoverIconColumn(6, action, action_hover); - ui->viBuffers->setClearSelectionOnFocusLoss(true); - ui->viBuffers->setInstantTooltips(true); - } - - for(RDTreeWidget *res : resources) - { - RDHeaderView *header = new RDHeaderView(Qt::Horizontal, this); - res->setHeader(header); - - res->setColumns({QString(), tr("Set"), tr("Binding"), tr("Type"), tr("Resource"), - tr("Contents"), tr("cont.d"), tr("Go")}); - header->setColumnStretchHints({-1, -1, 2, 2, 2, 4, 4, -1}); - - res->setHoverIconColumn(7, action, action_hover); - res->setClearSelectionOnFocusLoss(true); - res->setInstantTooltips(true); - } - - for(RDTreeWidget *ubo : ubos) - { - RDHeaderView *header = new RDHeaderView(Qt::Horizontal, this); - ubo->setHeader(header); - - ubo->setColumns({QString(), tr("Set"), tr("Binding"), tr("Buffer"), tr("Byte Range"), - tr("Size"), tr("Go")}); - header->setColumnStretchHints({-1, -1, 2, 4, 3, 3, -1}); - - ubo->setHoverIconColumn(6, action, action_hover); - ubo->setClearSelectionOnFocusLoss(true); - ubo->setInstantTooltips(true); - } - - { - RDHeaderView *header = new RDHeaderView(Qt::Horizontal, this); - ui->viewports->setHeader(header); - - ui->viewports->setColumns( - {tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height"), tr("MinDepth"), tr("MaxDepth")}); - header->setColumnStretchHints({-1, -1, -1, -1, -1, -1, 1}); - header->setMinimumSectionSize(40); - - ui->viewports->setClearSelectionOnFocusLoss(true); - ui->viewports->setInstantTooltips(true); - } - - { - RDHeaderView *header = new RDHeaderView(Qt::Horizontal, this); - ui->scissors->setHeader(header); - - ui->scissors->setColumns({tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height")}); - header->setColumnStretchHints({-1, -1, -1, -1, 1}); - header->setMinimumSectionSize(40); - - ui->scissors->setClearSelectionOnFocusLoss(true); - ui->scissors->setInstantTooltips(true); - } - - { - RDHeaderView *header = new RDHeaderView(Qt::Horizontal, this); - ui->framebuffer->setHeader(header); - - ui->framebuffer->setColumns({tr("Slot"), tr("Resource"), tr("Type"), tr("Width"), tr("Height"), - tr("Depth"), tr("Array Size"), tr("Format"), tr("Go")}); - header->setColumnStretchHints({2, 4, 2, 1, 1, 1, 1, 3, -1}); - - ui->framebuffer->setHoverIconColumn(8, action, action_hover); - ui->framebuffer->setClearSelectionOnFocusLoss(true); - ui->framebuffer->setInstantTooltips(true); - } - - { - RDHeaderView *header = new RDHeaderView(Qt::Horizontal, this); - ui->blends->setHeader(header); - - ui->blends->setColumns({tr("Slot"), tr("Enabled"), tr("Col Src"), tr("Col Dst"), tr("Col Op"), - tr("Alpha Src"), tr("Alpha Dst"), tr("Alpha Op"), tr("Write Mask")}); - header->setColumnStretchHints({-1, 1, 2, 2, 2, 2, 2, 2, 1}); - - ui->blends->setClearSelectionOnFocusLoss(true); - ui->blends->setInstantTooltips(true); - } - - { - RDHeaderView *header = new RDHeaderView(Qt::Horizontal, this); - ui->stencils->setHeader(header); - - ui->stencils->setColumns({tr("Face"), tr("Func"), tr("Fail Op"), tr("Depth Fail Op"), - tr("Pass Op"), tr("Write Mask"), tr("Comp Mask"), tr("Ref")}); - header->setColumnStretchHints({1, 2, 2, 2, 2, 1, 1, 1}); - - ui->stencils->setClearSelectionOnFocusLoss(true); - ui->stencils->setInstantTooltips(true); - } - - // this is often changed just because we're changing some tab in the designer. - ui->stagesTabs->setCurrentIndex(0); - - ui->stagesTabs->tabBar()->setVisible(false); - - ui->pipeFlow->setStages( - { - lit("VTX"), lit("VS"), lit("TCS"), lit("TES"), lit("GS"), lit("RS"), lit("FS"), lit("FB"), - lit("CS"), - }, - { - tr("Vertex Input"), tr("Vertex Shader"), tr("Tess. Control Shader"), - tr("Tess. Eval. Shader"), tr("Geometry Shader"), tr("Rasterizer"), tr("Fragment Shader"), - tr("Framebuffer Output"), tr("Compute Shader"), - }); - - ui->pipeFlow->setIsolatedStage(8); // compute shader isolated - - ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true}); - - m_Common.setMeshViewPixmap(ui->meshView); - - ui->viAttrs->setFont(Formatter::PreferredFont()); - ui->viBuffers->setFont(Formatter::PreferredFont()); - ui->vsShader->setFont(Formatter::PreferredFont()); - ui->vsResources->setFont(Formatter::PreferredFont()); - ui->vsUBOs->setFont(Formatter::PreferredFont()); - ui->gsShader->setFont(Formatter::PreferredFont()); - ui->gsResources->setFont(Formatter::PreferredFont()); - ui->gsUBOs->setFont(Formatter::PreferredFont()); - ui->tcsShader->setFont(Formatter::PreferredFont()); - ui->tcsResources->setFont(Formatter::PreferredFont()); - ui->tcsUBOs->setFont(Formatter::PreferredFont()); - ui->tesShader->setFont(Formatter::PreferredFont()); - ui->tesResources->setFont(Formatter::PreferredFont()); - ui->tesUBOs->setFont(Formatter::PreferredFont()); - ui->fsShader->setFont(Formatter::PreferredFont()); - ui->fsResources->setFont(Formatter::PreferredFont()); - ui->fsUBOs->setFont(Formatter::PreferredFont()); - ui->csShader->setFont(Formatter::PreferredFont()); - ui->csResources->setFont(Formatter::PreferredFont()); - ui->csUBOs->setFont(Formatter::PreferredFont()); - ui->viewports->setFont(Formatter::PreferredFont()); - ui->scissors->setFont(Formatter::PreferredFont()); - ui->framebuffer->setFont(Formatter::PreferredFont()); - ui->blends->setFont(Formatter::PreferredFont()); - - // reset everything back to defaults - clearState(); -} - -VulkanPipelineStateViewer::~VulkanPipelineStateViewer() -{ - delete ui; -} - -void VulkanPipelineStateViewer::OnLogfileLoaded() -{ - OnEventChanged(m_Ctx.CurEvent()); -} - -void VulkanPipelineStateViewer::OnLogfileClosed() -{ - ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true}); - - clearState(); -} - -void VulkanPipelineStateViewer::OnEventChanged(uint32_t eventID) -{ - setState(); -} - -void VulkanPipelineStateViewer::on_showDisabled_toggled(bool checked) -{ - setState(); -} - -void VulkanPipelineStateViewer::on_showEmpty_toggled(bool checked) -{ - setState(); -} - -void VulkanPipelineStateViewer::setInactiveRow(RDTreeWidgetItem *node) -{ - node->setItalic(true); -} - -void VulkanPipelineStateViewer::setEmptyRow(RDTreeWidgetItem *node) -{ - node->setBackgroundColor(QColor(255, 70, 70)); - node->setForegroundColor(QColor(0, 0, 0)); -} - -template -void VulkanPipelineStateViewer::setViewDetails(RDTreeWidgetItem *node, const bindType &view, - TextureDescription *tex) -{ - if(tex == NULL) - return; - - QString text; - - bool viewdetails = false; - - { - for(const VKPipe::ImageData &im : m_Ctx.CurVulkanPipelineState().images) - { - if(im.image == tex->ID) - { - text += tr("Texture is in the '%1' layout\n\n").arg(ToQStr(im.layouts[0].name)); - break; - } - } - - if(view.viewfmt != tex->format) - { - text += tr("The texture is format %1, the view treats it as %2.\n") - .arg(ToQStr(tex->format.strname)) - .arg(ToQStr(view.viewfmt.strname)); - - viewdetails = true; - } - - if(tex->mips > 1 && (tex->mips != view.numMip || view.baseMip > 0)) - { - if(view.numMip == 1) - text += - tr("The texture has %1 mips, the view covers mip %2.\n").arg(tex->mips).arg(view.baseMip); - else - text += tr("The texture has %1 mips, the view covers mips %2-%3.\n") - .arg(tex->mips) - .arg(view.baseMip) - .arg(view.baseMip + view.numMip - 1); - - viewdetails = true; - } - - if(tex->arraysize > 1 && (tex->arraysize != view.numLayer || view.baseLayer > 0)) - { - if(view.numLayer == 1) - text += tr("The texture has %1 array slices, the view covers slice %2.\n") - .arg(tex->arraysize) - .arg(view.baseLayer); - else - text += tr("The texture has %1 array slices, the view covers slices %2-%3.\n") - .arg(tex->arraysize) - .arg(view.baseLayer) - .arg(view.baseLayer + view.numLayer); - - viewdetails = true; - } - } - - text = text.trimmed(); - - node->setToolTip(text); - - if(viewdetails) - { - node->setBackgroundColor(QColor(127, 255, 212)); - node->setForegroundColor(QColor(0, 0, 0)); - } -} - -template -void VulkanPipelineStateViewer::setViewDetails(RDTreeWidgetItem *node, const bindType &view, - BufferDescription *buf) -{ - if(buf == NULL) - return; - - QString text; - - if(view.offset > 0 || view.size < buf->length) - { - text += tr("The view covers bytes %1-%2.\nThe buffer is %3 bytes in length.") - .arg(view.offset) - .arg(view.offset + view.size) - .arg(buf->length); - } - else - { - return; - } - - node->setToolTip(text); - node->setBackgroundColor(QColor(127, 255, 212)); - node->setForegroundColor(QColor(0, 0, 0)); -} - -bool VulkanPipelineStateViewer::showNode(bool usedSlot, bool filledSlot) -{ - const bool showDisabled = ui->showDisabled->isChecked(); - const bool showEmpty = ui->showEmpty->isChecked(); - - // show if it's referenced by the shader - regardless of empty or not - if(usedSlot) - return true; - - // it's bound, but not referenced, and we have "show disabled" - if(showDisabled && !usedSlot && filledSlot) - return true; - - // it's empty, and we have "show empty" - if(showEmpty && !filledSlot) - return true; - - return false; -} - -const VKPipe::Shader *VulkanPipelineStateViewer::stageForSender(QWidget *widget) -{ - if(!m_Ctx.LogLoaded()) - return NULL; - - while(widget) - { - if(widget == ui->stagesTabs->widget(0)) - return &m_Ctx.CurVulkanPipelineState().m_VS; - if(widget == ui->stagesTabs->widget(1)) - return &m_Ctx.CurVulkanPipelineState().m_VS; - if(widget == ui->stagesTabs->widget(2)) - return &m_Ctx.CurVulkanPipelineState().m_TCS; - if(widget == ui->stagesTabs->widget(3)) - return &m_Ctx.CurVulkanPipelineState().m_TES; - if(widget == ui->stagesTabs->widget(4)) - return &m_Ctx.CurVulkanPipelineState().m_GS; - if(widget == ui->stagesTabs->widget(5)) - return &m_Ctx.CurVulkanPipelineState().m_FS; - if(widget == ui->stagesTabs->widget(6)) - return &m_Ctx.CurVulkanPipelineState().m_FS; - if(widget == ui->stagesTabs->widget(7)) - return &m_Ctx.CurVulkanPipelineState().m_FS; - if(widget == ui->stagesTabs->widget(8)) - return &m_Ctx.CurVulkanPipelineState().m_CS; - - widget = widget->parentWidget(); - } - - qCritical() << "Unrecognised control calling event handler"; - - return NULL; -} - -void VulkanPipelineStateViewer::clearShaderState(QLabel *shader, RDTreeWidget *resources, - RDTreeWidget *cbuffers) -{ - shader->setText(tr("Unbound Shader")); - resources->clear(); - cbuffers->clear(); -} - -void VulkanPipelineStateViewer::clearState() -{ - m_VBNodes.clear(); - m_BindNodes.clear(); - - ui->viAttrs->clear(); - ui->viBuffers->clear(); - ui->topology->setText(QString()); - ui->primRestart->setVisible(false); - ui->topologyDiagram->setPixmap(QPixmap()); - - clearShaderState(ui->vsShader, ui->vsResources, ui->vsUBOs); - clearShaderState(ui->tcsShader, ui->tcsResources, ui->tcsUBOs); - clearShaderState(ui->tesShader, ui->tesResources, ui->tesUBOs); - clearShaderState(ui->gsShader, ui->gsResources, ui->gsUBOs); - clearShaderState(ui->fsShader, ui->fsResources, ui->fsUBOs); - clearShaderState(ui->csShader, ui->csResources, ui->csUBOs); - - const QPixmap &tick = Pixmaps::tick(this); - - ui->fillMode->setText(tr("Solid", "Fill Mode")); - ui->cullMode->setText(tr("Front", "Cull Mode")); - ui->frontCCW->setPixmap(tick); - - ui->depthBias->setText(lit("0.0")); - ui->depthBiasClamp->setText(lit("0.0")); - ui->slopeScaledBias->setText(lit("0.0")); - - ui->depthClamp->setPixmap(tick); - ui->rasterizerDiscard->setPixmap(tick); - ui->lineWidth->setText(lit("1.0")); - - ui->sampleCount->setText(lit("1")); - ui->sampleShading->setPixmap(tick); - ui->minSampleShading->setText(lit("0.0")); - ui->sampleMask->setText(lit("FFFFFFFF")); - - ui->viewports->clear(); - ui->scissors->clear(); - - ui->framebuffer->clear(); - ui->blends->clear(); - - ui->blendFactor->setText(lit("0.00, 0.00, 0.00, 0.00")); - ui->logicOp->setText(lit("-")); - ui->alphaToOne->setPixmap(tick); - - ui->depthEnabled->setPixmap(tick); - ui->depthFunc->setText(lit("GREATER_EQUAL")); - ui->depthWrite->setPixmap(tick); - - ui->depthBounds->setText(lit("0.0-1.0")); - ui->depthBounds->setPixmap(QPixmap()); - - ui->stencils->clear(); -} - -QVariantList VulkanPipelineStateViewer::makeSampler(const QString &bindset, const QString &slotname, - const VKPipe::BindingElement &descriptor) -{ - QString addressing; - QString addPrefix; - QString addVal; - - QString filter; - - QString addr[] = {ToQStr(descriptor.AddressU), ToQStr(descriptor.AddressV), - ToQStr(descriptor.AddressW)}; - - // arrange like either UVW: WRAP or UV: WRAP, W: CLAMP - for(int a = 0; a < 3; a++) - { - QString prefix = QString(QLatin1Char("UVW"[a])); - - if(a == 0 || addr[a] == addr[a - 1]) - { - addPrefix += prefix; - } - else - { - addressing += addPrefix + lit(": ") + addVal + lit(", "); - - addPrefix = prefix; - } - addVal = addr[a]; - } - - addressing += addPrefix + lit(": ") + addVal; - - if(descriptor.UseBorder()) - addressing += QFormatStr(" <%1, %2, %3, %4>") - .arg(descriptor.BorderColor[0]) - .arg(descriptor.BorderColor[1]) - .arg(descriptor.BorderColor[2]) - .arg(descriptor.BorderColor[3]); - - if(descriptor.unnormalized) - addressing += lit(" (Un-norm)"); - - filter = ToQStr(descriptor.Filter); - - if(descriptor.maxAniso > 1.0f) - filter += lit(" Aniso %1x").arg(descriptor.maxAniso); - - if(descriptor.Filter.func == FilterFunc::Comparison) - filter += QFormatStr(" (%1)").arg(ToQStr(descriptor.comparison)); - else if(descriptor.Filter.func != FilterFunc::Normal) - filter += QFormatStr(" (%1)").arg(ToQStr(descriptor.Filter.func)); - - QString lod = - lit("LODs: %1 - %2") - .arg((descriptor.minlod == -FLT_MAX ? lit("0") : QString::number(descriptor.minlod))) - .arg((descriptor.maxlod == FLT_MAX ? lit("FLT_MAX") : QString::number(descriptor.maxlod))); - - if(descriptor.mipBias != 0.0f) - lod += lit(" Bias %1").arg(descriptor.mipBias); - - return {QString(), - bindset, - slotname, - descriptor.immutableSampler ? tr("Immutable Sampler") : tr("Sampler"), - ToQStr(descriptor.name), - addressing, - filter + lit(", ") + lod}; -} - -void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, - const VKPipe::Shader &stage, int bindset, int bind, - const VKPipe::Pipeline &pipe, RDTreeWidget *resources, - QMap &samplers) -{ - const ShaderResource *shaderRes = NULL; - const BindpointMap *bindMap = NULL; - - bool isrw = false; - uint bindPoint = 0; - - if(shaderDetails != NULL) - { - // we find the matching binding for this set/binding. - // The spec requires that there are no overlapping definitions, or if there are they have - // compatible types so we can just pick the first one we come across. - // The spec also doesn't require variables which are statically unused to have valid bindings, - // so they may be overlapping or possibly just defaulted to 0. - // Any variables with no binding declared at all were set to 0 and sorted to the end at - // reflection time, so we can just use a single algorithm to select the best candidate: - // - // 1. Search for matching bindset/bind resources. It doesn't matter which 'namespace' (sampler/ - // read-only/read-write) we search in, because if there's a conflict the behaviour is - // illegal and if there's no conflict we won't get any ambiguity. - // 2. If we find a match, select it for use. - // 3. If we find a second match, use it in preference only if the old one was !used, and the new - // one is used. - // - // This will make us select the best possible option - the first declared used resource - // at a particular binding, ignoring any unused resources at that binding before/after. Or if - // there's no used resource at all, the first declared unused resource (which will prefer - // resources with proper bindings over those without, as with the sorting mentioned above). - - for(int i = 0; i < shaderDetails->ReadOnlyResources.count; i++) - { - const ShaderResource &ro = shaderDetails->ReadOnlyResources[i]; - - if(stage.BindpointMapping.ReadOnlyResources[ro.bindPoint].bindset == bindset && - stage.BindpointMapping.ReadOnlyResources[ro.bindPoint].bind == bind) - { - // use this one either if we have no candidate, or the candidate we have is unused and this - // one is used - if(bindMap == NULL || - (!bindMap->used && stage.BindpointMapping.ReadOnlyResources[ro.bindPoint].used)) - { - bindPoint = (uint)i; - shaderRes = &ro; - bindMap = &stage.BindpointMapping.ReadOnlyResources[ro.bindPoint]; - } - } - } - - for(int i = 0; i < shaderDetails->ReadWriteResources.count; i++) - { - const ShaderResource &rw = shaderDetails->ReadWriteResources[i]; - - if(stage.BindpointMapping.ReadWriteResources[rw.bindPoint].bindset == bindset && - stage.BindpointMapping.ReadWriteResources[rw.bindPoint].bind == bind) - { - // use this one either if we have no candidate, or the candidate we have is unused and this - // one is used - if(bindMap == NULL || - (!bindMap->used && stage.BindpointMapping.ReadWriteResources[rw.bindPoint].used)) - { - bindPoint = (uint)i; - isrw = true; - shaderRes = &rw; - bindMap = &stage.BindpointMapping.ReadWriteResources[rw.bindPoint]; - } - } - } - } - - const rdctype::array *slotBinds = NULL; - BindType bindType = BindType::Unknown; - ShaderStageMask stageBits = ShaderStageMask::Unknown; - - if(bindset < pipe.DescSets.count && bind < pipe.DescSets[bindset].bindings.count) - { - slotBinds = &pipe.DescSets[bindset].bindings[bind].binds; - bindType = pipe.DescSets[bindset].bindings[bind].type; - stageBits = pipe.DescSets[bindset].bindings[bind].stageFlags; - } - else - { - if(shaderRes->IsSampler) - bindType = BindType::Sampler; - else if(shaderRes->IsSampler && shaderRes->IsTexture) - bindType = BindType::ImageSampler; - else if(shaderRes->resType == TextureDim::Buffer) - bindType = BindType::ReadOnlyTBuffer; - else - bindType = BindType::ReadOnlyImage; - } - - bool usedSlot = bindMap != NULL && bindMap->used; - bool stageBitsIncluded = bool(stageBits & MaskForStage(stage.stage)); - - // skip descriptors that aren't for this shader stage - if(!usedSlot && !stageBitsIncluded) - return; - - if(bindType == BindType::ConstantBuffer) - return; - - // TODO - check compatibility between bindType and shaderRes.resType ? - - // consider it filled if any array element is filled - bool filledSlot = false; - for(int idx = 0; slotBinds != NULL && idx < slotBinds->count; idx++) - { - filledSlot |= (*slotBinds)[idx].res != ResourceId(); - if(bindType == BindType::Sampler || bindType == BindType::ImageSampler) - filledSlot |= (*slotBinds)[idx].sampler != ResourceId(); - } - - // if it's masked out by stage bits, act as if it's not filled, so it's marked in red - if(!stageBitsIncluded) - filledSlot = false; - - if(showNode(usedSlot, filledSlot)) - { - RDTreeWidgetItem *parentNode = resources->invisibleRootItem(); - - QString setname = QString::number(bindset); - - QString slotname = QString::number(bind); - if(shaderRes != NULL && shaderRes->name.count > 0) - slotname += lit(": ") + ToQStr(shaderRes->name); - - int arrayLength = 0; - if(slotBinds != NULL) - arrayLength = slotBinds->count; - else - arrayLength = (int)bindMap->arraySize; - - // for arrays, add a parent element that we add the real cbuffers below - if(arrayLength > 1) - { - RDTreeWidgetItem *node = - new RDTreeWidgetItem({QString(), setname, slotname, tr("Array[%1]").arg(arrayLength), - QString(), QString(), QString(), QString()}); - - if(!filledSlot) - setEmptyRow(node); - - if(!usedSlot) - setInactiveRow(node); - - resources->addTopLevelItem(node); - - // show the tree column - resources->showColumn(0); - parentNode = node; - } - - for(int idx = 0; idx < arrayLength; idx++) - { - const VKPipe::BindingElement *descriptorBind = NULL; - if(slotBinds != NULL) - descriptorBind = &(*slotBinds)[idx]; - - if(arrayLength > 1) - { - if(shaderRes != NULL && shaderRes->name.count > 0) - slotname = QFormatStr("%1[%2]: %3").arg(bind).arg(idx).arg(ToQStr(shaderRes->name)); - else - slotname = QFormatStr("%1[%2]").arg(bind).arg(idx); - } - - bool isbuf = false; - uint32_t w = 1, h = 1, d = 1; - uint32_t a = 1; - uint32_t samples = 1; - uint64_t len = 0; - QString format = tr("Unknown"); - QString name = tr("Empty"); - TextureDim restype = TextureDim::Unknown; - QVariant tag; - - TextureDescription *tex = NULL; - BufferDescription *buf = NULL; - - uint64_t descriptorLen = descriptorBind ? descriptorBind->size : 0; - - if(filledSlot && descriptorBind != NULL) - { - name = tr("Object %1").arg(ToQStr(descriptorBind->res)); - - format = ToQStr(descriptorBind->viewfmt.strname); - - // check to see if it's a texture - tex = m_Ctx.GetTexture(descriptorBind->res); - if(tex) - { - w = tex->width; - h = tex->height; - d = tex->depth; - a = tex->arraysize; - name = ToQStr(tex->name); - restype = tex->resType; - samples = tex->msSamp; - - tag = QVariant::fromValue(descriptorBind->res); - } - - // if not a texture, it must be a buffer - buf = m_Ctx.GetBuffer(descriptorBind->res); - if(buf) - { - len = buf->length; - w = 0; - h = 0; - d = 0; - a = 0; - name = ToQStr(buf->name); - restype = TextureDim::Buffer; - - if(descriptorLen == UINT64_MAX) - descriptorLen = len - descriptorBind->offset; - - tag = QVariant::fromValue( - VulkanBufferTag(isrw, bindPoint, buf->ID, descriptorBind->offset, descriptorLen)); - - isbuf = true; - } - } - else - { - name = tr("Empty"); - format = lit("-"); - w = h = d = a = 0; - } - - RDTreeWidgetItem *node = NULL; - RDTreeWidgetItem *samplerNode = NULL; - - if(bindType == BindType::ReadWriteBuffer || bindType == BindType::ReadOnlyTBuffer || - bindType == BindType::ReadWriteTBuffer) - { - if(!isbuf) - { - node = new RDTreeWidgetItem({ - QString(), bindset, slotname, ToQStr(bindType), lit("-"), lit("-"), QString(), - }); - - setEmptyRow(node); - } - else - { - QString range = lit("-"); - if(descriptorBind != NULL) - range = QFormatStr("%1 - %2").arg(descriptorBind->offset).arg(descriptorLen); - - node = new RDTreeWidgetItem({ - QString(), bindset, slotname, ToQStr(bindType), name, tr("%1 bytes").arg(len), range, - }); - - node->setTag(tag); - - if(!filledSlot) - setEmptyRow(node); - - if(!usedSlot) - setInactiveRow(node); - } - } - else if(bindType == BindType::Sampler) - { - if(descriptorBind == NULL || descriptorBind->sampler == ResourceId()) - { - node = new RDTreeWidgetItem({ - QString(), bindset, slotname, ToQStr(bindType), lit("-"), lit("-"), QString(), - }); - - setEmptyRow(node); - } - else - { - node = - new RDTreeWidgetItem(makeSampler(QString::number(bindset), slotname, *descriptorBind)); - - if(!filledSlot) - setEmptyRow(node); - - if(!usedSlot) - setInactiveRow(node); - - SamplerData sampData; - sampData.node = node; - node->setTag(QVariant::fromValue(sampData)); - - if(!samplers.contains(descriptorBind->sampler)) - samplers.insert(descriptorBind->sampler, sampData); - } - } - else - { - if(descriptorBind == NULL || descriptorBind->res == ResourceId()) - { - node = new RDTreeWidgetItem({ - QString(), bindset, slotname, ToQStr(bindType), lit("-"), lit("-"), QString(), - }); - - setEmptyRow(node); - } - else - { - QString typeName = ToQStr(restype) + lit(" ") + ToQStr(bindType); - - QString dim; - - if(restype == TextureDim::Texture3D) - dim = QFormatStr("%1x%2x%3").arg(w).arg(h).arg(d); - else if(restype == TextureDim::Texture1D || restype == TextureDim::Texture1DArray) - dim = QString::number(w); - else - dim = QFormatStr("%1x%2").arg(w).arg(h); - - if(descriptorBind->swizzle[0] != TextureSwizzle::Red || - descriptorBind->swizzle[1] != TextureSwizzle::Green || - descriptorBind->swizzle[2] != TextureSwizzle::Blue || - descriptorBind->swizzle[3] != TextureSwizzle::Alpha) - { - format += tr(" swizzle[%1%2%3%4]") - .arg(ToQStr(descriptorBind->swizzle[0])) - .arg(ToQStr(descriptorBind->swizzle[1])) - .arg(ToQStr(descriptorBind->swizzle[2])) - .arg(ToQStr(descriptorBind->swizzle[3])); - } - - if(restype == TextureDim::Texture1DArray || restype == TextureDim::Texture2DArray || - restype == TextureDim::Texture2DMSArray || restype == TextureDim::TextureCubeArray) - { - dim += QFormatStr(" %1[%2]").arg(ToQStr(restype)).arg(a); - } - - if(restype == TextureDim::Texture2DMS || restype == TextureDim::Texture2DMSArray) - dim += QFormatStr(", %1x MSAA").arg(samples); - - node = new RDTreeWidgetItem({ - QString(), bindset, slotname, typeName, name, dim, format, - }); - - node->setTag(tag); - - if(!filledSlot) - setEmptyRow(node); - - if(!usedSlot) - setInactiveRow(node); - } - - if(bindType == BindType::ImageSampler) - { - if(descriptorBind == NULL || descriptorBind->sampler == ResourceId()) - { - samplerNode = new RDTreeWidgetItem({ - QString(), bindset, slotname, ToQStr(bindType), lit("-"), lit("-"), QString(), - }); - - setEmptyRow(node); - } - else - { - if(!samplers.contains(descriptorBind->sampler)) - { - samplerNode = new RDTreeWidgetItem(makeSampler(QString(), QString(), *descriptorBind)); - - if(!filledSlot) - setEmptyRow(samplerNode); - - if(!usedSlot) - setInactiveRow(samplerNode); - - SamplerData sampData; - sampData.node = samplerNode; - samplerNode->setTag(QVariant::fromValue(sampData)); - - samplers.insert(descriptorBind->sampler, sampData); - } - - if(node != NULL) - { - m_CombinedImageSamplers[node] = samplers[descriptorBind->sampler].node; - samplers[descriptorBind->sampler].images.push_back(node); - } - } - } - } - - if(descriptorBind && tex) - setViewDetails(node, *descriptorBind, tex); - else if(descriptorBind && buf) - setViewDetails(node, *descriptorBind, buf); - - parentNode->addChild(node); - - if(samplerNode) - parentNode->addChild(samplerNode); - } - } -} - -void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDetails, - const VKPipe::Shader &stage, int bindset, - int bind, const VKPipe::Pipeline &pipe, - RDTreeWidget *ubos) -{ - const ConstantBlock *cblock = NULL; - const BindpointMap *bindMap = NULL; - - uint32_t slot = ~0U; - if(shaderDetails != NULL) - { - for(slot = 0; slot < (uint)shaderDetails->ConstantBlocks.count; slot++) - { - ConstantBlock cb = shaderDetails->ConstantBlocks[slot]; - if(stage.BindpointMapping.ConstantBlocks[cb.bindPoint].bindset == bindset && - stage.BindpointMapping.ConstantBlocks[cb.bindPoint].bind == bind) - { - cblock = &cb; - bindMap = &stage.BindpointMapping.ConstantBlocks[cb.bindPoint]; - break; - } - } - - if(slot >= (uint)shaderDetails->ConstantBlocks.count) - slot = ~0U; - } - - const rdctype::array *slotBinds = NULL; - BindType bindType = BindType::ConstantBuffer; - ShaderStageMask stageBits = ShaderStageMask::Unknown; - - if(bindset < pipe.DescSets.count && bind < pipe.DescSets[bindset].bindings.count) - { - slotBinds = &pipe.DescSets[bindset].bindings[bind].binds; - bindType = pipe.DescSets[bindset].bindings[bind].type; - stageBits = pipe.DescSets[bindset].bindings[bind].stageFlags; - } - - bool usedSlot = bindMap != NULL && bindMap->used; - bool stageBitsIncluded = bool(stageBits & MaskForStage(stage.stage)); - - // skip descriptors that aren't for this shader stage - if(!usedSlot && !stageBitsIncluded) - return; - - if(bindType != BindType::ConstantBuffer) - return; - - // consider it filled if any array element is filled (or it's push constants) - bool filledSlot = cblock != NULL && !cblock->bufferBacked; - for(int idx = 0; slotBinds != NULL && idx < slotBinds->count; idx++) - filledSlot |= (*slotBinds)[idx].res != ResourceId(); - - // if it's masked out by stage bits, act as if it's not filled, so it's marked in red - if(!stageBitsIncluded) - filledSlot = false; - - if(showNode(usedSlot, filledSlot)) - { - RDTreeWidgetItem *parentNode = ubos->invisibleRootItem(); - - QString setname = QString::number(bindset); - - QString slotname = QString::number(bind); - if(cblock != NULL && cblock->name.count > 0) - slotname += lit(": ") + ToQStr(cblock->name); - - int arrayLength = 0; - if(slotBinds != NULL) - arrayLength = slotBinds->count; - else - arrayLength = (int)bindMap->arraySize; - - // for arrays, add a parent element that we add the real cbuffers below - if(arrayLength > 1) - { - RDTreeWidgetItem *node = new RDTreeWidgetItem( - {QString(), setname, slotname, tr("Array[%1]").arg(arrayLength), QString(), QString()}); - - if(!filledSlot) - setEmptyRow(node); - - if(!usedSlot) - setInactiveRow(node); - - parentNode = node; - - ubos->showColumn(0); - } - - for(int idx = 0; idx < arrayLength; idx++) - { - const VKPipe::BindingElement *descriptorBind = NULL; - if(slotBinds != NULL) - descriptorBind = &(*slotBinds)[idx]; - - if(arrayLength > 1) - { - if(cblock != NULL && cblock->name.count > 0) - slotname = QFormatStr("%1[%2]: %3").arg(bind).arg(idx).arg(ToQStr(cblock->name)); - else - slotname = QFormatStr("%1[%2]").arg(bind).arg(idx); - } - - QString name = tr("Empty"); - uint64_t length = 0; - int numvars = cblock != NULL ? cblock->variables.count : 0; - uint64_t byteSize = cblock != NULL ? cblock->byteSize : 0; - - QString vecrange = lit("-"); - - if(filledSlot && descriptorBind != NULL) - { - name = QString(); - length = descriptorBind->size; - - BufferDescription *buf = m_Ctx.GetBuffer(descriptorBind->res); - if(buf) - { - name = ToQStr(buf->name); - if(length == UINT64_MAX) - length = buf->length - descriptorBind->offset; - } - - if(name == QString()) - name = lit("UBO ") + ToQStr(descriptorBind->res); - - vecrange = - QFormatStr("%1 - %2").arg(descriptorBind->offset).arg(descriptorBind->offset + length); - } - - QString sizestr; - - // push constants or specialization constants - if(cblock != NULL && !cblock->bufferBacked) - { - setname = QString(); - slotname = ToQStr(cblock->name); - name = tr("Push constants"); - vecrange = QString(); - sizestr = tr("%1 Variables").arg(numvars); - - // could maybe get range from ShaderVariable.reg if it's filled out - // from SPIR-V side. - } - else - { - if(length == byteSize) - sizestr = tr("%1 Variables, %2 bytes").arg(numvars).arg(length); - else - sizestr = - tr("%1 Variables, %2 bytes needed, %3 provided").arg(numvars).arg(byteSize).arg(length); - - if(length < byteSize) - filledSlot = false; - } - - RDTreeWidgetItem *node = - new RDTreeWidgetItem({QString(), setname, slotname, name, vecrange, sizestr}); - - node->setTag(QVariant::fromValue(VulkanCBufferTag(slot, (uint)idx))); - - if(!filledSlot) - setEmptyRow(node); - - if(!usedSlot) - setInactiveRow(node); - - parentNode->addChild(node); - } - } -} - -void VulkanPipelineStateViewer::setShaderState(const VKPipe::Shader &stage, - const VKPipe::Pipeline &pipe, QLabel *shader, - RDTreeWidget *resources, RDTreeWidget *ubos) -{ - ShaderReflection *shaderDetails = stage.ShaderDetails; - - if(stage.Object == ResourceId()) - shader->setText(tr("Unbound Shader")); - else - shader->setText(ToQStr(stage.name)); - - if(shaderDetails != NULL) - { - QString entryFunc = ToQStr(shaderDetails->EntryPoint); - if(shaderDetails->DebugInfo.files.count > 0 || entryFunc != lit("main")) - shader->setText(entryFunc + lit("()")); - - if(shaderDetails->DebugInfo.files.count > 0) - shader->setText(entryFunc + lit("() - ") + - QFileInfo(ToQStr(shaderDetails->DebugInfo.files[0].first)).fileName()); - } - - int vs = 0; - - // hide the tree columns. The functions below will add it - // if any array bindings are present - resources->hideColumn(0); - ubos->hideColumn(0); - - vs = resources->verticalScrollBar()->value(); - resources->setUpdatesEnabled(false); - resources->clear(); - - QMap samplers; - - for(int bindset = 0; bindset < pipe.DescSets.count; bindset++) - { - for(int bind = 0; bind < pipe.DescSets[bindset].bindings.count; bind++) - { - addResourceRow(shaderDetails, stage, bindset, bind, pipe, resources, samplers); - } - - // if we have a shader bound, go through and add rows for any resources it wants for binds that - // aren't - // in this descriptor set (e.g. if layout mismatches) - if(shaderDetails != NULL) - { - for(int i = 0; i < shaderDetails->ReadOnlyResources.count; i++) - { - const ShaderResource &ro = shaderDetails->ReadOnlyResources[i]; - - if(stage.BindpointMapping.ReadOnlyResources[ro.bindPoint].bindset == bindset && - stage.BindpointMapping.ReadOnlyResources[ro.bindPoint].bind >= - pipe.DescSets[bindset].bindings.count) - { - addResourceRow(shaderDetails, stage, bindset, - stage.BindpointMapping.ReadOnlyResources[ro.bindPoint].bind, pipe, - resources, samplers); - } - } - - for(int i = 0; i < shaderDetails->ReadWriteResources.count; i++) - { - const ShaderResource &rw = shaderDetails->ReadWriteResources[i]; - - if(stage.BindpointMapping.ReadWriteResources[rw.bindPoint].bindset == bindset && - stage.BindpointMapping.ReadWriteResources[rw.bindPoint].bind >= - pipe.DescSets[bindset].bindings.count) - { - addResourceRow(shaderDetails, stage, bindset, - stage.BindpointMapping.ReadWriteResources[rw.bindPoint].bind, pipe, - resources, samplers); - } - } - } - } - - // if we have a shader bound, go through and add rows for any resources it wants for descriptor - // sets that aren't - // bound at all - if(shaderDetails != NULL) - { - for(int i = 0; i < shaderDetails->ReadOnlyResources.count; i++) - { - const ShaderResource &ro = shaderDetails->ReadOnlyResources[i]; - - if(stage.BindpointMapping.ReadOnlyResources[ro.bindPoint].bindset >= pipe.DescSets.count) - { - addResourceRow( - shaderDetails, stage, stage.BindpointMapping.ReadOnlyResources[ro.bindPoint].bindset, - stage.BindpointMapping.ReadOnlyResources[ro.bindPoint].bind, pipe, resources, samplers); - } - } - - for(int i = 0; i < shaderDetails->ReadWriteResources.count; i++) - { - const ShaderResource &rw = shaderDetails->ReadWriteResources[i]; - - if(stage.BindpointMapping.ReadWriteResources[rw.bindPoint].bindset >= pipe.DescSets.count) - { - addResourceRow( - shaderDetails, stage, stage.BindpointMapping.ReadWriteResources[rw.bindPoint].bindset, - stage.BindpointMapping.ReadWriteResources[rw.bindPoint].bind, pipe, resources, samplers); - } - } - } - - resources->clearSelection(); - resources->setUpdatesEnabled(true); - resources->verticalScrollBar()->setValue(vs); - - vs = ubos->verticalScrollBar()->value(); - ubos->setUpdatesEnabled(false); - ubos->clear(); - for(int bindset = 0; bindset < pipe.DescSets.count; bindset++) - { - for(int bind = 0; bind < pipe.DescSets[bindset].bindings.count; bind++) - { - addConstantBlockRow(shaderDetails, stage, bindset, bind, pipe, ubos); - } - - // if we have a shader bound, go through and add rows for any cblocks it wants for binds that - // aren't - // in this descriptor set (e.g. if layout mismatches) - if(shaderDetails != NULL) - { - for(int i = 0; i < shaderDetails->ConstantBlocks.count; i++) - { - ConstantBlock &cb = shaderDetails->ConstantBlocks[i]; - - if(stage.BindpointMapping.ConstantBlocks[cb.bindPoint].bindset == bindset && - stage.BindpointMapping.ConstantBlocks[cb.bindPoint].bind >= - pipe.DescSets[bindset].bindings.count) - { - addConstantBlockRow(shaderDetails, stage, bindset, - stage.BindpointMapping.ConstantBlocks[cb.bindPoint].bind, pipe, ubos); - } - } - } - } - - // if we have a shader bound, go through and add rows for any resources it wants for descriptor - // sets that aren't - // bound at all - if(shaderDetails != NULL) - { - for(int i = 0; i < shaderDetails->ConstantBlocks.count; i++) - { - ConstantBlock &cb = shaderDetails->ConstantBlocks[i]; - - if(stage.BindpointMapping.ConstantBlocks[cb.bindPoint].bindset >= pipe.DescSets.count && - cb.bufferBacked) - { - addConstantBlockRow(shaderDetails, stage, - stage.BindpointMapping.ConstantBlocks[cb.bindPoint].bindset, - stage.BindpointMapping.ConstantBlocks[cb.bindPoint].bind, pipe, ubos); - } - } - } - - // search for push constants and add them last - if(shaderDetails != NULL) - { - for(int cb = 0; cb < shaderDetails->ConstantBlocks.count; cb++) - { - ConstantBlock &cblock = shaderDetails->ConstantBlocks[cb]; - if(cblock.bufferBacked == false) - { - // could maybe get range from ShaderVariable.reg if it's filled out - // from SPIR-V side. - - RDTreeWidgetItem *node = - new RDTreeWidgetItem({QString(), QString(), ToQStr(cblock.name), tr("Push constants"), - QString(), tr("%1 Variables").arg(cblock.variables.count)}); - - node->setTag(QVariant::fromValue(VulkanCBufferTag(cb, 0))); - - ubos->addTopLevelItem(node); - } - } - } - ubos->clearSelection(); - ubos->setUpdatesEnabled(true); - ubos->verticalScrollBar()->setValue(vs); -} - -void VulkanPipelineStateViewer::setState() -{ - if(!m_Ctx.LogLoaded()) - { - clearState(); - return; - } - - m_CombinedImageSamplers.clear(); - - const VKPipe::State &state = m_Ctx.CurVulkanPipelineState(); - const DrawcallDescription *draw = m_Ctx.CurDrawcall(); - - bool showDisabled = ui->showDisabled->isChecked(); - bool showEmpty = ui->showEmpty->isChecked(); - - const QPixmap &tick = Pixmaps::tick(this); - const QPixmap &cross = Pixmaps::cross(this); - - bool usedBindings[128] = {}; - - //////////////////////////////////////////////// - // Vertex Input - - int vs = 0; - - vs = ui->viAttrs->verticalScrollBar()->value(); - ui->viAttrs->setUpdatesEnabled(false); - ui->viAttrs->clear(); - { - int i = 0; - for(const VKPipe::VertexAttribute &a : state.VI.attrs) - { - bool filledSlot = true; - bool usedSlot = false; - - QString name = tr("Attribute %1").arg(i); - - if(state.m_VS.Object != ResourceId()) - { - int attrib = -1; - if((int32_t)a.location < state.m_VS.BindpointMapping.InputAttributes.count) - attrib = state.m_VS.BindpointMapping.InputAttributes[a.location]; - - if(attrib >= 0 && attrib < state.m_VS.ShaderDetails->InputSig.count) - { - name = ToQStr(state.m_VS.ShaderDetails->InputSig[attrib].varName); - usedSlot = true; - } - } - - if(showNode(usedSlot, filledSlot)) - { - RDTreeWidgetItem *node = new RDTreeWidgetItem( - {i, name, a.location, a.binding, ToQStr(a.format.strname), a.byteoffset}); - - usedBindings[a.binding] = true; - - if(!usedSlot) - setInactiveRow(node); - - ui->viAttrs->addTopLevelItem(node); - } - - i++; - } - } - ui->viAttrs->clearSelection(); - ui->viAttrs->setUpdatesEnabled(true); - ui->viAttrs->verticalScrollBar()->setValue(vs); - - m_BindNodes.clear(); - - Topology topo = draw != NULL ? draw->topology : Topology::Unknown; - - int numCPs = PatchList_Count(topo); - if(numCPs > 0) - { - ui->topology->setText(tr("PatchList (%1 Control Points)").arg(numCPs)); - } - else - { - ui->topology->setText(ToQStr(topo)); - } - - m_Common.setTopologyDiagram(ui->topologyDiagram, topo); - - ui->primRestart->setVisible(state.IA.primitiveRestartEnable); - - vs = ui->viBuffers->verticalScrollBar()->value(); - ui->viBuffers->setUpdatesEnabled(false); - ui->viBuffers->clear(); - - bool ibufferUsed = draw != NULL && (draw->flags & DrawFlags::UseIBuffer); - - if(state.IA.ibuffer.buf != ResourceId()) - { - if(ibufferUsed || showDisabled) - { - QString name = tr("Buffer ") + ToQStr(state.IA.ibuffer.buf); - uint64_t length = 1; - - if(!ibufferUsed) - length = 0; - - BufferDescription *buf = m_Ctx.GetBuffer(state.IA.ibuffer.buf); - - if(buf) - { - name = ToQStr(buf->name); - length = buf->length; - } - - RDTreeWidgetItem *node = new RDTreeWidgetItem( - {tr("Index"), name, tr("Index"), (qulonglong)state.IA.ibuffer.offs, - draw != NULL ? draw->indexByteWidth : 0, (qulonglong)length, QString()}); - - node->setTag(QVariant::fromValue( - VulkanVBIBTag(state.IA.ibuffer.buf, draw != NULL ? draw->indexOffset : 0))); - - if(!ibufferUsed) - setInactiveRow(node); - - if(state.IA.ibuffer.buf == ResourceId()) - setEmptyRow(node); - - ui->viBuffers->addTopLevelItem(node); - } - } - else - { - if(ibufferUsed || showEmpty) - { - RDTreeWidgetItem *node = new RDTreeWidgetItem( - {tr("Index"), tr("No Buffer Set"), tr("Index"), lit("-"), lit("-"), lit("-"), QString()}); - - node->setTag(QVariant::fromValue( - VulkanVBIBTag(state.IA.ibuffer.buf, draw != NULL ? draw->indexOffset : 0))); - - setEmptyRow(node); - - if(!ibufferUsed) - setInactiveRow(node); - - ui->viBuffers->addTopLevelItem(node); - } - } - - m_VBNodes.clear(); - - { - int i = 0; - for(; i < qMax(state.VI.vbuffers.count, state.VI.binds.count); i++) - { - const VKPipe::VB *vbuff = (i < state.VI.vbuffers.count ? &state.VI.vbuffers[i] : NULL); - const VKPipe::VertexBinding *bind = NULL; - - for(int b = 0; b < state.VI.binds.count; b++) - { - if(state.VI.binds[b].vbufferBinding == (uint32_t)i) - bind = &state.VI.binds[b]; - } - - bool filledSlot = ((vbuff != NULL && vbuff->buffer != ResourceId()) || bind != NULL); - bool usedSlot = (usedBindings[i]); - - if(showNode(usedSlot, filledSlot)) - { - QString name = tr("No Buffer"); - QString rate = lit("-"); - uint64_t length = 1; - uint64_t offset = 0; - uint32_t stride = 0; - - if(vbuff != NULL) - { - name = tr("Buffer ") + ToQStr(vbuff->buffer); - offset = vbuff->offset; - - BufferDescription *buf = m_Ctx.GetBuffer(vbuff->buffer); - if(buf) - { - name = ToQStr(buf->name); - length = buf->length; - } - } - - if(bind != NULL) - { - stride = bind->bytestride; - rate = bind->perInstance ? tr("Instance") : tr("Vertex"); - } - else - { - name += tr(", No Binding"); - } - - RDTreeWidgetItem *node = NULL; - - if(filledSlot) - node = new RDTreeWidgetItem( - {i, name, rate, (qulonglong)offset, stride, (qulonglong)length, QString()}); - else - node = new RDTreeWidgetItem( - {i, tr("No Binding"), lit("-"), lit("-"), lit("-"), lit("-"), QString()}); - - node->setTag(QVariant::fromValue(VulkanVBIBTag(vbuff != NULL ? vbuff->buffer : ResourceId(), - vbuff != NULL ? vbuff->offset : 0))); - - if(!filledSlot || bind == NULL || vbuff == NULL) - setEmptyRow(node); - - if(!usedSlot) - setInactiveRow(node); - - m_VBNodes.push_back(node); - - ui->viBuffers->addTopLevelItem(node); - } - } - - for(; i < (int)ARRAY_COUNT(usedBindings); i++) - { - if(usedBindings[i]) - { - RDTreeWidgetItem *node = new RDTreeWidgetItem( - {i, tr("No Binding"), lit("-"), lit("-"), lit("-"), lit("-"), QString()}); - - node->setTag(QVariant::fromValue(VulkanVBIBTag(ResourceId(), 0))); - - setEmptyRow(node); - - setInactiveRow(node); - - ui->viBuffers->addTopLevelItem(node); - - m_VBNodes.push_back(node); - } - } - } - ui->viBuffers->clearSelection(); - ui->viBuffers->setUpdatesEnabled(true); - ui->viBuffers->verticalScrollBar()->setValue(vs); - - setShaderState(state.m_VS, state.graphics, ui->vsShader, ui->vsResources, ui->vsUBOs); - setShaderState(state.m_GS, state.graphics, ui->gsShader, ui->gsResources, ui->gsUBOs); - setShaderState(state.m_TCS, state.graphics, ui->tcsShader, ui->tcsResources, ui->tcsUBOs); - setShaderState(state.m_TES, state.graphics, ui->tesShader, ui->tesResources, ui->tesUBOs); - setShaderState(state.m_FS, state.graphics, ui->fsShader, ui->fsResources, ui->fsUBOs); - setShaderState(state.m_CS, state.compute, ui->csShader, ui->csResources, ui->csUBOs); - - //////////////////////////////////////////////// - // Rasterizer - - vs = ui->viewports->verticalScrollBar()->value(); - ui->viewports->setUpdatesEnabled(false); - ui->viewports->clear(); - - int vs2 = ui->scissors->verticalScrollBar()->value(); - ui->scissors->setUpdatesEnabled(false); - ui->scissors->clear(); - - if(state.Pass.renderpass.obj != ResourceId()) - { - ui->scissors->addTopLevelItem( - new RDTreeWidgetItem({tr("Render Area"), state.Pass.renderArea.x, state.Pass.renderArea.y, - state.Pass.renderArea.width, state.Pass.renderArea.height})); - } - - { - int i = 0; - for(const VKPipe::ViewportScissor &v : state.VP.viewportScissors) - { - RDTreeWidgetItem *node = new RDTreeWidgetItem( - {i, v.vp.x, v.vp.y, v.vp.width, v.vp.height, v.vp.minDepth, v.vp.maxDepth}); - ui->viewports->addTopLevelItem(node); - - if(v.vp.width == 0 || v.vp.height == 0) - setEmptyRow(node); - - node = new RDTreeWidgetItem({i, v.scissor.x, v.scissor.y, v.scissor.width, v.scissor.height}); - ui->scissors->addTopLevelItem(node); - - if(v.scissor.width == 0 || v.scissor.height == 0) - setEmptyRow(node); - - i++; - } - } - - ui->viewports->verticalScrollBar()->setValue(vs); - ui->viewports->clearSelection(); - ui->scissors->clearSelection(); - ui->scissors->verticalScrollBar()->setValue(vs2); - - ui->viewports->setUpdatesEnabled(true); - ui->scissors->setUpdatesEnabled(true); - - ui->fillMode->setText(ToQStr(state.RS.fillMode)); - ui->cullMode->setText(ToQStr(state.RS.cullMode)); - ui->frontCCW->setPixmap(state.RS.FrontCCW ? tick : cross); - - ui->depthBias->setText(Formatter::Format(state.RS.depthBias)); - ui->depthBiasClamp->setText(Formatter::Format(state.RS.depthBiasClamp)); - ui->slopeScaledBias->setText(Formatter::Format(state.RS.slopeScaledDepthBias)); - - ui->depthClamp->setPixmap(state.RS.depthClampEnable ? tick : cross); - ui->rasterizerDiscard->setPixmap(state.RS.rasterizerDiscardEnable ? tick : cross); - ui->lineWidth->setText(Formatter::Format(state.RS.lineWidth)); - - ui->sampleCount->setText(QString::number(state.MSAA.rasterSamples)); - ui->sampleShading->setPixmap(state.MSAA.sampleShadingEnable ? tick : cross); - ui->minSampleShading->setText(Formatter::Format(state.MSAA.minSampleShading)); - ui->sampleMask->setText(Formatter::Format(state.MSAA.sampleMask, true)); - ui->alphaToOne->setPixmap(state.CB.alphaToOneEnable ? tick : cross); - ui->alphaToCoverage->setPixmap(state.CB.alphaToCoverageEnable ? tick : cross); - - //////////////////////////////////////////////// - // Output Merger - - bool targets[32] = {}; - - vs = ui->framebuffer->verticalScrollBar()->value(); - ui->framebuffer->setUpdatesEnabled(false); - ui->framebuffer->clear(); - { - int i = 0; - for(const VKPipe::Attachment &p : state.Pass.framebuffer.attachments) - { - int colIdx = -1; - for(int c = 0; c < state.Pass.renderpass.colorAttachments.count; c++) - { - if(state.Pass.renderpass.colorAttachments[c] == (uint)i) - { - colIdx = c; - break; - } - } - int resIdx = -1; - for(int c = 0; c < state.Pass.renderpass.resolveAttachments.count; c++) - { - if(state.Pass.renderpass.resolveAttachments[c] == (uint)i) - { - resIdx = c; - break; - } - } - - bool filledSlot = (p.img != ResourceId()); - bool usedSlot = - (colIdx >= 0 || resIdx >= 0 || state.Pass.renderpass.depthstencilAttachment == i); - - if(showNode(usedSlot, filledSlot)) - { - uint32_t w = 1, h = 1, d = 1; - uint32_t a = 1; - QString format = ToQStr(p.viewfmt.strname); - QString name = tr("Texture ") + ToQStr(p.img); - QString typeName = tr("Unknown"); - - if(p.img == ResourceId()) - { - name = tr("Empty"); - format = lit("-"); - typeName = lit("-"); - w = h = d = a = 0; - } - - TextureDescription *tex = m_Ctx.GetTexture(p.img); - if(tex) - { - w = tex->width; - h = tex->height; - d = tex->depth; - a = tex->arraysize; - name = ToQStr(tex->name); - typeName = ToQStr(tex->resType); - - if(!tex->customName && state.m_FS.ShaderDetails != NULL) - { - for(int s = 0; s < state.m_FS.ShaderDetails->OutputSig.count; s++) - { - if(state.m_FS.ShaderDetails->OutputSig[s].regIndex == (uint32_t)colIdx && - (state.m_FS.ShaderDetails->OutputSig[s].systemValue == ShaderBuiltin::Undefined || - state.m_FS.ShaderDetails->OutputSig[s].systemValue == ShaderBuiltin::ColorOutput)) - { - name = QFormatStr("<%1>").arg(ToQStr(state.m_FS.ShaderDetails->OutputSig[s].varName)); - } - } - } - } - - if(p.swizzle[0] != TextureSwizzle::Red || p.swizzle[1] != TextureSwizzle::Green || - p.swizzle[2] != TextureSwizzle::Blue || p.swizzle[3] != TextureSwizzle::Alpha) - { - format += tr(" swizzle[%1%2%3%4]") - .arg(ToQStr(p.swizzle[0])) - .arg(ToQStr(p.swizzle[1])) - .arg(ToQStr(p.swizzle[2])) - .arg(ToQStr(p.swizzle[3])); - } - - QString slotname; - - if(colIdx >= 0) - slotname = QFormatStr("Color %1").arg(i); - else if(resIdx >= 0) - slotname = QFormatStr("Resolve %1").arg(i); - else - slotname = lit("Depth"); - - RDTreeWidgetItem *node = - new RDTreeWidgetItem({slotname, name, typeName, w, h, d, a, format, QString()}); - - if(tex) - node->setTag(QVariant::fromValue(p.img)); - - if(p.img == ResourceId()) - { - setEmptyRow(node); - } - else if(!usedSlot) - { - setInactiveRow(node); - } - else - { - targets[i] = true; - } - - setViewDetails(node, p, tex); - - ui->framebuffer->addTopLevelItem(node); - } - - i++; - } - } - - ui->framebuffer->clearSelection(); - ui->framebuffer->setUpdatesEnabled(true); - ui->framebuffer->verticalScrollBar()->setValue(vs); - - vs = ui->blends->verticalScrollBar()->value(); - ui->blends->setUpdatesEnabled(false); - ui->blends->clear(); - { - int i = 0; - for(const VKPipe::Blend &blend : state.CB.attachments) - { - bool filledSlot = true; - bool usedSlot = (targets[i]); - - if(showNode(usedSlot, filledSlot)) - { - RDTreeWidgetItem *node = new RDTreeWidgetItem( - {i, blend.blendEnable ? tr("True") : tr("False"), - - ToQStr(blend.blend.Source), ToQStr(blend.blend.Destination), - ToQStr(blend.blend.Operation), - - ToQStr(blend.alphaBlend.Source), ToQStr(blend.alphaBlend.Destination), - ToQStr(blend.alphaBlend.Operation), - - QFormatStr("%1%2%3%4") - .arg((blend.writeMask & 0x1) == 0 ? lit("_") : lit("R")) - .arg((blend.writeMask & 0x2) == 0 ? lit("_") : lit("G")) - .arg((blend.writeMask & 0x4) == 0 ? lit("_") : lit("B")) - .arg((blend.writeMask & 0x8) == 0 ? lit("_") : lit("A"))}); - - if(!filledSlot) - setEmptyRow(node); - - if(!usedSlot) - setInactiveRow(node); - - ui->blends->addTopLevelItem(node); - } - - i++; - } - } - ui->blends->clearSelection(); - ui->blends->setUpdatesEnabled(true); - ui->blends->verticalScrollBar()->setValue(vs); - - ui->blendFactor->setText(QFormatStr("%1, %2, %3, %4") - .arg(state.CB.blendConst[0], 0, 'f', 2) - .arg(state.CB.blendConst[1], 0, 'f', 2) - .arg(state.CB.blendConst[2], 0, 'f', 2) - .arg(state.CB.blendConst[3], 0, 'f', 2)); - ui->logicOp->setText(state.CB.logicOpEnable ? ToQStr(state.CB.logic) : lit("-")); - - ui->depthEnabled->setPixmap(state.DS.depthTestEnable ? tick : cross); - ui->depthFunc->setText(ToQStr(state.DS.depthCompareOp)); - ui->depthWrite->setPixmap(state.DS.depthWriteEnable ? tick : cross); - - if(state.DS.depthBoundsEnable) - { - ui->depthBounds->setText(Formatter::Format(state.DS.minDepthBounds) + lit("-") + - Formatter::Format(state.DS.maxDepthBounds)); - ui->depthBounds->setPixmap(QPixmap()); - } - else - { - ui->depthBounds->setText(QString()); - ui->depthBounds->setPixmap(cross); - } - - ui->stencils->setUpdatesEnabled(false); - ui->stencils->clear(); - if(state.DS.stencilTestEnable) - { - ui->stencils->addTopLevelItem(new RDTreeWidgetItem( - {tr("Front"), ToQStr(state.DS.front.Func), ToQStr(state.DS.front.FailOp), - ToQStr(state.DS.front.DepthFailOp), ToQStr(state.DS.front.PassOp), - Formatter::Format(state.DS.front.writeMask, true), - Formatter::Format(state.DS.front.compareMask, true), - Formatter::Format(state.DS.front.ref, true)})); - ui->stencils->addTopLevelItem( - new RDTreeWidgetItem({tr("Back"), ToQStr(state.DS.back.Func), ToQStr(state.DS.back.FailOp), - ToQStr(state.DS.back.DepthFailOp), ToQStr(state.DS.back.PassOp), - Formatter::Format(state.DS.back.writeMask, true), - Formatter::Format(state.DS.back.compareMask, true), - Formatter::Format(state.DS.back.ref, true)})); - } - else - { - ui->stencils->addTopLevelItem(new RDTreeWidgetItem( - {tr("Front"), lit("-"), lit("-"), lit("-"), lit("-"), lit("-"), lit("-"), lit("-")})); - ui->stencils->addTopLevelItem(new RDTreeWidgetItem( - {tr("Back"), lit("-"), lit("-"), lit("-"), lit("-"), lit("-"), lit("-"), lit("-")})); - } - ui->stencils->clearSelection(); - ui->stencils->setUpdatesEnabled(true); - - // highlight the appropriate stages in the flowchart - if(draw == NULL) - { - ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true}); - } - else if(draw->flags & DrawFlags::Dispatch) - { - ui->pipeFlow->setStagesEnabled({false, false, false, false, false, false, false, false, true}); - } - else - { - ui->pipeFlow->setStagesEnabled( - {true, true, state.m_TCS.Object != ResourceId(), state.m_TES.Object != ResourceId(), - state.m_GS.Object != ResourceId(), true, state.m_FS.Object != ResourceId(), true, false}); - } -} - -QString VulkanPipelineStateViewer::formatMembers(int indent, const QString &nameprefix, - const rdctype::array &vars) -{ - QString indentstr(indent * 4, QLatin1Char(' ')); - - QString ret = QString(); - - int i = 0; - - for(const ShaderConstant &v : vars) - { - if(v.type.members.count > 0) - { - if(i > 0) - ret += lit("\n"); - ret += indentstr + lit("// struct %1\n").arg(ToQStr(v.type.descriptor.name)); - ret += indentstr + lit("{\n") + - formatMembers(indent + 1, ToQStr(v.name) + lit("_"), v.type.members) + indentstr + - lit("}\n"); - if(i < vars.count - 1) - ret += lit("\n"); - } - else - { - QString arr = QString(); - if(v.type.descriptor.elements > 1) - arr = QFormatStr("[%1]").arg(v.type.descriptor.elements); - ret += QFormatStr("%1%2 %3%4%5;\n") - .arg(indentstr) - .arg(ToQStr(v.type.descriptor.name)) - .arg(nameprefix) - .arg(ToQStr(v.name)) - .arg(arr); - } - - i++; - } - - return ret; -} - -void VulkanPipelineStateViewer::resource_itemActivated(RDTreeWidgetItem *item, int column) -{ - const VKPipe::Shader *stage = stageForSender(item->treeWidget()); - - if(stage == NULL) - return; - - QVariant tag = item->tag(); - - if(tag.canConvert()) - { - TextureDescription *tex = m_Ctx.GetTexture(tag.value()); - - if(tex) - { - if(tex->resType == TextureDim::Buffer) - { - IBufferViewer *viewer = m_Ctx.ViewTextureAsBuffer(0, 0, tex->ID); - - m_Ctx.AddDockWindow(viewer->Widget(), DockReference::AddTo, this); - } - else - { - if(!m_Ctx.HasTextureViewer()) - m_Ctx.ShowTextureViewer(); - ITextureViewer *viewer = m_Ctx.GetTextureViewer(); - viewer->ViewTexture(tex->ID, true); - } - - return; - } - } - else if(tag.canConvert()) - { - VulkanBufferTag buf = tag.value(); - - const ShaderResource &shaderRes = buf.rwRes - ? stage->ShaderDetails->ReadWriteResources[buf.bindPoint] - : stage->ShaderDetails->ReadOnlyResources[buf.bindPoint]; - - QString format = lit("// struct %1\n").arg(ToQStr(shaderRes.variableType.descriptor.name)); - - if(shaderRes.variableType.members.count > 1) - { - format += lit("// members skipped as they are fixed size:\n"); - for(int i = 0; i < shaderRes.variableType.members.count - 1; i++) - format += QFormatStr("%1 %2;\n") - .arg(ToQStr(shaderRes.variableType.members[i].type.descriptor.name)) - .arg(ToQStr(shaderRes.variableType.members[i].name)); - } - - if(shaderRes.variableType.members.count > 0) - { - format += lit("{\n") + - formatMembers(1, QString(), shaderRes.variableType.members.back().type.members) + - lit("}"); - } - else - { - const auto &desc = shaderRes.variableType.descriptor; - - format = QString(); - if(desc.rowMajorStorage) - format += lit("row_major "); - - format += ToQStr(desc.type); - if(desc.rows > 1 && desc.cols > 1) - format += QFormatStr("%1x%2").arg(desc.rows).arg(desc.cols); - else if(desc.cols > 1) - format += desc.cols; - - if(desc.name.count > 0) - format += lit(" ") + ToQStr(desc.name); - - if(desc.elements > 1) - format += QFormatStr("[%1]").arg(desc.elements); - } - - if(buf.ID != ResourceId()) - { - IBufferViewer *viewer = m_Ctx.ViewBuffer(buf.offset, buf.size, buf.ID, format); - - m_Ctx.AddDockWindow(viewer->Widget(), DockReference::AddTo, this); - } - } -} - -void VulkanPipelineStateViewer::ubo_itemActivated(RDTreeWidgetItem *item, int column) -{ - const VKPipe::Shader *stage = stageForSender(item->treeWidget()); - - if(stage == NULL) - return; - - QVariant tag = item->tag(); - - if(!tag.canConvert()) - return; - - VulkanCBufferTag cb = tag.value(); - - IConstantBufferPreviewer *prev = m_Ctx.ViewConstantBuffer(stage->stage, cb.slotIdx, cb.arrayIdx); - - m_Ctx.AddDockWindow(prev->Widget(), DockReference::RightOf, this, 0.3f); -} - -void VulkanPipelineStateViewer::on_viAttrs_itemActivated(RDTreeWidgetItem *item, int column) -{ - on_meshView_clicked(); -} - -void VulkanPipelineStateViewer::on_viBuffers_itemActivated(RDTreeWidgetItem *item, int column) -{ - QVariant tag = item->tag(); - - if(tag.canConvert()) - { - VulkanVBIBTag buf = tag.value(); - - if(buf.id != ResourceId()) - { - IBufferViewer *viewer = m_Ctx.ViewBuffer(buf.offset, UINT64_MAX, buf.id); - - m_Ctx.AddDockWindow(viewer->Widget(), DockReference::AddTo, this); - } - } -} - -void VulkanPipelineStateViewer::highlightIABind(int slot) -{ - int idx = ((slot + 1) * 21) % 32; // space neighbouring colours reasonably distinctly - - const VKPipe::VertexInput &VI = m_Ctx.CurVulkanPipelineState().VI; - - QColor col = QColor::fromHslF(float(idx) / 32.0f, 1.0f, - qBound(0.05, palette().color(QPalette::Base).lightnessF(), 0.95)); - - ui->viAttrs->beginUpdate(); - ui->viBuffers->beginUpdate(); - - if(slot < m_VBNodes.count()) - { - m_VBNodes[slot]->setBackgroundColor(col); - m_VBNodes[slot]->setForegroundColor(contrastingColor(col, QColor(0, 0, 0))); - } - - if(slot < m_BindNodes.count()) - { - m_BindNodes[slot]->setBackgroundColor(col); - m_BindNodes[slot]->setForegroundColor(contrastingColor(col, QColor(0, 0, 0))); - } - - for(int i = 0; i < ui->viAttrs->topLevelItemCount(); i++) - { - RDTreeWidgetItem *item = ui->viAttrs->topLevelItem(i); - - if((int)VI.attrs[i].binding != slot) - { - item->setBackground(QBrush()); - item->setForeground(QBrush()); - } - else - { - item->setBackgroundColor(col); - item->setForegroundColor(contrastingColor(col, QColor(0, 0, 0))); - } - } - - ui->viAttrs->endUpdate(); - ui->viBuffers->endUpdate(); -} - -void VulkanPipelineStateViewer::on_viAttrs_mouseMove(QMouseEvent *e) -{ - if(!m_Ctx.LogLoaded()) - return; - - QModelIndex idx = ui->viAttrs->indexAt(e->pos()); - - vertex_leave(NULL); - - const VKPipe::VertexInput &VI = m_Ctx.CurVulkanPipelineState().VI; - - if(idx.isValid()) - { - if(idx.row() >= 0 && idx.row() < VI.attrs.count) - { - uint32_t binding = VI.attrs[idx.row()].binding; - - highlightIABind((int)binding); - } - } -} - -void VulkanPipelineStateViewer::on_viBuffers_mouseMove(QMouseEvent *e) -{ - if(!m_Ctx.LogLoaded()) - return; - - RDTreeWidgetItem *item = ui->viBuffers->itemAt(e->pos()); - - vertex_leave(NULL); - - if(item) - { - int idx = m_VBNodes.indexOf(item); - if(idx >= 0) - { - highlightIABind(idx); - } - else - { - item->setBackground(ui->viBuffers->palette().brush(QPalette::Window)); - item->setForeground(ui->viBuffers->palette().brush(QPalette::WindowText)); - } - } -} - -void VulkanPipelineStateViewer::vertex_leave(QEvent *e) -{ - ui->viAttrs->beginUpdate(); - ui->viBuffers->beginUpdate(); - - for(int i = 0; i < ui->viAttrs->topLevelItemCount(); i++) - { - ui->viAttrs->topLevelItem(i)->setBackground(QBrush()); - ui->viAttrs->topLevelItem(i)->setForeground(QBrush()); - } - - for(int i = 0; i < ui->viBuffers->topLevelItemCount(); i++) - { - ui->viBuffers->topLevelItem(i)->setBackground(QBrush()); - ui->viBuffers->topLevelItem(i)->setForeground(QBrush()); - } - - ui->viAttrs->endUpdate(); - ui->viBuffers->endUpdate(); -} - -void VulkanPipelineStateViewer::on_pipeFlow_stageSelected(int index) -{ - ui->stagesTabs->setCurrentIndex(index); -} - -void VulkanPipelineStateViewer::shaderView_clicked() -{ - const VKPipe::Shader *stage = stageForSender(qobject_cast(QObject::sender())); - - if(stage == NULL || stage->Object == ResourceId()) - return; - - ShaderReflection *shaderDetails = stage->ShaderDetails; - - IShaderViewer *shad = m_Ctx.ViewShader(&stage->BindpointMapping, shaderDetails, stage->stage); - - m_Ctx.AddDockWindow(shad->Widget(), DockReference::AddTo, this); -} - -void VulkanPipelineStateViewer::shaderLabel_clicked(QMouseEvent *event) -{ - // forward to shaderView_clicked, we only need this to handle the different parameter, and we - // can't use a lambda because then QObject::sender() is NULL - shaderView_clicked(); -} - -void VulkanPipelineStateViewer::shaderEdit_clicked() -{ - QWidget *sender = qobject_cast(QObject::sender()); - const VKPipe::Shader *stage = stageForSender(sender); - - if(!stage || stage->Object == ResourceId()) - return; - - const ShaderReflection *shaderDetails = stage->ShaderDetails; - - if(!shaderDetails) - return; - - QString entryFunc = lit("EditedShader%1S").arg(ToQStr(stage->stage, GraphicsAPI::Vulkan)[0]); - - QString mainfile; - - QStringMap files; - - bool hasOrigSource = m_Common.PrepareShaderEditing(shaderDetails, entryFunc, files, mainfile); - - if(hasOrigSource) - { - if(files.empty()) - return; - } - else - { - QString glsl; - - if(!m_Ctx.Config().SPIRVDisassemblers.isEmpty()) - glsl = disassembleSPIRV(shaderDetails); - - mainfile = lit("generated.glsl"); - - files[mainfile] = glsl; - - if(glsl.isEmpty()) - { - m_Ctx.Replay().AsyncInvoke( - [this, stage, shaderDetails, entryFunc, mainfile](IReplayController *r) { - rdctype::str disasm = r->DisassembleShader(shaderDetails, ""); - - GUIInvoke::call([this, stage, shaderDetails, entryFunc, mainfile, disasm]() { - QStringMap fileMap; - fileMap[mainfile] = ToQStr(disasm); - m_Common.EditShader(stage->stage, stage->Object, shaderDetails, entryFunc, fileMap, - mainfile); - }); - }); - return; - } - } - - m_Common.EditShader(stage->stage, stage->Object, shaderDetails, entryFunc, files, mainfile); -} - -QString VulkanPipelineStateViewer::disassembleSPIRV(const ShaderReflection *shaderDetails) -{ - QString glsl; - - const SPIRVDisassembler &disasm = m_Ctx.Config().SPIRVDisassemblers[0]; - - if(disasm.executable.isEmpty()) - return QString(); - - QString spv_bin_file = QDir(QDir::tempPath()).absoluteFilePath(lit("spv_bin.spv")); - - QFile binHandle(spv_bin_file); - if(binHandle.open(QFile::WriteOnly | QIODevice::Truncate)) - { - binHandle.write( - QByteArray((const char *)shaderDetails->RawBytes.elems, shaderDetails->RawBytes.count)); - binHandle.close(); - } - else - { - RDDialog::critical(this, tr("Error writing temp file"), - tr("Couldn't write temporary SPIR-V file %1.").arg(spv_bin_file)); - return QString(); - } - - if(!disasm.args.contains(lit("{spv_bin}"))) - { - RDDialog::critical( - this, tr("Wrongly configured disassembler"), - tr("Please use {spv_bin} in the disassembler arguments to specify the input file.")); - return QString(); - } - - LambdaThread *thread = new LambdaThread([this, &glsl, &disasm, spv_bin_file]() { - QString spv_disas_file = QDir(QDir::tempPath()).absoluteFilePath(lit("spv_disas.txt")); - - QString args = disasm.args; - - bool writesToFile = disasm.args.contains(lit("{spv_disas}")); - - args.replace(lit("{spv_bin}"), spv_bin_file); - args.replace(lit("{spv_disas}"), spv_disas_file); - - QStringList argList = ParseArgsList(args); - - QProcess process; - process.start(disasm.executable, argList); - process.waitForFinished(); - - if(process.exitStatus() != QProcess::NormalExit || process.exitCode() != 0) - { - GUIInvoke::call([this]() { - RDDialog::critical(this, tr("Error running disassembler"), - tr("There was an error invoking the external SPIR-V disassembler.")); - }); - } - - if(writesToFile) - { - QFile outputHandle(spv_disas_file); - if(outputHandle.open(QFile::ReadOnly | QIODevice::Text)) - { - glsl = QString::fromUtf8(outputHandle.readAll()); - outputHandle.close(); - } - } - else - { - glsl = QString::fromUtf8(process.readAll()); - } - - QFile::remove(spv_bin_file); - QFile::remove(spv_disas_file); - }); - thread->start(); - - ShowProgressDialog(this, tr("Please wait - running external disassembler"), - [thread]() { return !thread->isRunning(); }); - - thread->deleteLater(); - - return glsl; -} - -void VulkanPipelineStateViewer::shaderSave_clicked() -{ - const VKPipe::Shader *stage = stageForSender(qobject_cast(QObject::sender())); - - if(stage == NULL) - return; - - ShaderReflection *shaderDetails = stage->ShaderDetails; - - if(stage->Object == ResourceId()) - return; - - m_Common.SaveShaderFile(shaderDetails); -} - -void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, VKPipe::VertexInput &vi) -{ - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Attributes")); - xml.writeEndElement(); - - QList rows; - - for(const VKPipe::VertexAttribute &attr : vi.attrs) - rows.push_back({attr.location, attr.binding, ToQStr(attr.format.strname), attr.byteoffset}); - - m_Common.exportHTMLTable(xml, {tr("Location"), tr("Binding"), tr("Format"), tr("Offset")}, rows); - } - - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Bindings")); - xml.writeEndElement(); - - QList rows; - - for(const VKPipe::VertexBinding &attr : vi.binds) - rows.push_back({attr.vbufferBinding, attr.bytestride, - attr.perInstance ? tr("PER_INSTANCE") : tr("PER_VERTEX")}); - - m_Common.exportHTMLTable(xml, {tr("Binding"), tr("Byte Stride"), tr("Step Rate")}, rows); - } - - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Vertex Buffers")); - xml.writeEndElement(); - - QList rows; - - int i = 0; - for(const VKPipe::VB &vb : vi.vbuffers) - { - QString name = tr("Buffer %1").arg(ToQStr(vb.buffer)); - uint64_t length = 0; - - if(vb.buffer == ResourceId()) - { - continue; - } - else - { - BufferDescription *buf = m_Ctx.GetBuffer(vb.buffer); - if(buf) - { - name = ToQStr(buf->name); - length = buf->length; - } - } - - rows.push_back({i, name, (qulonglong)vb.offset, (qulonglong)length}); - - i++; - } - - m_Common.exportHTMLTable(xml, {tr("Binding"), tr("Buffer"), tr("Offset"), tr("Byte Length")}, - rows); - } -} - -void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, VKPipe::InputAssembly &ia) -{ - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Index Buffer")); - xml.writeEndElement(); - - BufferDescription *ib = m_Ctx.GetBuffer(ia.ibuffer.buf); - - QString name = tr("Empty"); - uint64_t length = 0; - - if(ib) - { - name = ToQStr(ib->name); - length = ib->length; - } - - QString ifmt = lit("UNKNOWN"); - if(m_Ctx.CurDrawcall()->indexByteWidth == 2) - ifmt = lit("UINT16"); - if(m_Ctx.CurDrawcall()->indexByteWidth == 4) - ifmt = lit("UINT32"); - - m_Common.exportHTMLTable( - xml, {tr("Buffer"), tr("Format"), tr("Offset"), tr("Byte Length"), tr("Primitive Restart")}, - {name, ifmt, (qulonglong)ia.ibuffer.offs, (qulonglong)length, - ia.primitiveRestartEnable ? tr("Yes") : tr("No")}); - } - - xml.writeStartElement(lit("p")); - xml.writeEndElement(); - - m_Common.exportHTMLTable( - xml, {tr("Primitive Topology"), tr("Tessellation Control Points")}, - {ToQStr(m_Ctx.CurDrawcall()->topology), m_Ctx.CurVulkanPipelineState().Tess.numControlPoints}); -} - -void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, VKPipe::Shader &sh) -{ - ShaderReflection *shaderDetails = sh.ShaderDetails; - - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Shader")); - xml.writeEndElement(); - - QString shadername = tr("Unknown"); - - if(sh.Object == ResourceId()) - shadername = tr("Unbound"); - else - shadername = ToQStr(sh.name); - - if(shaderDetails) - { - QString entryFunc = ToQStr(shaderDetails->EntryPoint); - if(entryFunc != lit("main")) - shadername = QFormatStr("%1()").arg(entryFunc); - else if(shaderDetails->DebugInfo.files.count > 0) - shadername = QFormatStr("%1() - %2") - .arg(entryFunc) - .arg(QFileInfo(ToQStr(shaderDetails->DebugInfo.files[0].first)).fileName()); - } - - xml.writeStartElement(lit("p")); - xml.writeCharacters(shadername); - xml.writeEndElement(); - - if(sh.Object == ResourceId()) - return; - } - - const VKPipe::Pipeline &pipeline = - (sh.stage == ShaderStage::Compute ? m_Ctx.CurVulkanPipelineState().compute - : m_Ctx.CurVulkanPipelineState().graphics); - - if(shaderDetails && shaderDetails->ConstantBlocks.count > 0) - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("UBOs")); - xml.writeEndElement(); - - QList rows; - - for(int i = 0; i < shaderDetails->ConstantBlocks.count; i++) - { - const ConstantBlock &b = shaderDetails->ConstantBlocks[i]; - const BindpointMap &bindMap = sh.BindpointMapping.ConstantBlocks[i]; - - if(!bindMap.used) - continue; - - const VKPipe::DescriptorSet &set = - pipeline.DescSets[sh.BindpointMapping.ConstantBlocks[i].bindset]; - const VKPipe::DescriptorBinding &bind = - set.bindings[sh.BindpointMapping.ConstantBlocks[i].bind]; - - QString setname = QString::number(bindMap.bindset); - - QString slotname = QFormatStr("%1: %2").arg(bindMap.bind).arg(ToQStr(b.name)); - - for(uint32_t a = 0; a < bind.descriptorCount; a++) - { - const VKPipe::BindingElement &descriptorBind = bind.binds[a]; - - ResourceId id = bind.binds[a].res; - - if(bindMap.arraySize > 1) - slotname = QFormatStr("%1: %2[%3]").arg(bindMap.bind).arg(ToQStr(b.name)).arg(a); - - QString name; - uint64_t byteOffset = descriptorBind.offset; - uint64_t length = descriptorBind.size; - int numvars = b.variables.count; - - if(descriptorBind.res == ResourceId()) - { - name = tr("Empty"); - length = 0; - } - - BufferDescription *buf = m_Ctx.GetBuffer(id); - if(buf) - { - name = ToQStr(buf->name); - - if(length == UINT64_MAX) - length = buf->length - byteOffset; - } - - if(name.isEmpty()) - name = tr("UBO %1").arg(ToQStr(descriptorBind.res)); - - // push constants - if(!b.bufferBacked) - { - setname = QString(); - slotname = ToQStr(b.name); - name = tr("Push constants"); - byteOffset = 0; - length = 0; - - // could maybe get range/size from ShaderVariable.reg if it's filled out - // from SPIR-V side. - } - - rows.push_back({setname, slotname, name, (qulonglong)byteOffset, (qulonglong)length, - numvars, b.byteSize}); - } - } - - m_Common.exportHTMLTable(xml, {tr("Set"), tr("Bind"), tr("Buffer"), tr("Byte Offset"), - tr("Byte Size"), tr("Number of Variables"), tr("Bytes Needed")}, - rows); - } - - if(shaderDetails->ReadOnlyResources.count > 0) - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Read-only Resources")); - xml.writeEndElement(); - - QList rows; - - for(int i = 0; i < shaderDetails->ReadOnlyResources.count; i++) - { - const ShaderResource &b = shaderDetails->ReadOnlyResources[i]; - const BindpointMap &bindMap = sh.BindpointMapping.ReadOnlyResources[i]; - - if(!bindMap.used) - continue; - - const VKPipe::DescriptorSet &set = - pipeline.DescSets[sh.BindpointMapping.ReadOnlyResources[i].bindset]; - const VKPipe::DescriptorBinding &bind = - set.bindings[sh.BindpointMapping.ReadOnlyResources[i].bind]; - - QString setname = QString::number(bindMap.bindset); - - QString slotname = QFormatStr("%1: %2").arg(bindMap.bind).arg(ToQStr(b.name)); - - for(uint32_t a = 0; a < bind.descriptorCount; a++) - { - const VKPipe::BindingElement &descriptorBind = bind.binds[a]; - - ResourceId id = bind.binds[a].res; - - if(bindMap.arraySize > 1) - slotname = QFormatStr("%1: %2[%3]").arg(bindMap.bind).arg(ToQStr(b.name)).arg(a); - - QString name; - - if(descriptorBind.res == ResourceId()) - name = tr("Empty"); - - BufferDescription *buf = m_Ctx.GetBuffer(id); - if(buf) - name = ToQStr(buf->name); - - TextureDescription *tex = m_Ctx.GetTexture(id); - if(tex) - name = ToQStr(tex->name); - - if(name.isEmpty()) - name = tr("Resource %1").arg(ToQStr(descriptorBind.res)); - - uint64_t w = 1; - uint32_t h = 1, d = 1; - uint32_t arr = 0; - QString format = tr("Unknown"); - QString viewParams; - - if(tex) - { - w = tex->width; - h = tex->height; - d = tex->depth; - arr = tex->arraysize; - format = ToQStr(tex->format.strname); - name = ToQStr(tex->name); - - if(tex->mips > 1) - { - viewParams = tr("Mips: %1-%2") - .arg(descriptorBind.baseMip) - .arg(descriptorBind.baseMip + descriptorBind.numMip - 1); - } - - if(tex->arraysize > 1) - { - if(!viewParams.isEmpty()) - viewParams += lit(", "); - viewParams += tr("Layers: %1-%2") - .arg(descriptorBind.baseLayer) - .arg(descriptorBind.baseLayer + descriptorBind.numLayer - 1); - } - } - - if(buf) - { - w = buf->length; - h = 0; - d = 0; - a = 0; - format = lit("-"); - name = ToQStr(buf->name); - - uint64_t length = descriptorBind.size; - - if(length == UINT64_MAX) - length = buf->length - descriptorBind.offset; - - viewParams = - tr("Byte Range: %1 - %2").arg(descriptorBind.offset).arg(descriptorBind.offset + length); - } - - if(bind.type != BindType::Sampler) - rows.push_back({setname, slotname, name, ToQStr(bind.type), (qulonglong)w, h, d, arr, - format, viewParams}); - - if(bind.type == BindType::ImageSampler || bind.type == BindType::Sampler) - { - name = tr("Sampler %1").arg(ToQStr(descriptorBind.sampler)); - - if(bind.type == BindType::ImageSampler) - setname = slotname = QString(); - - QVariantList sampDetails = makeSampler(QString(), QString(), descriptorBind); - rows.push_back({setname, slotname, name, ToQStr(bind.type), QString(), QString(), - QString(), QString(), sampDetails[5], sampDetails[6]}); - } - } - } - - m_Common.exportHTMLTable( - xml, {tr("Set"), tr("Bind"), tr("Buffer"), tr("Resource Type"), tr("Width"), tr("Height"), - tr("Depth"), tr("Array Size"), tr("Resource Format"), tr("View Parameters")}, - rows); - } - - if(shaderDetails->ReadWriteResources.count > 0) - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Read-write Resources")); - xml.writeEndElement(); - - QList rows; - - for(int i = 0; i < shaderDetails->ReadWriteResources.count; i++) - { - const ShaderResource &b = shaderDetails->ReadWriteResources[i]; - const BindpointMap &bindMap = sh.BindpointMapping.ReadWriteResources[i]; - - if(!bindMap.used) - continue; - - const VKPipe::DescriptorSet &set = - pipeline.DescSets[sh.BindpointMapping.ReadWriteResources[i].bindset]; - const VKPipe::DescriptorBinding &bind = - set.bindings[sh.BindpointMapping.ReadWriteResources[i].bind]; - - QString setname = QString::number(bindMap.bindset); - - QString slotname = QFormatStr("%1: %2").arg(bindMap.bind).arg(ToQStr(b.name)); - - for(uint32_t a = 0; a < bind.descriptorCount; a++) - { - const VKPipe::BindingElement &descriptorBind = bind.binds[a]; - - ResourceId id = bind.binds[a].res; - - if(bindMap.arraySize > 1) - slotname = QFormatStr("%1: %2[%3]").arg(bindMap.bind).arg(ToQStr(b.name)).arg(a); - - QString name; - - if(descriptorBind.res == ResourceId()) - name = tr("Empty"); - - BufferDescription *buf = m_Ctx.GetBuffer(id); - if(buf) - name = ToQStr(buf->name); - - TextureDescription *tex = m_Ctx.GetTexture(id); - if(tex) - name = ToQStr(tex->name); - - if(name.isEmpty()) - name = tr("Resource %1").arg(ToQStr(descriptorBind.res)); - - uint64_t w = 1; - uint32_t h = 1, d = 1; - uint32_t arr = 0; - QString format = tr("Unknown"); - QString viewParams; - - if(tex) - { - w = tex->width; - h = tex->height; - d = tex->depth; - arr = tex->arraysize; - format = ToQStr(tex->format.strname); - name = ToQStr(tex->name); - - if(tex->mips > 1) - { - viewParams = tr("Mips: %1-%2") - .arg(descriptorBind.baseMip) - .arg(descriptorBind.baseMip + descriptorBind.numMip - 1); - } - - if(tex->arraysize > 1) - { - if(!viewParams.isEmpty()) - viewParams += lit(", "); - viewParams += tr("Layers: %1-%2") - .arg(descriptorBind.baseLayer) - .arg(descriptorBind.baseLayer + descriptorBind.numLayer - 1); - } - } - - if(buf) - { - w = buf->length; - h = 0; - d = 0; - a = 0; - format = lit("-"); - name = ToQStr(buf->name); - - uint64_t length = descriptorBind.size; - - if(length == UINT64_MAX) - length = buf->length - descriptorBind.offset; - - viewParams = - tr("Byte Range: %1 - %2").arg(descriptorBind.offset).arg(descriptorBind.offset + length); - } - - rows.push_back({setname, slotname, name, ToQStr(bind.type), (qulonglong)w, h, d, arr, - format, viewParams}); - } - } - - m_Common.exportHTMLTable( - xml, {tr("Set"), tr("Bind"), tr("Buffer"), tr("Resource Type"), tr("Width"), tr("Height"), - tr("Depth"), tr("Array Size"), tr("Resource Format"), tr("View Parameters")}, - rows); - } -} - -void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, VKPipe::Raster &rs) -{ - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Raster State")); - xml.writeEndElement(); - - m_Common.exportHTMLTable( - xml, {tr("Fill Mode"), tr("Cull Mode"), tr("Front CCW")}, - {ToQStr(rs.fillMode), ToQStr(rs.cullMode), rs.FrontCCW ? tr("Yes") : tr("No")}); - - xml.writeStartElement(lit("p")); - xml.writeEndElement(); - - m_Common.exportHTMLTable(xml, {tr("Depth Clip Enable"), tr("Rasterizer Discard Enable")}, - {rs.depthClampEnable ? tr("Yes") : tr("No"), - rs.rasterizerDiscardEnable ? tr("Yes") : tr("No")}); - - xml.writeStartElement(lit("p")); - xml.writeEndElement(); - - m_Common.exportHTMLTable( - xml, {tr("Depth Bias"), tr("Depth Bias Clamp"), tr("Slope Scaled Bias"), tr("Line Width")}, - {Formatter::Format(rs.depthBias), Formatter::Format(rs.depthBiasClamp), - Formatter::Format(rs.slopeScaledDepthBias), Formatter::Format(rs.lineWidth)}); - } - - VKPipe::MultiSample &msaa = m_Ctx.CurVulkanPipelineState().MSAA; - - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Multisampling State")); - xml.writeEndElement(); - - m_Common.exportHTMLTable( - xml, {tr("Raster Samples"), tr("Sample-rate shading"), tr("Min Sample Shading Rate"), - tr("Sample Mask")}, - {msaa.rasterSamples, msaa.sampleShadingEnable ? tr("Yes") : tr("No"), - Formatter::Format(msaa.minSampleShading), Formatter::Format(msaa.sampleMask, true)}); - } - - VKPipe::ViewState &vp = m_Ctx.CurVulkanPipelineState().VP; - - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Viewports")); - xml.writeEndElement(); - - QList rows; - - int i = 0; - for(const VKPipe::ViewportScissor &vs : vp.viewportScissors) - { - const VKPipe::Viewport &v = vs.vp; - - rows.push_back({i, v.x, v.y, v.width, v.height, v.minDepth, v.maxDepth}); - - i++; - } - - m_Common.exportHTMLTable(xml, {tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height"), - tr("Min Depth"), tr("Max Depth")}, - rows); - } - - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Scissors")); - xml.writeEndElement(); - - QList rows; - - int i = 0; - for(const VKPipe::ViewportScissor &vs : vp.viewportScissors) - { - const VKPipe::Scissor &s = vs.scissor; - - rows.push_back({i, s.x, s.y, s.width, s.height}); - - i++; - } - - m_Common.exportHTMLTable(xml, {tr("Slot"), tr("X"), tr("Y"), tr("Width"), tr("Height")}, rows); - } -} - -void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, VKPipe::ColorBlend &cb) -{ - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Color Blend State")); - xml.writeEndElement(); - - QString blendConst = QFormatStr("%1, %2, %3, %4") - .arg(cb.blendConst[0], 0, 'f', 2) - .arg(cb.blendConst[1], 0, 'f', 2) - .arg(cb.blendConst[2], 0, 'f', 2) - .arg(cb.blendConst[3], 0, 'f', 2); - - m_Common.exportHTMLTable( - xml, {tr("Alpha to Coverage"), tr("Alpha to One"), tr("Logic Op"), tr("Blend Constant")}, - { - cb.alphaToCoverageEnable ? tr("Yes") : tr("No"), - cb.alphaToOneEnable ? tr("Yes") : tr("No"), - cb.logicOpEnable ? ToQStr(cb.logic) : tr("Disabled"), blendConst, - }); - - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Attachment Blends")); - xml.writeEndElement(); - - QList rows; - - int i = 0; - for(const VKPipe::Blend &b : cb.attachments) - { - rows.push_back( - {i, b.blendEnable ? tr("Yes") : tr("No"), ToQStr(b.blend.Source), ToQStr(b.blend.Destination), - ToQStr(b.blend.Operation), ToQStr(b.alphaBlend.Source), ToQStr(b.alphaBlend.Destination), - ToQStr(b.alphaBlend.Operation), ((b.writeMask & 0x1) == 0 ? lit("_") : lit("R")) + - ((b.writeMask & 0x2) == 0 ? lit("_") : lit("G")) + - ((b.writeMask & 0x4) == 0 ? lit("_") : lit("B")) + - ((b.writeMask & 0x8) == 0 ? lit("_") : lit("A"))}); - - i++; - } - - m_Common.exportHTMLTable( - xml, - { - tr("Slot"), tr("Blend Enable"), tr("Blend Source"), tr("Blend Destination"), - tr("Blend Operation"), tr("Alpha Blend Source"), tr("Alpha Blend Destination"), - tr("Alpha Blend Operation"), tr("Write Mask"), - }, - rows); -} - -void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, VKPipe::DepthStencil &ds) -{ - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Depth State")); - xml.writeEndElement(); - - m_Common.exportHTMLTable( - xml, {tr("Depth Test Enable"), tr("Depth Writes Enable"), tr("Depth Function"), - tr("Depth Bounds")}, - { - ds.depthTestEnable ? tr("Yes") : tr("No"), ds.depthWriteEnable ? tr("Yes") : tr("No"), - ToQStr(ds.depthCompareOp), ds.depthBoundsEnable - ? QFormatStr("%1 - %2") - .arg(Formatter::Format(ds.minDepthBounds)) - .arg(Formatter::Format(ds.maxDepthBounds)) - : tr("Disabled"), - }); - } - - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Stencil State")); - xml.writeEndElement(); - - if(ds.stencilTestEnable) - { - QList rows; - - rows.push_back({ - tr("Front"), Formatter::Format(ds.front.ref, true), - Formatter::Format(ds.front.compareMask, true), - Formatter::Format(ds.front.writeMask, true), ToQStr(ds.front.Func), - ToQStr(ds.front.PassOp), ToQStr(ds.front.FailOp), ToQStr(ds.front.DepthFailOp), - }); - - rows.push_back({ - tr("back"), Formatter::Format(ds.back.ref, true), - Formatter::Format(ds.back.compareMask, true), Formatter::Format(ds.back.writeMask, true), - ToQStr(ds.back.Func), ToQStr(ds.back.PassOp), ToQStr(ds.back.FailOp), - ToQStr(ds.back.DepthFailOp), - }); - - m_Common.exportHTMLTable(xml, - {tr("Face"), tr("Ref"), tr("Compare Mask"), tr("Write Mask"), - tr("Function"), tr("Pass Op"), tr("Fail Op"), tr("Depth Fail Op")}, - rows); - } - else - { - xml.writeStartElement(lit("p")); - xml.writeCharacters(tr("Disabled")); - xml.writeEndElement(); - } - } -} - -void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, VKPipe::CurrentPass &pass) -{ - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Framebuffer")); - xml.writeEndElement(); - - m_Common.exportHTMLTable( - xml, {tr("Width"), tr("Height"), tr("Layers")}, - {pass.framebuffer.width, pass.framebuffer.height, pass.framebuffer.layers}); - - QList rows; - - int i = 0; - for(const VKPipe::Attachment &a : pass.framebuffer.attachments) - { - TextureDescription *tex = m_Ctx.GetTexture(a.img); - - QString name = tr("Image %1").arg(ToQStr(a.img)); - - if(tex) - name = ToQStr(tex->name); - - rows.push_back({i, name, a.baseMip, a.numMip, a.baseLayer, a.numLayer}); - - i++; - } - - m_Common.exportHTMLTable(xml, - { - tr("Slot"), tr("Image"), tr("First mip"), tr("Number of mips"), - tr("First array layer"), tr("Number of layers"), - }, - rows); - } - - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Render Pass")); - xml.writeEndElement(); - - if(pass.renderpass.inputAttachments.count > 0) - { - QList inputs; - - for(int i = 0; i < pass.renderpass.inputAttachments.count; i++) - inputs.push_back({pass.renderpass.inputAttachments[i]}); - - m_Common.exportHTMLTable(xml, - { - tr("Input Attachment"), - }, - inputs); - - xml.writeStartElement(lit("p")); - xml.writeEndElement(); - } - - if(pass.renderpass.colorAttachments.count > 0) - { - QList colors; - - for(int i = 0; i < pass.renderpass.colorAttachments.count; i++) - colors.push_back({pass.renderpass.colorAttachments[i]}); - - m_Common.exportHTMLTable(xml, - { - tr("Color Attachment"), - }, - colors); - - xml.writeStartElement(lit("p")); - xml.writeEndElement(); - } - - if(pass.renderpass.depthstencilAttachment >= 0) - { - xml.writeStartElement(lit("p")); - xml.writeCharacters( - tr("Depth-stencil Attachment: %1").arg(pass.renderpass.depthstencilAttachment)); - xml.writeEndElement(); - } - } - - { - xml.writeStartElement(lit("h3")); - xml.writeCharacters(tr("Render Area")); - xml.writeEndElement(); - - m_Common.exportHTMLTable( - xml, {tr("X"), tr("Y"), tr("Width"), tr("Height")}, - {pass.renderArea.x, pass.renderArea.y, pass.renderArea.width, pass.renderArea.height}); - } -} - -void VulkanPipelineStateViewer::on_exportHTML_clicked() -{ - QXmlStreamWriter *xmlptr = m_Common.beginHTMLExport(); - - if(xmlptr) - { - QXmlStreamWriter &xml = *xmlptr; - - const QStringList &stageNames = ui->pipeFlow->stageNames(); - const QStringList &stageAbbrevs = ui->pipeFlow->stageAbbreviations(); - - int stage = 0; - for(const QString &sn : stageNames) - { - xml.writeStartElement(lit("div")); - xml.writeStartElement(lit("a")); - xml.writeAttribute(lit("name"), stageAbbrevs[stage]); - xml.writeEndElement(); - xml.writeEndElement(); - - xml.writeStartElement(lit("div")); - xml.writeAttribute(lit("class"), lit("stage")); - - xml.writeStartElement(lit("h1")); - xml.writeCharacters(sn); - xml.writeEndElement(); - - switch(stage) - { - case 0: - // VTX - xml.writeStartElement(lit("h2")); - xml.writeCharacters(tr("Input Assembly")); - xml.writeEndElement(); - exportHTML(xml, m_Ctx.CurVulkanPipelineState().IA); - - xml.writeStartElement(lit("h2")); - xml.writeCharacters(tr("Vertex Input")); - xml.writeEndElement(); - exportHTML(xml, m_Ctx.CurVulkanPipelineState().VI); - break; - case 1: exportHTML(xml, m_Ctx.CurVulkanPipelineState().m_VS); break; - case 2: exportHTML(xml, m_Ctx.CurVulkanPipelineState().m_TCS); break; - case 3: exportHTML(xml, m_Ctx.CurVulkanPipelineState().m_TES); break; - case 4: exportHTML(xml, m_Ctx.CurVulkanPipelineState().m_GS); break; - case 5: exportHTML(xml, m_Ctx.CurVulkanPipelineState().RS); break; - case 6: exportHTML(xml, m_Ctx.CurVulkanPipelineState().m_FS); break; - case 7: - // FB - xml.writeStartElement(lit("h2")); - xml.writeCharacters(tr("Color Blend")); - xml.writeEndElement(); - exportHTML(xml, m_Ctx.CurVulkanPipelineState().CB); - - xml.writeStartElement(lit("h2")); - xml.writeCharacters(tr("Depth Stencil")); - xml.writeEndElement(); - exportHTML(xml, m_Ctx.CurVulkanPipelineState().DS); - - xml.writeStartElement(lit("h2")); - xml.writeCharacters(tr("Current Pass")); - xml.writeEndElement(); - exportHTML(xml, m_Ctx.CurVulkanPipelineState().Pass); - break; - case 8: exportHTML(xml, m_Ctx.CurVulkanPipelineState().m_CS); break; - } - - xml.writeEndElement(); - - stage++; - } - - m_Common.endHTMLExport(xmlptr); - } -} - -void VulkanPipelineStateViewer::on_meshView_clicked() -{ - if(!m_Ctx.HasMeshPreview()) - m_Ctx.ShowMeshPreview(); - ToolWindowManager::raiseToolWindow(m_Ctx.GetMeshPreview()->Widget()); -} diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h deleted file mode 100644 index 18b6e3615..000000000 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h +++ /dev/null @@ -1,135 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2016-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. - ******************************************************************************/ - -#pragma once - -#include -#include "Code/CaptureContext.h" - -namespace Ui -{ -class VulkanPipelineStateViewer; -} - -class QXmlStreamWriter; - -class RDTreeWidget; -class RDTreeWidgetItem; -class PipelineStateViewer; - -struct SamplerData -{ - SamplerData() : node(NULL) {} - QList images; - RDTreeWidgetItem *node; -}; - -class VulkanPipelineStateViewer : public QFrame, public ILogViewer -{ - Q_OBJECT - -public: - explicit VulkanPipelineStateViewer(ICaptureContext &ctx, PipelineStateViewer &common, - QWidget *parent = 0); - ~VulkanPipelineStateViewer(); - - void OnLogfileLoaded(); - void OnLogfileClosed(); - void OnSelectedEventChanged(uint32_t eventID) {} - void OnEventChanged(uint32_t eventID); - -private slots: - // automatic slots - void on_showDisabled_toggled(bool checked); - void on_showEmpty_toggled(bool checked); - void on_exportHTML_clicked(); - void on_meshView_clicked(); - void on_viAttrs_itemActivated(RDTreeWidgetItem *item, int column); - void on_viBuffers_itemActivated(RDTreeWidgetItem *item, int column); - void on_viAttrs_mouseMove(QMouseEvent *event); - void on_viBuffers_mouseMove(QMouseEvent *event); - void on_pipeFlow_stageSelected(int index); - - // manual slots - void shaderView_clicked(); - void shaderLabel_clicked(QMouseEvent *event); - void shaderEdit_clicked(); - - void shaderSave_clicked(); - void resource_itemActivated(RDTreeWidgetItem *item, int column); - void ubo_itemActivated(RDTreeWidgetItem *item, int column); - void vertex_leave(QEvent *e); - -private: - Ui::VulkanPipelineStateViewer *ui; - ICaptureContext &m_Ctx; - PipelineStateViewer &m_Common; - - QVariantList makeSampler(const QString &bindset, const QString &slotname, - const VKPipe::BindingElement &descriptor); - void addResourceRow(ShaderReflection *shaderDetails, const VKPipe::Shader &stage, int bindset, - int bind, const VKPipe::Pipeline &pipe, RDTreeWidget *resources, - QMap &samplers); - void addConstantBlockRow(ShaderReflection *shaderDetails, const VKPipe::Shader &stage, - int bindset, int bind, const VKPipe::Pipeline &pipe, RDTreeWidget *ubos); - - void setShaderState(const VKPipe::Shader &stage, const VKPipe::Pipeline &pipe, QLabel *shader, - RDTreeWidget *res, RDTreeWidget *ubo); - void clearShaderState(QLabel *shader, RDTreeWidget *res, RDTreeWidget *ubo); - void setState(); - void clearState(); - - void setInactiveRow(RDTreeWidgetItem *node); - void setEmptyRow(RDTreeWidgetItem *node); - void highlightIABind(int slot); - - QString formatMembers(int indent, const QString &nameprefix, - const rdctype::array &vars); - const VKPipe::Shader *stageForSender(QWidget *widget); - - QString disassembleSPIRV(const ShaderReflection *shaderDetails); - - template - void setViewDetails(RDTreeWidgetItem *node, const viewType &view, TextureDescription *tex); - - template - void setViewDetails(RDTreeWidgetItem *node, const viewType &view, BufferDescription *buf); - - bool showNode(bool usedSlot, bool filledSlot); - - void exportHTML(QXmlStreamWriter &xml, VKPipe::VertexInput &vi); - void exportHTML(QXmlStreamWriter &xml, VKPipe::InputAssembly &ia); - void exportHTML(QXmlStreamWriter &xml, VKPipe::Shader &sh); - void exportHTML(QXmlStreamWriter &xml, VKPipe::Raster &rs); - void exportHTML(QXmlStreamWriter &xml, VKPipe::ColorBlend &cb); - void exportHTML(QXmlStreamWriter &xml, VKPipe::DepthStencil &ds); - void exportHTML(QXmlStreamWriter &xml, VKPipe::CurrentPass &pass); - - // keep track of the VB nodes (we want to be able to highlight them easily on hover) - QList m_VBNodes; - QList m_BindNodes; - - // from an combined image to its sampler (since we de-duplicate) - QMap m_CombinedImageSamplers; -}; diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.ui b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.ui deleted file mode 100644 index 1f714a7f6..000000000 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.ui +++ /dev/null @@ -1,3329 +0,0 @@ - - - VulkanPipelineStateViewer - - - - 0 - 0 - 911 - 566 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::Panel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Display Controls - - - 4 - - - - - - - Qt::Vertical - - - - - - - Show Disabled Items - - - Show Disabled Items - - - - :/page_white_delete.png:/page_white_delete.png - - - true - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Show Empty Items - - - Show Empty Items - - - - :/page_white_database.png:/page_white_database.png - - - true - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Export the current pipeline state to an HTML file - - - Export - - - - :/save.png:/save.png - - - false - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 12 - - - - - - - - 0 - - - true - - - - Vertex Input - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - true - - - - - 0 - 0 - 911 - 511 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Attributes - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - 0 - - - false - - - false - - - true - - - false - - - false - - - - - - - - - - - 0 - 0 - - - - Buffers - - - - 2 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - 0 - - - false - - - false - - - true - - - false - - - false - - - - - - - - - - - 0 - 0 - - - - Mesh View - - - - - - - 0 - 0 - - - - - 75 - 75 - - - - PointingHandCursor - - - View the mesh input data - - - :/wireframe_mesh.png - - - true - - - - - - - - - - - 0 - 0 - - - - Primitive Topology - - - - - - - 14 - - - - Triangle List - - - Qt::AlignHCenter|Qt::AlignTop - - - - - - - - 0 - 0 - - - - - 256 - 0 - - - - - - - :/topologies/topo_trilist.svg - - - Qt::AlignCenter - - - - - - - - 14 - - - - Primitive Restart Enabled - - - Qt::AlignBottom|Qt::AlignHCenter - - - - - - - - - - - - - - - Vertex Shader - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Shader - - - - 0 - - - 0 - - - 4 - - - - - - 250 - 0 - - - - PointingHandCursor - - - Open Shader Source - - - QFrame::Box - - - - - - - - - - PointingHandCursor - - - Open Shader Source - - - View - - - - :/action.png:/action.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Edit Shader - - - Edit - - - - :/page_white_edit.png:/page_white_edit.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Save Shader SPIR-V - - - Save - - - - :/save.png:/save.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Qt::Horizontal - - - - 576 - 20 - - - - - - - - - - - QFrame::NoFrame - - - true - - - - - 0 - 0 - 911 - 462 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Resources - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - 0 - 0 - - - - Uniform Buffers - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - - - - - Tess Control Shader - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Shader - - - - 0 - - - 0 - - - 4 - - - - - - 250 - 0 - - - - PointingHandCursor - - - Open Shader Source - - - QFrame::Box - - - - - - - - - - PointingHandCursor - - - Open Shader Source - - - View - - - - :/action.png:/action.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Edit Shader - - - Edit - - - - :/page_white_edit.png:/page_white_edit.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Save Shader SPIR-V - - - Save - - - - :/save.png:/save.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Qt::Horizontal - - - - 576 - 20 - - - - - - - - - - - QFrame::NoFrame - - - true - - - - - 0 - 0 - 911 - 462 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Resources - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - 0 - 0 - - - - Uniform Buffers - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - - - - - Tess Eval Shader - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Shader - - - - 0 - - - 0 - - - 4 - - - - - - 250 - 0 - - - - PointingHandCursor - - - Open Shader Source - - - QFrame::Box - - - - - - - - - - PointingHandCursor - - - Open Shader Source - - - View - - - - :/action.png:/action.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Edit Shader - - - Edit - - - - :/page_white_edit.png:/page_white_edit.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Save Shader SPIR-V - - - Save - - - - :/save.png:/save.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Qt::Horizontal - - - - 576 - 20 - - - - - - - - - - - QFrame::NoFrame - - - true - - - - - 0 - 0 - 911 - 462 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Resources - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - 0 - 0 - - - - Uniform Buffers - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - - - - - Geometry Shader - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Shader - - - - 0 - - - 0 - - - 4 - - - - - - 250 - 0 - - - - PointingHandCursor - - - Open Shader Source - - - QFrame::Box - - - - - - - - - - PointingHandCursor - - - Open Shader Source - - - View - - - - :/action.png:/action.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Edit Shader - - - Edit - - - - :/page_white_edit.png:/page_white_edit.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Save Shader SPIR-V - - - Save - - - - :/save.png:/save.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Qt::Horizontal - - - - 576 - 20 - - - - - - - - - - - QFrame::NoFrame - - - true - - - - - 0 - 0 - 911 - 462 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Resources - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - 0 - 0 - - - - Uniform Buffers - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - - - - - Rasterizer - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Rasterizer State - - - - 2 - - - 2 - - - 2 - - - 2 - - - 0 - - - - - Depth Bias Clamp: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - Fill Mode: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - - 12 - - - - 0.00 - - - Qt::AlignCenter - - - 4 - - - - - - - Slope-Scaled Bias: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - - 12 - - - - Solid - - - Qt::AlignCenter - - - 4 - - - - - - - - - - :/cross.png - - - Qt::AlignCenter - - - 4 - - - - - - - Front CCW: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - Cull Mode: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - Depth Bias: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - Line Width: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - - 12 - - - - None - - - Qt::AlignCenter - - - 4 - - - - - - - - 12 - - - - 0.00 - - - Qt::AlignCenter - - - 4 - - - - - - - - - - :/cross.png - - - Qt::AlignCenter - - - 4 - - - - - - - Rasterizer Discard: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - Depth Clamp: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - - - - :/cross.png - - - Qt::AlignCenter - - - 4 - - - - - - - - 12 - - - - 0.00 - - - Qt::AlignCenter - - - 4 - - - - - - - - 12 - - - - 0.00 - - - Qt::AlignCenter - - - 4 - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 0 - 0 - - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 0 - 0 - - - - - - - - - - - - 0 - 0 - - - - Scissor Regions - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - 0 - - - false - - - true - - - 50 - - - - - - - - - - - 0 - 0 - - - - Viewports - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - 0 - - - false - - - true - - - 50 - - - - - - - - - - Multisample State - - - - 2 - - - 2 - - - 2 - - - 2 - - - 0 - - - - - Min Sample Shading: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - - 12 - - - - 0 - - - Qt::AlignCenter - - - 4 - - - - - - - Sample Mask: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - Sample Shading: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - - 12 - - - - 0.00 - - - Qt::AlignCenter - - - 4 - - - - - - - Sample Count: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - - 12 - - - - FFFFFFFF - - - Qt::AlignCenter - - - 4 - - - - - - - - - - :/cross.png - - - Qt::AlignCenter - - - 4 - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 0 - 0 - - - - - - - - Alpha to 1: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - :/cross.png - - - Qt::AlignCenter - - - 4 - - - - - - - Alpha to Coverage: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - :/cross.png - - - Qt::AlignCenter - - - 4 - - - - - - - - - - - Fragment Shader - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Shader - - - - 0 - - - 0 - - - 4 - - - - - - 250 - 0 - - - - PointingHandCursor - - - Open Shader Source - - - QFrame::Box - - - - - - - - - - PointingHandCursor - - - Open Shader Source - - - View - - - - :/action.png:/action.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Edit Shader - - - Edit - - - - :/page_white_edit.png:/page_white_edit.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Save Shader SPIR-V - - - Save - - - - :/save.png:/save.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Qt::Horizontal - - - - 576 - 20 - - - - - - - - - - - QFrame::NoFrame - - - true - - - - - 0 - 0 - 911 - 462 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Resources - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - 0 - 0 - - - - Uniform Buffers - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - - - - - Framebuffer - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::NoFrame - - - true - - - - - 0 - 0 - 911 - 511 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Framebuffer Attachments - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractScrollArea::AdjustToContents - - - QAbstractItemView::NoEditTriggers - - - false - - - 0 - - - false - - - false - - - true - - - false - - - false - - - - - - - - - - - 0 - 0 - - - - Target Blends - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractScrollArea::AdjustToContents - - - QAbstractItemView::NoEditTriggers - - - false - - - 0 - - - false - - - false - - - true - - - false - - - - - - - - - - - 0 - 0 - - - - Blend State - - - - 2 - - - 2 - - - 2 - - - 2 - - - 0 - - - - - Blend Factor: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - - 12 - - - - 0.00, 0.00, 0.00, 0.00 - - - Qt::AlignCenter - - - 4 - - - - - - - Logic Op: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - - - - 12 - - - - - - - - Qt::AlignCenter - - - 4 - - - - - - - - - - - 0 - 0 - - - - Depth State - - - - 2 - - - 2 - - - 2 - - - 2 - - - 0 - - - - - Enabled: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - :/cross.png - - - Qt::AlignCenter - - - 4 - - - - - - - Bounds: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - :/cross.png - - - Qt::AlignCenter - - - 4 - - - - - - - Write: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - :/cross.png - - - Qt::AlignCenter - - - 4 - - - - - - - Func: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 12 - - - - GREATER_EQUAL - - - Qt::AlignCenter - - - 4 - - - - - - - - - - - 0 - 0 - - - - Stencil State - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - 0 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - 0 - 0 - - - - QFrame::Box - - - QFrame::Plain - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAsNeeded - - - QAbstractScrollArea::AdjustToContents - - - QAbstractItemView::NoEditTriggers - - - false - - - QAbstractItemView::NoSelection - - - 0 - - - false - - - false - - - true - - - false - - - false - - - - - - - - - - - - - - - Compute Shader - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Shader - - - - 0 - - - 0 - - - 4 - - - - - - 250 - 0 - - - - PointingHandCursor - - - Open Shader Source - - - QFrame::Box - - - - - - - - - - PointingHandCursor - - - Open Shader Source - - - View - - - - :/action.png:/action.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Edit Shader - - - Edit - - - - :/page_white_edit.png:/page_white_edit.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Save Shader SPIR-V - - - Save - - - - :/save.png:/save.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Qt::Horizontal - - - - 576 - 20 - - - - - - - - - - - QFrame::NoFrame - - - true - - - - - 0 - 0 - 911 - 462 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Resources - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - 0 - 0 - - - - Uniform Buffers - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - true - - - true - - - false - - - - - - - - - - - - - - - - - - - RDLabel - QLabel -
Widgets/Extended/RDLabel.h
-
- - RDTreeWidget - QTreeView -
Widgets/Extended/RDTreeWidget.h
-
- - PipelineFlowChart - QFrame -
Widgets/PipelineFlowChart.h
- 1 -
-
- - - - -
diff --git a/qrenderdoc/Windows/PixelHistoryView.cpp b/qrenderdoc/Windows/PixelHistoryView.cpp deleted file mode 100644 index 16bf24464..000000000 --- a/qrenderdoc/Windows/PixelHistoryView.cpp +++ /dev/null @@ -1,785 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 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. - ******************************************************************************/ - -#include "PixelHistoryView.h" -#include -#include -#include -#include -#include "3rdparty/toolwindowmanager/ToolWindowManager.h" -#include "ui_PixelHistoryView.h" - -struct EventTag -{ - uint32_t eventID = 0; - uint32_t primitive = ~0U; -}; - -Q_DECLARE_METATYPE(EventTag); - -class PixelHistoryItemModel : public QAbstractItemModel -{ -public: - PixelHistoryItemModel(ICaptureContext &ctx, ResourceId tex, const TextureDisplay &display, - QObject *parent) - : QAbstractItemModel(parent), m_Ctx(ctx) - { - m_Tex = m_Ctx.GetTexture(tex); - m_Display = display; - - CompType compType = m_Tex->format.compType; - - if(compType == CompType::Typeless) - compType = display.typeHint; - - m_IsUint = (compType == CompType::UInt); - m_IsSint = (compType == CompType::SInt); - m_IsFloat = (!m_IsUint && !m_IsSint); - - if(compType == CompType::Depth) - m_IsDepth = true; - - if(m_Tex->format.special) - { - switch(m_Tex->format.specialFormat) - { - case SpecialFormat::D16S8: - case SpecialFormat::D24S8: - case SpecialFormat::D32S8: - case SpecialFormat::S8: m_IsDepth = true; break; - default: break; - } - } - } - - void setHistory(const rdctype::array &history) - { - m_ModList.reserve(history.count); - for(const PixelModification &h : history) - m_ModList.push_back(h); - - m_Loading = false; - - emit beginResetModel(); - - setShowFailures(true); - - emit endResetModel(); - } - - void setShowFailures(bool show) - { - emit beginResetModel(); - - m_History.clear(); - m_History.reserve(m_ModList.count()); - for(const PixelModification &h : m_ModList) - { - if(!show && !h.passed()) - continue; - - if(m_History.isEmpty() || m_History.back().back().eventID != h.eventID) - m_History.push_back({h}); - else - m_History.back().push_back(h); - } - - emit endResetModel(); - } - - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override - { - if(row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount()) - return QModelIndex(); - - return createIndex(row, column, makeTag(row, parent)); - } - - QModelIndex parent(const QModelIndex &index) const override - { - if(m_Loading || isEvent(index)) - return QModelIndex(); - - int eventRow = getEventRow(index); - - return createIndex(eventRow, 0, makeTag(eventRow, QModelIndex())); - } - int rowCount(const QModelIndex &parent = QModelIndex()) const override - { - if(m_Loading) - return parent.isValid() ? 0 : 1; - - if(!parent.isValid()) - return m_History.count(); - - if(isEvent(parent)) - { - const QList &mods = getMods(parent); - const DrawcallDescription *draw = m_Ctx.GetDrawcall(mods.front().eventID); - - if(draw && draw->flags & DrawFlags::Clear) - return 0; - - return mods.count(); - } - - return 0; - } - int columnCount(const QModelIndex &parent = QModelIndex()) const override { return 5; } - Qt::ItemFlags flags(const QModelIndex &index) const override - { - if(!index.isValid()) - return 0; - - return QAbstractItemModel::flags(index); - } - - QVariant headerData(int section, Qt::Orientation orientation, int role) const override - { - if(orientation == Qt::Horizontal && role == Qt::DisplayRole && section == 0) - return lit("Event"); - - // sizes for the colour previews - if(orientation == Qt::Horizontal && role == Qt::SizeHintRole && (section == 2 || section == 4)) - return QSize(18, 0); - - return QVariant(); - } - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override - { - if(index.isValid()) - { - int col = index.column(); - - // preview columns - if(col == 2 || col == 4) - { - if(role == Qt::SizeHintRole) - return QSize(16, 0); - } - - if(m_Loading) - { - if(role == Qt::DisplayRole && col == 0) - return tr("Loading..."); - - return QVariant(); - } - - if(role == Qt::DisplayRole) - { - // main text - if(col == 0) - { - if(isEvent(index)) - { - const QList &mods = getMods(index); - const DrawcallDescription *drawcall = m_Ctx.GetDrawcall(mods.front().eventID); - if(!drawcall) - return QVariant(); - - QString ret; - QList drawstack; - const DrawcallDescription *parent = m_Ctx.GetDrawcall(drawcall->parent); - while(parent) - { - drawstack.push_back(parent); - parent = m_Ctx.GetDrawcall(parent->parent); - } - - if(!drawstack.isEmpty()) - { - ret += lit("> ") + ToQStr(drawstack.back()->name); - - if(drawstack.count() > 3) - ret += lit(" ..."); - - ret += lit("\n"); - - if(drawstack.count() > 2) - ret += lit("> ") + ToQStr(drawstack[1]->name) + lit("\n"); - if(drawstack.count() > 1) - ret += lit("> ") + ToQStr(drawstack[0]->name) + lit("\n"); - - ret += lit("\n"); - } - - bool passed = true; - bool uavnowrite = false; - - if(mods.front().directShaderWrite) - { - ret += tr("EID %1\n%2\nBound as UAV or copy - potential modification") - .arg(mods.front().eventID) - .arg(ToQStr(drawcall->name)); - - if(memcmp(mods[0].preMod.col.value_u, mods[0].postMod.col.value_u, - sizeof(uint32_t) * 4) == 0) - { - ret += tr("\nNo change in tex value"); - uavnowrite = true; - } - } - else - { - passed = false; - for(const PixelModification &m : mods) - passed |= m.passed(); - - QString failure = passed ? QString() : failureString(mods[0]); - - ret += tr("EID %1\n%2%3\n%4 Fragments touching pixel\n") - .arg(mods.front().eventID) - .arg(ToQStr(drawcall->name)) - .arg(failure) - .arg(mods.count()); - } - - return ret; - } - else - { - const PixelModification &mod = getMod(index); - - if(mod.directShaderWrite) - { - QString ret = tr("Potential UAV/Copy write"); - - if(mod.preMod.col.value_u[0] == mod.postMod.col.value_u[0] && - mod.preMod.col.value_u[1] == mod.postMod.col.value_u[1] && - mod.preMod.col.value_u[2] == mod.postMod.col.value_u[2] && - mod.preMod.col.value_u[3] == mod.postMod.col.value_u[3]) - { - ret += tr("\nNo change in tex value"); - } - - return ret; - } - else - { - QString ret = tr("Primitive %1\n").arg(mod.primitiveID); - - if(mod.shaderDiscarded) - ret += failureString(mod); - - return ret; - } - } - } - - // pre mod/shader out text - if(col == 1) - { - if(isEvent(index)) - { - return tr("Tex Before\n\n") + modString(getMods(index).first().preMod); - } - else - { - const PixelModification &mod = getMod(index); - if(mod.unboundPS) - return tr("No Pixel\nShader\nBound"); - if(mod.directShaderWrite) - return tr("Tex Before\n\n") + modString(mod.preMod); - return tr("Shader Out\n\n") + modString(mod.shaderOut); - } - } - - // post mod text - if(col == 3) - { - if(isEvent(index)) - return tr("Tex After\n\n") + modString(getMods(index).last().postMod); - else - return tr("Tex After\n\n") + modString(getMod(index).shaderOut); - } - } - - if(role == Qt::BackgroundRole && (m_IsDepth || m_IsFloat)) - { - // pre mod color - if(col == 2) - { - if(isEvent(index)) - return backgroundBrush(getMods(index).first().preMod); - else - return backgroundBrush(getMod(index).shaderOut); - } - else if(col == 4) - { - if(isEvent(index)) - return backgroundBrush(getMods(index).last().postMod); - else - return backgroundBrush(getMod(index).postMod); - } - } - - // text backgrounds marking pass/fail - if(role == Qt::BackgroundRole && (col == 0 || col == 1 || col == 3)) - { - // rest - if(isEvent(index)) - { - const QList &mods = getMods(index); - - bool passed = false; - for(const PixelModification &m : mods) - passed |= m.passed(); - - if(mods[0].directShaderWrite && - memcmp(mods[0].preMod.col.value_u, mods[0].postMod.col.value_u, sizeof(uint32_t) * 4) == - 0) - return QBrush(QColor::fromRgb(235, 235, 235)); - - return passed ? QBrush(QColor::fromRgb(235, 255, 235)) - : QBrush(QColor::fromRgb(255, 235, 235)); - } - else - { - if(getMod(index).shaderDiscarded) - return QBrush(QColor::fromRgb(255, 235, 235)); - } - } - - if(role == Qt::UserRole) - { - EventTag tag; - - if(isEvent(index)) - { - tag.eventID = getMods(index).first().eventID; - } - else - { - const PixelModification &mod = getMod(index); - - tag.eventID = mod.eventID; - if(!mod.directShaderWrite) - tag.primitive = mod.primitiveID; - } - - return QVariant::fromValue(tag); - } - } - - return QVariant(); - } - - const QVector &modifications() { return m_ModList; } - ResourceId texID() { return m_Tex->ID; } -private: - ICaptureContext &m_Ctx; - - const TextureDescription *m_Tex; - TextureDisplay m_Display; - bool m_IsDepth = false, m_IsUint = false, m_IsSint = false, m_IsFloat = true; - - bool m_Loading = true; - QVector> m_History; - QVector m_ModList; - - // mask for top bit of quintptr - static const quintptr eventTagMask = 1ULL << (Q_PROCESSOR_WORDSIZE * 8 - 1); - - // 1 byte on 32-bit, 2 bytes on 64-bit - static const quintptr modRowBits = Q_PROCESSOR_WORDSIZE * 2; - - // mask without top bit and however many bits we have for modification mask - static const quintptr eventRowMask = UINTPTR_MAX >> (1 + modRowBits); - - static const quintptr modRowMask = (1 << modRowBits) - 1; - - inline bool isEvent(QModelIndex parent) const { return parent.internalId() & eventTagMask; } - int getEventRow(QModelIndex index) const - { - if(isEvent(index)) - return index.row(); - else - return (index.internalId() & ~eventTagMask) >> modRowBits; - } - - int getModRow(QModelIndex index) const { return int(index.internalId() & modRowMask); } - const QList &getMods(QModelIndex index) const - { - return m_History[index.row()]; - } - - const PixelModification &getMod(QModelIndex index) const - { - return m_History[getEventRow(index)][getModRow(index)]; - } - - quintptr makeTag(int row, QModelIndex parent) const - { - if(!parent.isValid()) - { - // event - return eventTagMask | row; - } - else - { - // modification - if(quintptr(row) > modRowMask) - qCritical() << "Packing failure - more than 255 modifications in one event"; - - return ((parent.internalId() & eventRowMask) << modRowBits) | (quintptr(row) & modRowMask); - } - } - - QBrush backgroundBrush(const ModificationValue &val) const - { - float rangesize = (m_Display.rangemax - m_Display.rangemin); - - float r = val.col.value_f[0]; - float g = val.col.value_f[1]; - float b = val.col.value_f[2]; - - if(!m_Display.Red) - r = 0.0f; - if(!m_Display.Green) - g = 0.0f; - if(!m_Display.Blue) - b = 0.0f; - - if(m_Display.Red && !m_Display.Green && !m_Display.Blue && !m_Display.Alpha) - g = b = r; - if(!m_Display.Red && m_Display.Green && !m_Display.Blue && !m_Display.Alpha) - r = b = g; - if(!m_Display.Red && !m_Display.Green && m_Display.Blue && !m_Display.Alpha) - g = r = b; - if(!m_Display.Red && !m_Display.Green && !m_Display.Blue && m_Display.Alpha) - g = b = r = val.col.value_f[3]; - - r = qBound(0.0f, (r - m_Display.rangemin) / rangesize, 1.0f); - g = qBound(0.0f, (g - m_Display.rangemin) / rangesize, 1.0f); - b = qBound(0.0f, (b - m_Display.rangemin) / rangesize, 1.0f); - - if(m_IsDepth) - r = g = b = qBound(0.0f, (val.depth - m_Display.rangemin) / rangesize, 1.0f); - - { - r = (float)powf(r, 1.0f / 2.2f); - g = (float)powf(g, 1.0f / 2.2f); - b = (float)powf(b, 1.0f / 2.2f); - } - - return QBrush(QColor::fromRgb((int)(255.0f * r), (int)(255.0f * g), (int)(255.0f * b))); - } - - QString modString(const ModificationValue &val) const - { - QString s; - - int numComps = (int)(m_Tex->format.compCount); - - static const QString colourLetterPrefix[] = {lit("R: "), lit("G: "), lit("B: "), lit("A: ")}; - - if(!m_IsDepth) - { - if(m_IsUint) - { - for(int i = 0; i < numComps; i++) - s += colourLetterPrefix[i] + Formatter::Format(val.col.value_u[i]) + lit("\n"); - } - else if(m_IsSint) - { - for(int i = 0; i < numComps; i++) - s += colourLetterPrefix[i] + Formatter::Format(val.col.value_i[i]) + lit("\n"); - } - else - { - for(int i = 0; i < numComps; i++) - s += colourLetterPrefix[i] + Formatter::Format(val.col.value_f[i]) + lit("\n"); - } - } - - if(val.depth >= 0.0f) - s += lit("\nD: ") + Formatter::Format(val.depth); - else if(val.depth < -1.5f) - s += lit("\nD: ?"); - else - s += lit("\nD: -"); - - if(val.stencil >= 0) - s += lit("\nS: 0x") + Formatter::Format(uint8_t(val.stencil & 0xff), true); - else if(val.stencil == -2) - s += lit("\nS: ?"); - else - s += lit("\nS: -"); - - return s; - } - - QString failureString(const PixelModification &mod) const - { - QString s; - - if(mod.sampleMasked) - s += tr("\nMasked by SampleMask"); - if(mod.backfaceCulled) - s += tr("\nBackface culled"); - if(mod.depthClipped) - s += tr("\nDepth Clipped"); - if(mod.scissorClipped) - s += tr("\nScissor Clipped"); - if(mod.shaderDiscarded) - s += tr("\nShader executed a discard"); - if(mod.depthTestFailed) - s += tr("\nDepth test failed"); - if(mod.stencilTestFailed) - s += tr("\nStencil test failed"); - - return s; - } -}; - -PixelHistoryView::PixelHistoryView(ICaptureContext &ctx, ResourceId id, QPoint point, - const TextureDisplay &display, QWidget *parent) - : QFrame(parent), ui(new Ui::PixelHistoryView), m_Ctx(ctx) -{ - ui->setupUi(this); - - ui->events->setFont(Formatter::PreferredFont()); - - m_Pixel = point; - m_Display = display; - - TextureDescription *tex = m_Ctx.GetTexture(id); - - QString title = - tr("Pixel History on %1 for (%2, %3)").arg(ToQStr(tex->name)).arg(point.x()).arg(point.y()); - if(tex->msSamp > 1) - title += tr(" @ Sample %1").arg(display.sampleIdx); - setWindowTitle(title); - - QString channelStr; - if(display.Red) - channelStr += lit("R"); - if(display.Green) - channelStr += lit("G"); - if(display.Blue) - channelStr += lit("B"); - - if(channelStr.length() > 1) - channelStr += tr(" channels"); - else - channelStr += tr(" channel"); - - if(!display.Red && !display.Green && !display.Blue && display.Alpha) - channelStr = lit("Alpha"); - - QString text; - text = tr("Preview colours displayed in visible range %1 - %2 with %3 visible.\n\n") - .arg(Formatter::Format(display.rangemin)) - .arg(Formatter::Format(display.rangemax)) - .arg(channelStr); - text += - tr("Double click to jump to an event.\n" - "Right click to debug an event, or hide failed events."); - - ui->label->setText(text); - - ui->eventsHidden->setVisible(false); - - m_Model = new PixelHistoryItemModel(ctx, id, display, this); - ui->events->setModel(m_Model); - - ui->events->hideBranches(); - - ui->events->header()->setSectionResizeMode(0, QHeaderView::Stretch); - ui->events->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); - ui->events->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); - ui->events->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); - ui->events->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); - - m_Ctx.AddLogViewer(this); -} - -PixelHistoryView::~PixelHistoryView() -{ - disableTimelineHighlight(); - - ui->events->setModel(NULL); - m_Ctx.RemoveLogViewer(this); - delete ui; -} - -void PixelHistoryView::enableTimelineHighlight() -{ - if(m_Ctx.HasTimelineBar()) - m_Ctx.GetTimelineBar()->HighlightHistory(m_Model->texID(), m_Model->modifications().toList()); -} - -void PixelHistoryView::disableTimelineHighlight() -{ - if(m_Ctx.HasTimelineBar()) - m_Ctx.GetTimelineBar()->HighlightHistory(ResourceId(), {}); -} - -void PixelHistoryView::enterEvent(QEvent *event) -{ - enableTimelineHighlight(); -} - -void PixelHistoryView::leaveEvent(QEvent *event) -{ - disableTimelineHighlight(); -} - -void PixelHistoryView::OnLogfileLoaded() -{ -} - -void PixelHistoryView::OnLogfileClosed() -{ - ToolWindowManager::closeToolWindow(this); -} - -void PixelHistoryView::SetHistory(const rdctype::array &history) -{ - m_Model->setHistory(history); - - enableTimelineHighlight(); -} - -void PixelHistoryView::startDebug(EventTag tag) -{ - m_Ctx.SetEventID({this}, tag.eventID, tag.eventID); - - ShaderDebugTrace *trace = NULL; - - m_Ctx.Replay().BlockInvoke([this, &trace](IReplayController *r) { - trace = r->DebugPixel((uint32_t)m_Pixel.x(), (uint32_t)m_Pixel.y(), m_Display.sampleIdx, ~0U); - }); - - if(trace->states.count == 0) - { - RDDialog::critical(this, tr("Debug Error"), tr("Error debugging pixel.")); - m_Ctx.Replay().AsyncInvoke([trace](IReplayController *r) { r->FreeTrace(trace); }); - return; - } - - GUIInvoke::call([this, trace]() { - QString debugContext = QFormatStr("Pixel %1,%2").arg(m_Pixel.x()).arg(m_Pixel.y()); - - const ShaderReflection *shaderDetails = - m_Ctx.CurPipelineState().GetShaderReflection(ShaderStage::Pixel); - const ShaderBindpointMapping &bindMapping = - m_Ctx.CurPipelineState().GetBindpointMapping(ShaderStage::Pixel); - - // viewer takes ownership of the trace - IShaderViewer *s = - m_Ctx.DebugShader(&bindMapping, shaderDetails, ShaderStage::Pixel, trace, debugContext); - - m_Ctx.AddDockWindow(s->Widget(), DockReference::MainToolArea, NULL); - }); -} - -void PixelHistoryView::jumpToPrimitive(EventTag tag) -{ - m_Ctx.SetEventID({this}, tag.eventID, tag.eventID); - m_Ctx.ShowMeshPreview(); - - IBufferViewer *viewer = m_Ctx.GetMeshPreview(); - - const DrawcallDescription *draw = m_Ctx.CurDrawcall(); - - if(draw) - { - uint32_t vertIdx = RENDERDOC_VertexOffset(draw->topology, tag.primitive); - - if(vertIdx != ~0U) - viewer->ScrollToRow(vertIdx); - } -} - -void PixelHistoryView::on_events_customContextMenuRequested(const QPoint &pos) -{ - QModelIndex index = ui->events->indexAt(pos); - - QMenu contextMenu(this); - - QAction hideFailed(tr("&Show failed events"), this); - hideFailed.setCheckable(true); - hideFailed.setChecked(m_ShowFailures); - - contextMenu.addAction(&hideFailed); - - QObject::connect(&hideFailed, &QAction::toggled, [this](bool checked) { - m_Model->setShowFailures(m_ShowFailures = checked); - ui->eventsHidden->setVisible(!m_ShowFailures); - }); - - if(!index.isValid()) - { - RDDialog::show(&contextMenu, ui->events->viewport()->mapToGlobal(pos)); - return; - } - - EventTag tag = m_Model->data(index, Qt::UserRole).value(); - if(tag.eventID == 0) - { - RDDialog::show(&contextMenu, ui->events->viewport()->mapToGlobal(pos)); - return; - } - - QAction jumpAction(tr("&Go to primitive %1 at Event %2").arg(tag.primitive).arg(tag.eventID), this); - - QString debugText; - - if(tag.primitive == ~0U) - { - debugText = - tr("&Debug Pixel (%1, %2) at Event %3").arg(m_Pixel.x()).arg(m_Pixel.y()).arg(tag.eventID); - } - else - { - debugText = tr("&Debug Pixel (%1, %2) primitive %3 at Event %4") - .arg(m_Pixel.x()) - .arg(m_Pixel.y()) - .arg(tag.eventID) - .arg(tag.primitive); - - contextMenu.addAction(&jumpAction); - } - - QAction debugAction(debugText, this); - - contextMenu.addAction(&debugAction); - - QObject::connect(&jumpAction, &QAction::triggered, [this, tag]() { jumpToPrimitive(tag); }); - QObject::connect(&debugAction, &QAction::triggered, [this, tag]() { startDebug(tag); }); - - RDDialog::show(&contextMenu, ui->events->viewport()->mapToGlobal(pos)); -} - -void PixelHistoryView::on_events_doubleClicked(const QModelIndex &index) -{ - EventTag tag = m_Model->data(index, Qt::UserRole).value(); - if(tag.eventID > 0) - m_Ctx.SetEventID({this}, tag.eventID, tag.eventID); -} - -// TODO TimelineBar diff --git a/qrenderdoc/Windows/PixelHistoryView.h b/qrenderdoc/Windows/PixelHistoryView.h deleted file mode 100644 index 0c1f1842e..000000000 --- a/qrenderdoc/Windows/PixelHistoryView.h +++ /dev/null @@ -1,78 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 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. - ******************************************************************************/ - -#pragma once - -#include -#include "Code/CaptureContext.h" - -namespace Ui -{ -class PixelHistoryView; -} - -class PixelHistoryItemModel; -struct EventTag; - -class PixelHistoryView : public QFrame, public IPixelHistoryView, public ILogViewer -{ - Q_OBJECT - -public: - explicit PixelHistoryView(ICaptureContext &ctx, ResourceId id, QPoint point, - const TextureDisplay &display, QWidget *parent = 0); - ~PixelHistoryView(); - - // IPixelHistoryView - QWidget *Widget() override { return this; } - void SetHistory(const rdctype::array &history) override; - - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; - void OnSelectedEventChanged(uint32_t eventID) override {} - void OnEventChanged(uint32_t eventID) override {} -private slots: - // automatic slots - void on_events_customContextMenuRequested(const QPoint &pos); - void on_events_doubleClicked(const QModelIndex &index); - -protected: - void enterEvent(QEvent *event) override; - void leaveEvent(QEvent *event) override; - -private: - void enableTimelineHighlight(); - void disableTimelineHighlight(); - - Ui::PixelHistoryView *ui; - ICaptureContext &m_Ctx; - - TextureDisplay m_Display; - QPoint m_Pixel; - PixelHistoryItemModel *m_Model; - bool m_ShowFailures = true; - void startDebug(EventTag tag); - void jumpToPrimitive(EventTag tag); -}; diff --git a/qrenderdoc/Windows/PixelHistoryView.ui b/qrenderdoc/Windows/PixelHistoryView.ui deleted file mode 100644 index 88a60b5f4..000000000 --- a/qrenderdoc/Windows/PixelHistoryView.ui +++ /dev/null @@ -1,109 +0,0 @@ - - - PixelHistoryView - - - - 0 - 0 - 662 - 569 - - - - Pixel History - - - - 3 - - - 3 - - - 3 - - - 3 - - - - - ***code overwritten preview*** Preview colours displayed in visible range {min} - {max} with {red, blue, green} channels. - -Right click to debug an event, hide failed events, or jump to the modification's primitive in the mesh view. - - - true - - - - - - - - - - - - 200 - 0 - 0 - - - - - - - - - 200 - 0 - 0 - - - - - - - - - 106 - 104 - 100 - - - - - - - - Failed events are currently hidden - - - - - - - Qt::CustomContextMenu - - - 16 - - - false - - - - - - - - RDTreeView - QTreeView -
Widgets/Extended/RDTreeView.h
-
-
- - -
diff --git a/qrenderdoc/Windows/PythonShell.cpp b/qrenderdoc/Windows/PythonShell.cpp deleted file mode 100644 index cf7f74df0..000000000 --- a/qrenderdoc/Windows/PythonShell.cpp +++ /dev/null @@ -1,682 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 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. - ******************************************************************************/ - -#include "PythonShell.h" -#include -#include -#include -#include "3rdparty/scintilla/include/SciLexer.h" -#include "3rdparty/scintilla/include/qt/ScintillaEdit.h" -#include "Code/ScintillaSyntax.h" -#include "Code/pyrenderdoc/PythonContext.h" -#include "ui_PythonShell.h" - -// a forwarder that invokes onto the UI thread wherever necessary. -// Note this does NOT make CaptureContext thread safe. We just invoke for any potentially UI -// operations. All invokes are blocking, so there can't be any times when the UI thread waits -// on the python thread. -struct CaptureContextInvoker : ICaptureContext -{ - ICaptureContext &m_Ctx; - CaptureContextInvoker(ICaptureContext &ctx) : m_Ctx(ctx) {} - virtual ~CaptureContextInvoker() {} - // - /////////////////////////////////////////////////////////////////////// - // pass-through functions that don't need the UI thread - /////////////////////////////////////////////////////////////////////// - // - virtual QString ConfigFilePath(const QString &filename) override - { - return m_Ctx.ConfigFilePath(filename); - } - virtual QString TempLogFilename(QString appname) override - { - return m_Ctx.TempLogFilename(appname); - } - virtual IReplayManager &Replay() override { return m_Ctx.Replay(); } - virtual bool LogLoaded() override { return m_Ctx.LogLoaded(); } - virtual bool IsLogLocal() override { return m_Ctx.IsLogLocal(); } - virtual bool LogLoading() override { return m_Ctx.LogLoading(); } - virtual QString LogFilename() override { return m_Ctx.LogFilename(); } - virtual const FrameDescription &FrameInfo() override { return m_Ctx.FrameInfo(); } - virtual const APIProperties &APIProps() override { return m_Ctx.APIProps(); } - virtual uint32_t CurSelectedEvent() override { return m_Ctx.CurSelectedEvent(); } - virtual uint32_t CurEvent() override { return m_Ctx.CurEvent(); } - virtual const DrawcallDescription *CurSelectedDrawcall() override - { - return m_Ctx.CurSelectedDrawcall(); - } - virtual const DrawcallDescription *CurDrawcall() override { return m_Ctx.CurDrawcall(); } - virtual const DrawcallDescription *GetFirstDrawcall() override - { - return m_Ctx.GetFirstDrawcall(); - } - virtual const DrawcallDescription *GetLastDrawcall() override { return m_Ctx.GetLastDrawcall(); } - virtual const rdctype::array &CurDrawcalls() override - { - return m_Ctx.CurDrawcalls(); - } - virtual TextureDescription *GetTexture(ResourceId id) override { return m_Ctx.GetTexture(id); } - virtual const rdctype::array &GetTextures() override - { - return m_Ctx.GetTextures(); - } - virtual BufferDescription *GetBuffer(ResourceId id) override { return m_Ctx.GetBuffer(id); } - virtual const rdctype::array &GetBuffers() override - { - return m_Ctx.GetBuffers(); - } - virtual const DrawcallDescription *GetDrawcall(uint32_t eventID) override - { - return m_Ctx.GetDrawcall(eventID); - } - virtual WindowingSystem CurWindowingSystem() override { return m_Ctx.CurWindowingSystem(); } - virtual void *FillWindowingData(uintptr_t winId) override - { - return m_Ctx.FillWindowingData(winId); - } - virtual const QVector &DebugMessages() override { return m_Ctx.DebugMessages(); } - virtual int UnreadMessageCount() override { return m_Ctx.UnreadMessageCount(); } - virtual void MarkMessagesRead() override { return m_Ctx.MarkMessagesRead(); } - virtual D3D11Pipe::State &CurD3D11PipelineState() override - { - return m_Ctx.CurD3D11PipelineState(); - } - virtual D3D12Pipe::State &CurD3D12PipelineState() override - { - return m_Ctx.CurD3D12PipelineState(); - } - virtual GLPipe::State &CurGLPipelineState() override { return m_Ctx.CurGLPipelineState(); } - virtual VKPipe::State &CurVulkanPipelineState() override - { - return m_Ctx.CurVulkanPipelineState(); - } - virtual CommonPipelineState &CurPipelineState() override { return m_Ctx.CurPipelineState(); } - virtual PersistantConfig &Config() override { return m_Ctx.Config(); } - // - /////////////////////////////////////////////////////////////////////// - // functions that invoke onto the UI thread - /////////////////////////////////////////////////////////////////////// - // - template - void InvokeVoidFunction(F ptr, paramTypes... params) - { - if(!GUIInvoke::onUIThread()) - { - GUIInvoke::blockcall([this, ptr, params...]() { (m_Ctx.*ptr)(params...); }); - - return; - } - - (m_Ctx.*ptr)(params...); - } - - template - R InvokeRetFunction(F ptr, paramTypes... params) - { - if(!GUIInvoke::onUIThread()) - { - R ret; - GUIInvoke::blockcall([this, &ret, ptr, params...]() { ret = (m_Ctx.*ptr)(params...); }); - - return ret; - } - - return (m_Ctx.*ptr)(params...); - } - - virtual void LoadLogfile(const QString &logFile, const QString &origFilename, bool temporary, - bool local) override - { - InvokeVoidFunction(&ICaptureContext::LoadLogfile, logFile, origFilename, temporary, local); - } - virtual void CloseLogfile() override { InvokeVoidFunction(&ICaptureContext::CloseLogfile); } - virtual void SetEventID(const QVector &exclude, uint32_t selectedEventID, - uint32_t eventID, bool force = false) override - { - InvokeVoidFunction(&ICaptureContext::SetEventID, exclude, selectedEventID, eventID, force); - } - virtual void RefreshStatus() override { InvokeVoidFunction(&ICaptureContext::RefreshStatus); } - virtual void AddLogViewer(ILogViewer *viewer) override - { - InvokeVoidFunction(&ICaptureContext::AddLogViewer, viewer); - } - virtual void RemoveLogViewer(ILogViewer *viewer) override - { - InvokeVoidFunction(&ICaptureContext::RemoveLogViewer, viewer); - } - virtual void AddMessages(const rdctype::array &msgs) override - { - InvokeVoidFunction(&ICaptureContext::AddMessages, msgs); - } - virtual IMainWindow *GetMainWindow() override - { - return InvokeRetFunction(&ICaptureContext::GetMainWindow); - } - virtual IEventBrowser *GetEventBrowser() override - { - return InvokeRetFunction(&ICaptureContext::GetEventBrowser); - } - virtual IAPIInspector *GetAPIInspector() override - { - return InvokeRetFunction(&ICaptureContext::GetAPIInspector); - } - virtual ITextureViewer *GetTextureViewer() override - { - return InvokeRetFunction(&ICaptureContext::GetTextureViewer); - } - virtual IBufferViewer *GetMeshPreview() override - { - return InvokeRetFunction(&ICaptureContext::GetMeshPreview); - } - virtual IPipelineStateViewer *GetPipelineViewer() override - { - return InvokeRetFunction(&ICaptureContext::GetPipelineViewer); - } - virtual ICaptureDialog *GetCaptureDialog() override - { - return InvokeRetFunction(&ICaptureContext::GetCaptureDialog); - } - virtual IDebugMessageView *GetDebugMessageView() override - { - return InvokeRetFunction(&ICaptureContext::GetDebugMessageView); - } - virtual IStatisticsViewer *GetStatisticsViewer() override - { - return InvokeRetFunction(&ICaptureContext::GetStatisticsViewer); - } - virtual ITimelineBar *GetTimelineBar() override - { - return InvokeRetFunction(&ICaptureContext::GetTimelineBar); - } - virtual IPythonShell *GetPythonShell() override - { - return InvokeRetFunction(&ICaptureContext::GetPythonShell); - } - virtual bool HasEventBrowser() override - { - return InvokeRetFunction(&ICaptureContext::HasEventBrowser); - } - virtual bool HasAPIInspector() override - { - return InvokeRetFunction(&ICaptureContext::HasAPIInspector); - } - virtual bool HasTextureViewer() override - { - return InvokeRetFunction(&ICaptureContext::HasTextureViewer); - } - virtual bool HasPipelineViewer() override - { - return InvokeRetFunction(&ICaptureContext::HasPipelineViewer); - } - virtual bool HasMeshPreview() override - { - return InvokeRetFunction(&ICaptureContext::HasMeshPreview); - } - virtual bool HasCaptureDialog() override - { - return InvokeRetFunction(&ICaptureContext::HasCaptureDialog); - } - virtual bool HasDebugMessageView() override - { - return InvokeRetFunction(&ICaptureContext::HasDebugMessageView); - } - virtual bool HasStatisticsViewer() override - { - return InvokeRetFunction(&ICaptureContext::HasStatisticsViewer); - } - virtual bool HasTimelineBar() override - { - return InvokeRetFunction(&ICaptureContext::HasTimelineBar); - } - virtual bool HasPythonShell() override - { - return InvokeRetFunction(&ICaptureContext::HasPythonShell); - } - - virtual void ShowEventBrowser() override - { - InvokeVoidFunction(&ICaptureContext::ShowEventBrowser); - } - virtual void ShowAPIInspector() override - { - InvokeVoidFunction(&ICaptureContext::ShowAPIInspector); - } - virtual void ShowTextureViewer() override - { - InvokeVoidFunction(&ICaptureContext::ShowTextureViewer); - } - virtual void ShowMeshPreview() override { InvokeVoidFunction(&ICaptureContext::ShowMeshPreview); } - virtual void ShowPipelineViewer() override - { - InvokeVoidFunction(&ICaptureContext::ShowPipelineViewer); - } - virtual void ShowCaptureDialog() override - { - InvokeVoidFunction(&ICaptureContext::ShowCaptureDialog); - } - virtual void ShowDebugMessageView() override - { - InvokeVoidFunction(&ICaptureContext::ShowDebugMessageView); - } - virtual void ShowStatisticsViewer() override - { - InvokeVoidFunction(&ICaptureContext::ShowStatisticsViewer); - } - virtual void ShowTimelineBar() override { InvokeVoidFunction(&ICaptureContext::ShowTimelineBar); } - virtual void ShowPythonShell() override { InvokeVoidFunction(&ICaptureContext::ShowPythonShell); } - virtual IShaderViewer *EditShader(bool customShader, const QString &entryPoint, - const QStringMap &files, IShaderViewer::SaveCallback saveCallback, - IShaderViewer::CloseCallback closeCallback) override - { - return InvokeRetFunction(&ICaptureContext::EditShader, customShader, - entryPoint, files, saveCallback, closeCallback); - } - - virtual IShaderViewer *DebugShader(const ShaderBindpointMapping *bind, - const ShaderReflection *shader, ShaderStage stage, - ShaderDebugTrace *trace, const QString &debugContext) override - { - return InvokeRetFunction(&ICaptureContext::DebugShader, bind, shader, stage, - trace, debugContext); - } - - virtual IShaderViewer *ViewShader(const ShaderBindpointMapping *bind, - const ShaderReflection *shader, ShaderStage stage) override - { - return InvokeRetFunction(&ICaptureContext::ViewShader, bind, shader, stage); - } - - virtual IBufferViewer *ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId id, - const QString &format = QString()) override - { - return InvokeRetFunction(&ICaptureContext::ViewBuffer, byteOffset, byteSize, - id, format); - } - - virtual IBufferViewer *ViewTextureAsBuffer(uint32_t arrayIdx, uint32_t mip, ResourceId id, - const QString &format = QString()) override - { - return InvokeRetFunction(&ICaptureContext::ViewTextureAsBuffer, arrayIdx, mip, - id, format); - } - - virtual IConstantBufferPreviewer *ViewConstantBuffer(ShaderStage stage, uint32_t slot, - uint32_t idx) override - { - return InvokeRetFunction(&ICaptureContext::ViewConstantBuffer, - stage, slot, idx); - } - - virtual IPixelHistoryView *ViewPixelHistory(ResourceId texID, int x, int y, - const TextureDisplay &display) override - { - return InvokeRetFunction(&ICaptureContext::ViewPixelHistory, texID, x, y, - display); - } - - virtual QWidget *CreateBuiltinWindow(const QString &objectName) override - { - return InvokeRetFunction(&ICaptureContext::CreateBuiltinWindow, objectName); - } - - virtual void BuiltinWindowClosed(QWidget *window) override - { - InvokeVoidFunction(&ICaptureContext::BuiltinWindowClosed, window); - } - - virtual void RaiseDockWindow(QWidget *dockWindow) override - { - InvokeVoidFunction(&ICaptureContext::RaiseDockWindow, dockWindow); - } - - virtual void AddDockWindow(QWidget *newWindow, DockReference ref, QWidget *refWindow, - float percentage = 0.5f) override - { - InvokeVoidFunction(&ICaptureContext::AddDockWindow, newWindow, ref, refWindow, percentage); - } -}; - -PythonShell::PythonShell(ICaptureContext &ctx, QWidget *parent) - : QFrame(parent), ui(new Ui::PythonShell), m_Ctx(ctx) -{ - ui->setupUi(this); - - m_ThreadCtx = new CaptureContextInvoker(m_Ctx); - - QObject::connect(ui->lineInput, &RDLineEdit::keyPress, this, &PythonShell::interactive_keypress); - - ui->lineInput->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); - ui->interactiveOutput->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); - ui->scriptOutput->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); - - scriptEditor = new ScintillaEdit(this); - - scriptEditor->styleSetFont( - STYLE_DEFAULT, QFontDatabase::systemFont(QFontDatabase::FixedFont).family().toUtf8().data()); - - scriptEditor->setMarginLeft(4); - scriptEditor->setMarginWidthN(0, 32); - scriptEditor->setMarginWidthN(1, 0); - scriptEditor->setMarginWidthN(2, 16); - scriptEditor->setObjectName(lit("scriptEditor")); - - scriptEditor->markerSetBack(CURRENT_MARKER, SCINTILLA_COLOUR(240, 128, 128)); - scriptEditor->markerSetBack(CURRENT_MARKER + 1, SCINTILLA_COLOUR(240, 128, 128)); - scriptEditor->markerDefine(CURRENT_MARKER, SC_MARK_SHORTARROW); - scriptEditor->markerDefine(CURRENT_MARKER + 1, SC_MARK_BACKGROUND); - - ConfigureSyntax(scriptEditor, SCLEX_PYTHON); - - scriptEditor->setTabWidth(4); - - scriptEditor->setScrollWidth(1); - scriptEditor->setScrollWidthTracking(true); - - scriptEditor->colourise(0, -1); - - QObject::connect(scriptEditor, &ScintillaEdit::modified, [this](int type, int, int, int, - const QByteArray &, int, int, int) { - if(type & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) - { - scriptEditor->markerDeleteAll(CURRENT_MARKER); - scriptEditor->markerDeleteAll(CURRENT_MARKER + 1); - } - }); - - ui->scriptSplitter->insertWidget(0, scriptEditor); - int w = ui->scriptSplitter->rect().width(); - ui->scriptSplitter->setSizes({w * 2 / 3, w / 3}); - - ui->tabWidget->setCurrentIndex(0); - - interactiveContext = NULL; - - enableButtons(true); - - // reset output to default - on_clear_clicked(); - on_newScript_clicked(); -} - -PythonShell::~PythonShell() -{ - m_Ctx.BuiltinWindowClosed(this); - - interactiveContext->Finish(); - - delete m_ThreadCtx; - - delete ui; -} - -void PythonShell::on_execute_clicked() -{ - QString command = ui->lineInput->text(); - - appendText(ui->interactiveOutput, command + lit("\n")); - - if(command.trimmed().length() > 0) - interactiveContext->executeString(command, true); - - history.push_front(command); - historyidx = -1; - - ui->lineInput->clear(); - - appendText(ui->interactiveOutput, lit(">> ")); -} - -void PythonShell::on_clear_clicked() -{ - QString minidocHeader = scriptHeader(); - - minidocHeader += lit("\n\n>> "); - - ui->interactiveOutput->setText(minidocHeader); - - if(interactiveContext) - interactiveContext->Finish(); - - interactiveContext = newContext(); -} - -void PythonShell::on_newScript_clicked() -{ - QString minidocHeader = scriptHeader(); - - minidocHeader.replace(QLatin1Char('\n'), lit("\n# ")); - - minidocHeader = QFormatStr("# %1\n\n").arg(minidocHeader); - - scriptEditor->setText(minidocHeader.toUtf8().data()); - - scriptEditor->emptyUndoBuffer(); -} - -void PythonShell::on_openScript_clicked() -{ - QString filename = RDDialog::getOpenFileName(this, tr("Open Python Script"), QString(), - tr("Python scripts (*.py)")); - - if(!filename.isEmpty()) - { - QFile f(filename); - if(f.open(QIODevice::ReadOnly | QIODevice::Text)) - { - scriptEditor->setText(f.readAll().data()); - } - else - { - RDDialog::critical(this, tr("Error loading script"), - tr("Couldn't open path %1.").arg(filename)); - } - } -} - -void PythonShell::on_saveScript_clicked() -{ - QString filename = RDDialog::getSaveFileName(this, tr("Save Python Script"), QString(), - tr("Python scripts (*.py)")); - - if(!filename.isEmpty()) - { - QDir dirinfo = QFileInfo(filename).dir(); - if(dirinfo.exists()) - { - QFile f(filename); - if(f.open(QIODevice::WriteOnly | QIODevice::Truncate)) - { - f.write(scriptEditor->getText(scriptEditor->textLength() + 1)); - } - else - { - RDDialog::critical( - this, tr("Error saving script"), - tr("Couldn't open path %1 for write.\n%2").arg(filename).arg(f.errorString())); - } - } - else - { - RDDialog::critical(this, tr("Invalid directory"), - tr("Cannot find target directory to save to")); - } - } -} - -void PythonShell::on_runScript_clicked() -{ - PythonContext *context = newContext(); - - ui->scriptOutput->clear(); - - QString script = QString::fromUtf8(scriptEditor->getText(scriptEditor->textLength() + 1)); - - enableButtons(false); - - LambdaThread *thread = new LambdaThread([this, script, context]() { - - scriptContext = context; - context->executeString(lit("script.py"), script); - scriptContext = NULL; - - GUIInvoke::call([this, context]() { - context->Finish(); - enableButtons(true); - }); - }); - - thread->selfDelete(true); - thread->start(); -} - -void PythonShell::on_abortRun_clicked() -{ - if(scriptContext) - scriptContext->abort(); -} - -void PythonShell::traceLine(const QString &file, int line) -{ - if(QObject::sender() == (QObject *)interactiveContext) - return; - - scriptEditor->markerDeleteAll(CURRENT_MARKER); - scriptEditor->markerDeleteAll(CURRENT_MARKER + 1); - - scriptEditor->markerAdd(line > 0 ? line - 1 : 0, CURRENT_MARKER); - scriptEditor->markerAdd(line > 0 ? line - 1 : 0, CURRENT_MARKER + 1); -} - -void PythonShell::exception(const QString &type, const QString &value, int finalLine, - QList frames) -{ - QTextEdit *out = ui->scriptOutput; - if(QObject::sender() == (QObject *)interactiveContext) - out = ui->interactiveOutput; - - QString exString; - - if(finalLine >= 0) - traceLine(QString(), finalLine); - - if(!out->toPlainText().endsWith(QLatin1Char('\n'))) - exString = lit("\n"); - if(!frames.isEmpty()) - { - exString += tr("Traceback (most recent call last):\n"); - for(const QString &f : frames) - exString += QFormatStr(" %1\n").arg(f); - } - exString += QFormatStr("%1: %2\n").arg(type).arg(value); - - appendText(out, exString); -} - -void PythonShell::textOutput(bool isStdError, const QString &output) -{ - QTextEdit *out = ui->scriptOutput; - if(QObject::sender() == (QObject *)interactiveContext) - out = ui->interactiveOutput; - - appendText(out, output); -} - -void PythonShell::interactive_keypress(QKeyEvent *event) -{ - if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) - on_execute_clicked(); - - bool moved = false; - - if(event->key() == Qt::Key_Down && historyidx > -1) - { - historyidx--; - - moved = true; - } - - QString workingtext; - - if(event->key() == Qt::Key_Up && historyidx + 1 < history.count()) - { - if(historyidx == -1) - workingtext = ui->lineInput->text(); - - historyidx++; - - moved = true; - } - - if(moved) - { - if(historyidx == -1) - ui->lineInput->setText(workingtext); - else - ui->lineInput->setText(history[historyidx]); - - ui->lineInput->deselect(); - } -} - -QString PythonShell::scriptHeader() -{ - return tr(R"(RenderDoc Python console, powered by python %1. -The 'pyrenderdoc' object is the current CaptureContext instance. -The 'renderdoc' and 'qrenderdoc' modules are available. -Documentation is available: https://renderdoc.org/docs/python_api/index.html)") - .arg(interactiveContext->versionString()); -} - -void PythonShell::appendText(QTextEdit *output, const QString &text) -{ - output->moveCursor(QTextCursor::End); - output->insertPlainText(text); - - // scroll to the bottom - QScrollBar *vscroll = output->verticalScrollBar(); - vscroll->setValue(vscroll->maximum()); -} - -void PythonShell::enableButtons(bool enable) -{ - ui->newScript->setEnabled(enable); - ui->openScript->setEnabled(enable); - ui->saveScript->setEnabled(enable); - ui->runScript->setEnabled(enable); - ui->abortRun->setEnabled(!enable); -} - -PythonContext *PythonShell::newContext() -{ - PythonContext *ret = new PythonContext(); - - QObject::connect(ret, &PythonContext::traceLine, this, &PythonShell::traceLine); - QObject::connect(ret, &PythonContext::exception, this, &PythonShell::exception); - QObject::connect(ret, &PythonContext::textOutput, this, &PythonShell::textOutput); - - ret->setGlobal("pyrenderdoc", (ICaptureContext *)m_ThreadCtx); - - return ret; -} diff --git a/qrenderdoc/Windows/PythonShell.h b/qrenderdoc/Windows/PythonShell.h deleted file mode 100644 index 48810c74c..000000000 --- a/qrenderdoc/Windows/PythonShell.h +++ /dev/null @@ -1,87 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 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. - ******************************************************************************/ - -#pragma once - -#include -#include "Code/CaptureContext.h" - -class PythonContext; -class ScintillaEdit; -class QTextEdit; - -namespace Ui -{ -class PythonShell; -} - -struct CaptureContextInvoker; - -class PythonShell : public QFrame, public IPythonShell -{ - Q_OBJECT - -public: - explicit PythonShell(ICaptureContext &ctx, QWidget *parent = 0); - - ~PythonShell(); - - // IPythonShell - QWidget *Widget() override { return this; } -private slots: - // automatic slots - void on_execute_clicked(); - void on_clear_clicked(); - void on_newScript_clicked(); - void on_openScript_clicked(); - void on_saveScript_clicked(); - void on_runScript_clicked(); - void on_abortRun_clicked(); - - // manual slots - void interactive_keypress(QKeyEvent *e); - void traceLine(const QString &file, int line); - void exception(const QString &type, const QString &value, int finalLine, QList frames); - void textOutput(bool isStdError, const QString &output); - -private: - Ui::PythonShell *ui; - ICaptureContext &m_Ctx; - CaptureContextInvoker *m_ThreadCtx = NULL; - - ScintillaEdit *scriptEditor; - - static const int CURRENT_MARKER = 0; - - PythonContext *interactiveContext, *scriptContext; - - QList history; - int historyidx = -1; - - PythonContext *newContext(); - - QString scriptHeader(); - void appendText(QTextEdit *output, const QString &text); - void enableButtons(bool enable); -}; diff --git a/qrenderdoc/Windows/PythonShell.ui b/qrenderdoc/Windows/PythonShell.ui deleted file mode 100644 index d201e42bd..000000000 --- a/qrenderdoc/Windows/PythonShell.ui +++ /dev/null @@ -1,315 +0,0 @@ - - - PythonShell - - - - 0 - 0 - 544 - 346 - - - - Interactive Python Shell - - - - 0 - - - 3 - - - 3 - - - 3 - - - 3 - - - - - 1 - - - - Interactive Shell - - - - 4 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - Qt::ScrollBarAlwaysOn - - - true - - - - - - - 6 - - - - - - - - Execute - - - - - - - Clear - - - - - - - - - - Run Scripts - - - - 4 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - 0 - 0 - - - - - 0 - 28 - - - - QFrame::Panel - - - QFrame::Raised - - - - 2 - - - 6 - - - 2 - - - 6 - - - 2 - - - - - Create a new blank script - - - New - - - - :/page_white_edit.png:/page_white_edit.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Open an existing python script - - - Open - - - - :/folder_page_white.png:/folder_page_white.png - - - QToolButton::InstantPopup - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Save the current script to disk - - - Save As - - - - :/save.png:/save.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Qt::Vertical - - - - - - - Begin running the script in python - - - Run - - - - :/arrow_right.png:/arrow_right.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Stop execution of the current script - - - Abort - - - - :/del.png:/del.png - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Qt::Horizontal - - - false - - - - Qt::ScrollBarAlwaysOn - - - true - - - - - - - - - - - - - RDLineEdit - QLineEdit -
Widgets/Extended/RDLineEdit.h
-
- - RDTextEdit - QTextEdit -
Widgets/Extended/RDTextEdit.h
-
-
- - - - -
diff --git a/qrenderdoc/Windows/ShaderViewer.cpp b/qrenderdoc/Windows/ShaderViewer.cpp deleted file mode 100644 index d8c5e0132..000000000 --- a/qrenderdoc/Windows/ShaderViewer.cpp +++ /dev/null @@ -1,2448 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 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. - ******************************************************************************/ - -#include "ShaderViewer.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "3rdparty/scintilla/include/SciLexer.h" -#include "3rdparty/scintilla/include/qt/ScintillaEdit.h" -#include "3rdparty/toolwindowmanager/ToolWindowManager.h" -#include "3rdparty/toolwindowmanager/ToolWindowManagerArea.h" -#include "Code/ScintillaSyntax.h" -#include "Widgets/FindReplace.h" -#include "ui_ShaderViewer.h" - -namespace -{ -struct VariableTag -{ - VariableTag() {} - VariableTag(VariableCategory c, int i, int a = 0) : cat(c), idx(i), arrayIdx(a) {} - VariableCategory cat = VariableCategory::Unknown; - int idx = 0; - int arrayIdx = 0; - - bool operator==(const VariableTag &o) - { - return cat == o.cat && idx == o.idx && arrayIdx == o.arrayIdx; - } -}; -}; - -Q_DECLARE_METATYPE(VariableTag); - -ShaderViewer::ShaderViewer(ICaptureContext &ctx, QWidget *parent) - : QFrame(parent), ui(new Ui::ShaderViewer), m_Ctx(ctx) -{ - ui->setupUi(this); - - ui->constants->setFont(Formatter::PreferredFont()); - ui->variables->setFont(Formatter::PreferredFont()); - ui->watch->setFont(Formatter::PreferredFont()); - ui->inputSig->setFont(Formatter::PreferredFont()); - ui->outputSig->setFont(Formatter::PreferredFont()); - - // we create this up front so its state stays persistent as much as possible. - m_FindReplace = new FindReplace(this); - - m_FindResults = MakeEditor(lit("findresults"), QString(), SCLEX_NULL); - m_FindResults->setReadOnly(true); - m_FindResults->setWindowTitle(lit("Find Results")); - - // remove margins - m_FindResults->setMarginWidthN(0, 0); - m_FindResults->setMarginWidthN(1, 0); - m_FindResults->setMarginWidthN(2, 0); - - QObject::connect(m_FindReplace, &FindReplace::performFind, this, &ShaderViewer::performFind); - QObject::connect(m_FindReplace, &FindReplace::performFindAll, this, &ShaderViewer::performFindAll); - QObject::connect(m_FindReplace, &FindReplace::performReplace, this, &ShaderViewer::performReplace); - QObject::connect(m_FindReplace, &FindReplace::performReplaceAll, this, - &ShaderViewer::performReplaceAll); - - ui->docking->addToolWindow(m_FindReplace, ToolWindowManager::NoArea); - ui->docking->setToolWindowProperties(m_FindReplace, ToolWindowManager::HideOnClose); - - ui->docking->addToolWindow(m_FindResults, ToolWindowManager::NoArea); - ui->docking->setToolWindowProperties(m_FindResults, ToolWindowManager::HideOnClose); - - { - m_DisassemblyView = - MakeEditor(lit("scintillaDisassem"), QString(), - m_Ctx.APIProps().pipelineType == GraphicsAPI::Vulkan ? SCLEX_GLSL : SCLEX_HLSL); - m_DisassemblyView->setReadOnly(true); - - QObject::connect(m_DisassemblyView, &ScintillaEdit::keyPressed, this, - &ShaderViewer::readonly_keyPressed); - - // C# LightCoral - m_DisassemblyView->markerSetBack(CURRENT_MARKER, SCINTILLA_COLOUR(240, 128, 128)); - m_DisassemblyView->markerSetBack(CURRENT_MARKER + 1, SCINTILLA_COLOUR(240, 128, 128)); - m_DisassemblyView->markerDefine(CURRENT_MARKER, SC_MARK_SHORTARROW); - m_DisassemblyView->markerDefine(CURRENT_MARKER + 1, SC_MARK_BACKGROUND); - - // C# LightSlateGray - m_DisassemblyView->markerSetBack(FINISHED_MARKER, SCINTILLA_COLOUR(119, 136, 153)); - m_DisassemblyView->markerSetBack(FINISHED_MARKER + 1, SCINTILLA_COLOUR(119, 136, 153)); - m_DisassemblyView->markerDefine(FINISHED_MARKER, SC_MARK_ROUNDRECT); - m_DisassemblyView->markerDefine(FINISHED_MARKER + 1, SC_MARK_BACKGROUND); - - // C# Red - m_DisassemblyView->markerSetBack(BREAKPOINT_MARKER, SCINTILLA_COLOUR(255, 0, 0)); - m_DisassemblyView->markerSetBack(BREAKPOINT_MARKER + 1, SCINTILLA_COLOUR(255, 0, 0)); - m_DisassemblyView->markerDefine(BREAKPOINT_MARKER, SC_MARK_CIRCLE); - m_DisassemblyView->markerDefine(BREAKPOINT_MARKER + 1, SC_MARK_BACKGROUND); - - m_Scintillas.push_back(m_DisassemblyView); - - m_DisassemblyFrame = new QWidget(this); - m_DisassemblyFrame->setWindowTitle(tr("Disassembly")); - - m_DisassemblyToolbar = new QFrame(this); - m_DisassemblyToolbar->setFrameShape(QFrame::Panel); - m_DisassemblyToolbar->setFrameShadow(QFrame::Raised); - - QHBoxLayout *toolbarlayout = new QHBoxLayout(m_DisassemblyToolbar); - toolbarlayout->setSpacing(2); - toolbarlayout->setContentsMargins(3, 3, 3, 3); - - m_DisassemblyType = new QComboBox(m_DisassemblyToolbar); - m_DisassemblyType->setMaxVisibleItems(12); - m_DisassemblyType->setSizeAdjustPolicy(QComboBox::AdjustToContents); - - toolbarlayout->addWidget(new QLabel(tr("Disassembly type:"), m_DisassemblyToolbar)); - toolbarlayout->addWidget(m_DisassemblyType); - toolbarlayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); - - QVBoxLayout *framelayout = new QVBoxLayout(m_DisassemblyFrame); - framelayout->setSpacing(0); - framelayout->setMargin(0); - framelayout->addWidget(m_DisassemblyToolbar); - framelayout->addWidget(m_DisassemblyView); - - ui->docking->addToolWindow(m_DisassemblyFrame, ToolWindowManager::EmptySpace); - ui->docking->setToolWindowProperties(m_DisassemblyFrame, - ToolWindowManager::HideCloseButton | - ToolWindowManager::DisallowFloatWindow | - ToolWindowManager::AlwaysDisplayFullTabs); - } - - ui->docking->setAllowFloatingWindow(false); - - { - QMenu *snippetsMenu = new QMenu(this); - - QAction *dim = new QAction(tr("Texture Dimensions Global"), this); - QAction *mip = new QAction(tr("Selected Mip Global"), this); - QAction *slice = new QAction(tr("Seleted Array Slice / Cubemap Face Global"), this); - QAction *sample = new QAction(tr("Selected Sample Global"), this); - QAction *type = new QAction(tr("Texture Type Global"), this); - QAction *samplers = new QAction(tr("Point && Linear Samplers"), this); - QAction *resources = new QAction(tr("Texture Resources"), this); - - snippetsMenu->addAction(dim); - snippetsMenu->addAction(mip); - snippetsMenu->addAction(slice); - snippetsMenu->addAction(sample); - snippetsMenu->addAction(type); - snippetsMenu->addSeparator(); - snippetsMenu->addAction(samplers); - snippetsMenu->addAction(resources); - - QObject::connect(dim, &QAction::triggered, this, &ShaderViewer::snippet_textureDimensions); - QObject::connect(mip, &QAction::triggered, this, &ShaderViewer::snippet_selectedMip); - QObject::connect(slice, &QAction::triggered, this, &ShaderViewer::snippet_selectedSlice); - QObject::connect(sample, &QAction::triggered, this, &ShaderViewer::snippet_selectedSample); - QObject::connect(type, &QAction::triggered, this, &ShaderViewer::snippet_selectedType); - QObject::connect(samplers, &QAction::triggered, this, &ShaderViewer::snippet_samplers); - QObject::connect(resources, &QAction::triggered, this, &ShaderViewer::snippet_resources); - - ui->snippets->setMenu(snippetsMenu); - } - - QVBoxLayout *layout = new QVBoxLayout(this); - layout->setSpacing(0); - layout->setMargin(0); - layout->addWidget(ui->toolbar); - layout->addWidget(ui->docking); - - m_Ctx.AddLogViewer(this); -} - -void ShaderViewer::editShader(bool customShader, const QString &entryPoint, const QStringMap &files) -{ - m_Scintillas.removeOne(m_DisassemblyView); - ui->docking->removeToolWindow(m_DisassemblyFrame); - - // hide watch, constants, variables - ui->watch->hide(); - ui->variables->hide(); - ui->constants->hide(); - - ui->snippets->setVisible(customShader); - - // hide debugging toolbar buttons - ui->stepBack->hide(); - ui->stepNext->hide(); - ui->runToCursor->hide(); - ui->runToSample->hide(); - ui->runToNaNOrInf->hide(); - ui->regFormatSep->hide(); - ui->intView->hide(); - ui->floatView->hide(); - - // hide signatures - ui->inputSig->hide(); - ui->outputSig->hide(); - - QString title; - - QWidget *sel = NULL; - for(const QString &f : files.keys()) - { - QString name = QFileInfo(f).fileName(); - QString text = files[f]; - - ScintillaEdit *scintilla = AddFileScintilla(name, text); - - scintilla->setReadOnly(false); - QObject::connect(scintilla, &ScintillaEdit::keyPressed, this, &ShaderViewer::editable_keyPressed); - - QObject::connect(scintilla, &ScintillaEdit::modified, [this](int type, int, int, int, - const QByteArray &, int, int, int) { - if(type & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT | SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) - m_FindState = FindState(); - }); - - m_Ctx.GetMainWindow()->RegisterShortcut(QKeySequence(QKeySequence::Save).toString(), this, - [this]() { on_save_clicked(); }); - - QWidget *w = (QWidget *)scintilla; - w->setProperty("filename", f); - - if(text.contains(entryPoint)) - sel = scintilla; - - if(sel == scintilla || title.isEmpty()) - title = tr("%1 - Edit (%2)").arg(entryPoint).arg(name); - } - - if(sel != NULL) - ToolWindowManager::raiseToolWindow(sel); - - setWindowTitle(title); - - if(files.count() > 2) - addFileList(); - - m_Errors = MakeEditor(lit("errors"), QString(), SCLEX_NULL); - m_Errors->setReadOnly(true); - m_Errors->setWindowTitle(lit("Errors")); - - // remove margins - m_Errors->setMarginWidthN(0, 0); - m_Errors->setMarginWidthN(1, 0); - m_Errors->setMarginWidthN(2, 0); - - QObject::connect(m_Errors, &ScintillaEdit::keyPressed, this, &ShaderViewer::readonly_keyPressed); - - ui->docking->addToolWindow( - m_Errors, ToolWindowManager::AreaReference(ToolWindowManager::BottomOf, - ui->docking->areaOf(m_Scintillas.front()), 0.2f)); - ui->docking->setToolWindowProperties( - m_Errors, ToolWindowManager::HideCloseButton | ToolWindowManager::DisallowFloatWindow); -} - -void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderReflection *shader, - ShaderStage stage, ShaderDebugTrace *trace, - const QString &debugContext) -{ - m_Mapping = bind; - m_ShaderDetails = shader; - m_Trace = trace; - m_Stage = stage; - - // no replacing allowed, stay in find mode - m_FindReplace->allowUserModeChange(false); - - if(!shader || !bind) - m_Trace = NULL; - - if(trace) - setWindowTitle(QFormatStr("Debugging %1 - %2") - .arg(m_Ctx.CurPipelineState().GetShaderName(stage)) - .arg(debugContext)); - else - setWindowTitle(m_Ctx.CurPipelineState().GetShaderName(stage)); - - if(shader) - { - m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) { - rdctype::array targets = r->GetDisassemblyTargets(); - - rdctype::str disasm = r->DisassembleShader(m_ShaderDetails, ""); - - GUIInvoke::call([this, targets, disasm]() { - QStringList targetNames; - for(const rdctype::str &t : targets) - targetNames << ToQStr(t); - - m_DisassemblyType->addItems(targetNames); - m_DisassemblyType->setCurrentIndex(0); - QObject::connect(m_DisassemblyType, OverloadedSlot::of(&QComboBox::currentIndexChanged), - this, &ShaderViewer::disassemble_typeChanged); - - // read-only applies to us too! - m_DisassemblyView->setReadOnly(false); - m_DisassemblyView->setText(disasm.c_str()); - m_DisassemblyView->setReadOnly(true); - - updateDebugging(); - }); - }); - } - - // we always want to highlight words/registers - QObject::connect(m_DisassemblyView, &ScintillaEdit::buttonReleased, this, - &ShaderViewer::disassembly_buttonReleased); - - // suppress the built-in context menu and hook up our own - if(trace) - { - m_DisassemblyView->usePopUp(SC_POPUP_NEVER); - - m_DisassemblyFrame->layout()->removeWidget(m_DisassemblyToolbar); - - m_DisassemblyView->setContextMenuPolicy(Qt::CustomContextMenu); - QObject::connect(m_DisassemblyView, &ScintillaEdit::customContextMenuRequested, this, - &ShaderViewer::disassembly_contextMenu); - - m_DisassemblyView->setMouseDwellTime(500); - - QObject::connect(m_DisassemblyView, &ScintillaEdit::dwellStart, this, - &ShaderViewer::disasm_tooltipShow); - QObject::connect(m_DisassemblyView, &ScintillaEdit::dwellEnd, this, - &ShaderViewer::disasm_tooltipHide); - } - - if(shader && shader->DebugInfo.files.count > 0) - { - if(trace) - setWindowTitle(QFormatStr("Debug %1() - %2").arg(ToQStr(shader->EntryPoint)).arg(debugContext)); - else - setWindowTitle(ToQStr(shader->EntryPoint)); - - int fileIdx = 0; - - QWidget *sel = NULL; - for(auto &f : shader->DebugInfo.files) - { - QString name = QFileInfo(ToQStr(f.first)).fileName(); - QString text = ToQStr(f.second); - - ScintillaEdit *scintilla = AddFileScintilla(name, text); - - if(sel == NULL) - sel = scintilla; - - fileIdx++; - } - - if(trace || sel == NULL) - sel = m_DisassemblyView; - - if(shader->DebugInfo.files.count > 2) - addFileList(); - - ToolWindowManager::raiseToolWindow(sel); - } - - ui->snippets->hide(); - - if(trace) - { - // hide signatures - ui->inputSig->hide(); - ui->outputSig->hide(); - - ui->variables->setColumns({tr("Name"), tr("Type"), tr("Value")}); - ui->variables->header()->setSectionResizeMode(0, QHeaderView::Stretch); - ui->variables->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); - ui->variables->header()->setSectionResizeMode(2, QHeaderView::Stretch); - - ui->constants->setColumns({tr("Name"), tr("Type"), tr("Value")}); - ui->constants->header()->setSectionResizeMode(0, QHeaderView::Stretch); - ui->constants->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); - ui->constants->header()->setSectionResizeMode(2, QHeaderView::Stretch); - - ui->watch->setWindowTitle(tr("Watch")); - ui->docking->addToolWindow( - ui->watch, ToolWindowManager::AreaReference(ToolWindowManager::BottomOf, - ui->docking->areaOf(m_DisassemblyFrame), 0.25f)); - ui->docking->setToolWindowProperties( - ui->watch, ToolWindowManager::HideCloseButton | ToolWindowManager::DisallowFloatWindow); - - ui->variables->setWindowTitle(tr("Variables")); - ui->docking->addToolWindow( - ui->variables, - ToolWindowManager::AreaReference(ToolWindowManager::AddTo, ui->docking->areaOf(ui->watch))); - ui->docking->setToolWindowProperties( - ui->variables, ToolWindowManager::HideCloseButton | ToolWindowManager::DisallowFloatWindow); - - ui->constants->setWindowTitle(tr("Constants && Resources")); - ui->docking->addToolWindow( - ui->constants, ToolWindowManager::AreaReference(ToolWindowManager::LeftOf, - ui->docking->areaOf(ui->variables), 0.5f)); - ui->docking->setToolWindowProperties( - ui->constants, ToolWindowManager::HideCloseButton | ToolWindowManager::DisallowFloatWindow); - - m_DisassemblyView->setMarginWidthN(1, 20); - - // display current line in margin 2, distinct from breakpoint in margin 1 - sptr_t markMask = (1 << CURRENT_MARKER) | (1 << FINISHED_MARKER); - - m_DisassemblyView->setMarginMaskN(1, m_DisassemblyView->marginMaskN(1) & ~markMask); - m_DisassemblyView->setMarginMaskN(2, m_DisassemblyView->marginMaskN(2) | markMask); - - QObject::connect(ui->stepBack, &QToolButton::clicked, this, &ShaderViewer::stepBack); - QObject::connect(ui->stepNext, &QToolButton::clicked, this, &ShaderViewer::stepNext); - QObject::connect(ui->runBack, &QToolButton::clicked, this, &ShaderViewer::runBack); - QObject::connect(ui->run, &QToolButton::clicked, this, &ShaderViewer::run); - QObject::connect(ui->runToCursor, &QToolButton::clicked, this, &ShaderViewer::runToCursor); - QObject::connect(ui->runToSample, &QToolButton::clicked, this, &ShaderViewer::runToSample); - QObject::connect(ui->runToNaNOrInf, &QToolButton::clicked, this, &ShaderViewer::runToNanOrInf); - - QObject::connect(new QShortcut(QKeySequence(Qt::Key_F10), m_DisassemblyView), - &QShortcut::activated, this, &ShaderViewer::stepNext); - QObject::connect(new QShortcut(QKeySequence(Qt::Key_F10 | Qt::ShiftModifier), m_DisassemblyView), - &QShortcut::activated, this, &ShaderViewer::stepBack); - QObject::connect( - new QShortcut(QKeySequence(Qt::Key_F10 | Qt::ControlModifier), m_DisassemblyView), - &QShortcut::activated, this, &ShaderViewer::runToCursor); - QObject::connect(new QShortcut(QKeySequence(Qt::Key_F5), m_DisassemblyView), - &QShortcut::activated, this, &ShaderViewer::run); - QObject::connect(new QShortcut(QKeySequence(Qt::Key_F5 | Qt::ShiftModifier), m_DisassemblyView), - &QShortcut::activated, this, &ShaderViewer::runBack); - QObject::connect(new QShortcut(QKeySequence(Qt::Key_F9), m_DisassemblyView), - &QShortcut::activated, [this]() { ToggleBreakpoint(); }); - - // event filter to pick up tooltip events - ui->constants->installEventFilter(this); - ui->variables->installEventFilter(this); - ui->watch->installEventFilter(this); - - SetCurrentStep(0); - - QObject::connect(ui->watch, &RDTableWidget::keyPress, this, &ShaderViewer::watch_keyPress); - - ui->watch->insertRow(0); - - for(int i = 0; i < ui->watch->columnCount(); i++) - { - QTableWidgetItem *item = new QTableWidgetItem(); - if(i > 0) - item->setFlags(item->flags() & ~Qt::ItemIsEditable); - ui->watch->setItem(0, i, item); - } - - ui->watch->resizeRowsToContents(); - } - else - { - // hide watch, constants, variables - ui->watch->hide(); - ui->variables->hide(); - ui->constants->hide(); - - // hide debugging toolbar buttons - ui->stepBack->hide(); - ui->stepNext->hide(); - ui->runToCursor->hide(); - ui->runToSample->hide(); - ui->runToNaNOrInf->hide(); - ui->regFormatSep->hide(); - ui->intView->hide(); - ui->floatView->hide(); - - // show input and output signatures - ui->inputSig->setColumns( - {tr("Name"), tr("Index"), tr("Reg"), tr("Type"), tr("SysValue"), tr("Mask"), tr("Used")}); - for(int i = 0; i < ui->inputSig->header()->count(); i++) - ui->inputSig->header()->setSectionResizeMode(i, QHeaderView::ResizeToContents); - - ui->outputSig->setColumns( - {tr("Name"), tr("Index"), tr("Reg"), tr("Type"), tr("SysValue"), tr("Mask"), tr("Used")}); - for(int i = 0; i < ui->outputSig->header()->count(); i++) - ui->outputSig->header()->setSectionResizeMode(i, QHeaderView::ResizeToContents); - - if(shader) - { - for(const SigParameter &s : shader->InputSig) - { - QString name = s.varName.count == 0 - ? ToQStr(s.semanticName) - : QFormatStr("%1 (%2)").arg(ToQStr(s.varName)).arg(ToQStr(s.semanticName)); - if(s.semanticName.count == 0) - name = ToQStr(s.varName); - - QString semIdx = s.needSemanticIndex ? QString::number(s.semanticIndex) : QString(); - - QString regIdx = - s.systemValue == ShaderBuiltin::Undefined ? QString::number(s.regIndex) : lit("-"); - - ui->inputSig->addTopLevelItem(new RDTreeWidgetItem( - {name, semIdx, QString::number(s.regIndex), TypeString(s), ToQStr(s.systemValue), - GetComponentString(s.regChannelMask), GetComponentString(s.channelUsedMask)})); - } - - bool multipleStreams = false; - for(const SigParameter &s : shader->OutputSig) - { - if(s.stream > 0) - { - multipleStreams = true; - break; - } - } - - for(const SigParameter &s : shader->OutputSig) - { - QString name = s.varName.count == 0 - ? ToQStr(s.semanticName) - : QFormatStr("%1 (%2)").arg(ToQStr(s.varName)).arg(ToQStr(s.semanticName)); - if(s.semanticName.count == 0) - name = ToQStr(s.varName); - - if(multipleStreams) - name = QFormatStr("Stream %1 : %2").arg(s.stream).arg(name); - - QString semIdx = s.needSemanticIndex ? QString::number(s.semanticIndex) : QString(); - - QString regIdx = - s.systemValue == ShaderBuiltin::Undefined ? QString::number(s.regIndex) : lit("-"); - - ui->outputSig->addTopLevelItem(new RDTreeWidgetItem( - {name, semIdx, regIdx, TypeString(s), ToQStr(s.systemValue), - GetComponentString(s.regChannelMask), GetComponentString(s.channelUsedMask)})); - } - } - - ui->inputSig->setWindowTitle(tr("Input Signature")); - ui->docking->addToolWindow(ui->inputSig, ToolWindowManager::AreaReference( - ToolWindowManager::BottomOf, - ui->docking->areaOf(m_DisassemblyFrame), 0.2f)); - ui->docking->setToolWindowProperties( - ui->inputSig, ToolWindowManager::HideCloseButton | ToolWindowManager::DisallowFloatWindow); - - ui->outputSig->setWindowTitle(tr("Output Signature")); - ui->docking->addToolWindow( - ui->outputSig, ToolWindowManager::AreaReference(ToolWindowManager::RightOf, - ui->docking->areaOf(ui->inputSig), 0.5f)); - ui->docking->setToolWindowProperties( - ui->outputSig, ToolWindowManager::HideCloseButton | ToolWindowManager::DisallowFloatWindow); - } -} - -ShaderViewer::~ShaderViewer() -{ - // don't want to async invoke while using 'this', so save the trace separately - ShaderDebugTrace *trace = m_Trace; - - m_Ctx.Replay().AsyncInvoke([trace](IReplayController *r) { r->FreeTrace(trace); }); - - if(m_CloseCallback) - m_CloseCallback(&m_Ctx); - - m_Ctx.RemoveLogViewer(this); - delete ui; -} - -void ShaderViewer::OnLogfileLoaded() -{ -} - -void ShaderViewer::OnLogfileClosed() -{ - ToolWindowManager::closeToolWindow(this); -} - -void ShaderViewer::OnEventChanged(uint32_t eventID) -{ -} - -ScintillaEdit *ShaderViewer::AddFileScintilla(const QString &name, const QString &text) -{ - ScintillaEdit *scintilla = MakeEditor( - lit("scintilla") + name, text, IsD3D(m_Ctx.APIProps().localRenderer) ? SCLEX_HLSL : SCLEX_GLSL); - scintilla->setReadOnly(true); - scintilla->setWindowTitle(name); - ((QWidget *)scintilla)->setProperty("name", name); - - QObject::connect(scintilla, &ScintillaEdit::keyPressed, this, &ShaderViewer::readonly_keyPressed); - - ToolWindowManager::AreaReference ref(ToolWindowManager::EmptySpace); - - if(!m_Scintillas.empty()) - ref = ToolWindowManager::AreaReference(ToolWindowManager::AddTo, - ui->docking->areaOf(m_Scintillas[0])); - - ui->docking->addToolWindow(scintilla, ref); - ui->docking->setToolWindowProperties(scintilla, ToolWindowManager::HideCloseButton | - ToolWindowManager::DisallowFloatWindow | - ToolWindowManager::AlwaysDisplayFullTabs); - - m_Scintillas.push_back(scintilla); - - return scintilla; -} - -ScintillaEdit *ShaderViewer::MakeEditor(const QString &name, const QString &text, int lang) -{ - ScintillaEdit *ret = new ScintillaEdit(this); - - ret->setText(text.toUtf8().data()); - - sptr_t numlines = ret->lineCount(); - - int margin0width = 30; - if(numlines > 1000) - margin0width += 6; - if(numlines > 10000) - margin0width += 6; - - ret->setMarginLeft(4); - ret->setMarginWidthN(0, margin0width); - ret->setMarginWidthN(1, 0); - ret->setMarginWidthN(2, 16); - ret->setObjectName(name); - - ret->styleSetFont(STYLE_DEFAULT, - QFontDatabase::systemFont(QFontDatabase::FixedFont).family().toUtf8().data()); - - // C# DarkGreen - ret->indicSetFore(INDICATOR_REGHIGHLIGHT, SCINTILLA_COLOUR(0, 100, 0)); - ret->indicSetStyle(INDICATOR_REGHIGHLIGHT, INDIC_ROUNDBOX); - - // set up find result highlight style - ret->indicSetFore(INDICATOR_FINDRESULT, SCINTILLA_COLOUR(200, 200, 127)); - ret->indicSetStyle(INDICATOR_FINDRESULT, INDIC_FULLBOX); - ret->indicSetAlpha(INDICATOR_FINDRESULT, 50); - ret->indicSetOutlineAlpha(INDICATOR_FINDRESULT, 80); - - ConfigureSyntax(ret, lang); - - ret->setTabWidth(4); - - ret->setScrollWidth(1); - ret->setScrollWidthTracking(true); - - ret->colourise(0, -1); - - ret->emptyUndoBuffer(); - - return ret; -} - -void ShaderViewer::readonly_keyPressed(QKeyEvent *event) -{ - if(event->key() == Qt::Key_F && (event->modifiers() & Qt::ControlModifier)) - { - m_FindReplace->setReplaceMode(false); - on_findReplace_clicked(); - } - - if(event->key() == Qt::Key_F3) - { - find((event->modifiers() & Qt::ShiftModifier) == 0); - } -} - -void ShaderViewer::editable_keyPressed(QKeyEvent *event) -{ - if(event->key() == Qt::Key_H && (event->modifiers() & Qt::ControlModifier)) - { - m_FindReplace->setReplaceMode(true); - on_findReplace_clicked(); - } -} - -void ShaderViewer::disassembly_contextMenu(const QPoint &pos) -{ - int scintillaPos = m_DisassemblyView->positionFromPoint(pos.x(), pos.y()); - - QMenu contextMenu(this); - - QAction intDisplay(tr("Integer register display"), this); - QAction floatDisplay(tr("Float register display"), this); - - intDisplay.setCheckable(true); - floatDisplay.setCheckable(true); - - intDisplay.setChecked(ui->intView->isChecked()); - floatDisplay.setChecked(ui->floatView->isChecked()); - - QObject::connect(&intDisplay, &QAction::triggered, this, &ShaderViewer::on_intView_clicked); - QObject::connect(&floatDisplay, &QAction::triggered, this, &ShaderViewer::on_floatView_clicked); - - contextMenu.addAction(&intDisplay); - contextMenu.addAction(&floatDisplay); - contextMenu.addSeparator(); - - QAction addBreakpoint(tr("Toggle breakpoint here"), this); - QAction runCursor(tr("Run to Cursor"), this); - - QObject::connect(&addBreakpoint, &QAction::triggered, [this, scintillaPos] { - m_DisassemblyView->setSelection(scintillaPos, scintillaPos); - ToggleBreakpoint(); - }); - QObject::connect(&runCursor, &QAction::triggered, [this, scintillaPos] { - m_DisassemblyView->setSelection(scintillaPos, scintillaPos); - runToCursor(); - }); - - contextMenu.addAction(&addBreakpoint); - contextMenu.addAction(&runCursor); - contextMenu.addSeparator(); - - QAction copyText(tr("Copy"), this); - QAction selectAll(tr("Select All"), this); - - copyText.setEnabled(!m_DisassemblyView->selectionEmpty()); - - QObject::connect(©Text, &QAction::triggered, [this] { - m_DisassemblyView->copyRange(m_DisassemblyView->selectionStart(), - m_DisassemblyView->selectionEnd()); - }); - QObject::connect(&selectAll, &QAction::triggered, [this] { m_DisassemblyView->selectAll(); }); - - contextMenu.addAction(©Text); - contextMenu.addAction(&selectAll); - contextMenu.addSeparator(); - - RDDialog::show(&contextMenu, m_DisassemblyView->viewport()->mapToGlobal(pos)); -} - -void ShaderViewer::disassembly_buttonReleased(QMouseEvent *event) -{ - if(event->button() == Qt::LeftButton) - { - sptr_t scintillaPos = m_DisassemblyView->positionFromPoint(event->x(), event->y()); - - sptr_t start = m_DisassemblyView->wordStartPosition(scintillaPos, true); - sptr_t end = m_DisassemblyView->wordEndPosition(scintillaPos, true); - - QString text = QString::fromUtf8(m_DisassemblyView->textRange(start, end)); - - if(!text.isEmpty()) - { - VariableTag tag; - getRegisterFromWord(text, tag.cat, tag.idx, tag.arrayIdx); - - // for now since we don't have friendly naming, only highlight registers - if(tag.cat != VariableCategory::Unknown) - { - start = 0; - end = m_DisassemblyView->length(); - - for(int i = 0; i < ui->variables->topLevelItemCount(); i++) - { - RDTreeWidgetItem *item = ui->variables->topLevelItem(i); - if(item->tag().value() == tag) - item->setBackgroundColor(QColor::fromHslF( - 0.333f, 1.0f, qBound(0.25, palette().color(QPalette::Base).lightnessF(), 0.85))); - else - item->setBackground(QBrush()); - } - - for(int i = 0; i < ui->constants->topLevelItemCount(); i++) - { - RDTreeWidgetItem *item = ui->constants->topLevelItem(i); - if(item->tag().value() == tag) - item->setBackgroundColor(QColor::fromHslF( - 0.333f, 1.0f, qBound(0.25, palette().color(QPalette::Base).lightnessF(), 0.85))); - else - item->setBackground(QBrush()); - } - - m_DisassemblyView->setIndicatorCurrent(INDICATOR_REGHIGHLIGHT); - m_DisassemblyView->indicatorClearRange(start, end); - - sptr_t flags = SCFIND_MATCHCASE | SCFIND_WHOLEWORD; - - if(tag.cat != VariableCategory::Unknown) - { - flags |= SCFIND_REGEXP | SCFIND_POSIX; - text += lit("\\.[xyzwrgba]+"); - } - - QByteArray findUtf8 = text.toUtf8(); - - QPair result; - - do - { - result = m_DisassemblyView->findText(flags, findUtf8.data(), start, end); - - if(result.first >= 0) - m_DisassemblyView->indicatorFillRange(result.first, result.second - result.first); - - start = result.second; - - } while(result.first >= 0); - } - } - } -} - -void ShaderViewer::disassemble_typeChanged(int index) -{ - if(m_ShaderDetails == NULL) - return; - - QByteArray target = m_DisassemblyType->currentText().toUtf8(); - - m_Ctx.Replay().AsyncInvoke([this, target](IReplayController *r) { - rdctype::str disasm = r->DisassembleShader(m_ShaderDetails, target.data()); - - GUIInvoke::call([this, disasm]() { - m_DisassemblyView->setReadOnly(false); - m_DisassemblyView->setText(disasm.c_str()); - m_DisassemblyView->setReadOnly(true); - m_DisassemblyView->emptyUndoBuffer(); - }); - }); -} - -void ShaderViewer::watch_keyPress(QKeyEvent *event) -{ - if(event->key() == Qt::Key_Delete || event->key() == Qt::Key_Backspace) - { - QList items = ui->watch->selectedItems(); - if(!items.isEmpty() && items.back()->row() < ui->watch->rowCount() - 1) - ui->watch->removeRow(items.back()->row()); - } -} - -void ShaderViewer::on_watch_itemChanged(QTableWidgetItem *item) -{ - // ignore changes to the type/value columns. Only look at name changes, which must be by the user - if(item->column() != 0) - return; - - static bool recurse = false; - - if(recurse) - return; - - recurse = true; - - // if the item is now empty, remove it - if(item->text().isEmpty()) - ui->watch->removeRow(item->row()); - - // ensure we have a trailing row for adding new watch items. - - if(ui->watch->rowCount() == 0 || ui->watch->item(ui->watch->rowCount() - 1, 0) == NULL || - !ui->watch->item(ui->watch->rowCount() - 1, 0)->text().isEmpty()) - { - // add a new row if needed - if(ui->watch->rowCount() == 0 || ui->watch->item(ui->watch->rowCount() - 1, 0) != NULL) - ui->watch->insertRow(ui->watch->rowCount()); - - for(int i = 0; i < ui->watch->columnCount(); i++) - { - QTableWidgetItem *newItem = new QTableWidgetItem(); - if(i > 0) - newItem->setFlags(newItem->flags() & ~Qt::ItemIsEditable); - ui->watch->setItem(ui->watch->rowCount() - 1, i, newItem); - } - } - - ui->watch->resizeRowsToContents(); - - recurse = false; - - updateDebugging(); -} - -bool ShaderViewer::stepBack() -{ - if(!m_Trace) - return false; - - if(CurrentStep() == 0) - return false; - - SetCurrentStep(CurrentStep() - 1); - - return true; -} - -bool ShaderViewer::stepNext() -{ - if(!m_Trace) - return false; - - if(CurrentStep() + 1 >= m_Trace->states.count) - return false; - - SetCurrentStep(CurrentStep() + 1); - - return true; -} - -void ShaderViewer::runToCursor() -{ - if(!m_Trace) - return; - - sptr_t i = m_DisassemblyView->lineFromPosition(m_DisassemblyView->currentPos()); - - for(; i < m_DisassemblyView->lineCount(); i++) - { - int line = instructionForLine(i); - if(line >= 0) - { - runTo(line, true); - break; - } - } -} - -int ShaderViewer::instructionForLine(sptr_t line) -{ - QString trimmed = QString::fromUtf8(m_DisassemblyView->getLine(line).trimmed()); - - int colon = trimmed.indexOf(QLatin1Char(':')); - - if(colon > 0) - { - trimmed.truncate(colon); - - bool ok = false; - int instruction = trimmed.toInt(&ok); - - if(ok && instruction >= 0) - return instruction; - } - - return -1; -} - -void ShaderViewer::runToSample() -{ - runTo(-1, true, ShaderEvents::SampleLoadGather); -} - -void ShaderViewer::runToNanOrInf() -{ - runTo(-1, true, ShaderEvents::GeneratedNanOrInf); -} - -void ShaderViewer::runBack() -{ - runTo(-1, false); -} - -void ShaderViewer::run() -{ - runTo(-1, true); -} - -void ShaderViewer::runTo(int runToInstruction, bool forward, ShaderEvents condition) -{ - if(!m_Trace) - return; - - int step = CurrentStep(); - - int inc = forward ? 1 : -1; - - bool firstStep = true; - - while(step < m_Trace->states.count) - { - if(runToInstruction >= 0 && m_Trace->states[step].nextInstruction == (uint32_t)runToInstruction) - break; - - if(!firstStep && (m_Trace->states[step + inc].flags & condition)) - break; - - if(!firstStep && m_Breakpoints.contains((int)m_Trace->states[step].nextInstruction)) - break; - - firstStep = false; - - if(step + inc < 0 || step + inc >= m_Trace->states.count) - break; - - step += inc; - } - - SetCurrentStep(step); -} - -QString ShaderViewer::stringRep(const ShaderVariable &var, bool useType) -{ - if(ui->intView->isChecked() || (useType && var.type == VarType::Int)) - return RowString(var, 0, VarType::Int); - - if(useType && var.type == VarType::UInt) - return RowString(var, 0, VarType::UInt); - - return RowString(var, 0, VarType::Float); -} - -RDTreeWidgetItem *ShaderViewer::makeResourceRegister(const BindpointMap &bind, uint32_t idx, - const BoundResource &bound, - const ShaderResource &res) -{ - QString name = QFormatStr(" (%1)").arg(ToQStr(res.name)); - - const TextureDescription *tex = m_Ctx.GetTexture(bound.Id); - const BufferDescription *buf = m_Ctx.GetBuffer(bound.Id); - - if(res.IsSampler) - return NULL; - - QChar regChar(QLatin1Char('u')); - - if(res.IsReadOnly) - regChar = QLatin1Char('t'); - - QString regname; - - if(m_Ctx.APIProps().pipelineType == GraphicsAPI::D3D12) - { - if(bind.arraySize == 1) - regname = QFormatStr("%1%2:%3").arg(regChar).arg(bind.bindset).arg(bind.bind); - else - regname = QFormatStr("%1%2:%3[%4]").arg(regChar).arg(bind.bindset).arg(bind.bind).arg(idx); - } - else - { - regname = QFormatStr("%1%2").arg(regChar).arg(bind.bind); - } - - if(tex) - { - QString type = QFormatStr("%1x%2x%3[%4] @ %5 - %6") - .arg(tex->width) - .arg(tex->height) - .arg(tex->depth > 1 ? tex->depth : tex->arraysize) - .arg(tex->mips) - .arg(ToQStr(tex->format.strname)) - .arg(ToQStr(tex->name)); - - return new RDTreeWidgetItem({regname + name, lit("Texture"), type}); - } - else if(buf) - { - QString type = QFormatStr("%1 - %2").arg(buf->length).arg(ToQStr(buf->name)); - - return new RDTreeWidgetItem({regname + name, lit("Buffer"), type}); - } - else - { - return new RDTreeWidgetItem({regname + name, lit("Resource"), lit("unknown")}); - } -} - -void ShaderViewer::addFileList() -{ - QListWidget *list = new QListWidget(this); - list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - list->setSelectionMode(QAbstractItemView::SingleSelection); - QObject::connect(list, &QListWidget::currentRowChanged, - [this](int idx) { ToolWindowManager::raiseToolWindow(m_Scintillas[idx]); }); - list->setWindowTitle(tr("File List")); - - for(ScintillaEdit *s : m_Scintillas) - list->addItem(s->windowTitle()); - - ui->docking->addToolWindow( - list, ToolWindowManager::AreaReference(ToolWindowManager::LeftOf, - ui->docking->areaOf(m_Scintillas.front()), 0.2f)); - ui->docking->setToolWindowProperties( - list, ToolWindowManager::HideCloseButton | ToolWindowManager::DisallowFloatWindow); -} - -void ShaderViewer::updateDebugging() -{ - if(!m_Trace || m_CurrentStep < 0 || m_CurrentStep >= m_Trace->states.count) - return; - - const ShaderDebugState &state = m_Trace->states[m_CurrentStep]; - - uint32_t nextInst = state.nextInstruction; - bool done = false; - - if(m_CurrentStep == m_Trace->states.count - 1) - { - nextInst--; - done = true; - } - - // add current instruction marker - m_DisassemblyView->markerDeleteAll(CURRENT_MARKER); - m_DisassemblyView->markerDeleteAll(CURRENT_MARKER + 1); - m_DisassemblyView->markerDeleteAll(FINISHED_MARKER); - m_DisassemblyView->markerDeleteAll(FINISHED_MARKER + 1); - - for(sptr_t i = 0; i < m_DisassemblyView->lineCount(); i++) - { - if(QString::fromUtf8(m_DisassemblyView->getLine(i).trimmed()) - .startsWith(QFormatStr("%1:").arg(nextInst))) - { - m_DisassemblyView->markerAdd(i, done ? FINISHED_MARKER : CURRENT_MARKER); - m_DisassemblyView->markerAdd(i, done ? FINISHED_MARKER + 1 : CURRENT_MARKER + 1); - - int pos = m_DisassemblyView->positionFromLine(i); - m_DisassemblyView->setSelection(pos, pos); - - ensureLineScrolled(m_DisassemblyView, i); - break; - } - } - - if(ui->constants->topLevelItemCount() == 0) - { - for(int i = 0; i < m_Trace->cbuffers.count; i++) - { - for(int j = 0; j < m_Trace->cbuffers[i].count; j++) - { - if(m_Trace->cbuffers[i][j].rows > 0 || m_Trace->cbuffers[i][j].columns > 0) - { - RDTreeWidgetItem *node = - new RDTreeWidgetItem({ToQStr(m_Trace->cbuffers[i][j].name), lit("cbuffer"), - stringRep(m_Trace->cbuffers[i][j], false)}); - node->setTag(QVariant::fromValue(VariableTag(VariableCategory::Constants, j, i))); - - ui->constants->addTopLevelItem(node); - } - } - } - - for(int i = 0; i < m_Trace->inputs.count; i++) - { - const ShaderVariable &input = m_Trace->inputs[i]; - - if(input.rows > 0 || input.columns > 0) - { - RDTreeWidgetItem *node = new RDTreeWidgetItem( - {ToQStr(input.name), ToQStr(input.type) + lit(" input"), stringRep(input, true)}); - node->setTag(QVariant::fromValue(VariableTag(VariableCategory::Inputs, i))); - - ui->constants->addTopLevelItem(node); - } - } - - QMap> rw = - m_Ctx.CurPipelineState().GetReadWriteResources(m_Stage); - QMap> ro = - m_Ctx.CurPipelineState().GetReadOnlyResources(m_Stage); - - bool tree = false; - - for(int i = 0; - i < m_Mapping->ReadWriteResources.count && i < m_ShaderDetails->ReadWriteResources.count; i++) - { - BindpointMap bind = m_Mapping->ReadWriteResources[i]; - - if(!bind.used) - continue; - - if(bind.arraySize == 1) - { - RDTreeWidgetItem *node = - makeResourceRegister(bind, 0, rw[bind][0], m_ShaderDetails->ReadWriteResources[i]); - if(node) - ui->constants->addTopLevelItem(node); - } - else - { - RDTreeWidgetItem *node = - new RDTreeWidgetItem({ToQStr(m_ShaderDetails->ReadWriteResources[i].name), - QFormatStr("[%1]").arg(bind.arraySize), QString()}); - - for(uint32_t a = 0; a < bind.arraySize; a++) - node->addChild( - makeResourceRegister(bind, a, rw[bind][a], m_ShaderDetails->ReadWriteResources[i])); - - tree = true; - - ui->constants->addTopLevelItem(node); - } - } - - for(int i = 0; - i < m_Mapping->ReadOnlyResources.count && i < m_ShaderDetails->ReadOnlyResources.count; i++) - { - BindpointMap bind = m_Mapping->ReadOnlyResources[i]; - - if(!bind.used) - continue; - - if(bind.arraySize == 1) - { - RDTreeWidgetItem *node = - makeResourceRegister(bind, 0, ro[bind][0], m_ShaderDetails->ReadOnlyResources[i]); - if(node) - ui->constants->addTopLevelItem(node); - } - else - { - RDTreeWidgetItem *node = - new RDTreeWidgetItem({ToQStr(m_ShaderDetails->ReadOnlyResources[i].name), - QFormatStr("[%1]").arg(bind.arraySize), QString()}); - - for(uint32_t a = 0; a < bind.arraySize; a++) - node->addChild( - makeResourceRegister(bind, a, ro[bind][a], m_ShaderDetails->ReadOnlyResources[i])); - - tree = true; - - ui->constants->addTopLevelItem(node); - } - } - - if(tree) - { - ui->constants->setIndentation(20); - ui->constants->setRootIsDecorated(true); - } - } - - if(ui->variables->topLevelItemCount() == 0) - { - for(int i = 0; i < state.registers.count; i++) - ui->variables->addTopLevelItem( - new RDTreeWidgetItem({ToQStr(state.registers[i].name), lit("temporary"), QString()})); - - for(int i = 0; i < state.indexableTemps.count; i++) - { - RDTreeWidgetItem *node = - new RDTreeWidgetItem({QFormatStr("x%1").arg(i), lit("indexable"), QString()}); - for(int t = 0; t < state.indexableTemps[i].count; t++) - node->addChild(new RDTreeWidgetItem( - {ToQStr(state.indexableTemps[i][t].name), lit("indexable"), QString()})); - ui->variables->addTopLevelItem(node); - } - - for(int i = 0; i < state.outputs.count; i++) - ui->variables->addTopLevelItem( - new RDTreeWidgetItem({ToQStr(state.outputs[i].name), lit("output"), QString()})); - } - - ui->variables->setUpdatesEnabled(false); - - int v = 0; - - for(int i = 0; i < state.registers.count; i++) - { - RDTreeWidgetItem *node = ui->variables->topLevelItem(v++); - - node->setText(2, stringRep(state.registers[i], false)); - node->setTag(QVariant::fromValue(VariableTag(VariableCategory::Temporaries, i))); - } - - for(int i = 0; i < state.indexableTemps.count; i++) - { - RDTreeWidgetItem *node = ui->variables->topLevelItem(v++); - - for(int t = 0; t < state.indexableTemps[i].count; t++) - { - RDTreeWidgetItem *child = node->child(t); - - child->setText(2, stringRep(state.indexableTemps[i][t], false)); - child->setTag(QVariant::fromValue(VariableTag(VariableCategory::IndexTemporaries, t, i))); - } - } - - for(int i = 0; i < state.outputs.count; i++) - { - RDTreeWidgetItem *node = ui->variables->topLevelItem(v++); - - node->setText(2, stringRep(state.outputs[i], false)); - node->setTag(QVariant::fromValue(VariableTag(VariableCategory::Outputs, i))); - } - - ui->variables->setUpdatesEnabled(true); - - ui->watch->setUpdatesEnabled(false); - - for(int i = 0; i < ui->watch->rowCount() - 1; i++) - { - QTableWidgetItem *item = ui->watch->item(i, 0); - ui->watch->setItem(i, 1, new QTableWidgetItem(tr("register", "watch type"))); - - QString reg = item->text().trimmed(); - - QRegularExpression regexp(lit("^([rvo])([0-9]+)(\\.[xyzwrgba]+)?(,[xfiudb])?$")); - - QRegularExpressionMatch match = regexp.match(reg); - - // try indexable temps - if(!match.hasMatch()) - { - regexp = QRegularExpression(lit("^(x[0-9]+)\\[([0-9]+)\\](\\.[xyzwrgba]+)?(,[xfiudb])?$")); - - match = regexp.match(reg); - } - - if(match.hasMatch()) - { - QString regtype = match.captured(1); - QString regidx = match.captured(2); - QString swizzle = match.captured(3).replace(QLatin1Char('.'), QString()); - QString regcast = match.captured(4).replace(QLatin1Char(','), QString()); - - if(regcast.isEmpty()) - { - if(ui->intView->isChecked()) - regcast = lit("i"); - else - regcast = lit("f"); - } - - VariableCategory varCat = VariableCategory::Unknown; - int arrIndex = -1; - - bool ok = false; - - if(regtype == lit("r")) - { - varCat = VariableCategory::Temporaries; - } - else if(regtype == lit("v")) - { - varCat = VariableCategory::Inputs; - } - else if(regtype == lit("o")) - { - varCat = VariableCategory::Outputs; - } - else if(regtype[0] == QLatin1Char('x')) - { - varCat = VariableCategory::IndexTemporaries; - QString tempArrayIndexStr = regtype.mid(1); - arrIndex = tempArrayIndexStr.toInt(&ok); - - if(!ok) - arrIndex = -1; - } - - const rdctype::array *vars = GetVariableList(varCat, arrIndex); - - ok = false; - int regindex = regidx.toInt(&ok); - - if(vars && ok && regindex >= 0 && regindex < vars->count) - { - const ShaderVariable &vr = vars->elems[regindex]; - - if(swizzle.isEmpty()) - { - swizzle = lit("xyzw").left((int)vr.columns); - - if(regcast == lit("d") && swizzle.count() > 2) - swizzle = lit("xy"); - } - - QString val; - - for(int s = 0; s < swizzle.count(); s++) - { - QChar swiz = swizzle[s]; - - int elindex = 0; - if(swiz == QLatin1Char('x') || swiz == QLatin1Char('r')) - elindex = 0; - if(swiz == QLatin1Char('y') || swiz == QLatin1Char('g')) - elindex = 1; - if(swiz == QLatin1Char('z') || swiz == QLatin1Char('b')) - elindex = 2; - if(swiz == QLatin1Char('w') || swiz == QLatin1Char('a')) - elindex = 3; - - if(regcast == lit("i")) - { - val += Formatter::Format(vr.value.iv[elindex]); - } - else if(regcast == lit("f")) - { - val += Formatter::Format(vr.value.fv[elindex]); - } - else if(regcast == lit("u")) - { - val += Formatter::Format(vr.value.uv[elindex]); - } - else if(regcast == lit("x")) - { - val += Formatter::Format(vr.value.uv[elindex], true); - } - else if(regcast == lit("b")) - { - val += QFormatStr("%1").arg(vr.value.uv[elindex], 32, 2, QLatin1Char('0')); - } - else if(regcast == lit("d")) - { - if(elindex < 2) - val += Formatter::Format(vr.value.dv[elindex]); - else - val += lit("-"); - } - - if(s < swizzle.count() - 1) - val += lit(", "); - } - - item = new QTableWidgetItem(val); - item->setData(Qt::UserRole, QVariant::fromValue(VariableTag(varCat, regindex, arrIndex))); - - ui->watch->setItem(i, 2, item); - - continue; - } - } - - ui->watch->setItem(i, 2, new QTableWidgetItem(tr("Error evaluating expression"))); - } - - ui->watch->setUpdatesEnabled(true); - - updateVariableTooltip(); -} - -void ShaderViewer::ensureLineScrolled(ScintillaEdit *s, int line) -{ - int firstLine = s->firstVisibleLine(); - int linesVisible = s->linesOnScreen(); - - if(s->isVisible() && (line < firstLine || line > (firstLine + linesVisible))) - s->scrollCaret(); -} - -int ShaderViewer::CurrentStep() -{ - return m_CurrentStep; -} - -void ShaderViewer::SetCurrentStep(int step) -{ - if(m_Trace && !m_Trace->states.empty()) - m_CurrentStep = qBound(0, step, m_Trace->states.count - 1); - else - m_CurrentStep = 0; - - updateDebugging(); -} - -void ShaderViewer::ToggleBreakpoint(int instruction) -{ - sptr_t instLine = -1; - - if(instruction == -1) - { - // search forward for an instruction - instLine = m_DisassemblyView->lineFromPosition(m_DisassemblyView->currentPos()); - - for(; instLine < m_DisassemblyView->lineCount(); instLine++) - { - instruction = instructionForLine(instLine); - - if(instruction >= 0) - break; - } - } - - if(instruction < 0 || instruction >= m_DisassemblyView->lineCount()) - return; - - if(instLine == -1) - { - // find line for this instruction - for(instLine = 0; instLine < m_DisassemblyView->lineCount(); instLine++) - { - int inst = instructionForLine(instLine); - - if(instruction == inst) - break; - } - - if(instLine >= m_DisassemblyView->lineCount()) - instLine = -1; - } - - if(m_Breakpoints.contains(instruction)) - { - if(instLine >= 0) - { - m_DisassemblyView->markerDelete(instLine, BREAKPOINT_MARKER); - m_DisassemblyView->markerDelete(instLine, BREAKPOINT_MARKER + 1); - } - m_Breakpoints.removeOne(instruction); - } - else - { - if(instLine >= 0) - { - m_DisassemblyView->markerAdd(instLine, BREAKPOINT_MARKER); - m_DisassemblyView->markerAdd(instLine, BREAKPOINT_MARKER + 1); - } - m_Breakpoints.push_back(instruction); - } -} - -void ShaderViewer::ShowErrors(const QString &errors) -{ - if(m_Errors) - { - m_Errors->setReadOnly(false); - m_Errors->setText(errors.toUtf8().data()); - m_Errors->setReadOnly(true); - } -} - -int ShaderViewer::snippetPos() -{ - if(IsD3D(m_Ctx.APIProps().pipelineType)) - return 0; - - if(m_Scintillas.isEmpty()) - return 0; - - QPair ver = - m_Scintillas[0]->findText(SCFIND_REGEXP, "#version.*", 0, m_Scintillas[0]->length()); - - if(ver.first < 0) - return 0; - - return ver.second + 1; -} - -void ShaderViewer::insertVulkanUBO() -{ - if(m_Scintillas.isEmpty()) - return; - - m_Scintillas[0]->insertText(snippetPos(), - "layout(binding = 0, std140) uniform RENDERDOC_Uniforms\n" - "{\n" - " uvec4 TexDim;\n" - " uint SelectedMip;\n" - " int TextureType;\n" - " uint SelectedSliceFace;\n" - " int SelectedSample;\n" - "} RENDERDOC;\n\n"); -} - -void ShaderViewer::snippet_textureDimensions() -{ - if(m_Scintillas.isEmpty()) - return; - - GraphicsAPI api = m_Ctx.APIProps().pipelineType; - - if(IsD3D(api)) - { - m_Scintillas[0]->insertText(snippetPos(), - "// xyz == width, height, depth. w == # mips\n" - "uint4 RENDERDOC_TexDim; \n\n"); - } - else if(api == GraphicsAPI::OpenGL) - { - m_Scintillas[0]->insertText(snippetPos(), - "// xyz == width, height, depth. w == # mips\n" - "uniform uvec4 RENDERDOC_TexDim;\n\n"); - } - else if(api == GraphicsAPI::Vulkan) - { - insertVulkanUBO(); - } - - m_Scintillas[0]->setSelection(0, 0); -} - -void ShaderViewer::snippet_selectedMip() -{ - if(m_Scintillas.isEmpty()) - return; - - GraphicsAPI api = m_Ctx.APIProps().pipelineType; - - if(IsD3D(api)) - { - m_Scintillas[0]->insertText(snippetPos(), - "// selected mip in UI\n" - "uint RENDERDOC_SelectedMip;\n\n"); - } - else if(api == GraphicsAPI::OpenGL) - { - m_Scintillas[0]->insertText(snippetPos(), - "// selected mip in UI\n" - "uniform uint RENDERDOC_SelectedMip;\n\n"); - } - else if(api == GraphicsAPI::Vulkan) - { - insertVulkanUBO(); - } - - m_Scintillas[0]->setSelection(0, 0); -} - -void ShaderViewer::snippet_selectedSlice() -{ - if(m_Scintillas.isEmpty()) - return; - - GraphicsAPI api = m_Ctx.APIProps().pipelineType; - - if(IsD3D(api)) - { - m_Scintillas[0]->insertText(snippetPos(), - "// selected array slice or cubemap face in UI\n" - "uint RENDERDOC_SelectedSliceFace;\n\n"); - } - else if(api == GraphicsAPI::OpenGL) - { - m_Scintillas[0]->insertText(snippetPos(), - "// selected array slice or cubemap face in UI\n" - "uniform uint RENDERDOC_SelectedSliceFace;\n\n"); - } - else if(api == GraphicsAPI::Vulkan) - { - insertVulkanUBO(); - } - - m_Scintillas[0]->setSelection(0, 0); -} - -void ShaderViewer::snippet_selectedSample() -{ - if(m_Scintillas.isEmpty()) - return; - - GraphicsAPI api = m_Ctx.APIProps().pipelineType; - - if(IsD3D(api)) - { - m_Scintillas[0]->insertText(snippetPos(), - "// selected MSAA sample or -numSamples for resolve. See docs\n" - "int RENDERDOC_SelectedSample;\n\n"); - } - else if(api == GraphicsAPI::OpenGL) - { - m_Scintillas[0]->insertText(snippetPos(), - "// selected MSAA sample or -numSamples for resolve. See docs\n" - "uniform int RENDERDOC_SelectedSample;\n\n"); - } - else if(api == GraphicsAPI::Vulkan) - { - insertVulkanUBO(); - } - - m_Scintillas[0]->setSelection(0, 0); -} - -void ShaderViewer::snippet_selectedType() -{ - if(m_Scintillas.isEmpty()) - return; - - GraphicsAPI api = m_Ctx.APIProps().pipelineType; - - if(IsD3D(api)) - { - m_Scintillas[0]->insertText(snippetPos(), - "// 1 = 1D, 2 = 2D, 3 = 3D, 4 = Depth, 5 = Depth + Stencil\n" - "// 6 = Depth (MS), 7 = Depth + Stencil (MS)\n" - "uint RENDERDOC_TextureType;\n\n"); - } - else if(api == GraphicsAPI::OpenGL) - { - m_Scintillas[0]->insertText(snippetPos(), - "// 1 = 1D, 2 = 2D, 3 = 3D, 4 = Cube\n" - "// 5 = 1DArray, 6 = 2DArray, 7 = CubeArray\n" - "// 8 = Rect, 9 = Buffer, 10 = 2DMS\n" - "uniform uint RENDERDOC_TextureType;\n\n"); - } - else if(api == GraphicsAPI::Vulkan) - { - insertVulkanUBO(); - } - - m_Scintillas[0]->setSelection(0, 0); -} - -void ShaderViewer::snippet_samplers() -{ - if(m_Scintillas.isEmpty()) - return; - - GraphicsAPI api = m_Ctx.APIProps().pipelineType; - - if(IsD3D(api)) - { - m_Scintillas[0]->insertText(snippetPos(), - "// Samplers\n" - "SamplerState pointSampler : register(s0);\n" - "SamplerState linearSampler : register(s1);\n" - "// End Samplers\n\n"); - - m_Scintillas[0]->setSelection(0, 0); - } -} - -void ShaderViewer::snippet_resources() -{ - if(m_Scintillas.isEmpty()) - return; - - GraphicsAPI api = m_Ctx.APIProps().pipelineType; - - if(IsD3D(api)) - { - m_Scintillas[0]->insertText( - snippetPos(), - "// Textures\n" - "Texture1DArray texDisplayTex1DArray : register(t1);\n" - "Texture2DArray texDisplayTex2DArray : register(t2);\n" - "Texture3D texDisplayTex3D : register(t3);\n" - "Texture2DArray texDisplayTexDepthArray : register(t4);\n" - "Texture2DArray texDisplayTexStencilArray : register(t5);\n" - "Texture2DMSArray texDisplayTexDepthMSArray : register(t6);\n" - "Texture2DMSArray texDisplayTexStencilMSArray : register(t7);\n" - "Texture2DMSArray texDisplayTex2DMSArray : register(t9);\n" - "\n" - "Texture1DArray texDisplayUIntTex1DArray : register(t11);\n" - "Texture2DArray texDisplayUIntTex2DArray : register(t12);\n" - "Texture3D texDisplayUIntTex3D : register(t13);\n" - "Texture2DMSArray texDisplayUIntTex2DMSArray : register(t19);\n" - "\n" - "Texture1DArray texDisplayIntTex1DArray : register(t21);\n" - "Texture2DArray texDisplayIntTex2DArray : register(t22);\n" - "Texture3D texDisplayIntTex3D : register(t23);\n" - "Texture2DMSArray texDisplayIntTex2DMSArray : register(t29);\n" - "// End Textures\n\n\n"); - } - else if(api == GraphicsAPI::OpenGL) - { - m_Scintillas[0]->insertText(snippetPos(), - "// Textures\n" - "// Unsigned int samplers\n" - "layout (binding = 1) uniform usampler1D texUInt1D;\n" - "layout (binding = 2) uniform usampler2D texUInt2D;\n" - "layout (binding = 3) uniform usampler3D texUInt3D;\n" - "// cube = 4\n" - "layout (binding = 5) uniform usampler1DArray texUInt1DArray;\n" - "layout (binding = 6) uniform usampler2DArray texUInt2DArray;\n" - "// cube array = 7\n" - "layout (binding = 8) uniform usampler2DRect texUInt2DRect;\n" - "layout (binding = 9) uniform usamplerBuffer texUIntBuffer;\n" - "layout (binding = 10) uniform usampler2DMS texUInt2DMS;\n" - "\n" - "// Int samplers\n" - "layout (binding = 1) uniform isampler1D texSInt1D;\n" - "layout (binding = 2) uniform isampler2D texSInt2D;\n" - "layout (binding = 3) uniform isampler3D texSInt3D;\n" - "// cube = 4\n" - "layout (binding = 5) uniform isampler1DArray texSInt1DArray;\n" - "layout (binding = 6) uniform isampler2DArray texSInt2DArray;\n" - "// cube array = 7\n" - "layout (binding = 8) uniform isampler2DRect texSInt2DRect;\n" - "layout (binding = 9) uniform isamplerBuffer texSIntBuffer;\n" - "layout (binding = 10) uniform isampler2DMS texSInt2DMS;\n" - "\n" - "// Floating point samplers\n" - "layout (binding = 1) uniform sampler1D tex1D;\n" - "layout (binding = 2) uniform sampler2D tex2D;\n" - "layout (binding = 3) uniform sampler3D tex3D;\n" - "layout (binding = 4) uniform samplerCube texCube;\n" - "layout (binding = 5) uniform sampler1DArray tex1DArray;\n" - "layout (binding = 6) uniform sampler2DArray tex2DArray;\n" - "layout (binding = 7) uniform samplerCubeArray texCubeArray;\n" - "layout (binding = 8) uniform sampler2DRect tex2DRect;\n" - "layout (binding = 9) uniform samplerBuffer texBuffer;\n" - "layout (binding = 10) uniform sampler2DMS tex2DMS;\n" - "// End Textures\n\n\n"); - } - else if(api == GraphicsAPI::Vulkan) - { - m_Scintillas[0]->insertText(snippetPos(), - "// Textures\n" - "// Floating point samplers\n" - "layout(binding = 6) uniform sampler1DArray tex1DArray;\n" - "layout(binding = 7) uniform sampler2DArray tex2DArray;\n" - "layout(binding = 8) uniform sampler3D tex3D;\n" - "layout(binding = 9) uniform sampler2DMS tex2DMS;\n" - "\n" - "// Unsigned int samplers\n" - "layout(binding = 11) uniform usampler1DArray texUInt1DArray;\n" - "layout(binding = 12) uniform usampler2DArray texUInt2DArray;\n" - "layout(binding = 13) uniform usampler3D texUInt3D;\n" - "layout(binding = 14) uniform usampler2DMS texUInt2DMS;\n" - "\n" - "// Int samplers\n" - "layout(binding = 16) uniform isampler1DArray texSInt1DArray;\n" - "layout(binding = 17) uniform isampler2DArray texSInt2DArray;\n" - "layout(binding = 18) uniform isampler3D texSInt3D;\n" - "layout(binding = 19) uniform isampler2DMS texSInt2DMS;\n" - "// End Textures\n\n\n"); - } - - m_Scintillas[0]->setSelection(0, 0); -} - -bool ShaderViewer::eventFilter(QObject *watched, QEvent *event) -{ - if(event->type() == QEvent::ToolTip) - { - QHelpEvent *he = (QHelpEvent *)event; - - RDTreeWidget *tree = qobject_cast(watched); - if(tree) - { - RDTreeWidgetItem *item = tree->itemAt(tree->viewport()->mapFromGlobal(QCursor::pos())); - if(item) - { - VariableTag tag = item->tag().value(); - showVariableTooltip(tag.cat, tag.idx, tag.arrayIdx); - } - } - - RDTableWidget *table = qobject_cast(watched); - if(table) - { - QTableWidgetItem *item = table->itemAt(table->viewport()->mapFromGlobal(QCursor::pos())); - if(item) - { - item = table->item(item->row(), 2); - VariableTag tag = item->data(Qt::UserRole).value(); - showVariableTooltip(tag.cat, tag.idx, tag.arrayIdx); - } - } - } - if(event->type() == QEvent::MouseMove || event->type() == QEvent::Leave) - { - hideVariableTooltip(); - } - - return QFrame::eventFilter(watched, event); -} - -void ShaderViewer::disasm_tooltipShow(int x, int y) -{ - // do nothing if there's no trace - if(!m_Trace || m_CurrentStep < 0 || m_CurrentStep >= m_Trace->states.count) - return; - - // ignore any messages if we're already outside the viewport - if(!m_DisassemblyView->rect().contains(m_DisassemblyView->mapFromGlobal(QCursor::pos()))) - return; - - if(m_DisassemblyView->isVisible()) - { - sptr_t scintillaPos = m_DisassemblyView->positionFromPoint(x, y); - - sptr_t start = m_DisassemblyView->wordStartPosition(scintillaPos, true); - sptr_t end = m_DisassemblyView->wordEndPosition(scintillaPos, true); - - QString text = QString::fromUtf8(m_DisassemblyView->textRange(start, end)); - - if(!text.isEmpty()) - { - VariableTag tag; - getRegisterFromWord(text, tag.cat, tag.idx, tag.arrayIdx); - - if(tag.cat != VariableCategory::Unknown && tag.idx >= 0 && tag.arrayIdx >= 0) - showVariableTooltip(tag.cat, tag.idx, tag.arrayIdx); - } - } -} - -void ShaderViewer::disasm_tooltipHide(int x, int y) -{ - hideVariableTooltip(); -} - -void ShaderViewer::showVariableTooltip(VariableCategory varCat, int varIdx, int arrayIdx) -{ - const rdctype::array *vars = GetVariableList(varCat, arrayIdx); - - if(!vars || varIdx < 0 || varIdx >= vars->count) - { - m_TooltipVarIdx = -1; - return; - } - - m_TooltipVarCat = varCat; - m_TooltipVarIdx = varIdx; - m_TooltipArrayIdx = arrayIdx; - m_TooltipPos = QCursor::pos(); - - updateVariableTooltip(); -} - -const rdctype::array *ShaderViewer::GetVariableList(VariableCategory varCat, - int arrayIdx) -{ - const rdctype::array *vars = NULL; - - if(!m_Trace || m_CurrentStep < 0 || m_CurrentStep >= m_Trace->states.count) - return vars; - - const ShaderDebugState &state = m_Trace->states[m_CurrentStep]; - - arrayIdx = qMax(0, arrayIdx); - - switch(varCat) - { - case VariableCategory::Unknown: vars = NULL; break; - case VariableCategory::Temporaries: vars = &state.registers; break; - case VariableCategory::IndexTemporaries: - vars = arrayIdx < state.indexableTemps.count ? &state.indexableTemps[arrayIdx] : NULL; - break; - case VariableCategory::Inputs: vars = &m_Trace->inputs; break; - case VariableCategory::Constants: - vars = arrayIdx < m_Trace->cbuffers.count ? &m_Trace->cbuffers[arrayIdx] : NULL; - break; - case VariableCategory::Outputs: vars = &state.outputs; break; - } - - return vars; -} - -void ShaderViewer::getRegisterFromWord(const QString &text, VariableCategory &varCat, int &varIdx, - int &arrayIdx) -{ - QChar regtype = text[0]; - QString regidx = text.mid(1); - - varCat = VariableCategory::Unknown; - varIdx = -1; - arrayIdx = 0; - - if(regtype == QLatin1Char('r')) - varCat = VariableCategory::Temporaries; - else if(regtype == QLatin1Char('v')) - varCat = VariableCategory::Inputs; - else if(regtype == QLatin1Char('o')) - varCat = VariableCategory::Outputs; - else - return; - - bool ok = false; - varIdx = regidx.toInt(&ok); - - // if we have a list of registers and the index is in range, and we matched the whole word - // (i.e. v0foo is not the same as v0), then show the tooltip - if(QFormatStr("%1%2").arg(regtype).arg(varIdx) != text) - { - varCat = VariableCategory::Unknown; - varIdx = -1; - } -} - -void ShaderViewer::updateVariableTooltip() -{ - if(m_TooltipVarIdx < 0) - return; - - const rdctype::array *vars = GetVariableList(m_TooltipVarCat, m_TooltipArrayIdx); - const ShaderVariable &var = vars->elems[m_TooltipVarIdx]; - - QString text = QFormatStr("
%1\n").arg(ToQStr(var.name));
-  text +=
-      lit("                 X          Y          Z          W \n"
-          "----------------------------------------------------\n");
-
-  text += QFormatStr("float | %1 %2 %3 %4\n")
-              .arg(Formatter::Format(var.value.fv[0]), 10)
-              .arg(Formatter::Format(var.value.fv[1]), 10)
-              .arg(Formatter::Format(var.value.fv[2]), 10)
-              .arg(Formatter::Format(var.value.fv[3]), 10);
-  text += QFormatStr("uint  | %1 %2 %3 %4\n")
-              .arg(var.value.uv[0], 10, 10, QLatin1Char(' '))
-              .arg(var.value.uv[1], 10, 10, QLatin1Char(' '))
-              .arg(var.value.uv[2], 10, 10, QLatin1Char(' '))
-              .arg(var.value.uv[3], 10, 10, QLatin1Char(' '));
-  text += QFormatStr("int   | %1 %2 %3 %4\n")
-              .arg(var.value.iv[0], 10, 10, QLatin1Char(' '))
-              .arg(var.value.iv[1], 10, 10, QLatin1Char(' '))
-              .arg(var.value.iv[2], 10, 10, QLatin1Char(' '))
-              .arg(var.value.iv[3], 10, 10, QLatin1Char(' '));
-  text += QFormatStr("hex   |   %1   %2   %3   %4")
-              .arg(Formatter::HexFormat(var.value.uv[0], 4))
-              .arg(Formatter::HexFormat(var.value.uv[1], 4))
-              .arg(Formatter::HexFormat(var.value.uv[2], 4))
-              .arg(Formatter::HexFormat(var.value.uv[3], 4));
-
-  text += lit("
"); - - QToolTip::showText(m_TooltipPos, text); -} - -void ShaderViewer::hideVariableTooltip() -{ - QToolTip::hideText(); - m_TooltipVarIdx = -1; -} - -void ShaderViewer::on_findReplace_clicked() -{ - if(m_FindReplace->isVisible()) - { - ToolWindowManager::raiseToolWindow(m_FindReplace); - } - else - { - ui->docking->moveToolWindow( - m_FindReplace, ToolWindowManager::AreaReference(ToolWindowManager::NewFloatingArea)); - ui->docking->setToolWindowProperties(m_FindReplace, ToolWindowManager::HideOnClose); - } - ui->docking->areaOf(m_FindReplace)->parentWidget()->activateWindow(); - m_FindReplace->takeFocus(); -} - -void ShaderViewer::on_save_clicked() -{ - if(m_Trace) - { - m_Ctx.GetPipelineViewer()->SaveShaderFile(m_ShaderDetails); - return; - } - - if(m_SaveCallback) - { - QMap files; - for(ScintillaEdit *s : m_Scintillas) - { - QWidget *w = (QWidget *)s; - files[w->property("filename").toString()] = QString::fromUtf8(s->getText(s->textLength() + 1)); - } - m_SaveCallback(&m_Ctx, this, files); - } -} - -void ShaderViewer::on_intView_clicked() -{ - ui->intView->setChecked(true); - ui->floatView->setChecked(false); - - updateDebugging(); -} - -void ShaderViewer::on_floatView_clicked() -{ - ui->floatView->setChecked(true); - ui->intView->setChecked(false); - - updateDebugging(); -} - -ScintillaEdit *ShaderViewer::currentScintilla() -{ - ScintillaEdit *cur = qobject_cast(QApplication::focusWidget()); - - if(cur == NULL) - { - for(ScintillaEdit *s : m_Scintillas) - { - if(s->isVisible()) - { - cur = s; - break; - } - } - } - - return cur; -} - -ScintillaEdit *ShaderViewer::nextScintilla(ScintillaEdit *cur) -{ - for(int i = 0; i < m_Scintillas.count(); i++) - { - if(m_Scintillas[i] == cur) - { - if(i + 1 < m_Scintillas.count()) - return m_Scintillas[i + 1]; - - return m_Scintillas[0]; - } - } - - if(!m_Scintillas.isEmpty()) - return m_Scintillas[0]; - - return NULL; -} - -void ShaderViewer::find(bool down) -{ - ScintillaEdit *cur = currentScintilla(); - - if(!cur) - return; - - QString find = m_FindReplace->findText(); - - sptr_t flags = 0; - - if(m_FindReplace->matchCase()) - flags |= SCFIND_MATCHCASE; - if(m_FindReplace->matchWord()) - flags |= SCFIND_WHOLEWORD; - if(m_FindReplace->regexp()) - flags |= SCFIND_REGEXP | SCFIND_POSIX; - - FindReplace::SearchContext context = m_FindReplace->context(); - - QString findHash = QFormatStr("%1%2%3").arg(find).arg(flags).arg((int)context); - - if(findHash != m_FindState.hash) - { - m_FindState.hash = findHash; - m_FindState.start = 0; - m_FindState.end = cur->length(); - m_FindState.offset = cur->currentPos(); - } - - int start = m_FindState.start + m_FindState.offset; - int end = m_FindState.end; - - if(!down) - end = m_FindState.start; - - QPair result = cur->findText(flags, find.toUtf8().data(), start, end); - - m_FindState.prevResult = result; - - if(result.first == -1) - { - sptr_t maxOffset = down ? 0 : m_FindState.end; - - // if we're at offset 0 searching down, there are no results. Same for offset max and searching - // up - if(m_FindState.offset == maxOffset) - return; - - // otherwise, we can wrap the search around - - if(context == FindReplace::AllFiles) - { - cur = nextScintilla(cur); - ToolWindowManager::raiseToolWindow(cur); - cur->activateWindow(); - cur->QWidget::setFocus(); - } - - m_FindState.offset = maxOffset; - - start = m_FindState.start + m_FindState.offset; - end = m_FindState.end; - - if(!down) - end = m_FindState.start; - - result = cur->findText(flags, find.toUtf8().data(), start, end); - - m_FindState.prevResult = result; - - if(result.first == -1) - return; - } - - cur->setSelection(result.first, result.second); - - ensureLineScrolled(cur, cur->lineFromPosition(result.first)); - - if(down) - m_FindState.offset = result.second - m_FindState.start; - else - m_FindState.offset = result.first - m_FindState.start; -} - -void ShaderViewer::performFind() -{ - find(m_FindReplace->direction() == FindReplace::Down); -} - -void ShaderViewer::performFindAll() -{ - ScintillaEdit *cur = currentScintilla(); - - if(!cur) - return; - - QString find = m_FindReplace->findText(); - - sptr_t flags = 0; - - QString results = tr("Find all \"%1\"").arg(find); - - if(m_FindReplace->matchCase()) - { - flags |= SCFIND_MATCHCASE; - results += tr(", Match case"); - } - - if(m_FindReplace->matchWord()) - { - flags |= SCFIND_WHOLEWORD; - results += tr(", Match whole word"); - } - - if(m_FindReplace->regexp()) - { - flags |= SCFIND_REGEXP | SCFIND_POSIX; - results += tr(", with Regular Expressions"); - } - - FindReplace::SearchContext context = m_FindReplace->context(); - - if(context == FindReplace::File) - results += tr(", in current file\n"); - else - results += tr(", in all files\n"); - - // trash the find state for any incremental finds - m_FindState = FindState(); - - QList scintillas = m_Scintillas; - - if(context == FindReplace::File) - scintillas = {cur}; - - QList> resultList; - - QByteArray findUtf8 = find.toUtf8(); - - for(ScintillaEdit *s : scintillas) - { - sptr_t start = 0; - sptr_t end = s->length(); - - s->setIndicatorCurrent(INDICATOR_FINDRESULT); - s->indicatorClearRange(start, end); - - if(findUtf8.isEmpty()) - continue; - - QPair result; - - do - { - result = s->findText(flags, findUtf8.data(), start, end); - - if(result.first >= 0) - { - int line = s->lineFromPosition(result.first); - sptr_t lineStart = s->positionFromLine(line); - sptr_t lineEnd = s->lineEndPosition(line); - - s->indicatorFillRange(result.first, result.second - result.first); - - QString lineText = QString::fromUtf8(s->textRange(lineStart, lineEnd)); - - results += QFormatStr(" %1(%2): ").arg(s->windowTitle()).arg(line, 4); - int startPos = results.length(); - - results += lineText; - results += lit("\n"); - - resultList.push_back( - qMakePair(result.first - lineStart + startPos, result.second - lineStart + startPos)); - } - - start = result.second; - - } while(result.first >= 0); - } - - if(findUtf8.isEmpty()) - return; - - results += tr("Matching lines: %1").arg(resultList.count()); - - m_FindResults->setReadOnly(false); - m_FindResults->setText(results.toUtf8().data()); - - m_FindResults->setIndicatorCurrent(INDICATOR_FINDRESULT); - - for(QPair r : resultList) - m_FindResults->indicatorFillRange(r.first, r.second - r.first); - - m_FindResults->setReadOnly(true); - - if(m_FindResults->isVisible()) - { - ToolWindowManager::raiseToolWindow(m_FindResults); - } - else - { - ui->docking->moveToolWindow(m_FindResults, - ToolWindowManager::AreaReference(ToolWindowManager::BottomOf, - ui->docking->areaOf(cur), 0.2f)); - ui->docking->setToolWindowProperties(m_FindResults, ToolWindowManager::HideOnClose); - } -} - -void ShaderViewer::performReplace() -{ - ScintillaEdit *cur = currentScintilla(); - - if(!cur) - return; - - QString find = m_FindReplace->findText(); - - if(find.isEmpty()) - return; - - sptr_t flags = 0; - - if(m_FindReplace->matchCase()) - flags |= SCFIND_MATCHCASE; - if(m_FindReplace->matchWord()) - flags |= SCFIND_WHOLEWORD; - if(m_FindReplace->regexp()) - flags |= SCFIND_REGEXP | SCFIND_POSIX; - - FindReplace::SearchContext context = m_FindReplace->context(); - - QString findHash = QFormatStr("%1%2%3").arg(find).arg(flags).arg((int)context); - - // if we didn't have a valid previous find, just do a find and bail - if(findHash != m_FindState.hash) - { - performFind(); - return; - } - - if(m_FindState.prevResult.first == -1) - return; - - cur->setTargetRange(m_FindState.prevResult.first, m_FindState.prevResult.second); - - FindState save = m_FindState; - - QString replaceText = m_FindReplace->replaceText(); - - // otherwise we have a valid previous find. Do the replace now - // note this will invalidate the find state (as most user operations would), so we save/restore - // the state - if(m_FindReplace->regexp()) - cur->replaceTargetRE(-1, replaceText.toUtf8().data()); - else - cur->replaceTarget(-1, replaceText.toUtf8().data()); - - m_FindState = save; - - // adjust the offset if we replaced text and it went up or down in size - m_FindState.offset += (replaceText.count() - find.count()); - - // move to the next result - performFind(); -} - -void ShaderViewer::performReplaceAll() -{ - ScintillaEdit *cur = currentScintilla(); - - if(!cur) - return; - - QString find = m_FindReplace->findText(); - QString replace = m_FindReplace->replaceText(); - - if(find.isEmpty()) - return; - - sptr_t flags = 0; - - if(m_FindReplace->matchCase()) - flags |= SCFIND_MATCHCASE; - if(m_FindReplace->matchWord()) - flags |= SCFIND_WHOLEWORD; - if(m_FindReplace->regexp()) - flags |= SCFIND_REGEXP | SCFIND_POSIX; - - FindReplace::SearchContext context = m_FindReplace->context(); - - (void)context; - - // trash the find state for any incremental finds - m_FindState = FindState(); - - QList scintillas = m_Scintillas; - - if(context == FindReplace::File) - scintillas = {cur}; - - int numReplacements = 1; - - for(ScintillaEdit *s : scintillas) - { - sptr_t start = 0; - sptr_t end = s->length(); - - QPair result; - - QByteArray findUtf8 = find.toUtf8(); - QByteArray replaceUtf8 = replace.toUtf8(); - - do - { - result = s->findText(flags, findUtf8.data(), start, end); - - if(result.first >= 0) - { - s->setTargetRange(result.first, result.second); - - if(m_FindReplace->regexp()) - s->replaceTargetRE(-1, replaceUtf8.data()); - else - s->replaceTarget(-1, replaceUtf8.data()); - - numReplacements++; - } - - start = result.second + (replaceUtf8.count() - findUtf8.count()); - - } while(result.first >= 0); - } - - RDDialog::information( - this, tr("Replace all"), - tr("%1 replacements made in %2 files").arg(numReplacements).arg(scintillas.count())); -} diff --git a/qrenderdoc/Windows/ShaderViewer.h b/qrenderdoc/Windows/ShaderViewer.h deleted file mode 100644 index 136171fdd..000000000 --- a/qrenderdoc/Windows/ShaderViewer.h +++ /dev/null @@ -1,237 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 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. - ******************************************************************************/ - -#pragma once - -#include -#include "Code/CaptureContext.h" - -namespace Ui -{ -class ShaderViewer; -} - -class RDTreeWidgetItem; -struct ShaderDebugTrace; -struct ShaderReflection; -class ScintillaEdit; -class FindReplace; -class QTableWidgetItem; -class QKeyEvent; -class QMouseEvent; -class QComboBox; - -// from Scintilla -typedef intptr_t sptr_t; - -enum class VariableCategory -{ - Unknown, - Inputs, - Constants, - IndexTemporaries, - Temporaries, - Outputs, -}; - -class ShaderViewer : public QFrame, public IShaderViewer, public ILogViewer -{ - Q_OBJECT - -public: - static IShaderViewer *EditShader(ICaptureContext &ctx, bool customShader, const QString &entryPoint, - const QStringMap &files, IShaderViewer::SaveCallback saveCallback, - IShaderViewer::CloseCallback closeCallback, QWidget *parent) - { - ShaderViewer *ret = new ShaderViewer(ctx, parent); - ret->m_SaveCallback = saveCallback; - ret->m_CloseCallback = closeCallback; - ret->editShader(customShader, entryPoint, files); - return ret; - } - - static IShaderViewer *DebugShader(ICaptureContext &ctx, const ShaderBindpointMapping *bind, - const ShaderReflection *shader, ShaderStage stage, - ShaderDebugTrace *trace, const QString &debugContext, - QWidget *parent) - { - ShaderViewer *ret = new ShaderViewer(ctx, parent); - ret->debugShader(bind, shader, stage, trace, debugContext); - return ret; - } - - static IShaderViewer *ViewShader(ICaptureContext &ctx, const ShaderBindpointMapping *bind, - const ShaderReflection *shader, ShaderStage stage, QWidget *parent) - { - return DebugShader(ctx, bind, shader, stage, NULL, QString(), parent); - } - - ~ShaderViewer(); - - // IShaderViewer - virtual QWidget *Widget() override { return this; } - virtual int CurrentStep() override; - virtual void SetCurrentStep(int step) override; - - virtual void ToggleBreakpoint(int instruction = -1) override; - - virtual void ShowErrors(const QString &errors) override; - - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; - void OnSelectedEventChanged(uint32_t eventID) override {} - void OnEventChanged(uint32_t eventID) override; - -private slots: - // automatic slots - void on_findReplace_clicked(); - void on_save_clicked(); - void on_intView_clicked(); - void on_floatView_clicked(); - - void on_watch_itemChanged(QTableWidgetItem *item); - - // manual slots - void readonly_keyPressed(QKeyEvent *event); - void editable_keyPressed(QKeyEvent *event); - void disassembly_contextMenu(const QPoint &pos); - void disassembly_buttonReleased(QMouseEvent *event); - void disassemble_typeChanged(int index); - void watch_keyPress(QKeyEvent *event); - void performFind(); - void performFindAll(); - void performReplace(); - void performReplaceAll(); - - void snippet_textureDimensions(); - void snippet_selectedMip(); - void snippet_selectedSlice(); - void snippet_selectedSample(); - void snippet_selectedType(); - void snippet_samplers(); - void snippet_resources(); - - void disasm_tooltipShow(int x, int y); - void disasm_tooltipHide(int x, int y); - -public slots: - bool stepBack(); - bool stepNext(); - void runToCursor(); - void runToSample(); - void runToNanOrInf(); - void runBack(); - void run(); - -private: - explicit ShaderViewer(ICaptureContext &ctx, QWidget *parent = 0); - void editShader(bool customShader, const QString &entryPoint, const QStringMap &files); - void debugShader(const ShaderBindpointMapping *bind, const ShaderReflection *shader, - ShaderStage stage, ShaderDebugTrace *trace, const QString &debugContext); - - bool eventFilter(QObject *watched, QEvent *event) override; - - const rdctype::array *GetVariableList(VariableCategory varCat, int arrayIdx); - void getRegisterFromWord(const QString &text, VariableCategory &varCat, int &varIdx, int &arrayIdx); - - void showVariableTooltip(VariableCategory varCat, int varIdx, int arrayIdx); - void updateVariableTooltip(); - void hideVariableTooltip(); - - VariableCategory m_TooltipVarCat = VariableCategory::Temporaries; - int m_TooltipVarIdx = -1; - int m_TooltipArrayIdx = -1; - QPoint m_TooltipPos; - - Ui::ShaderViewer *ui; - ICaptureContext &m_Ctx; - const ShaderBindpointMapping *m_Mapping = NULL; - const ShaderReflection *m_ShaderDetails = NULL; - ShaderStage m_Stage; - ScintillaEdit *m_DisassemblyView = NULL; - QFrame *m_DisassemblyToolbar = NULL; - QWidget *m_DisassemblyFrame = NULL; - QComboBox *m_DisassemblyType = NULL; - ScintillaEdit *m_Errors = NULL; - ScintillaEdit *m_FindResults = NULL; - QList m_Scintillas; - - FindReplace *m_FindReplace; - - struct FindState - { - // hash identifies when the search has changed - QString hash; - - // the range identified when the search first occurred (for incremental find/replace) - sptr_t start = 0; - sptr_t end = 0; - - // the current offset where to search from next time, relative to above range - sptr_t offset = 0; - - // the last result - QPair prevResult; - } m_FindState; - - SaveCallback m_SaveCallback; - CloseCallback m_CloseCallback; - - ShaderDebugTrace *m_Trace = NULL; - int m_CurrentStep; - QList m_Breakpoints; - - static const int CURRENT_MARKER = 0; - static const int BREAKPOINT_MARKER = 2; - static const int FINISHED_MARKER = 4; - - static const int INDICATOR_FINDRESULT = 0; - static const int INDICATOR_REGHIGHLIGHT = 1; - - void addFileList(); - - ScintillaEdit *MakeEditor(const QString &name, const QString &text, int lang); - ScintillaEdit *AddFileScintilla(const QString &name, const QString &text); - - ScintillaEdit *currentScintilla(); - ScintillaEdit *nextScintilla(ScintillaEdit *cur); - - int snippetPos(); - void insertVulkanUBO(); - - int instructionForLine(sptr_t line); - - void updateDebugging(); - - void ensureLineScrolled(ScintillaEdit *s, int i); - - void find(bool down); - - void runTo(int runToInstruction, bool forward, ShaderEvents condition = ShaderEvents::NoEvent); - - QString stringRep(const ShaderVariable &var, bool useType); - RDTreeWidgetItem *makeResourceRegister(const BindpointMap &bind, uint32_t idx, - const BoundResource &ro, const ShaderResource &resources); -}; diff --git a/qrenderdoc/Windows/ShaderViewer.ui b/qrenderdoc/Windows/ShaderViewer.ui deleted file mode 100644 index e3d2ddf04..000000000 --- a/qrenderdoc/Windows/ShaderViewer.ui +++ /dev/null @@ -1,521 +0,0 @@ - - - ShaderViewer - - - - 0 - 0 - 963 - 574 - - - - Form - - - - - 80 - 90 - 351 - 301 - - - - - - - 570 - 160 - 256 - 192 - - - - QFrame::Panel - - - QFrame::Sunken - - - QAbstractItemView::NoEditTriggers - - - false - - - false - - - 0 - - - false - - - false - - - true - - - false - - - - - - 590 - 360 - 256 - 192 - - - - QFrame::Panel - - - QFrame::Sunken - - - QAbstractItemView::NoEditTriggers - - - false - - - false - - - 0 - - - false - - - false - - - true - - - false - - - - - - 20 - 310 - 256 - 192 - - - - Qt::PreventContextMenu - - - 0 - - - false - - - false - - - true - - - - - - 310 - 310 - 256 - 192 - - - - 0 - - - false - - - false - - - true - - - - - - 40 - 10 - 388 - 28 - - - - - 0 - 0 - - - - - 0 - 28 - - - - QFrame::Panel - - - QFrame::Raised - - - - 2 - - - 6 - - - 2 - - - 6 - - - 2 - - - - - Find & Replace - - - - - - - :/find.png:/find.png - - - true - - - - - - - Qt::Vertical - - - - - - - Compile & Save changes - - - - - - - :/save.png:/save.png - - - true - - - - - - - Insert built-in snippets - - - - - - - :/plugin_add.png:/plugin_add.png - - - QToolButton::InstantPopup - - - true - - - - - - - Qt::Vertical - - - - - - - Run backwards (Shift-F5) - - - - - - - :/control_start_blue.png:/control_start_blue.png - - - true - - - - - - - Step Back (Shift-F10) - - - - - - - :/control_reverse_blue.png:/control_reverse_blue.png - - - true - - - - - - - Step Next (F10) - - - - - - - :/control_play_blue.png:/control_play_blue.png - - - true - - - - - - - Run forwards (F5) - - - - - - - :/control_end_blue.png:/control_end_blue.png - - - true - - - - - - - Qt::Vertical - - - - - - - - 23 - 22 - - - - Run to Cursor (Ctrl-F10) - - - - :/control_cursor_blue.png:/control_cursor_blue.png - - - true - - - - - - - - 23 - 22 - - - - Run to Sample/Load/Gather - - - - :/control_sample_blue.png:/control_sample_blue.png - - - true - - - - - - - - 23 - 22 - - - - Run to NaN or Inf - - - - :/control_nan_blue.png:/control_nan_blue.png - - - true - - - - - - - Qt::Vertical - - - - - - - int - - - true - - - false - - - true - - - - - - - float - - - true - - - true - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 710 - 20 - 151 - 131 - - - - QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - false - - - false - - - true - - - false - - - - Name - - - - - Type - - - - - Value - - - - - - - RDTreeWidget - QTreeView -
Widgets/Extended/RDTreeWidget.h
-
- - ToolWindowManager - QWidget -
3rdparty/toolwindowmanager/ToolWindowManager.h
-
- - RDTableWidget - QTableWidget -
Widgets/Extended/RDTableWidget.h
-
-
- - - - -
diff --git a/qrenderdoc/Windows/StatisticsViewer.cpp b/qrenderdoc/Windows/StatisticsViewer.cpp deleted file mode 100644 index bb1f67d27..000000000 --- a/qrenderdoc/Windows/StatisticsViewer.cpp +++ /dev/null @@ -1,835 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 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. - ******************************************************************************/ - -#include "StatisticsViewer.h" -#include -#include "ui_StatisticsViewer.h" - -static const int HistogramWidth = 128; -static const QString Stars = QString(HistogramWidth, QLatin1Char('*')); - -QString Pow2IndexAsReadable(int index) -{ - uint64_t value = 1ULL << index; - - if(value >= (1024 * 1024)) - { - float slice = (float)value / (1024 * 1024); - return QFormatStr("%1MB").arg(Formatter::Format(slice)); - } - else if(value >= 1024) - { - float slice = (float)value / 1024; - return QFormatStr("%1KB").arg(Formatter::Format(slice)); - } - else - { - return QFormatStr("%1B").arg(Formatter::Format((float)value)); - } -} - -int SliceForString(const QString &s, uint32_t value, uint32_t maximum) -{ - if(value == 0 || maximum == 0) - return 0; - - float ratio = (float)value / maximum; - int slice = (int)(ratio * s.length()); - return qMax(1, slice); -} - -QString CountOrEmpty(uint32_t count) -{ - if(count == 0) - return QString(); - else - return QFormatStr("(%1)").arg(count); -} - -QString CreateSimpleIntegerHistogram(const QString &legend, const rdctype::array &array) -{ - uint32_t maxCount = 0; - int maxWithValue = 0; - - for(int o = 0; o < array.count; o++) - { - uint32_t value = array[o]; - if(value > 0) - maxWithValue = o; - maxCount = qMax(maxCount, value); - } - - QString text = QFormatStr("\n%1:\n").arg(legend); - - for(int o = 0; o <= maxWithValue; o++) - { - uint32_t count = array[o]; - int slice = SliceForString(Stars, count, maxCount); - text += QFormatStr("%1: %2 %3\n").arg(o, 4).arg(Stars.left(slice)).arg(CountOrEmpty(count)); - } - - return text; -} - -void StatisticsViewer::AppendDrawStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - // #mivance see AppendConstantBindStatistics - const DrawcallStats &draws = frameInfo.stats.draws; - - m_Report.append(tr("\n*** Draw Statistics ***\n\n")); - - m_Report.append(tr("Total calls: %1, instanced: %2, indirect: %3\n") - .arg(draws.calls) - .arg(draws.instanced) - .arg(draws.indirect)); - - if(draws.instanced > 0) - { - m_Report.append(tr("\nInstance counts:\n")); - uint32_t maxCount = 0; - int maxWithValue = 0; - int maximum = draws.counts.count; - for(int s = 1; s < maximum; s++) - { - uint32_t value = draws.counts[s]; - if(value > 0) - maxWithValue = s; - maxCount = qMax(maxCount, value); - } - - for(int s = 1; s <= maxWithValue; s++) - { - uint32_t count = draws.counts[s]; - int slice = SliceForString(Stars, count, maxCount); - m_Report.append(QFormatStr("%1%2: %3 %4\n") - .arg((s == maximum - 1) ? lit(">=") : lit(" ")) - .arg(s, 2) - .arg(Stars.left(slice)) - .arg(CountOrEmpty(count))); - } - } -} - -void StatisticsViewer::AppendDispatchStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - m_Report.append(tr("\n*** Dispatch Statistics ***\n\n")); - m_Report.append(tr("Total calls: %1, indirect: %2\n") - .arg(frameInfo.stats.dispatches.calls) - .arg(frameInfo.stats.dispatches.indirect)); -} - -void StatisticsViewer::AppendInputAssemblerStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - const IndexBindStats &indices = frameInfo.stats.indices; - const LayoutBindStats &layouts = frameInfo.stats.layouts; - - const VertexBindStats &vertices = frameInfo.stats.vertices; - - m_Report.append(tr("\n*** Input Assembler Statistics ***\n\n")); - - m_Report.append(tr("Total index calls: %1, non-null index sets: %2, null index sets: %3\n") - .arg(indices.calls) - .arg(indices.sets) - .arg(indices.nulls)); - m_Report.append(tr("Total layout calls: %1, non-null layout sets: %2, null layout sets: %3\n") - .arg(layouts.calls) - .arg(layouts.sets) - .arg(layouts.nulls)); - m_Report.append(tr("Total vertex calls: %1, non-null vertex sets: %2, null vertex sets: %3\n") - .arg(vertices.calls) - .arg(vertices.sets) - .arg(vertices.nulls)); - - m_Report.append(CreateSimpleIntegerHistogram(tr("Aggregate vertex slot counts per invocation"), - vertices.bindslots)); -} - -void StatisticsViewer::AppendShaderStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - const ShaderChangeStats *shaders = frameInfo.stats.shaders; - ShaderChangeStats totalShadersPerStage; - memset(&totalShadersPerStage, 0, sizeof(totalShadersPerStage)); - for(auto s : indices()) - { - totalShadersPerStage.calls += shaders[s].calls; - totalShadersPerStage.sets += shaders[s].sets; - totalShadersPerStage.nulls += shaders[s].nulls; - totalShadersPerStage.redundants += shaders[s].redundants; - } - - m_Report.append(tr("\n*** Shader Set Statistics ***\n\n")); - - for(auto s : indices()) - { - m_Report.append(tr("%1 calls: %2, non-null shader sets: %3, null shader sets: %4, " - "redundant shader sets: %5\n") - .arg(m_Ctx.CurPipelineState().Abbrev(StageFromIndex(s))) - .arg(shaders[s].calls) - .arg(shaders[s].sets) - .arg(shaders[s].nulls) - .arg(shaders[s].redundants)); - } - - m_Report.append(tr("Total calls: %1, non-null shader sets: %2, null shader sets: %3, " - "reundant shader sets: %4\n") - .arg(totalShadersPerStage.calls) - .arg(totalShadersPerStage.sets) - .arg(totalShadersPerStage.nulls) - .arg(totalShadersPerStage.redundants)); -} - -void StatisticsViewer::AppendConstantBindStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - // #mivance C++-side we guarantee all stages will have the same slots - // and sizes count, so pattern off of the first frame's first stage - const ConstantBindStats &reference = frameInfo.stats.constants[0]; - - // #mivance there is probably a way to iterate the fields via - // GetType()/GetField() and build a sort of dynamic min/max/average - // structure for a given type with known integral types (or arrays - // thereof), but given we're heading for a Qt/C++ rewrite of the UI - // perhaps best not to dwell too long on that - ConstantBindStats totalConstantsPerStage[ENUM_ARRAY_SIZE(ShaderStage)]; - memset(&totalConstantsPerStage, 0, sizeof(totalConstantsPerStage)); - for(auto s : indices()) - { - totalConstantsPerStage[s].bindslots.create(reference.bindslots.count); - totalConstantsPerStage[s].sizes.create(reference.sizes.count); - } - - { - const ConstantBindStats *constants = frameInfo.stats.constants; - for(auto s : indices()) - { - totalConstantsPerStage[s].calls += constants[s].calls; - totalConstantsPerStage[s].sets += constants[s].sets; - totalConstantsPerStage[s].nulls += constants[s].nulls; - - for(int l = 0; l < constants[s].bindslots.count; l++) - totalConstantsPerStage[s].bindslots[l] += constants[s].bindslots[l]; - - for(int z = 0; z < constants[s].sizes.count; z++) - totalConstantsPerStage[s].sizes[z] += constants[s].sizes[z]; - } - } - - ConstantBindStats totalConstantsForAllStages; - memset(&totalConstantsForAllStages, 0, sizeof(totalConstantsForAllStages)); - totalConstantsForAllStages.bindslots.create(totalConstantsPerStage[0].bindslots.count); - totalConstantsForAllStages.sizes.create(totalConstantsPerStage[0].sizes.count); - - for(auto s : indices()) - { - const ConstantBindStats &perStage = totalConstantsPerStage[s]; - totalConstantsForAllStages.calls += perStage.calls; - totalConstantsForAllStages.sets += perStage.sets; - totalConstantsForAllStages.nulls += perStage.nulls; - - for(int l = 0; l < perStage.bindslots.count; l++) - totalConstantsForAllStages.bindslots[l] += perStage.bindslots[l]; - - for(int z = 0; z < perStage.sizes.count; z++) - totalConstantsForAllStages.sizes[z] += perStage.sizes[z]; - } - - m_Report.append(tr("\n*** Constant Bind Statistics ***\n\n")); - - for(auto s : indices()) - { - m_Report.append(tr("%1 calls: %2, non-null buffer sets: %3, null buffer sets: %4\n") - .arg(m_Ctx.CurPipelineState().Abbrev(StageFromIndex(s))) - .arg(totalConstantsPerStage[s].calls) - .arg(totalConstantsPerStage[s].sets) - .arg(totalConstantsPerStage[s].nulls)); - } - - m_Report.append(tr("Total calls: %1, non-null buffer sets: %2, null buffer sets: %3\n") - .arg(totalConstantsForAllStages.calls) - .arg(totalConstantsForAllStages.sets) - .arg(totalConstantsForAllStages.nulls)); - - m_Report.append( - CreateSimpleIntegerHistogram(tr("Aggregate slot counts per invocation across all stages"), - totalConstantsForAllStages.bindslots)); - - m_Report.append(tr("\nAggregate constant buffer sizes across all stages:\n")); - uint32_t maxCount = 0; - int maxWithValue = 0; - for(int s = 0; s < totalConstantsForAllStages.sizes.count; s++) - { - uint32_t value = totalConstantsForAllStages.sizes[s]; - if(value > 0) - maxWithValue = s; - maxCount = qMax(maxCount, value); - } - - for(int s = 0; s <= maxWithValue; s++) - { - uint32_t count = totalConstantsForAllStages.sizes[s]; - int slice = SliceForString(Stars, count, maxCount); - m_Report.append(QFormatStr("%1: %2 %3\n") - .arg(Pow2IndexAsReadable(s), 8) - .arg(Stars.left(slice)) - .arg(CountOrEmpty(count))); - } -} - -void StatisticsViewer::AppendSamplerBindStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - // #mivance see AppendConstantBindStatistics - const SamplerBindStats &reference = frameInfo.stats.samplers[0]; - - SamplerBindStats totalSamplersPerStage[ENUM_ARRAY_SIZE(ShaderStage)]; - memset(&totalSamplersPerStage, 0, sizeof(totalSamplersPerStage)); - for(auto s : indices()) - { - totalSamplersPerStage[s].bindslots.create(reference.bindslots.count); - } - - { - const SamplerBindStats *samplers = frameInfo.stats.samplers; - for(auto s : indices()) - { - totalSamplersPerStage[s].calls += samplers[s].calls; - totalSamplersPerStage[s].sets += samplers[s].sets; - totalSamplersPerStage[s].nulls += samplers[s].nulls; - - for(int l = 0; l < samplers[s].bindslots.count; l++) - { - totalSamplersPerStage[s].bindslots[l] += samplers[s].bindslots[l]; - } - } - } - - SamplerBindStats totalSamplersForAllStages; - memset(&totalSamplersForAllStages, 0, sizeof(totalSamplersForAllStages)); - totalSamplersForAllStages.bindslots.create(totalSamplersPerStage[0].bindslots.count); - - for(auto s : indices()) - { - SamplerBindStats perStage = totalSamplersPerStage[s]; - totalSamplersForAllStages.calls += perStage.calls; - totalSamplersForAllStages.sets += perStage.sets; - totalSamplersForAllStages.nulls += perStage.nulls; - for(int l = 0; l < perStage.bindslots.count; l++) - { - totalSamplersForAllStages.bindslots[l] += perStage.bindslots[l]; - } - } - - m_Report.append(tr("\n*** Sampler Bind Statistics ***\n\n")); - - for(auto s : indices()) - { - m_Report.append(tr("%1 calls: %2, non-null sampler sets: %3, null sampler sets: %4\n") - .arg(m_Ctx.CurPipelineState().Abbrev(StageFromIndex(s))) - .arg(totalSamplersPerStage[s].calls) - .arg(totalSamplersPerStage[s].sets) - .arg(totalSamplersPerStage[s].nulls)); - } - - m_Report.append(tr("Total calls: %1, non-null sampler sets: %2, null sampler sets: %3\n") - .arg(totalSamplersForAllStages.calls) - .arg(totalSamplersForAllStages.sets) - .arg(totalSamplersForAllStages.nulls)); - - m_Report.append( - CreateSimpleIntegerHistogram(tr("Aggregate slot counts per invocation across all stages"), - totalSamplersForAllStages.bindslots)); -} - -void StatisticsViewer::AppendResourceBindStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - // #mivance see AppendConstantBindStatistics - const ResourceBindStats &reference = frameInfo.stats.resources[0]; - - ResourceBindStats totalResourcesPerStage[ENUM_ARRAY_SIZE(ShaderStage)]; - memset(&totalResourcesPerStage, 0, sizeof(totalResourcesPerStage)); - for(auto s : indices()) - { - totalResourcesPerStage[s].types.create(reference.types.count); - totalResourcesPerStage[s].bindslots.create(reference.bindslots.count); - } - - { - const ResourceBindStats *resources = frameInfo.stats.resources; - for(auto s : indices()) - { - totalResourcesPerStage[s].calls += resources[s].calls; - totalResourcesPerStage[s].sets += resources[s].sets; - totalResourcesPerStage[s].nulls += resources[s].nulls; - - for(int z = 0; z < resources[s].types.count; z++) - { - totalResourcesPerStage[s].types[z] += resources[s].types[z]; - } - - for(int l = 0; l < resources[s].bindslots.count; l++) - { - totalResourcesPerStage[s].bindslots[l] += resources[s].bindslots[l]; - } - } - } - - ResourceBindStats totalResourcesForAllStages; - memset(&totalResourcesForAllStages, 0, sizeof(totalResourcesForAllStages)); - totalResourcesForAllStages.types.create(totalResourcesPerStage[0].types.count); - totalResourcesForAllStages.bindslots.create(totalResourcesPerStage[0].bindslots.count); - - for(auto s : indices()) - { - ResourceBindStats perStage = totalResourcesPerStage[s]; - totalResourcesForAllStages.calls += perStage.calls; - totalResourcesForAllStages.sets += perStage.sets; - totalResourcesForAllStages.nulls += perStage.nulls; - for(int t = 0; t < perStage.types.count; t++) - { - totalResourcesForAllStages.types[t] += perStage.types[t]; - } - for(int l = 0; l < perStage.bindslots.count; l++) - { - totalResourcesForAllStages.bindslots[l] += perStage.bindslots[l]; - } - } - - m_Report.append(tr("\n*** Resource Bind Statistics ***\n\n")); - - for(auto s : indices()) - { - m_Report.append(tr("%1 calls: %2 non-null resource sets: %3 null resource sets: %4\n") - .arg(m_Ctx.CurPipelineState().Abbrev(StageFromIndex(s))) - .arg(totalResourcesPerStage[s].calls) - .arg(totalResourcesPerStage[s].sets) - .arg(totalResourcesPerStage[s].nulls)); - } - - m_Report.append(tr("Total calls: %1 non-null resource sets: %2 null resource sets: %3\n") - .arg(totalResourcesForAllStages.calls) - .arg(totalResourcesForAllStages.sets) - .arg(totalResourcesForAllStages.nulls)); - - uint32_t maxCount = 0; - int maxWithCount = 0; - - m_Report.append(tr("\nResource types across all stages:\n")); - for(int s = 0; s < totalResourcesForAllStages.types.count; s++) - { - uint32_t count = totalResourcesForAllStages.types[s]; - if(count > 0) - maxWithCount = s; - maxCount = qMax(maxCount, count); - } - - for(int s = 0; s <= maxWithCount; s++) - { - uint32_t count = totalResourcesForAllStages.types[s]; - int slice = SliceForString(Stars, count, maxCount); - TextureDim type = (TextureDim)s; - m_Report.append( - QFormatStr("%1: %2 %3\n").arg(ToQStr(type), 20).arg(Stars.left(slice)).arg(CountOrEmpty(count))); - } - - m_Report.append( - CreateSimpleIntegerHistogram(tr("Aggregate slot counts per invocation across all stages"), - totalResourcesForAllStages.bindslots)); -} - -void StatisticsViewer::AppendUpdateStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - // #mivance see AppendConstantBindStatistics - const ResourceUpdateStats &reference = frameInfo.stats.updates; - - ResourceUpdateStats totalUpdates; - memset(&totalUpdates, 0, sizeof(totalUpdates)); - totalUpdates.types.create(reference.types.count); - totalUpdates.sizes.create(reference.sizes.count); - - { - ResourceUpdateStats updates = frameInfo.stats.updates; - - totalUpdates.calls += updates.calls; - totalUpdates.clients += updates.clients; - totalUpdates.servers += updates.servers; - - for(int t = 0; t < updates.types.count; t++) - totalUpdates.types[t] += updates.types[t]; - - for(int t = 0; t < updates.sizes.count; t++) - totalUpdates.sizes[t] += updates.sizes[t]; - } - - m_Report.append(tr("\n*** Resource Update Statistics ***\n\n")); - - m_Report.append(tr("Total calls: %1, client-updated memory: %2, server-updated memory: %3\n") - .arg(totalUpdates.calls) - .arg(totalUpdates.clients) - .arg(totalUpdates.servers)); - - m_Report.append(tr("\nUpdated resource types:\n")); - uint32_t maxCount = 0; - int maxWithValue = 0; - for(int s = 1; s < totalUpdates.types.count; s++) - { - uint32_t value = totalUpdates.types[s]; - if(value > 0) - maxWithValue = s; - maxCount = qMax(maxCount, value); - } - - for(int s = 1; s <= maxWithValue; s++) - { - uint32_t count = totalUpdates.types[s]; - int slice = SliceForString(Stars, count, maxCount); - TextureDim type = (TextureDim)s; - m_Report.append( - QFormatStr("%1: %2 %3\n").arg(ToQStr(type), 20).arg(Stars.left(slice)).arg(CountOrEmpty(count))); - } - - m_Report.append(tr("\nUpdated resource sizes:\n")); - maxCount = 0; - maxWithValue = 0; - for(int s = 0; s < totalUpdates.sizes.count; s++) - { - uint32_t value = totalUpdates.sizes[s]; - if(value > 0) - maxWithValue = s; - maxCount = qMax(maxCount, value); - } - - for(int s = 0; s <= maxWithValue; s++) - { - uint32_t count = totalUpdates.sizes[s]; - int slice = SliceForString(Stars, count, maxCount); - m_Report.append(QFormatStr("%1: %2 %3\n") - .arg(Pow2IndexAsReadable(s), 8) - .arg(Stars.left(slice)) - .arg(CountOrEmpty(count))); - } -} - -void StatisticsViewer::AppendBlendStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - BlendStats blends = frameInfo.stats.blends; - m_Report.append(tr("\n*** Blend Statistics ***\n")); - m_Report.append( - tr("Blend calls: %1 non-null sets: %2, null (default) sets: %3, redundant sets: %4\n") - .arg(blends.calls) - .arg(blends.sets) - .arg(blends.nulls) - .arg(blends.redundants)); -} - -void StatisticsViewer::AppendDepthStencilStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - DepthStencilStats depths = frameInfo.stats.depths; - m_Report.append(tr("\n*** Depth Stencil Statistics ***\n")); - m_Report.append(tr("Depth/stencil calls: %1 non-null sets: %2, null (default) sets: " - "%3, redundant sets: %4\n") - .arg(depths.calls) - .arg(depths.sets) - .arg(depths.nulls) - .arg(depths.redundants)); -} - -void StatisticsViewer::AppendRasterizationStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - RasterizationStats rasters = frameInfo.stats.rasters; - m_Report.append(tr("\n*** Rasterization Statistics ***\n")); - m_Report.append(tr("Rasterization calls: %1 non-null sets: %2, null (default) sets: " - "%3, redundant sets: %4\n") - .arg(rasters.calls) - .arg(rasters.sets) - .arg(rasters.nulls) - .arg(rasters.redundants)); - m_Report.append(CreateSimpleIntegerHistogram(tr("Viewports set"), rasters.viewports)); - m_Report.append(CreateSimpleIntegerHistogram(tr("Scissors set"), rasters.rects)); -} - -void StatisticsViewer::AppendOutputStatistics() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - OutputTargetStats outputs = frameInfo.stats.outputs; - m_Report.append(tr("\n*** Output Statistics ***\n")); - m_Report.append(tr("Output calls: %1 non-null sets: %2, null sets: %3\n") - .arg(outputs.calls) - .arg(outputs.sets) - .arg(outputs.nulls)); - m_Report.append(CreateSimpleIntegerHistogram(tr("Outputs set"), outputs.bindslots)); -} - -void StatisticsViewer::AppendDetailedInformation() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - if(!frameInfo.stats.recorded) - return; - - AppendDrawStatistics(); - AppendDispatchStatistics(); - AppendInputAssemblerStatistics(); - AppendShaderStatistics(); - AppendConstantBindStatistics(); - AppendSamplerBindStatistics(); - AppendResourceBindStatistics(); - AppendBlendStatistics(); - AppendDepthStencilStatistics(); - AppendRasterizationStatistics(); - AppendUpdateStatistics(); - AppendOutputStatistics(); -} - -void StatisticsViewer::CountContributingEvents(const DrawcallDescription &draw, uint32_t &drawCount, - uint32_t &dispatchCount, uint32_t &diagnosticCount) -{ - const DrawFlags diagnosticMask = - DrawFlags::SetMarker | DrawFlags::PushMarker | DrawFlags::PopMarker; - DrawFlags diagnosticMasked = draw.flags & diagnosticMask; - - if(diagnosticMasked != DrawFlags::NoFlags) - diagnosticCount += 1; - - if(draw.flags & DrawFlags::Drawcall) - drawCount += 1; - - if(draw.flags & DrawFlags::Dispatch) - dispatchCount += 1; - - for(const DrawcallDescription &c : draw.children) - CountContributingEvents(c, drawCount, dispatchCount, diagnosticCount); -} - -void StatisticsViewer::AppendAPICallSummary() -{ - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - if(!frameInfo.stats.recorded) - return; - - uint32_t numConstantSets = 0; - uint32_t numSamplerSets = 0; - uint32_t numResourceSets = 0; - uint32_t numShaderSets = 0; - - for(auto s : indices()) - { - numConstantSets += frameInfo.stats.constants[s].calls; - numSamplerSets += frameInfo.stats.samplers[s].calls; - numResourceSets += frameInfo.stats.resources[s].calls; - numShaderSets += frameInfo.stats.shaders[s].calls; - } - - uint32_t numResourceUpdates = frameInfo.stats.updates.calls; - uint32_t numIndexVertexSets = (frameInfo.stats.indices.calls + frameInfo.stats.vertices.calls + - frameInfo.stats.layouts.calls); - uint32_t numBlendSets = frameInfo.stats.blends.calls; - uint32_t numDepthStencilSets = frameInfo.stats.depths.calls; - uint32_t numRasterizationSets = frameInfo.stats.rasters.calls; - uint32_t numOutputSets = frameInfo.stats.outputs.calls; - - m_Report += tr("\tIndex/vertex bind calls: %1\n").arg(numIndexVertexSets); - m_Report += tr("\tConstant bind calls: %1\n").arg(numConstantSets); - m_Report += tr("\tSampler bind calls: %1\n").arg(numSamplerSets); - m_Report += tr("\tResource bind calls: %1\n").arg(numResourceSets); - m_Report += tr("\tShader set calls: %1\n").arg(numShaderSets); - m_Report += tr("\tBlend set calls: %1\n").arg(numBlendSets); - m_Report += tr("\tDepth/stencil set calls: %1\n").arg(numDepthStencilSets); - m_Report += tr("\tRasterization set calls: %1\n").arg(numRasterizationSets); - m_Report += tr("\tResource update calls: %1\n").arg(numResourceUpdates); - m_Report += tr("\tOutput set calls: %1\n").arg(numOutputSets); -} - -void StatisticsViewer::GenerateReport() -{ - const rdctype::array &curDraws = m_Ctx.CurDrawcalls(); - - uint32_t drawCount = 0; - uint32_t dispatchCount = 0; - uint32_t diagnosticCount = 0; - for(const DrawcallDescription &d : curDraws) - CountContributingEvents(d, drawCount, dispatchCount, diagnosticCount); - - uint32_t numAPIcalls = - m_Ctx.GetLastDrawcall()->eventID - (drawCount + dispatchCount + diagnosticCount); - - int numTextures = m_Ctx.GetTextures().count; - int numBuffers = m_Ctx.GetBuffers().count; - - uint64_t IBBytes = 0; - uint64_t VBBytes = 0; - uint64_t BufBytes = 0; - for(const BufferDescription &b : m_Ctx.GetBuffers()) - { - BufBytes += b.length; - - if(b.creationFlags & BufferCategory::Index) - IBBytes += b.length; - if(b.creationFlags & BufferCategory::Vertex) - VBBytes += b.length; - } - - uint64_t RTBytes = 0; - uint64_t TexBytes = 0; - uint64_t LargeTexBytes = 0; - - int numRTs = 0; - float texW = 0, texH = 0; - float largeTexW = 0, largeTexH = 0; - int texCount = 0, largeTexCount = 0; - for(const TextureDescription &t : m_Ctx.GetTextures()) - { - if(t.creationFlags & (TextureCategory::ColorTarget | TextureCategory::DepthTarget)) - { - numRTs++; - - RTBytes += t.byteSize; - } - else - { - texW += (float)t.width; - texH += (float)t.height; - texCount++; - - TexBytes += t.byteSize; - - if(t.width > 32 && t.height > 32) - { - largeTexW += (float)t.width; - largeTexH += (float)t.height; - largeTexCount++; - - LargeTexBytes += t.byteSize; - } - } - } - - texW /= texCount; - texH /= texCount; - - largeTexW /= largeTexCount; - largeTexH /= largeTexCount; - - const FrameDescription &frameInfo = m_Ctx.FrameInfo(); - - float compressedMB = (float)frameInfo.compressedFileSize / (1024.0f * 1024.0f); - float uncompressedMB = (float)frameInfo.uncompressedFileSize / (1024.0f * 1024.0f); - float compressRatio = uncompressedMB / compressedMB; - float persistentMB = (float)frameInfo.persistentSize / (1024.0f * 1024.0f); - float initDataMB = (float)frameInfo.initDataSize / (1024.0f * 1024.0f); - - QString header = - tr("Stats for %1.\n\nFile size: %2MB (%3MB uncompressed, compression ratio %4:1)\n" - "Persistent Data (approx): %5MB, Frame-initial data (approx): %6MB\n") - .arg(QFileInfo(m_Ctx.LogFilename()).fileName()) - .arg(compressedMB, 2, 'f', 2) - .arg(uncompressedMB, 2, 'f', 2) - .arg(compressRatio, 2, 'f', 2) - .arg(persistentMB, 2, 'f', 2) - .arg(initDataMB, 2, 'f', 2); - QString drawList = tr("Draw calls: %1\nDispatch calls: %2\n").arg(drawCount).arg(dispatchCount); - QString ratio = tr("API:Draw/Dispatch call ratio: %1\n\n") - .arg((float)numAPIcalls / (float)(drawCount + dispatchCount)); - QString textures = tr("%1 Textures - %2 MB (%3 MB over 32x32), %4 RTs - %5 MB.\n" - "Avg. tex dimension: %6x%7 (%8x%9 over 32x32)\n") - .arg(numTextures) - .arg((float)TexBytes / (1024.0f * 1024.0f), 2, 'f', 2) - .arg((float)LargeTexBytes / (1024.0f * 1024.0f), 2, 'f', 2) - .arg(numRTs) - .arg((float)RTBytes / (1024.0f * 1024.0f), 2, 'f', 2) - .arg(texW) - .arg(texH) - .arg(largeTexW) - .arg(largeTexH); - QString buffers = tr("%1 Buffers - %2 MB total %3 MB IBs %4 MB VBs.\n") - .arg(numBuffers) - .arg((float)BufBytes / (1024.0f * 1024.0f), 2, 'f', 2) - .arg((float)IBBytes / (1024.0f * 1024.0f), 2, 'f', 2) - .arg((float)VBBytes / (1024.0f * 1024.0f), 2, 'f', 2); - QString load = tr("%1 MB - Grand total GPU buffer + texture load.\n") - .arg((float)(TexBytes + BufBytes + RTBytes) / (1024.0f * 1024.0f), 2, 'f', 2); - - m_Report = header; - - m_Report.append(tr("\n*** Summary ***\n\n")); - m_Report.append(drawList); - m_Report += tr("API calls: %1\n").arg(numAPIcalls); - AppendAPICallSummary(); - m_Report.append(ratio); - m_Report.append(textures); - m_Report.append(buffers); - m_Report.append(load); - - AppendDetailedInformation(); -} - -StatisticsViewer::StatisticsViewer(ICaptureContext &ctx, QWidget *parent) - : QFrame(parent), ui(new Ui::StatisticsViewer), m_Ctx(ctx) -{ - ui->setupUi(this); - - ui->statistics->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); - - m_Ctx.AddLogViewer(this); -} - -StatisticsViewer::~StatisticsViewer() -{ - m_Ctx.BuiltinWindowClosed(this); - - m_Ctx.RemoveLogViewer(this); - delete ui; -} - -void StatisticsViewer::OnLogfileClosed() -{ - ui->statistics->clear(); -} - -void StatisticsViewer::OnLogfileLoaded() -{ - GenerateReport(); - ui->statistics->setText(m_Report); -} \ No newline at end of file diff --git a/qrenderdoc/Windows/StatisticsViewer.h b/qrenderdoc/Windows/StatisticsViewer.h deleted file mode 100644 index f77605bda..000000000 --- a/qrenderdoc/Windows/StatisticsViewer.h +++ /dev/null @@ -1,73 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 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. - ******************************************************************************/ - -#pragma once - -#include -#include "Code/CaptureContext.h" - -namespace Ui -{ -class StatisticsViewer; -} - -class StatisticsViewer : public QFrame, public IStatisticsViewer, public ILogViewer -{ - Q_OBJECT - -public: - explicit StatisticsViewer(ICaptureContext &ctx, QWidget *parent = 0); - ~StatisticsViewer(); - - // IStatisticsViewer - QWidget *Widget() override { return this; } - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; - void OnSelectedEventChanged(uint32_t eventID) override {} - void OnEventChanged(uint32_t eventID) override {} -private: - Ui::StatisticsViewer *ui; - ICaptureContext &m_Ctx; - - QString m_Report; - - void AppendDrawStatistics(); - void AppendDispatchStatistics(); - void AppendInputAssemblerStatistics(); - void AppendShaderStatistics(); - void AppendConstantBindStatistics(); - void AppendSamplerBindStatistics(); - void AppendResourceBindStatistics(); - void AppendUpdateStatistics(); - void AppendBlendStatistics(); - void AppendDepthStencilStatistics(); - void AppendRasterizationStatistics(); - void AppendOutputStatistics(); - void AppendDetailedInformation(); - void CountContributingEvents(const DrawcallDescription &draw, uint32_t &drawCount, - uint32_t &dispatchCount, uint32_t &diagnosticCount); - void AppendAPICallSummary(); - void GenerateReport(); -}; diff --git a/qrenderdoc/Windows/StatisticsViewer.ui b/qrenderdoc/Windows/StatisticsViewer.ui deleted file mode 100644 index 70763f300..000000000 --- a/qrenderdoc/Windows/StatisticsViewer.ui +++ /dev/null @@ -1,43 +0,0 @@ - - - StatisticsViewer - - - - 0 - 0 - 400 - 300 - - - - Statistics - - - - 3 - - - 3 - - - 3 - - - 3 - - - - - IBeamCursor - - - true - - - - - - - - diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp deleted file mode 100644 index d40cac9d7..000000000 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ /dev/null @@ -1,3816 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2016-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. - ******************************************************************************/ - -#include "TextureViewer.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "3rdparty/flowlayout/FlowLayout.h" -#include "3rdparty/toolwindowmanager/ToolWindowManagerArea.h" -#include "Code/CaptureContext.h" -#include "Code/QRDUtils.h" -#include "Code/Resources.h" -#include "Dialogs/TextureSaveDialog.h" -#include "Widgets/ResourcePreview.h" -#include "Widgets/TextureGoto.h" -#include "ui_TextureViewer.h" - -float area(const QSizeF &s) -{ - return s.width() * s.height(); -} - -float aspect(const QSizeF &s) -{ - return s.width() / s.height(); -} - -Q_DECLARE_METATYPE(Following); -Q_DECLARE_METATYPE(ResourceId); - -const Following Following::Default = Following(); - -Following::Following(FollowType t, ShaderStage s, int i, int a) -{ - Type = t; - Stage = s; - index = i; - arrayEl = a; -} - -Following::Following() -{ - Type = FollowType::OutputColour; - Stage = ShaderStage::Pixel; - index = 0; - arrayEl = 0; -} - -bool Following::operator!=(const Following &o) -{ - return !(*this == o); -} - -bool Following::operator==(const Following &o) -{ - return Type == o.Type && Stage == o.Stage && index == o.index; -} - -void Following::GetDrawContext(ICaptureContext &ctx, bool ©, bool &clear, bool &compute) -{ - const DrawcallDescription *curDraw = ctx.CurDrawcall(); - copy = curDraw != NULL && (curDraw->flags & (DrawFlags::Copy | DrawFlags::Resolve)); - clear = curDraw != NULL && (curDraw->flags & DrawFlags::Clear); - compute = curDraw != NULL && (curDraw->flags & DrawFlags::Dispatch) && - ctx.CurPipelineState().GetShader(ShaderStage::Compute) != ResourceId(); -} - -int Following::GetHighestMip(ICaptureContext &ctx) -{ - return GetBoundResource(ctx, arrayEl).HighestMip; -} - -int Following::GetFirstArraySlice(ICaptureContext &ctx) -{ - return GetBoundResource(ctx, arrayEl).FirstSlice; -} - -CompType Following::GetTypeHint(ICaptureContext &ctx) -{ - return GetBoundResource(ctx, arrayEl).typeHint; -} - -ResourceId Following::GetResourceId(ICaptureContext &ctx) -{ - return GetBoundResource(ctx, arrayEl).Id; -} - -BoundResource Following::GetBoundResource(ICaptureContext &ctx, int arrayIdx) -{ - BoundResource ret; - - if(Type == FollowType::OutputColour) - { - auto outputs = GetOutputTargets(ctx); - - if(index < outputs.size()) - ret = outputs[index]; - } - else if(Type == FollowType::OutputDepth) - { - ret = GetDepthTarget(ctx); - } - else if(Type == FollowType::ReadWrite) - { - auto rw = GetReadWriteResources(ctx); - - ShaderBindpointMapping mapping = GetMapping(ctx); - - if(index < mapping.ReadWriteResources.count) - { - BindpointMap &key = mapping.ReadWriteResources[index]; - - if(rw.contains(key)) - ret = rw[key][arrayIdx]; - } - } - else if(Type == FollowType::ReadOnly) - { - auto ro = GetReadOnlyResources(ctx); - - ShaderBindpointMapping mapping = GetMapping(ctx); - - if(index < mapping.ReadOnlyResources.count) - { - BindpointMap &key = mapping.ReadOnlyResources[index]; - - if(ro.contains(key)) - ret = ro[key][arrayIdx]; - } - } - - return ret; -} - -QVector Following::GetOutputTargets(ICaptureContext &ctx) -{ - const DrawcallDescription *curDraw = ctx.CurDrawcall(); - bool copy = false, clear = false, compute = false; - GetDrawContext(ctx, copy, clear, compute); - - if(copy || clear) - { - return {BoundResource(curDraw->copyDestination)}; - } - else if(compute) - { - return {}; - } - else - { - QVector ret = ctx.CurPipelineState().GetOutputTargets(); - - if(ret.isEmpty() && curDraw != NULL && (curDraw->flags & DrawFlags::Present)) - { - if(curDraw->copyDestination != ResourceId()) - return {BoundResource(curDraw->copyDestination)}; - - for(const TextureDescription &tex : ctx.GetTextures()) - { - if(tex.creationFlags & TextureCategory::SwapBuffer) - return {BoundResource(tex.ID)}; - } - } - - return ret; - } -} - -BoundResource Following::GetDepthTarget(ICaptureContext &ctx) -{ - bool copy = false, clear = false, compute = false; - GetDrawContext(ctx, copy, clear, compute); - - if(copy || clear || compute) - return BoundResource(ResourceId()); - else - return ctx.CurPipelineState().GetDepthTarget(); -} - -QMap> Following::GetReadWriteResources(ICaptureContext &ctx, - ShaderStage stage) -{ - bool copy = false, clear = false, compute = false; - GetDrawContext(ctx, copy, clear, compute); - - if(copy || clear) - { - return QMap>(); - } - else if(compute) - { - // only return compute resources for one stage - if(stage == ShaderStage::Pixel || stage == ShaderStage::Compute) - return ctx.CurPipelineState().GetReadWriteResources(ShaderStage::Compute); - else - return QMap>(); - } - else - { - return ctx.CurPipelineState().GetReadWriteResources(stage); - } -} - -QMap> Following::GetReadWriteResources(ICaptureContext &ctx) -{ - return GetReadWriteResources(ctx, Stage); -} - -QMap> Following::GetReadOnlyResources(ICaptureContext &ctx, - ShaderStage stage) -{ - const DrawcallDescription *curDraw = ctx.CurDrawcall(); - bool copy = false, clear = false, compute = false; - GetDrawContext(ctx, copy, clear, compute); - - if(copy || clear) - { - QMap> ret; - - // only return copy source for one stage - if(copy && stage == ShaderStage::Pixel) - ret[BindpointMap(0, 0)] = {BoundResource(curDraw->copySource)}; - - return ret; - } - else if(compute) - { - // only return compute resources for one stage - if(stage == ShaderStage::Pixel || stage == ShaderStage::Compute) - return ctx.CurPipelineState().GetReadOnlyResources(ShaderStage::Compute); - else - return QMap>(); - } - else - { - return ctx.CurPipelineState().GetReadOnlyResources(stage); - } -} - -QMap> Following::GetReadOnlyResources(ICaptureContext &ctx) -{ - return GetReadOnlyResources(ctx, Stage); -} - -const ShaderReflection *Following::GetReflection(ICaptureContext &ctx, ShaderStage stage) -{ - bool copy = false, clear = false, compute = false; - GetDrawContext(ctx, copy, clear, compute); - - if(copy || clear) - return NULL; - else if(compute) - return ctx.CurPipelineState().GetShaderReflection(ShaderStage::Compute); - else - return ctx.CurPipelineState().GetShaderReflection(stage); -} - -const ShaderReflection *Following::GetReflection(ICaptureContext &ctx) -{ - return GetReflection(ctx, Stage); -} - -const ShaderBindpointMapping &Following::GetMapping(ICaptureContext &ctx, ShaderStage stage) -{ - bool copy = false, clear = false, compute = false; - GetDrawContext(ctx, copy, clear, compute); - - if(copy || clear) - { - static ShaderBindpointMapping mapping; - - // for PS only add a single mapping to get the copy source - if(copy && stage == ShaderStage::Pixel) - mapping.ReadOnlyResources = {BindpointMap(0, 0)}; - else - mapping.ReadOnlyResources.clear(); - - return mapping; - } - else if(compute) - { - return ctx.CurPipelineState().GetBindpointMapping(ShaderStage::Compute); - } - else - { - return ctx.CurPipelineState().GetBindpointMapping(stage); - } -} - -const ShaderBindpointMapping &Following::GetMapping(ICaptureContext &ctx) -{ - return GetMapping(ctx, Stage); -} - -class TextureListItemModel : public QAbstractItemModel -{ -public: - enum FilterType - { - Textures, - RenderTargets, - String - }; - - TextureListItemModel(QWidget *parent) : QAbstractItemModel(parent) - { - goArrow.addPixmap(Pixmaps::action(parent), QIcon::Normal, QIcon::Off); - goArrow.addPixmap(Pixmaps::action_hover(parent), QIcon::Normal, QIcon::Off); - } - void reset(FilterType type, const QString &filter, ICaptureContext &ctx) - { - const rdctype::array src = ctx.GetTextures(); - - texs.clear(); - texs.reserve(src.count); - - emit beginResetModel(); - - TextureCategory rtFlags = TextureCategory::ColorTarget | TextureCategory::DepthTarget; - - for(const TextureDescription &t : src) - { - if(type == Textures) - { - if(!(t.creationFlags & rtFlags)) - texs.push_back(t); - } - else if(type == RenderTargets) - { - if((t.creationFlags & rtFlags)) - texs.push_back(t); - } - else - { - if(filter.isEmpty()) - texs.push_back(t); - else if(ToQStr(t.name).contains(filter, Qt::CaseInsensitive)) - texs.push_back(t); - } - } - - emit endResetModel(); - } - - QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override - { - if(row < 0 || row >= rowCount()) - return QModelIndex(); - - return createIndex(row, 0); - } - - QModelIndex parent(const QModelIndex &index) const override { return QModelIndex(); } - int rowCount(const QModelIndex &parent = QModelIndex()) const override { return texs.count(); } - int columnCount(const QModelIndex &parent = QModelIndex()) const override { return 1; } - Qt::ItemFlags flags(const QModelIndex &index) const override - { - if(!index.isValid()) - return 0; - - return QAbstractItemModel::flags(index); - } - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override - { - if(index.isValid()) - { - if(role == Qt::DisplayRole) - { - if(index.row() >= 0 && index.row() < texs.count()) - return ToQStr(texs[index.row()].name); - } - - if(role == Qt::UserRole) - { - return QVariant::fromValue(texs[index.row()].ID); - } - - if(role == Qt::DecorationRole) - { - return QVariant(goArrow); - } - } - - return QVariant(); - } - -private: - QVector texs; - QIcon goArrow; -}; - -class TextureListItemDelegate : public QItemDelegate -{ -public: - TextureListItemDelegate(QObject *parent = 0) : QItemDelegate(parent) {} - void paint(QPainter *painter, const QStyleOptionViewItem &opt, const QModelIndex &index) const override - { - if(index.isValid()) - { - QStyleOptionViewItem option = opt; - option.decorationAlignment = Qt::AlignBaseline | Qt::AlignRight; - painter->eraseRect(option.rect); - - QIcon icon = index.model()->data(index, Qt::DecorationRole).value(); - - drawBackground(painter, option, index); - if(option.state & QStyle::State_MouseOver) - drawDecoration(painter, option, option.rect, - icon.pixmap(option.decorationSize, QIcon::Active)); - else - drawDecoration(painter, option, option.rect, - icon.pixmap(option.decorationSize, QIcon::Normal)); - drawDisplay(painter, option, option.rect, - index.model()->data(index, Qt::DisplayRole).toString()); - drawFocus(painter, option, option.rect); - - if(option.state & QStyle::State_MouseOver) - { - QRect r = option.rect; - r.adjust(0, 0, -1, -1); - - painter->drawRect(r); - } - } - } -}; - -TextureDescription *TextureViewer::GetCurrentTexture() -{ - return m_CachedTexture; -} - -void TextureViewer::UI_UpdateCachedTexture() -{ - if(!m_Ctx.LogLoaded()) - { - m_CachedTexture = NULL; - return; - } - - ResourceId id = m_LockedId; - if(id == ResourceId()) - id = m_Following.GetResourceId(m_Ctx); - - if(id == ResourceId()) - id = m_TexDisplay.texid; - - m_CachedTexture = m_Ctx.GetTexture(id); -} - -TextureViewer::TextureViewer(ICaptureContext &ctx, QWidget *parent) - : QFrame(parent), ui(new Ui::TextureViewer), m_Ctx(ctx) -{ - ui->setupUi(this); - - ui->textureList->setFont(Formatter::PreferredFont()); - ui->textureListFilter->setFont(Formatter::PreferredFont()); - ui->rangeBlack->setFont(Formatter::PreferredFont()); - ui->rangeWhite->setFont(Formatter::PreferredFont()); - ui->hdrMul->setFont(Formatter::PreferredFont()); - ui->channels->setFont(Formatter::PreferredFont()); - ui->mipLevel->setFont(Formatter::PreferredFont()); - ui->sliceFace->setFont(Formatter::PreferredFont()); - ui->zoomOption->setFont(Formatter::PreferredFont()); - - Reset(); - - on_checkerBack_clicked(); - - QObject::connect(ui->zoomOption->lineEdit(), &QLineEdit::returnPressed, this, - &TextureViewer::zoomOption_returnPressed); - - QObject::connect(ui->depthDisplay, &QToolButton::toggled, this, - &TextureViewer::channelsWidget_toggled); - QObject::connect(ui->stencilDisplay, &QToolButton::toggled, this, - &TextureViewer::channelsWidget_toggled); - QObject::connect(ui->flip_y, &QToolButton::toggled, this, &TextureViewer::channelsWidget_toggled); - QObject::connect(ui->gammaDisplay, &QToolButton::toggled, this, - &TextureViewer::channelsWidget_toggled); - QObject::connect(ui->channels, OverloadedSlot::of(&QComboBox::currentIndexChanged), this, - &TextureViewer::channelsWidget_selected); - QObject::connect(ui->hdrMul, OverloadedSlot::of(&QComboBox::currentIndexChanged), this, - &TextureViewer::channelsWidget_selected); - QObject::connect(ui->customShader, OverloadedSlot::of(&QComboBox::currentIndexChanged), this, - &TextureViewer::channelsWidget_selected); - QObject::connect(ui->customShader, &QComboBox::currentTextChanged, [this] { UI_UpdateChannels(); }); - QObject::connect(ui->rangeHistogram, &RangeHistogram::rangeUpdated, this, - &TextureViewer::range_rangeUpdated); - QObject::connect(ui->rangeBlack, &RDLineEdit::textChanged, this, - &TextureViewer::rangePoint_textChanged); - QObject::connect(ui->rangeBlack, &RDLineEdit::leave, this, &TextureViewer::rangePoint_leave); - QObject::connect(ui->rangeBlack, &RDLineEdit::keyPress, this, &TextureViewer::rangePoint_keyPress); - QObject::connect(ui->rangeWhite, &RDLineEdit::textChanged, this, - &TextureViewer::rangePoint_textChanged); - QObject::connect(ui->rangeWhite, &RDLineEdit::leave, this, &TextureViewer::rangePoint_leave); - QObject::connect(ui->rangeWhite, &RDLineEdit::keyPress, this, &TextureViewer::rangePoint_keyPress); - - for(RDToolButton *butt : {ui->channelRed, ui->channelGreen, ui->channelBlue, ui->channelAlpha}) - { - QObject::connect(butt, &RDToolButton::toggled, this, &TextureViewer::channelsWidget_toggled); - QObject::connect(butt, &RDToolButton::mouseClicked, this, - &TextureViewer::channelsWidget_mouseClicked); - QObject::connect(butt, &RDToolButton::doubleClicked, this, - &TextureViewer::channelsWidget_mouseClicked); - } - - QWidget *renderContainer = ui->renderContainer; - - ui->dockarea->addToolWindow(ui->renderContainer, ToolWindowManager::EmptySpace); - ui->dockarea->setToolWindowProperties( - renderContainer, ToolWindowManager::DisallowUserDocking | ToolWindowManager::HideCloseButton | - ToolWindowManager::DisableDraggableTab | - ToolWindowManager::AlwaysDisplayFullTabs); - - ui->dockarea->addToolWindow(ui->inputThumbs, ToolWindowManager::AreaReference( - ToolWindowManager::RightOf, - ui->dockarea->areaOf(renderContainer), 0.25f)); - ui->dockarea->setToolWindowProperties(ui->inputThumbs, ToolWindowManager::HideCloseButton); - - ui->dockarea->addToolWindow( - ui->outputThumbs, ToolWindowManager::AreaReference(ToolWindowManager::AddTo, - ui->dockarea->areaOf(ui->inputThumbs))); - ui->dockarea->setToolWindowProperties(ui->outputThumbs, ToolWindowManager::HideCloseButton); - - ui->dockarea->addToolWindow( - ui->pixelContextLayout, - ToolWindowManager::AreaReference(ToolWindowManager::BottomOf, - ui->dockarea->areaOf(ui->outputThumbs), 0.25f)); - ui->dockarea->setToolWindowProperties(ui->pixelContextLayout, ToolWindowManager::HideCloseButton); - - ui->dockarea->addToolWindow(ui->textureListFrame, ToolWindowManager::NoArea); - ui->dockarea->setToolWindowProperties(ui->textureListFrame, ToolWindowManager::HideOnClose); - - ui->dockarea->setAllowFloatingWindow(false); - - renderContainer->setWindowTitle(tr("Unbound")); - ui->pixelContextLayout->setWindowTitle(tr("Pixel Context")); - ui->outputThumbs->setWindowTitle(tr("Outputs")); - ui->inputThumbs->setWindowTitle(tr("Inputs")); - ui->textureListFrame->setWindowTitle(tr("Texture List")); - - ui->textureList->setHoverCursor(Qt::PointingHandCursor); - - m_Goto = new TextureGoto(this, [this](QPoint p) { GotoLocation(p.x(), p.y()); }); - - QVBoxLayout *vertical = new QVBoxLayout(this); - - vertical->setSpacing(3); - vertical->setContentsMargins(3, 3, 3, 3); - - QWidget *flow1widget = new QWidget(this); - QWidget *flow2widget = new QWidget(this); - - FlowLayout *flow1 = new FlowLayout(flow1widget, 0, 3, 3); - FlowLayout *flow2 = new FlowLayout(flow2widget, 0, 3, 3); - - flow1widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); - flow2widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); - - flow1->addWidget(ui->channelsToolbar); - flow1->addWidget(ui->subresourceToolbar); - flow1->addWidget(ui->actionToolbar); - - flow2->addWidget(ui->zoomToolbar); - flow2->addWidget(ui->overlayToolbar); - flow2->addWidget(ui->rangeToolbar); - - vertical->addWidget(flow1widget); - vertical->addWidget(flow2widget); - vertical->addWidget(ui->dockarea); - - Ui_TextureViewer *u = ui; - u->pixelcontextgrid->setAlignment(u->pixelHistory, Qt::AlignCenter); - u->pixelcontextgrid->setAlignment(u->debugPixelContext, Qt::AlignCenter); - - QWidget *statusflowWidget = new QWidget(this); - - FlowLayout *statusflow = new FlowLayout(statusflowWidget, 0, 3, 0); - - statusflowWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); - - ui->statusbar->removeWidget(ui->texStatusDim); - ui->statusbar->removeWidget(ui->pickSwatch); - ui->statusbar->removeWidget(ui->statusText); - - statusflow->addWidget(ui->texStatusDim); - statusflow->addWidget(ui->pickSwatch); - statusflow->addWidget(ui->statusText); - - ui->texStatusDim->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); - ui->statusText->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); - - ui->statusbar->addWidget(statusflowWidget); - - ui->channels->addItems({tr("RGBA"), tr("RGBM"), tr("Custom")}); - - ui->zoomOption->addItems({lit("10%"), lit("25%"), lit("50%"), lit("75%"), lit("100%"), - lit("200%"), lit("400%"), lit("800%")}); - - ui->hdrMul->addItems({lit("2"), lit("4"), lit("8"), lit("16"), lit("32"), lit("128")}); - - ui->overlay->addItems({tr("None"), tr("Highlight Drawcall"), tr("Wireframe Mesh"), - tr("Depth Test"), tr("Stencil Test"), tr("Backface Cull"), - tr("Viewport/Scissor Region"), tr("NaN/INF/-ve Display"), - tr("Histogram Clipping"), tr("Clear Before Pass"), tr("Clear Before Draw"), - tr("Quad Overdraw (Pass)"), tr("Quad Overdraw (Draw)"), - tr("Triangle Size (Pass)"), tr("Triangle Size (Draw)")}); - - ui->textureListFilter->addItems({QString(), tr("Textures"), tr("Render Targets")}); - - ui->textureList->setModel(new TextureListItemModel(this)); - ui->textureList->setItemDelegate(new TextureListItemDelegate(ui->textureList)); - ui->textureList->viewport()->setAttribute(Qt::WA_Hover); - - ui->zoomOption->setCurrentText(QString()); - ui->fitToWindow->toggle(); - - m_Ctx.AddLogViewer(this); - - SetupTextureTabs(); -} - -TextureViewer::~TextureViewer() -{ - m_Ctx.BuiltinWindowClosed(this); - m_Ctx.RemoveLogViewer(this); - delete ui; -} - -void TextureViewer::RT_FetchCurrentPixel(uint32_t x, uint32_t y, PixelValue &pickValue, - PixelValue &realValue) -{ - TextureDescription *texptr = GetCurrentTexture(); - - if(texptr == NULL) - return; - - if(m_TexDisplay.FlipY) - y = (texptr->height - 1) - y; - - pickValue = m_Output->PickPixel(m_TexDisplay.texid, true, x, y, m_TexDisplay.sliceFace, - m_TexDisplay.mip, m_TexDisplay.sampleIdx); - - if(m_TexDisplay.CustomShader != ResourceId()) - realValue = m_Output->PickPixel(m_TexDisplay.texid, false, x, y, m_TexDisplay.sliceFace, - m_TexDisplay.mip, m_TexDisplay.sampleIdx); -} - -void TextureViewer::RT_PickPixelsAndUpdate(IReplayController *) -{ - PixelValue pickValue, realValue; - - uint32_t x = (uint32_t)m_PickedPoint.x(); - uint32_t y = (uint32_t)m_PickedPoint.y(); - - RT_FetchCurrentPixel(x, y, pickValue, realValue); - - m_Output->SetPixelContextLocation(x, y); - - m_CurHoverValue = pickValue; - - m_CurPixelValue = pickValue; - m_CurRealValue = realValue; - - GUIInvoke::call([this]() { UI_UpdateStatusText(); }); -} - -void TextureViewer::RT_PickHoverAndUpdate(IReplayController *) -{ - PixelValue pickValue, realValue; - - uint32_t x = (uint32_t)m_CurHoverPixel.x(); - uint32_t y = (uint32_t)m_CurHoverPixel.y(); - - RT_FetchCurrentPixel(x, y, pickValue, realValue); - - m_CurHoverValue = pickValue; - - GUIInvoke::call([this]() { UI_UpdateStatusText(); }); -} - -void TextureViewer::RT_UpdateAndDisplay(IReplayController *) -{ - if(m_Output != NULL) - m_Output->SetTextureDisplay(m_TexDisplay); - - GUIInvoke::call([this]() { ui->render->update(); }); -} - -void TextureViewer::RT_UpdateVisualRange(IReplayController *) -{ - TextureDescription *texptr = GetCurrentTexture(); - - if(!m_Visualise || texptr == NULL || m_Output == NULL) - return; - - ResourceFormat fmt = texptr->format; - - if(m_TexDisplay.CustomShader != ResourceId()) - fmt.compCount = 4; - - bool channels[] = { - m_TexDisplay.Red ? true : false, m_TexDisplay.Green && fmt.compCount > 1, - m_TexDisplay.Blue && fmt.compCount > 2, m_TexDisplay.Alpha && fmt.compCount > 3, - }; - - rdctype::array histogram = m_Output->GetHistogram( - ui->rangeHistogram->rangeMin(), ui->rangeHistogram->rangeMax(), channels); - - if(!histogram.empty()) - { - QVector histogramVec(histogram.count); - if(histogram.count > 0) - memcpy(histogramVec.data(), histogram.elems, histogram.count * sizeof(uint32_t)); - - GUIInvoke::call([this, histogramVec]() { - ui->rangeHistogram->setHistogramRange(ui->rangeHistogram->rangeMin(), - ui->rangeHistogram->rangeMax()); - ui->rangeHistogram->setHistogramData(histogramVec); - }); - } -} - -void TextureViewer::UI_UpdateStatusText() -{ - TextureDescription *texptr = GetCurrentTexture(); - if(texptr == NULL) - return; - - TextureDescription &tex = *texptr; - - bool dsv = (tex.creationFlags & TextureCategory::DepthTarget) || - (tex.format.compType == CompType::Depth); - bool uintTex = (tex.format.compType == CompType::UInt); - bool sintTex = (tex.format.compType == CompType::SInt); - - if(m_TexDisplay.overlay == DebugOverlay::QuadOverdrawPass || - m_TexDisplay.overlay == DebugOverlay::QuadOverdrawDraw) - { - dsv = false; - uintTex = false; - sintTex = true; - } - - QColor swatchColor; - - if(dsv || uintTex || sintTex) - { - swatchColor = QColor(0, 0, 0); - } - else - { - float r = qBound(0.0f, m_CurHoverValue.value_f[0], 1.0f); - float g = qBound(0.0f, m_CurHoverValue.value_f[1], 1.0f); - float b = qBound(0.0f, m_CurHoverValue.value_f[2], 1.0f); - - if(tex.format.srgbCorrected || (tex.creationFlags & TextureCategory::SwapBuffer)) - { - r = powf(r, 1.0f / 2.2f); - g = powf(g, 1.0f / 2.2f); - b = powf(b, 1.0f / 2.2f); - } - - swatchColor = QColor(int(255.0f * r), int(255.0f * g), int(255.0f * b)); - } - - { - QPalette Pal(palette()); - - Pal.setColor(QPalette::Background, swatchColor); - - ui->pickSwatch->setAutoFillBackground(true); - ui->pickSwatch->setPalette(Pal); - } - - int y = m_CurHoverPixel.y() >> (int)m_TexDisplay.mip; - - uint32_t mipWidth = qMax(1U, tex.width >> (int)m_TexDisplay.mip); - uint32_t mipHeight = qMax(1U, tex.height >> (int)m_TexDisplay.mip); - - if(m_Ctx.APIProps().pipelineType == GraphicsAPI::OpenGL) - y = (int)(mipHeight - 1) - y; - if(m_TexDisplay.FlipY) - y = (int)(mipHeight - 1) - y; - - y = qMax(0, y); - - int x = m_CurHoverPixel.x() >> (int)m_TexDisplay.mip; - float invWidth = mipWidth > 0 ? 1.0f / mipWidth : 0.0f; - float invHeight = mipHeight > 0 ? 1.0f / mipHeight : 0.0f; - - QString hoverCoords = QFormatStr("%1, %2 (%3, %4)") - .arg(x, 4) - .arg(y, 4) - .arg((x * invWidth), 5, 'f', 4) - .arg((y * invHeight), 5, 'f', 4); - - QString statusText = tr("Hover - ") + hoverCoords; - - uint32_t hoverX = (uint32_t)m_CurHoverPixel.x(); - uint32_t hoverY = (uint32_t)m_CurHoverPixel.y(); - - if(hoverX > tex.width || hoverY > tex.height) - statusText = tr("Hover - [%1]").arg(hoverCoords); - - if(m_PickedPoint.x() >= 0) - { - x = m_PickedPoint.x() >> (int)m_TexDisplay.mip; - y = m_PickedPoint.y() >> (int)m_TexDisplay.mip; - if(m_Ctx.APIProps().pipelineType == GraphicsAPI::OpenGL) - y = (int)(mipHeight - 1) - y; - if(m_TexDisplay.FlipY) - y = (int)(mipHeight - 1) - y; - - y = qMax(0, y); - - statusText += tr(" - Right click - %1, %2: ").arg(x, 4).arg(y, 4); - - PixelValue val = m_CurPixelValue; - - if(m_TexDisplay.CustomShader != ResourceId()) - { - statusText += QFormatStr("%1, %2, %3, %4") - .arg(Formatter::Format(val.value_f[0])) - .arg(Formatter::Format(val.value_f[1])) - .arg(Formatter::Format(val.value_f[2])) - .arg(Formatter::Format(val.value_f[3])); - - val = m_CurRealValue; - - statusText += tr(" (Real: "); - } - - if(dsv) - { - statusText += tr("Depth "); - if(uintTex) - { - if(tex.format.compByteWidth == 2) - statusText += Formatter::Format(val.value_u16[0]); - else - statusText += Formatter::Format(val.value_u[0]); - } - else - { - statusText += Formatter::Format(val.value_f[0]); - } - - int stencil = (int)(255.0f * val.value_f[1]); - - statusText += - tr(", Stencil %1 / 0x%2").arg(stencil).arg(Formatter::Format(uint8_t(stencil & 0xff), true)); - } - else - { - if(uintTex) - { - statusText += QFormatStr("%1, %2, %3, %4") - .arg(Formatter::Format(val.value_u[0])) - .arg(Formatter::Format(val.value_u[1])) - .arg(Formatter::Format(val.value_u[2])) - .arg(Formatter::Format(val.value_u[3])); - } - else if(sintTex) - { - statusText += QFormatStr("%1, %2, %3, %4") - .arg(Formatter::Format(val.value_i[0])) - .arg(Formatter::Format(val.value_i[1])) - .arg(Formatter::Format(val.value_i[2])) - .arg(Formatter::Format(val.value_i[3])); - } - else - { - statusText += QFormatStr("%1, %2, %3, %4") - .arg(Formatter::Format(val.value_f[0])) - .arg(Formatter::Format(val.value_f[1])) - .arg(Formatter::Format(val.value_f[2])) - .arg(Formatter::Format(val.value_f[3])); - } - } - - if(m_TexDisplay.CustomShader != ResourceId()) - statusText += lit(")"); - - // PixelPicked = true; - } - else - { - statusText += tr(" - Right click to pick a pixel"); - - if(m_Output != NULL) - { - m_Ctx.Replay().AsyncInvoke([this](IReplayController *) { m_Output->DisablePixelContext(); }); - } - - // PixelPicked = false; - } - - // try and keep status text consistent by sticking to the high water mark - // of length (prevents nasty oscillation when the length of the string is - // just popping over/under enough to overflow onto the next line). - - if(statusText.length() > m_HighWaterStatusLength) - m_HighWaterStatusLength = statusText.length(); - - if(statusText.length() < m_HighWaterStatusLength) - statusText += QString(m_HighWaterStatusLength - statusText.length(), QLatin1Char(' ')); - - ui->statusText->setText(statusText); -} - -void TextureViewer::UI_UpdateTextureDetails() -{ - QString status; - - TextureDescription *texptr = GetCurrentTexture(); - if(texptr == NULL) - { - ui->texStatusDim->setText(status); - - ui->renderContainer->setWindowTitle(tr("Unbound")); - return; - } - - TextureDescription ¤t = *texptr; - - ResourceId followID = m_Following.GetResourceId(m_Ctx); - - { - TextureDescription *followtex = m_Ctx.GetTexture(followID); - BufferDescription *followbuf = m_Ctx.GetBuffer(followID); - - QString title; - - if(followID == ResourceId()) - { - title = tr("Unbound"); - } - else if(followtex || followbuf) - { - QString name; - - if(followtex) - name = ToQStr(followtex->name); - else - name = ToQStr(followbuf->name); - - switch(m_Following.Type) - { - case FollowType::OutputColour: - title = QString(tr("Cur Output %1 - %2")).arg(m_Following.index).arg(name); - break; - case FollowType::OutputDepth: title = QString(tr("Cur Depth Output - %1")).arg(name); break; - case FollowType::ReadWrite: - title = QString(tr("Cur RW Output %1 - %2")).arg(m_Following.index).arg(name); - break; - case FollowType::ReadOnly: - title = QString(tr("Cur Input %1 - %2")).arg(m_Following.index).arg(name); - break; - } - } - else - { - switch(m_Following.Type) - { - case FollowType::OutputColour: - title = QString(tr("Cur Output %1")).arg(m_Following.index); - break; - case FollowType::OutputDepth: title = QString(tr("Cur Depth Output")); break; - case FollowType::ReadWrite: - title = QString(tr("Cur RW Output %1")).arg(m_Following.index); - break; - case FollowType::ReadOnly: - title = QString(tr("Cur Input %1")).arg(m_Following.index); - break; - } - } - - ui->renderContainer->setWindowTitle(title); - } - - status = ToQStr(current.name) + lit(" - "); - - if(current.dimension >= 1) - status += QString::number(current.width); - if(current.dimension >= 2) - status += lit("x") + QString::number(current.height); - if(current.dimension >= 3) - status += lit("x") + QString::number(current.depth); - - if(current.arraysize > 1) - status += QFormatStr("[%1]").arg(QString::number(current.arraysize)); - - if(current.msQual > 0 || current.msSamp > 1) - status += QFormatStr(" MS{%1x %2Q}").arg(current.msSamp).arg(current.msQual); - - status += QFormatStr(" %1 mips").arg(current.mips); - - status += lit(" - ") + ToQStr(current.format.strname); - - if(current.format.compType != m_TexDisplay.typeHint && m_TexDisplay.typeHint != CompType::Typeless) - { - status += tr(" Viewed as %1").arg(ToQStr(m_TexDisplay.typeHint)); - } - - ui->texStatusDim->setText(status); -} - -void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw) -{ - TextureDescription *texptr = GetCurrentTexture(); - - // reset high-water mark - m_HighWaterStatusLength = 0; - - if(texptr == NULL) - return; - - TextureDescription &tex = *texptr; - - bool newtex = (m_TexDisplay.texid != tex.ID); - - // save settings for this current texture - if(m_Ctx.Config().TextureViewer_PerTexSettings) - { - m_TextureSettings[m_TexDisplay.texid].r = ui->channelRed->isChecked(); - m_TextureSettings[m_TexDisplay.texid].g = ui->channelGreen->isChecked(); - m_TextureSettings[m_TexDisplay.texid].b = ui->channelBlue->isChecked(); - m_TextureSettings[m_TexDisplay.texid].a = ui->channelAlpha->isChecked(); - - m_TextureSettings[m_TexDisplay.texid].displayType = qMax(0, ui->channels->currentIndex()); - m_TextureSettings[m_TexDisplay.texid].customShader = ui->customShader->currentText(); - - m_TextureSettings[m_TexDisplay.texid].depth = ui->depthDisplay->isChecked(); - m_TextureSettings[m_TexDisplay.texid].stencil = ui->stencilDisplay->isChecked(); - - m_TextureSettings[m_TexDisplay.texid].mip = qMax(0, ui->mipLevel->currentIndex()); - m_TextureSettings[m_TexDisplay.texid].slice = qMax(0, ui->sliceFace->currentIndex()); - - m_TextureSettings[m_TexDisplay.texid].minrange = ui->rangeHistogram->blackPoint(); - m_TextureSettings[m_TexDisplay.texid].maxrange = ui->rangeHistogram->whitePoint(); - - m_TextureSettings[m_TexDisplay.texid].typeHint = m_Following.GetTypeHint(m_Ctx); - } - - m_TexDisplay.texid = tex.ID; - - // interpret the texture according to the currently following type. - if(!currentTextureIsLocked()) - m_TexDisplay.typeHint = m_Following.GetTypeHint(m_Ctx); - else - m_TexDisplay.typeHint = CompType::Typeless; - - // if there is no such type or it isn't being followed, use the last seen interpretation - if(m_TexDisplay.typeHint == CompType::Typeless && m_TextureSettings.contains(m_TexDisplay.texid)) - m_TexDisplay.typeHint = m_TextureSettings[m_TexDisplay.texid].typeHint; - - // try to maintain the pan in the new texture. If the new texture - // is approx an integer multiple of the old texture, just changing - // the scale will keep everything the same. This is useful for - // downsample chains and things where you're flipping back and forth - // between overlapping textures, but even in the non-integer case - // pan will be kept approximately the same. - QSizeF curSize((float)tex.width, (float)tex.height); - float curArea = area(curSize); - float prevArea = area(m_PrevSize); - - if(prevArea > 0.0f) - { - float prevX = m_TexDisplay.offx; - float prevY = m_TexDisplay.offy; - - // allow slight difference in aspect ratio for rounding errors - // in downscales (e.g. 1680x1050 -> 840x525 -> 420x262 in the - // last downscale the ratios are 1.6 and 1.603053435). - if(qAbs(aspect(curSize) - aspect(m_PrevSize)) < 0.01f) - { - m_TexDisplay.scale *= m_PrevSize.width() / curSize.width(); - setCurrentZoomValue(m_TexDisplay.scale); - } - else - { - // this scale factor is arbitrary really, only intention is to have - // integer scales come out precisely, other 'similar' sizes will be - // similar ish - float scaleFactor = (float)(sqrt(curArea) / sqrt(prevArea)); - - m_TexDisplay.offx = prevX * scaleFactor; - m_TexDisplay.offy = prevY * scaleFactor; - } - } - - m_PrevSize = curSize; - - // refresh scroll position - setScrollPosition(getScrollPosition()); - - UI_UpdateStatusText(); - - ui->mipLevel->clear(); - - m_TexDisplay.mip = 0; - m_TexDisplay.sliceFace = 0; - - bool usemipsettings = true; - bool useslicesettings = true; - - if(tex.msSamp > 1) - { - for(uint32_t i = 0; i < tex.msSamp; i++) - ui->mipLevel->addItem(tr("Sample %1").arg(i)); - - // add an option to display unweighted average resolved value, - // to get an idea of how the samples average - if(tex.format.compType != CompType::UInt && tex.format.compType != CompType::SInt && - tex.format.compType != CompType::Depth && !(tex.creationFlags & TextureCategory::DepthTarget)) - ui->mipLevel->addItem(tr("Average val")); - - ui->mipLabel->setText(tr("Sample")); - - ui->mipLevel->setCurrentIndex(0); - } - else - { - for(uint32_t i = 0; i < tex.mips; i++) - ui->mipLevel->addItem( - QFormatStr("%1 - %2x%3").arg(i).arg(qMax(1U, tex.width >> i)).arg(qMax(1U, tex.height >> i))); - - ui->mipLabel->setText(tr("Mip")); - - int highestMip = -1; - - // only switch to the selected mip for outputs, and when changing drawcall - if(!currentTextureIsLocked() && m_Following.Type != FollowType::ReadOnly && newdraw) - highestMip = m_Following.GetHighestMip(m_Ctx); - - // assuming we get a valid mip for the highest mip, only switch to it - // if we've selected a new texture, or if it's different than the last mip. - // This prevents the case where the user has clicked on another mip and - // we don't want to snap their view back when stepping between events with the - // same mip used. But it does mean that if they are stepping between - // events with different mips used, then we will update in that case. - if(highestMip >= 0 && (newtex || highestMip != m_PrevHighestMip)) - { - usemipsettings = false; - ui->mipLevel->setCurrentIndex(qBound(0, highestMip, (int)tex.mips - 1)); - } - - if(ui->mipLevel->currentIndex() == -1) - ui->mipLevel->setCurrentIndex(qBound(0, m_PrevHighestMip, (int)tex.mips - 1)); - - m_PrevHighestMip = highestMip; - } - - if(tex.mips == 1 && tex.msSamp <= 1) - ui->mipLevel->setEnabled(false); - else - ui->mipLevel->setEnabled(true); - - ui->sliceFace->clear(); - - if(tex.arraysize == 1 && tex.depth <= 1) - { - ui->sliceFace->setEnabled(false); - } - else - { - ui->sliceFace->setEnabled(true); - - QString cubeFaces[] = {lit("X+"), lit("X-"), lit("Y+"), lit("Y-"), lit("Z+"), lit("Z-")}; - - uint32_t numSlices = tex.arraysize; - - // for 3D textures, display the number of slices at this mip - if(tex.depth > 1) - numSlices = qMax(1u, tex.depth >> (int)ui->mipLevel->currentIndex()); - - for(uint32_t i = 0; i < numSlices; i++) - { - if(tex.cubemap) - { - QString name = cubeFaces[i % 6]; - if(numSlices > 6) - name = QFormatStr("[%1] %2").arg(i / 6).arg( - cubeFaces[i % 6]); // Front 1, Back 2, 3, 4 etc for cube arrays - ui->sliceFace->addItem(name); - } - else - { - ui->sliceFace->addItem(tr("Slice %1").arg(i)); - } - } - - int firstArraySlice = -1; - // only switch to the selected mip for outputs, and when changing drawcall - if(!currentTextureIsLocked() && m_Following.Type != FollowType::ReadOnly && newdraw) - firstArraySlice = m_Following.GetFirstArraySlice(m_Ctx); - - // see above with highestMip and prevHighestMip for the logic behind this - if(firstArraySlice >= 0 && (newtex || firstArraySlice != m_PrevFirstArraySlice)) - { - useslicesettings = false; - ui->sliceFace->setCurrentIndex(qBound(0, firstArraySlice, (int)numSlices - 1)); - } - - if(ui->sliceFace->currentIndex() == -1) - ui->sliceFace->setCurrentIndex(qBound(0, m_PrevFirstArraySlice, (int)numSlices - 1)); - - m_PrevFirstArraySlice = firstArraySlice; - } - - // because slice and mip are specially set above, we restore any per-tex settings to apply - // even if we don't switch to a new texture. - // Note that if the slice or mip was changed because that slice or mip is the selected one - // at the API level, we leave this alone. - if(m_Ctx.Config().TextureViewer_PerTexSettings && m_TextureSettings.contains(tex.ID)) - { - if(usemipsettings) - ui->mipLevel->setCurrentIndex(m_TextureSettings[tex.ID].mip); - - if(useslicesettings) - ui->sliceFace->setCurrentIndex(m_TextureSettings[tex.ID].slice); - } - - // handling for if we've switched to a new texture - if(newtex) - { - // if we save certain settings per-texture, restore them (if we have any) - if(m_Ctx.Config().TextureViewer_PerTexSettings && m_TextureSettings.contains(tex.ID)) - { - ui->channels->setCurrentIndex(m_TextureSettings[tex.ID].displayType); - - ui->customShader->setCurrentText(m_TextureSettings[tex.ID].customShader); - - ui->channelRed->setChecked(m_TextureSettings[tex.ID].r); - ui->channelGreen->setChecked(m_TextureSettings[tex.ID].g); - ui->channelBlue->setChecked(m_TextureSettings[tex.ID].b); - ui->channelAlpha->setChecked(m_TextureSettings[tex.ID].a); - - ui->depthDisplay->setChecked(m_TextureSettings[tex.ID].depth); - ui->stencilDisplay->setChecked(m_TextureSettings[tex.ID].stencil); - - m_NoRangePaint = true; - ui->rangeHistogram->setRange(m_TextureSettings[m_TexDisplay.texid].minrange, - m_TextureSettings[m_TexDisplay.texid].maxrange); - m_NoRangePaint = false; - } - else if(m_Ctx.Config().TextureViewer_PerTexSettings) - { - // if we are using per-tex settings, reset back to RGB - ui->channels->setCurrentIndex(0); - - ui->customShader->setCurrentText(QString()); - - ui->channelRed->setChecked(true); - ui->channelGreen->setChecked(true); - ui->channelBlue->setChecked(true); - ui->channelAlpha->setChecked(false); - - ui->depthDisplay->setChecked(true); - ui->stencilDisplay->setChecked(false); - - m_NoRangePaint = true; - UI_SetHistogramRange(texptr, m_TexDisplay.typeHint); - m_NoRangePaint = false; - } - - // reset the range if desired - if(m_Ctx.Config().TextureViewer_ResetRange) - { - UI_SetHistogramRange(texptr, m_TexDisplay.typeHint); - } - } - - UI_UpdateFittedScale(); - UI_UpdateTextureDetails(); - UI_UpdateChannels(); - - if(ui->autoFit->isChecked()) - AutoFitRange(); - - m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) { - RT_UpdateVisualRange(r); - - RT_UpdateAndDisplay(r); - - if(m_Output != NULL) - RT_PickPixelsAndUpdate(r); - }); - - if(m_Ctx.HasTimelineBar()) - m_Ctx.GetTimelineBar()->HighlightResourceUsage(texptr->ID); -} - -void TextureViewer::UI_SetHistogramRange(const TextureDescription *tex, CompType typeHint) -{ - if(tex != NULL && (tex->format.compType == CompType::SNorm || typeHint == CompType::SNorm)) - ui->rangeHistogram->setRange(-1.0f, 1.0f); - else - ui->rangeHistogram->setRange(0.0f, 1.0f); -} - -void TextureViewer::UI_UpdateChannels() -{ - TextureDescription *tex = GetCurrentTexture(); - -#define SHOW(widget) widget->setVisible(true) -#define HIDE(widget) widget->setVisible(false) -#define ENABLE(widget) widget->setEnabled(true) -#define DISABLE(widget) widget->setEnabled(false) - - if(tex != NULL && (tex->creationFlags & TextureCategory::SwapBuffer)) - { - // swapbuffer is always srgb for 8-bit types, linear for 16-bit types - DISABLE(ui->gammaDisplay); - - if(tex->format.compByteWidth == 2 && !tex->format.special) - m_TexDisplay.linearDisplayAsGamma = false; - else - m_TexDisplay.linearDisplayAsGamma = true; - } - else - { - if(tex != NULL && !tex->format.srgbCorrected) - ENABLE(ui->gammaDisplay); - else - DISABLE(ui->gammaDisplay); - - m_TexDisplay.linearDisplayAsGamma = - !ui->gammaDisplay->isEnabled() || ui->gammaDisplay->isChecked(); - } - - if(tex != NULL && tex->format.srgbCorrected) - m_TexDisplay.linearDisplayAsGamma = false; - - bool dsv = false; - if(tex != NULL) - dsv = (tex->creationFlags & TextureCategory::DepthTarget) || - (tex->format.compType == CompType::Depth); - - if(dsv && ui->channels->currentIndex() != 2) - { - // Depth display (when not using custom) - - HIDE(ui->channelRed); - HIDE(ui->channelGreen); - HIDE(ui->channelBlue); - HIDE(ui->channelAlpha); - HIDE(ui->mulSep); - HIDE(ui->mulLabel); - HIDE(ui->hdrMul); - HIDE(ui->customShader); - HIDE(ui->customCreate); - HIDE(ui->customEdit); - HIDE(ui->customDelete); - SHOW(ui->depthDisplay); - SHOW(ui->stencilDisplay); - - m_TexDisplay.Red = ui->depthDisplay->isChecked(); - m_TexDisplay.Green = ui->stencilDisplay->isChecked(); - m_TexDisplay.Blue = false; - m_TexDisplay.Alpha = false; - - if(m_TexDisplay.Red == m_TexDisplay.Green && !m_TexDisplay.Red) - { - m_TexDisplay.Red = true; - ui->depthDisplay->setChecked(true); - } - - m_TexDisplay.HDRMul = -1.0f; - if(m_TexDisplay.CustomShader != ResourceId()) - { - memset(m_CurPixelValue.value_f, 0, sizeof(float) * 4); - memset(m_CurRealValue.value_f, 0, sizeof(float) * 4); - UI_UpdateStatusText(); - } - m_TexDisplay.CustomShader = ResourceId(); - } - else if(ui->channels->currentIndex() == 0 || !m_Ctx.LogLoaded()) - { - // RGBA - SHOW(ui->channelRed); - SHOW(ui->channelGreen); - SHOW(ui->channelBlue); - SHOW(ui->channelAlpha); - HIDE(ui->mulSep); - HIDE(ui->mulLabel); - HIDE(ui->hdrMul); - HIDE(ui->customShader); - HIDE(ui->customCreate); - HIDE(ui->customEdit); - HIDE(ui->customDelete); - HIDE(ui->depthDisplay); - HIDE(ui->stencilDisplay); - - m_TexDisplay.Red = ui->channelRed->isChecked(); - m_TexDisplay.Green = ui->channelGreen->isChecked(); - m_TexDisplay.Blue = ui->channelBlue->isChecked(); - m_TexDisplay.Alpha = ui->channelAlpha->isChecked(); - - m_TexDisplay.HDRMul = -1.0f; - if(m_TexDisplay.CustomShader != ResourceId()) - { - memset(m_CurPixelValue.value_f, 0, sizeof(float) * 4); - memset(m_CurRealValue.value_f, 0, sizeof(float) * 4); - UI_UpdateStatusText(); - } - m_TexDisplay.CustomShader = ResourceId(); - } - else if(ui->channels->currentIndex() == 1) - { - // RGBM - SHOW(ui->channelRed); - SHOW(ui->channelGreen); - SHOW(ui->channelBlue); - HIDE(ui->channelAlpha); - SHOW(ui->mulSep); - SHOW(ui->mulLabel); - SHOW(ui->hdrMul); - HIDE(ui->customShader); - HIDE(ui->customCreate); - HIDE(ui->customEdit); - HIDE(ui->customDelete); - HIDE(ui->depthDisplay); - HIDE(ui->stencilDisplay); - - m_TexDisplay.Red = ui->channelRed->isChecked(); - m_TexDisplay.Green = ui->channelGreen->isChecked(); - m_TexDisplay.Blue = ui->channelBlue->isChecked(); - m_TexDisplay.Alpha = false; - - bool ok = false; - float mul = ui->hdrMul->currentText().toFloat(&ok); - - if(!ok) - { - mul = 32.0f; - ui->hdrMul->setCurrentText(lit("32")); - } - - m_TexDisplay.HDRMul = mul; - if(m_TexDisplay.CustomShader != ResourceId()) - { - memset(m_CurPixelValue.value_f, 0, sizeof(float) * 4); - memset(m_CurRealValue.value_f, 0, sizeof(float) * 4); - UI_UpdateStatusText(); - } - m_TexDisplay.CustomShader = ResourceId(); - } - else if(ui->channels->currentIndex() == 2) - { - // custom shaders - SHOW(ui->channelRed); - SHOW(ui->channelGreen); - SHOW(ui->channelBlue); - SHOW(ui->channelAlpha); - HIDE(ui->mulSep); - HIDE(ui->mulLabel); - HIDE(ui->hdrMul); - SHOW(ui->customShader); - SHOW(ui->customCreate); - SHOW(ui->customEdit); - SHOW(ui->customDelete); - HIDE(ui->depthDisplay); - HIDE(ui->stencilDisplay); - - m_TexDisplay.Red = ui->channelRed->isChecked(); - m_TexDisplay.Green = ui->channelGreen->isChecked(); - m_TexDisplay.Blue = ui->channelBlue->isChecked(); - m_TexDisplay.Alpha = ui->channelAlpha->isChecked(); - - m_TexDisplay.HDRMul = -1.0f; - - m_TexDisplay.CustomShader = ResourceId(); - - QString shaderName = ui->customShader->currentText().toUpper(); - - if(m_CustomShaders.contains(shaderName)) - { - if(m_TexDisplay.CustomShader == ResourceId()) - { - memset(m_CurPixelValue.value_f, 0, sizeof(float) * 4); - memset(m_CurRealValue.value_f, 0, sizeof(float) * 4); - UI_UpdateStatusText(); - } - m_TexDisplay.CustomShader = m_CustomShaders[shaderName]; - ui->customDelete->setEnabled(true); - ui->customEdit->setEnabled(true); - } - else - { - ui->customDelete->setEnabled(false); - ui->customEdit->setEnabled(false); - } - } - -#undef HIDE -#undef SHOW -#undef ENABLE -#undef DISABLE - - m_TexDisplay.FlipY = ui->flip_y->isChecked(); - - INVOKE_MEMFN(RT_UpdateAndDisplay); - INVOKE_MEMFN(RT_UpdateVisualRange); -} - -void TextureViewer::SetupTextureTabs() -{ - ToolWindowManagerArea *textureTabs = ui->dockarea->areaOf(ui->renderContainer); - - QIcon tabIcon; - tabIcon.addFile(QStringLiteral(":/logo.svg"), QSize(), QIcon::Normal, QIcon::Off); - - textureTabs->setTabIcon(0, tabIcon); - - textureTabs->setElideMode(Qt::ElideRight); - - QObject::connect(textureTabs, &QTabWidget::currentChanged, this, - &TextureViewer::textureTab_Changed); - QObject::connect(textureTabs, &QTabWidget::tabCloseRequested, this, - &TextureViewer::textureTab_Closing); - - textureTabs->disableUserDrop(); -} - -void TextureViewer::textureTab_Changed(int index) -{ - ToolWindowManagerArea *textureTabs = ui->dockarea->areaOf(ui->renderContainer); - - QWidget *w = textureTabs->widget(index); - - if(w) - { - w->setLayout(ui->renderLayout); - - if(w == ui->renderContainer) - m_LockedId = ResourceId(); - else - m_LockedId = w->property("id").value(); - - UI_UpdateCachedTexture(); - } - - UI_OnTextureSelectionChanged(false); -} - -void TextureViewer::textureTab_Closing(int index) -{ - ToolWindowManagerArea *textureTabs = ui->dockarea->areaOf(ui->renderContainer); - if(index > 0) - { - // this callback happens AFTER the widget has already been removed unfortunately, so - // we need to search through the locked tab list to see which one was removed to be - // able to delete it properly. - QList ids = m_LockedTabs.keys(); - for(int i = 0; i < textureTabs->count(); i++) - { - QWidget *w = textureTabs->widget(i); - ResourceId id = w->property("id").value(); - ids.removeOne(id); - } - - if(ids.count() != 1) - qWarning() << "Expected only one removed tab, got " << ids.count(); - - for(ResourceId id : ids) - m_LockedTabs.remove(id); - - textureTabs->setCurrentIndex(index - 1); - textureTabs->widget(index - 1)->show(); - - return; - } - - // should never get here - tab 0 is the dynamic tab which is uncloseable. - qCritical() << "Somehow closing dynamic tab?"; - if(textureTabs->count() > 1) - { - textureTabs->setCurrentIndex(1); - textureTabs->widget(1)->show(); - } -} - -ResourcePreview *TextureViewer::UI_CreateThumbnail(ThumbnailStrip *strip) -{ - ResourcePreview *prev = new ResourcePreview(m_Ctx, m_Output); - - QObject::connect(prev, &ResourcePreview::clicked, this, &TextureViewer::thumb_clicked); - QObject::connect(prev, &ResourcePreview::doubleClicked, this, &TextureViewer::thumb_doubleClicked); - - prev->setActive(false); - strip->addThumb(prev); - return prev; -} - -void TextureViewer::UI_CreateThumbnails() -{ - if(!ui->outputThumbs->thumbs().isEmpty()) - return; - - // these will expand, but we make sure that there is a good set reserved - for(int i = 0; i < 9; i++) - { - ResourcePreview *prev = UI_CreateThumbnail(ui->outputThumbs); - - if(i == 0) - prev->setSelected(true); - } - - for(int i = 0; i < 128; i++) - UI_CreateThumbnail(ui->inputThumbs); -} - -void TextureViewer::GotoLocation(int x, int y) -{ - if(!m_Ctx.LogLoaded()) - return; - - TextureDescription *tex = GetCurrentTexture(); - - if(tex == NULL) - return; - - m_PickedPoint = QPoint(x, y); - - uint32_t mipHeight = qMax(1U, tex->height >> (int)m_TexDisplay.mip); - if(m_Ctx.APIProps().pipelineType == GraphicsAPI::OpenGL) - m_PickedPoint.setY((int)(mipHeight - 1) - m_PickedPoint.y()); - if(m_TexDisplay.FlipY) - m_PickedPoint.setY((int)(mipHeight - 1) - m_PickedPoint.x()); - - if(m_Output != NULL) - INVOKE_MEMFN(RT_PickPixelsAndUpdate); - INVOKE_MEMFN(RT_UpdateAndDisplay); - - UI_UpdateStatusText(); -} - -void TextureViewer::ViewTexture(ResourceId ID, bool focus) -{ - if(QThread::currentThread() != QCoreApplication::instance()->thread()) - { - GUIInvoke::call([this, ID, focus] { this->ViewTexture(ID, focus); }); - return; - } - - if(m_LockedTabs.contains(ID)) - { - if(focus) - ToolWindowManager::raiseToolWindow(this); - - QWidget *w = m_LockedTabs[ID]; - ToolWindowManagerArea *textureTabs = ui->dockarea->areaOf(ui->renderContainer); - - int idx = textureTabs->indexOf(w); - - if(idx >= 0) - textureTabs->setCurrentIndex(idx); - - INVOKE_MEMFN(RT_UpdateAndDisplay); - return; - } - - TextureDescription *tex = m_Ctx.GetTexture(ID); - if(tex) - { - QWidget *lockedContainer = new QWidget(this); - lockedContainer->setWindowTitle(ToQStr(tex->name)); - lockedContainer->setProperty("id", QVariant::fromValue(ID)); - - ToolWindowManagerArea *textureTabs = ui->dockarea->areaOf(ui->renderContainer); - - ToolWindowManager::AreaReference ref(ToolWindowManager::AddTo, textureTabs); - - ui->dockarea->addToolWindow(lockedContainer, ref); - ui->dockarea->setToolWindowProperties( - lockedContainer, - ToolWindowManager::DisallowUserDocking | ToolWindowManager::AlwaysDisplayFullTabs); - - lockedContainer->setLayout(ui->renderLayout); - - int idx = textureTabs->indexOf(lockedContainer); - - if(idx >= 0) - textureTabs->setTabIcon(idx, Icons::page_white_link()); - else - qCritical() << "Couldn't get tab index of new tab to set icon"; - - // newPanel.DockHandler.TabPageContextMenuStrip = tabContextMenu; - - if(focus) - ToolWindowManager::raiseToolWindow(this); - - m_LockedTabs[ID] = lockedContainer; - - INVOKE_MEMFN(RT_UpdateAndDisplay); - return; - } - - BufferDescription *buf = m_Ctx.GetBuffer(ID); - if(buf) - { - IBufferViewer *viewer = m_Ctx.ViewBuffer(0, 0, ID); - - m_Ctx.AddDockWindow(viewer->Widget(), DockReference::AddTo, this); - } -} - -void TextureViewer::texContextItem_triggered() -{ - QAction *act = qobject_cast(QObject::sender()); - - QVariant eid = act->property("eid"); - if(eid.isValid()) - { - m_Ctx.SetEventID({}, eid.toUInt(), eid.toUInt()); - return; - } - - QVariant id = act->property("id"); - if(id.isValid()) - { - ViewTexture(id.value(), false); - return; - } -} - -void TextureViewer::showDisabled_triggered() -{ - m_ShowDisabled = !m_ShowDisabled; - - if(m_Ctx.LogLoaded()) - m_Ctx.RefreshStatus(); -} - -void TextureViewer::showEmpty_triggered() -{ - m_ShowEmpty = !m_ShowEmpty; - - if(m_Ctx.LogLoaded()) - m_Ctx.RefreshStatus(); -} - -void TextureViewer::AddResourceUsageEntry(QMenu &menu, uint32_t start, uint32_t end, - ResourceUsage usage) -{ - QAction *item = NULL; - - if(start == end) - item = new QAction( - QFormatStr("EID %1: %2").arg(start).arg(ToQStr(usage, m_Ctx.APIProps().pipelineType)), this); - else - item = new QAction( - QFormatStr("EID %1-%2: %3").arg(start).arg(end).arg(ToQStr(usage, m_Ctx.APIProps().pipelineType)), - this); - - QObject::connect(item, &QAction::triggered, this, &TextureViewer::texContextItem_triggered); - item->setProperty("eid", QVariant(end)); - - menu.addAction(item); -} - -void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdctype::array &usage) -{ - QMenu contextMenu(this); - - QAction showDisabled(tr("Show Disabled"), this); - QAction showEmpty(tr("Show Empty"), this); - QAction openLockedTab(tr("Open new Locked Tab"), this); - QAction usageTitle(tr("Used:"), this); - QAction imageLayout(this); - - openLockedTab.setIcon(Icons::action_hover()); - - showDisabled.setChecked(m_ShowDisabled); - showDisabled.setChecked(m_ShowEmpty); - - contextMenu.addAction(&showDisabled); - contextMenu.addAction(&showEmpty); - - QObject::connect(&showDisabled, &QAction::triggered, this, &TextureViewer::showDisabled_triggered); - QObject::connect(&showEmpty, &QAction::triggered, this, &TextureViewer::showEmpty_triggered); - - if(m_Ctx.CurPipelineState().SupportsBarriers()) - { - contextMenu.addSeparator(); - imageLayout.setText(tr("Image is in layout ") + m_Ctx.CurPipelineState().GetResourceLayout(id)); - contextMenu.addAction(&imageLayout); - } - - if(id != ResourceId()) - { - contextMenu.addSeparator(); - contextMenu.addAction(&openLockedTab); - contextMenu.addSeparator(); - contextMenu.addAction(&usageTitle); - - openLockedTab.setProperty("id", QVariant::fromValue(id)); - - QObject::connect(&openLockedTab, &QAction::triggered, this, - &TextureViewer::texContextItem_triggered); - - uint32_t start = 0; - uint32_t end = 0; - ResourceUsage us = ResourceUsage::IndexBuffer; - - for(const EventUsage u : usage) - { - if(start == 0) - { - start = end = u.eventID; - us = u.usage; - continue; - } - - const DrawcallDescription *curDraw = m_Ctx.GetDrawcall(u.eventID); - - bool distinct = false; - - // if the usage is different from the last, add a new entry, - // or if the previous draw link is broken. - if(u.usage != us || curDraw == NULL || curDraw->previous == 0) - { - distinct = true; - } - else - { - // otherwise search back through real draws, to see if the - // last event was where we were - otherwise it's a new - // distinct set of drawcalls and should have a separate - // entry in the context menu - const DrawcallDescription *prev = m_Ctx.GetDrawcall(curDraw->previous); - - while(prev != NULL && prev->eventID > end) - { - if(!(prev->flags & (DrawFlags::Dispatch | DrawFlags::Drawcall | DrawFlags::CmdList))) - { - prev = m_Ctx.GetDrawcall(prev->previous); - } - else - { - distinct = true; - break; - } - - if(prev == NULL) - distinct = true; - } - } - - if(distinct) - { - AddResourceUsageEntry(contextMenu, start, end, us); - start = end = u.eventID; - us = u.usage; - } - - end = u.eventID; - } - - if(start != 0) - AddResourceUsageEntry(contextMenu, start, end, us); - - RDDialog::show(&contextMenu, QCursor::pos()); - } - else - { - RDDialog::show(&contextMenu, QCursor::pos()); - } -} - -void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, CompType typeHint, - bool force, Following &follow, const QString &bindName, - const QString &slotName) -{ - if(id != ResourceId() || force) - { - TextureDescription *texptr = m_Ctx.GetTexture(id); - BufferDescription *bufptr = m_Ctx.GetBuffer(id); - - if(texptr != NULL) - { - QString fullname = bindName; - if(texptr->customName) - { - if(!fullname.isEmpty()) - fullname += lit(" = "); - fullname += ToQStr(texptr->name); - } - if(fullname.isEmpty()) - fullname = ToQStr(texptr->name); - - prev->setResourceName(fullname); - WId handle = prev->thumbWinId(); - m_Ctx.Replay().AsyncInvoke([this, handle, id, typeHint](IReplayController *) { - m_Output->AddThumbnail(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(handle), id, - typeHint); - }); - } - else if(bufptr != NULL) - { - QString fullname = bindName; - if(bufptr->customName) - { - if(!fullname.isEmpty()) - fullname += lit(" = "); - fullname += ToQStr(bufptr->name); - } - if(fullname.isEmpty()) - fullname = ToQStr(bufptr->name); - - prev->setResourceName(fullname); - WId handle = prev->thumbWinId(); - m_Ctx.Replay().AsyncInvoke([this, handle](IReplayController *) { - m_Output->AddThumbnail(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(handle), - ResourceId(), CompType::Typeless); - }); - } - else - { - prev->setResourceName(QString()); - WId handle = prev->thumbWinId(); - m_Ctx.Replay().AsyncInvoke([this, handle](IReplayController *) { - m_Output->AddThumbnail(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(handle), - ResourceId(), CompType::Typeless); - }); - } - - prev->setProperty("f", QVariant::fromValue(follow)); - prev->setSlotName(slotName); - prev->setActive(true); - prev->setSelected(m_Following == follow); - } - else if(m_Following == follow) - { - prev->setResourceName(tr("Unused")); - prev->setActive(true); - prev->setSelected(true); - - WId handle = prev->thumbWinId(); - m_Ctx.Replay().AsyncInvoke([this, handle](IReplayController *) { - m_Output->AddThumbnail(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(handle), - ResourceId(), CompType::Typeless); - }); - } - else - { - prev->setResourceName(QString()); - prev->setActive(false); - prev->setSelected(false); - } -} - -void TextureViewer::InitStageResourcePreviews(ShaderStage stage, - const rdctype::array &resourceDetails, - const rdctype::array &mapping, - QMap> &ResList, - ThumbnailStrip *prevs, int &prevIndex, bool copy, - bool rw) -{ - for(int idx = 0; idx < mapping.count; idx++) - { - const BindpointMap &key = mapping[idx]; - - const QVector *resArray = NULL; - - if(ResList.contains(key)) - resArray = &ResList[key]; - - int arrayLen = resArray != NULL ? resArray->size() : 1; - - for(int arrayIdx = 0; arrayIdx < arrayLen; arrayIdx++) - { - ResourceId id = resArray != NULL ? resArray->at(arrayIdx).Id : ResourceId(); - CompType typeHint = resArray != NULL ? resArray->at(arrayIdx).typeHint : CompType::Typeless; - - bool used = key.used; - bool samplerBind = false; - bool otherBind = false; - - QString bindName; - - for(int b = 0; b < resourceDetails.count; b++) - { - const ShaderResource &bind = resourceDetails[b]; - if(bind.bindPoint == idx && bind.IsReadOnly) - { - bindName = ToQStr(bind.name); - otherBind = true; - break; - } - - if(bind.bindPoint == idx) - { - if(bind.IsSampler && !bind.IsReadOnly) - samplerBind = true; - else - otherBind = true; - } - } - - if(samplerBind && !otherBind) - continue; - - if(copy) - { - used = true; - bindName = tr("Source"); - } - - Following follow(rw ? FollowType::ReadWrite : FollowType::ReadOnly, stage, idx, arrayIdx); - QString slotName = QFormatStr("%1 %2%3") - .arg(m_Ctx.CurPipelineState().Abbrev(stage)) - .arg(rw ? lit("RW ") : lit("")) - .arg(idx); - - if(arrayLen > 1) - slotName += QFormatStr("[%1]").arg(arrayIdx); - - if(copy) - slotName = tr("SRC"); - - // show if it's referenced by the shader - regardless of empty or not - bool show = used; - - // it's bound, but not referenced, and we have "show disabled" - show = show || (m_ShowDisabled && !used && id != ResourceId()); - - // it's empty, and we have "show empty" - show = show || (m_ShowEmpty && id == ResourceId()); - - // it's the one we're following - show = show || (follow == m_Following); - - ResourcePreview *prev = NULL; - - if(prevIndex < prevs->thumbs().size()) - { - prev = prevs->thumbs()[prevIndex]; - - // don't use it if we're not actually going to show it - if(!show && !prev->isActive()) - continue; - } - else - { - // don't create it if we're not actually going to show it - if(!show) - continue; - - prev = UI_CreateThumbnail(prevs); - } - - prevIndex++; - - InitResourcePreview(prev, show ? id : ResourceId(), typeHint, show, follow, bindName, slotName); - } - } -} - -void TextureViewer::thumb_doubleClicked(QMouseEvent *e) -{ - if(e->buttons() & Qt::LeftButton) - { - ResourceId id = m_Following.GetResourceId(m_Ctx); - - if(id != ResourceId()) - ViewTexture(id, false); - } -} - -void TextureViewer::thumb_clicked(QMouseEvent *e) -{ - if(e->buttons() & Qt::LeftButton) - { - ResourcePreview *prev = qobject_cast(QObject::sender()); - - Following follow = prev->property("f").value(); - - for(ResourcePreview *p : ui->outputThumbs->thumbs()) - p->setSelected(false); - - for(ResourcePreview *p : ui->inputThumbs->thumbs()) - p->setSelected(false); - - m_Following = follow; - prev->setSelected(true); - - UI_UpdateCachedTexture(); - - ResourceId id = m_Following.GetResourceId(m_Ctx); - - if(id != ResourceId()) - { - UI_OnTextureSelectionChanged(false); - ui->renderContainer->show(); - } - } - - if(e->buttons() & Qt::RightButton) - { - ResourcePreview *prev = qobject_cast(QObject::sender()); - - Following follow = prev->property("f").value(); - - ResourceId id = follow.GetResourceId(m_Ctx); - - if(id == ResourceId() && follow == m_Following) - id = m_TexDisplay.texid; - - rdctype::array empty; - - if(id == ResourceId()) - { - OpenResourceContextMenu(id, empty); - } - else - { - m_Ctx.Replay().AsyncInvoke([this, id](IReplayController *r) { - rdctype::array usage = r->GetUsage(id); - - GUIInvoke::call([this, id, usage]() { OpenResourceContextMenu(id, usage); }); - }); - } - } -} - -void TextureViewer::render_mouseWheel(QWheelEvent *e) -{ - QPoint cursorPos = e->pos(); - - setFitToWindow(false); - - // scroll in logarithmic scale - double logScale = logf(m_TexDisplay.scale); - logScale += e->delta() / 2500.0; - UI_SetScale((float)expf(logScale), cursorPos.x(), cursorPos.y()); - - e->accept(); -} - -void TextureViewer::render_mouseMove(QMouseEvent *e) -{ - if(m_Output == NULL) - return; - - m_CurHoverPixel.setX(int((float(e->x() * ui->render->devicePixelRatio()) - m_TexDisplay.offx) / - m_TexDisplay.scale)); - m_CurHoverPixel.setY(int((float(e->y() * ui->render->devicePixelRatio()) - m_TexDisplay.offy) / - m_TexDisplay.scale)); - - if(m_TexDisplay.texid != ResourceId()) - { - TextureDescription *texptr = GetCurrentTexture(); - - if(texptr != NULL) - { - if(e->buttons() & Qt::RightButton) - { - ui->render->setCursor(QCursor(Qt::CrossCursor)); - - m_PickedPoint = m_CurHoverPixel; - - m_PickedPoint.setX(qBound(0, m_PickedPoint.x(), (int)texptr->width - 1)); - m_PickedPoint.setY(qBound(0, m_PickedPoint.y(), (int)texptr->height - 1)); - - m_Ctx.Replay().AsyncInvoke(lit("PickPixelClick"), - [this](IReplayController *r) { RT_PickPixelsAndUpdate(r); }); - } - else if(e->buttons() == Qt::NoButton) - { - m_Ctx.Replay().AsyncInvoke(lit("PickPixelHover"), - [this](IReplayController *r) { RT_PickHoverAndUpdate(r); }); - } - } - } - - QPoint curpos = QCursor::pos(); - - if(e->buttons() & Qt::LeftButton) - { - if(qAbs(m_DragStartPos.x() - curpos.x()) > ui->renderHScroll->singleStep() || - qAbs(m_DragStartPos.y() - curpos.y()) > ui->renderVScroll->singleStep()) - { - setScrollPosition(QPoint(m_DragStartScroll.x() + (curpos.x() - m_DragStartPos.x()), - m_DragStartScroll.y() + (curpos.y() - m_DragStartPos.y()))); - } - - ui->render->setCursor(QCursor(Qt::SizeAllCursor)); - } - - if(e->buttons() == Qt::NoButton) - { - ui->render->unsetCursor(); - } - - UI_UpdateStatusText(); -} - -void TextureViewer::render_mouseClick(QMouseEvent *e) -{ - ui->render->setFocus(); - - if(e->buttons() & Qt::RightButton) - render_mouseMove(e); - - if(e->buttons() & Qt::LeftButton) - { - m_DragStartPos = QCursor::pos(); - m_DragStartScroll = getScrollPosition(); - - ui->render->setCursor(QCursor(Qt::SizeAllCursor)); - } -} - -void TextureViewer::render_resize(QResizeEvent *e) -{ - UI_UpdateFittedScale(); - UI_CalcScrollbars(); - - INVOKE_MEMFN(RT_UpdateAndDisplay); -} - -void TextureViewer::render_keyPress(QKeyEvent *e) -{ - TextureDescription *texptr = GetCurrentTexture(); - - if(texptr == NULL) - return; - - if(e->matches(QKeySequence::Copy)) - { - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(ui->texStatusDim->text() + lit(" | ") + ui->statusText->text()); - } - - if(!m_Ctx.LogLoaded()) - return; - - if((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_G) - { - ShowGotoPopup(); - } - - bool nudged = false; - - int increment = 1 << (int)m_TexDisplay.mip; - - if(e->key() == Qt::Key_Up && m_PickedPoint.y() > 0) - { - m_PickedPoint -= QPoint(0, increment); - nudged = true; - } - else if(e->key() == Qt::Key_Down && m_PickedPoint.y() < (int)texptr->height - 1) - { - m_PickedPoint += QPoint(0, increment); - nudged = true; - } - else if(e->key() == Qt::Key_Left && m_PickedPoint.x() > 0) - { - m_PickedPoint -= QPoint(increment, 0); - nudged = true; - } - else if(e->key() == Qt::Key_Right && m_PickedPoint.x() < (int)texptr->height - 1) - { - m_PickedPoint += QPoint(increment, 0); - nudged = true; - } - - if(nudged) - { - m_PickedPoint = QPoint(qBound(0, m_PickedPoint.x(), (int)texptr->width - 1), - qBound(0, m_PickedPoint.y(), (int)texptr->height - 1)); - e->accept(); - - m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) { - RT_PickPixelsAndUpdate(r); - RT_UpdateAndDisplay(r); - }); - - UI_UpdateStatusText(); - } -} - -float TextureViewer::CurMaxScrollX() -{ - TextureDescription *texptr = GetCurrentTexture(); - - QSizeF size(1.0f, 1.0f); - - if(texptr != NULL) - size = QSizeF(texptr->width, texptr->height); - - return realRenderWidth() - size.width() * m_TexDisplay.scale; -} - -float TextureViewer::CurMaxScrollY() -{ - TextureDescription *texptr = GetCurrentTexture(); - - QSizeF size(1.0f, 1.0f); - - if(texptr != NULL) - size = QSizeF(texptr->width, texptr->height); - - return realRenderHeight() - size.height() * m_TexDisplay.scale; -} - -QPoint TextureViewer::getScrollPosition() -{ - return QPoint((int)m_TexDisplay.offx, m_TexDisplay.offy); -} - -void TextureViewer::setScrollPosition(const QPoint &pos) -{ - m_TexDisplay.offx = qMax(CurMaxScrollX(), (float)pos.x()); - m_TexDisplay.offy = qMax(CurMaxScrollY(), (float)pos.y()); - - m_TexDisplay.offx = qMin(0.0f, m_TexDisplay.offx); - m_TexDisplay.offy = qMin(0.0f, m_TexDisplay.offy); - - if(ScrollUpdateScrollbars) - { - ScrollUpdateScrollbars = false; - - if(ui->renderHScroll->isEnabled()) - ui->renderHScroll->setValue(qBound(0, -int(m_TexDisplay.offx), ui->renderHScroll->maximum())); - - if(ui->renderVScroll->isEnabled()) - ui->renderVScroll->setValue(qBound(0, -int(m_TexDisplay.offy), ui->renderVScroll->maximum())); - - ScrollUpdateScrollbars = true; - } - - INVOKE_MEMFN(RT_UpdateAndDisplay); -} - -void TextureViewer::UI_CalcScrollbars() -{ - TextureDescription *texptr = GetCurrentTexture(); - - QSizeF size(1.0f, 1.0f); - - if(texptr != NULL) - { - size = QSizeF(texptr->width, texptr->height); - } - - if((int)floor(size.width() * m_TexDisplay.scale) <= realRenderWidth()) - { - ui->renderHScroll->setEnabled(false); - } - else - { - ui->renderHScroll->setEnabled(true); - - ui->renderHScroll->setMaximum((int)ceil(size.width() * m_TexDisplay.scale - realRenderWidth())); - ui->renderHScroll->setPageStep(qMax(1, ui->renderHScroll->maximum() / 6)); - ui->renderHScroll->setSingleStep(int(m_TexDisplay.scale)); - } - - if((int)floor(size.height() * m_TexDisplay.scale) <= realRenderHeight()) - { - ui->renderVScroll->setEnabled(false); - } - else - { - ui->renderVScroll->setEnabled(true); - - ui->renderVScroll->setMaximum((int)ceil(size.height() * m_TexDisplay.scale - realRenderHeight())); - ui->renderVScroll->setPageStep(qMax(1, ui->renderVScroll->maximum() / 6)); - ui->renderVScroll->setSingleStep(int(m_TexDisplay.scale)); - } -} - -void TextureViewer::on_renderHScroll_valueChanged(int position) -{ - if(!ScrollUpdateScrollbars) - return; - - ScrollUpdateScrollbars = false; - - { - float delta = (float)position / (float)ui->renderHScroll->maximum(); - setScrollPosition(QPoint((int)(CurMaxScrollX() * delta), getScrollPosition().y())); - } - - ScrollUpdateScrollbars = true; -} - -void TextureViewer::on_renderVScroll_valueChanged(int position) -{ - if(!ScrollUpdateScrollbars) - return; - - ScrollUpdateScrollbars = false; - - { - float delta = (float)position / (float)ui->renderVScroll->maximum(); - setScrollPosition(QPoint(getScrollPosition().x(), (int)(CurMaxScrollY() * delta))); - } - - ScrollUpdateScrollbars = true; -} - -void TextureViewer::UI_RecreatePanels() -{ - ICaptureContext *ctx = &m_Ctx; - - // while a log is loaded, pass NULL into the widget - if(!m_Ctx.LogLoaded()) - ctx = NULL; - - { - CustomPaintWidget *render = new CustomPaintWidget(ctx, ui->renderContainer); - render->setObjectName(ui->render->objectName()); - render->setSizePolicy(ui->render->sizePolicy()); - delete ui->render; - ui->render = render; - ui->gridLayout->addWidget(render, 1, 0, 1, 1); - } - - { - CustomPaintWidget *pixelContext = new CustomPaintWidget(ctx, ui->pixelContextLayout); - pixelContext->setObjectName(ui->pixelContext->objectName()); - pixelContext->setSizePolicy(ui->pixelContext->sizePolicy()); - delete ui->pixelContext; - ui->pixelContext = pixelContext; - ui->pixelcontextgrid->addWidget(pixelContext, 0, 0, 1, 2); - } - - ui->render->setColours(darkBack, lightBack); - ui->pixelContext->setColours(darkBack, lightBack); - - QObject::connect(ui->render, &CustomPaintWidget::clicked, this, &TextureViewer::render_mouseClick); - QObject::connect(ui->render, &CustomPaintWidget::mouseMove, this, &TextureViewer::render_mouseMove); - QObject::connect(ui->render, &CustomPaintWidget::mouseWheel, this, - &TextureViewer::render_mouseWheel); - QObject::connect(ui->render, &CustomPaintWidget::resize, this, &TextureViewer::render_resize); - QObject::connect(ui->render, &CustomPaintWidget::keyPress, this, &TextureViewer::render_keyPress); - - QObject::connect(ui->pixelContext, &CustomPaintWidget::keyPress, this, - &TextureViewer::render_keyPress); -} - -void TextureViewer::OnLogfileLoaded() -{ - Reset(); - - WId renderID = ui->render->winId(); - WId contextID = ui->pixelContext->winId(); - - ui->saveTex->setEnabled(true); - ui->locationGoto->setEnabled(true); - ui->viewTexBuffer->setEnabled(true); - - TextureListItemModel *model = (TextureListItemModel *)ui->textureList->model(); - - model->reset(TextureListItemModel::String, QString(), m_Ctx); - - m_TexDisplay.darkBackgroundColor = - FloatVector(darkBack.redF(), darkBack.greenF(), darkBack.blueF(), 1.0f); - m_TexDisplay.lightBackgroundColor = - FloatVector(lightBack.redF(), lightBack.greenF(), lightBack.blueF(), 1.0f); - - m_Ctx.Replay().BlockInvoke([renderID, contextID, this](IReplayController *r) { - m_Output = r->CreateOutput(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(renderID), - ReplayOutputType::Texture); - - m_Output->SetPixelContext(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(contextID)); - - ui->render->setOutput(m_Output); - ui->pixelContext->setOutput(m_Output); - - RT_UpdateAndDisplay(r); - - GUIInvoke::call([this]() { OnEventChanged(m_Ctx.CurEvent()); }); - }); - - m_Watcher = new QFileSystemWatcher({ConfigFilePath(QString())}, this); - - QObject::connect(m_Watcher, &QFileSystemWatcher::fileChanged, this, - &TextureViewer::customShaderModified); - QObject::connect(m_Watcher, &QFileSystemWatcher::directoryChanged, this, - &TextureViewer::customShaderModified); - reloadCustomShaders(QString()); -} - -void TextureViewer::Reset() -{ - m_CachedTexture = NULL; - - memset(&m_TexDisplay, 0, sizeof(m_TexDisplay)); - m_TexDisplay.darkBackgroundColor = - FloatVector(darkBack.redF(), darkBack.greenF(), darkBack.blueF(), 1.0f); - m_TexDisplay.lightBackgroundColor = - FloatVector(lightBack.redF(), lightBack.greenF(), lightBack.blueF(), 1.0f); - - m_Output = NULL; - - m_TextureSettings.clear(); - - m_PrevSize = QSizeF(); - m_HighWaterStatusLength = 0; - - ui->rangeHistogram->setRange(0.0f, 1.0f); - - ui->textureListFilter->setCurrentIndex(0); - - ui->renderHScroll->setEnabled(false); - ui->renderVScroll->setEnabled(false); - - // PixelPicked = false; - - ui->statusText->setText(QString()); - ui->renderContainer->setWindowTitle(tr("Current")); - ui->zoomOption->setCurrentText(QString()); - ui->mipLevel->clear(); - ui->sliceFace->clear(); - - ui->channels->setCurrentIndex(0); - ui->overlay->setCurrentIndex(0); - - { - QPalette Pal(palette()); - - Pal.setColor(QPalette::Background, Qt::black); - - ui->pickSwatch->setAutoFillBackground(true); - ui->pickSwatch->setPalette(Pal); - } - - ui->customShader->clear(); - - UI_RecreatePanels(); - - ui->inputThumbs->clearThumbs(); - ui->outputThumbs->clearThumbs(); - - UI_UpdateTextureDetails(); - UI_UpdateChannels(); -} - -void TextureViewer::OnLogfileClosed() -{ - Reset(); - - delete m_Watcher; - m_Watcher = NULL; - - m_LockedTabs.clear(); - - ui->customShader->clear(); - m_CustomShaders.clear(); - - ui->saveTex->setEnabled(false); - ui->locationGoto->setEnabled(false); - ui->viewTexBuffer->setEnabled(false); -} - -void TextureViewer::OnEventChanged(uint32_t eventID) -{ - UI_UpdateCachedTexture(); - - TextureDescription *CurrentTexture = GetCurrentTexture(); - - if(!currentTextureIsLocked() || - (CurrentTexture != NULL && m_TexDisplay.texid != CurrentTexture->ID)) - UI_OnTextureSelectionChanged(true); - - if(m_Output == NULL) - return; - - UI_CreateThumbnails(); - - QVector RTs = Following::GetOutputTargets(m_Ctx); - BoundResource Depth = Following::GetDepthTarget(m_Ctx); - - int outIndex = 0; - int inIndex = 0; - - bool copy = false, clear = false, compute = false; - Following::GetDrawContext(m_Ctx, copy, clear, compute); - - for(int rt = 0; rt < RTs.size(); rt++) - { - ResourcePreview *prev; - - if(outIndex < ui->outputThumbs->thumbs().size()) - prev = ui->outputThumbs->thumbs()[outIndex]; - else - prev = UI_CreateThumbnail(ui->outputThumbs); - - outIndex++; - - Following follow(FollowType::OutputColour, ShaderStage::Pixel, rt, 0); - QString bindName = (copy || clear) ? tr("Destination") : QString(); - QString slotName = (copy || clear) - ? tr("DST") - : (m_Ctx.CurPipelineState().OutputAbbrev() + QString::number(rt)); - - InitResourcePreview(prev, RTs[rt].Id, RTs[rt].typeHint, false, follow, bindName, slotName); - } - - // depth - { - ResourcePreview *prev; - - if(outIndex < ui->outputThumbs->thumbs().size()) - prev = ui->outputThumbs->thumbs()[outIndex]; - else - prev = UI_CreateThumbnail(ui->outputThumbs); - - outIndex++; - - Following follow(FollowType::OutputDepth, ShaderStage::Pixel, 0, 0); - - InitResourcePreview(prev, Depth.Id, Depth.typeHint, false, follow, QString(), tr("DS")); - } - - ShaderStage stages[] = {ShaderStage::Vertex, ShaderStage::Hull, ShaderStage::Domain, - ShaderStage::Geometry, ShaderStage::Pixel}; - - int count = 5; - - if(compute) - { - stages[0] = ShaderStage::Compute; - count = 1; - } - - const rdctype::array empty; - - // display resources used for all stages - for(int i = 0; i < count; i++) - { - ShaderStage stage = stages[i]; - - QMap> RWs = Following::GetReadWriteResources(m_Ctx, stage); - QMap> ROs = Following::GetReadOnlyResources(m_Ctx, stage); - - const ShaderReflection *details = Following::GetReflection(m_Ctx, stage); - const ShaderBindpointMapping &mapping = Following::GetMapping(m_Ctx, stage); - - InitStageResourcePreviews(stage, details != NULL ? details->ReadWriteResources : empty, - mapping.ReadWriteResources, RWs, ui->outputThumbs, outIndex, copy, - true); - - InitStageResourcePreviews(stage, details != NULL ? details->ReadOnlyResources : empty, - mapping.ReadOnlyResources, ROs, ui->inputThumbs, inIndex, copy, false); - } - - // hide others - const QVector &outThumbs = ui->outputThumbs->thumbs(); - - for(; outIndex < outThumbs.size(); outIndex++) - { - ResourcePreview *prev = outThumbs[outIndex]; - prev->setResourceName(QString()); - prev->setActive(false); - prev->setSelected(false); - } - - ui->outputThumbs->refreshLayout(); - - const QVector &inThumbs = ui->inputThumbs->thumbs(); - - for(; inIndex < inThumbs.size(); inIndex++) - { - ResourcePreview *prev = inThumbs[inIndex]; - prev->setResourceName(QString()); - prev->setActive(false); - prev->setSelected(false); - } - - ui->inputThumbs->refreshLayout(); - - INVOKE_MEMFN(RT_UpdateAndDisplay); - - // if(autoFit.Checked) - // AutoFitRange(); -} - -QVariant TextureViewer::persistData() -{ - QVariantMap state = ui->dockarea->saveState(); - - state[lit("darkBack")] = darkBack; - state[lit("lightBack")] = lightBack; - - return state; -} - -void TextureViewer::setPersistData(const QVariant &persistData) -{ - QVariantMap state = persistData.toMap(); - - darkBack = state[lit("darkBack")].value(); - lightBack = state[lit("lightBack")].value(); - - if(darkBack != lightBack) - { - ui->backcolorPick->setChecked(false); - ui->checkerBack->setChecked(true); - } - else - { - ui->backcolorPick->setChecked(true); - ui->checkerBack->setChecked(false); - } - - m_TexDisplay.darkBackgroundColor = - FloatVector(darkBack.redF(), darkBack.greenF(), darkBack.blueF(), 1.0f); - m_TexDisplay.lightBackgroundColor = - FloatVector(lightBack.redF(), lightBack.greenF(), lightBack.blueF(), 1.0f); - - ui->render->setColours(darkBack, lightBack); - ui->pixelContext->setColours(darkBack, lightBack); - - ui->dockarea->restoreState(state); - - SetupTextureTabs(); -} - -float TextureViewer::GetFitScale() -{ - TextureDescription *texptr = GetCurrentTexture(); - - if(texptr == NULL) - return 1.0f; - - float xscale = (float)realRenderWidth() / (float)texptr->width; - float yscale = (float)realRenderHeight() / (float)texptr->height; - - return qMin(xscale, yscale); -} - -int TextureViewer::realRenderWidth() const -{ - return ui->render->width() * ui->render->devicePixelRatio(); -} - -int TextureViewer::realRenderHeight() const -{ - return ui->render->height() * ui->render->devicePixelRatio(); -} - -void TextureViewer::UI_UpdateFittedScale() -{ - if(ui->fitToWindow->isChecked()) - UI_SetScale(1.0f); -} - -void TextureViewer::UI_SetScale(float s) -{ - UI_SetScale(s, ui->render->width() / 2, ui->render->height() / 2); -} - -void TextureViewer::UI_SetScale(float s, int x, int y) -{ - if(ui->fitToWindow->isChecked()) - s = GetFitScale(); - - float prevScale = m_TexDisplay.scale; - - m_TexDisplay.scale = qBound(0.1f, s, 256.0f); - - INVOKE_MEMFN(RT_UpdateAndDisplay); - - float scaleDelta = (m_TexDisplay.scale / prevScale); - - QPoint newPos = getScrollPosition(); - - newPos -= QPoint(x, y); - newPos = QPoint((int)(newPos.x() * scaleDelta), (int)(newPos.y() * scaleDelta)); - newPos += QPoint(x, y); - - setScrollPosition(newPos); - - setCurrentZoomValue(m_TexDisplay.scale); - - UI_CalcScrollbars(); -} - -void TextureViewer::setCurrentZoomValue(float zoom) -{ - ui->zoomOption->setCurrentText(QString::number(ceil(zoom * 100)) + lit("%")); -} - -float TextureViewer::getCurrentZoomValue() -{ - if(ui->fitToWindow->isChecked()) - return m_TexDisplay.scale; - - QString zoomText = ui->zoomOption->currentText().replace(QLatin1Char('%'), QLatin1Char(' ')); - - bool ok = false; - int zoom = zoomText.toInt(&ok); - - if(!ok) - zoom = 100; - - return (float)(zoom) / 100.0f; -} - -void TextureViewer::setFitToWindow(bool checked) -{ - if(checked) - { - UI_UpdateFittedScale(); - ui->fitToWindow->setChecked(true); - } - else if(!checked) - { - ui->fitToWindow->setChecked(false); - float curScale = m_TexDisplay.scale; - ui->zoomOption->setCurrentText(QString()); - setCurrentZoomValue(curScale); - } -} - -void TextureViewer::on_fitToWindow_toggled(bool checked) -{ - UI_UpdateFittedScale(); -} - -void TextureViewer::on_zoomExactSize_clicked() -{ - ui->fitToWindow->setChecked(false); - UI_SetScale(1.0f); -} - -void TextureViewer::on_zoomOption_currentIndexChanged(int index) -{ - if(index >= 0) - { - setFitToWindow(false); - ui->zoomOption->setCurrentText(ui->zoomOption->itemText(index)); - UI_SetScale(getCurrentZoomValue()); - } -} - -void TextureViewer::zoomOption_returnPressed() -{ - UI_SetScale(getCurrentZoomValue()); -} - -void TextureViewer::on_overlay_currentIndexChanged(int index) -{ - m_TexDisplay.overlay = DebugOverlay::NoOverlay; - - if(ui->overlay->currentIndex() > 0) - m_TexDisplay.overlay = (DebugOverlay)ui->overlay->currentIndex(); - - INVOKE_MEMFN(RT_UpdateAndDisplay); -} - -void TextureViewer::channelsWidget_mouseClicked(QMouseEvent *event) -{ - RDToolButton *s = qobject_cast(QObject::sender()); - - if(event->button() == Qt::RightButton && s) - { - bool checkd = false; - - RDToolButton *butts[] = {ui->channelRed, ui->channelGreen, ui->channelBlue, ui->channelAlpha}; - - for(RDToolButton *b : butts) - { - if(b->isChecked() && b != s) - checkd = true; - if(!b->isChecked() && b == s) - checkd = true; - } - - ui->channelRed->setChecked(!checkd); - ui->channelGreen->setChecked(!checkd); - ui->channelBlue->setChecked(!checkd); - ui->channelAlpha->setChecked(!checkd); - s->setChecked(checkd); - } -} - -void TextureViewer::range_rangeUpdated() -{ - m_TexDisplay.rangemin = ui->rangeHistogram->blackPoint(); - m_TexDisplay.rangemax = ui->rangeHistogram->whitePoint(); - - ui->rangeBlack->setText(Formatter::Format(m_TexDisplay.rangemin)); - ui->rangeWhite->setText(Formatter::Format(m_TexDisplay.rangemax)); - - if(m_NoRangePaint) - return; - - INVOKE_MEMFN(RT_UpdateAndDisplay); - - if(m_Output == NULL) - { - ui->render->update(); - ui->pixelcontextgrid->update(); - } -} - -void TextureViewer::rangePoint_textChanged(QString text) -{ - m_RangePoint_Dirty = true; -} - -void TextureViewer::rangePoint_Update() -{ - float black = ui->rangeHistogram->blackPoint(); - float white = ui->rangeHistogram->whitePoint(); - - bool ok = false; - double d = ui->rangeBlack->text().toDouble(&ok); - - if(ok) - black = d; - - d = ui->rangeWhite->text().toDouble(&ok); - - if(ok) - white = d; - - ui->rangeHistogram->setRange(black, white); - - INVOKE_MEMFN(RT_UpdateVisualRange); -} - -void TextureViewer::rangePoint_leave() -{ - if(!m_RangePoint_Dirty) - return; - - rangePoint_Update(); - - m_RangePoint_Dirty = false; -} - -void TextureViewer::rangePoint_keyPress(QKeyEvent *e) -{ - // escape key - if(e->key() == Qt::Key_Escape) - { - m_RangePoint_Dirty = false; - ui->rangeHistogram->setRange(ui->rangeHistogram->blackPoint(), ui->rangeHistogram->whitePoint()); - } - if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) - { - rangePoint_Update(); - } -} - -void TextureViewer::on_zoomRange_clicked() -{ - float black = ui->rangeHistogram->blackPoint(); - float white = ui->rangeHistogram->whitePoint(); - - ui->autoFit->setChecked(false); - - ui->rangeHistogram->setRange(black, white); - - INVOKE_MEMFN(RT_UpdateVisualRange); -} - -void TextureViewer::on_autoFit_clicked() -{ - AutoFitRange(); -} - -void TextureViewer::on_reset01_clicked() -{ - UI_SetHistogramRange(GetCurrentTexture(), m_TexDisplay.typeHint); - - ui->autoFit->setChecked(false); - - INVOKE_MEMFN(RT_UpdateVisualRange); -} - -void TextureViewer::on_visualiseRange_clicked() -{ - if(ui->visualiseRange->isChecked()) - { - ui->rangeHistogram->setMinimumSize(QSize(300, 90)); - - m_Visualise = true; - INVOKE_MEMFN(RT_UpdateVisualRange); - } - else - { - m_Visualise = false; - ui->rangeHistogram->setMinimumSize(QSize(200, 0)); - - ui->rangeHistogram->setHistogramData({}); - } -} - -void TextureViewer::AutoFitRange() -{ - // no log loaded or buffer/empty texture currently being viewed - don't autofit - if(!m_Ctx.LogLoaded() || GetCurrentTexture() == NULL || m_Output == NULL) - return; - - m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) { - PixelValue min, max; - std::tie(min, max) = m_Output->GetMinMax(); - - { - float minval = FLT_MAX; - float maxval = -FLT_MAX; - - bool changeRange = false; - - ResourceFormat fmt = GetCurrentTexture()->format; - - if(m_TexDisplay.CustomShader != ResourceId()) - { - fmt.compType = CompType::Float; - } - - for(int i = 0; i < 4; i++) - { - if(fmt.compType == CompType::UInt) - { - min.value_f[i] = min.value_u[i]; - max.value_f[i] = max.value_u[i]; - } - else if(fmt.compType == CompType::SInt) - { - min.value_f[i] = min.value_i[i]; - max.value_f[i] = max.value_i[i]; - } - } - - if(m_TexDisplay.Red) - { - minval = qMin(minval, min.value_f[0]); - maxval = qMax(maxval, max.value_f[0]); - changeRange = true; - } - if(m_TexDisplay.Green && fmt.compCount > 1) - { - minval = qMin(minval, min.value_f[1]); - maxval = qMax(maxval, max.value_f[1]); - changeRange = true; - } - if(m_TexDisplay.Blue && fmt.compCount > 2) - { - minval = qMin(minval, min.value_f[2]); - maxval = qMax(maxval, max.value_f[2]); - changeRange = true; - } - if(m_TexDisplay.Alpha && fmt.compCount > 3) - { - minval = qMin(minval, min.value_f[3]); - maxval = qMax(maxval, max.value_f[3]); - changeRange = true; - } - - if(changeRange) - { - GUIInvoke::call([this, minval, maxval]() { - ui->rangeHistogram->setRange(minval, maxval); - INVOKE_MEMFN(RT_UpdateVisualRange); - }); - } - } - }); -} - -void TextureViewer::on_backcolorPick_clicked() -{ - QColor col = QColorDialog::getColor(Qt::black, this, tr("Choose background colour")); - - if(!col.isValid()) - return; - - col = col.toRgb(); - m_TexDisplay.darkBackgroundColor = m_TexDisplay.lightBackgroundColor = - FloatVector(col.redF(), col.greenF(), col.blueF(), 1.0f); - - darkBack = lightBack = col; - - ui->render->setColours(darkBack, lightBack); - ui->pixelContext->setColours(darkBack, lightBack); - - ui->backcolorPick->setChecked(true); - ui->checkerBack->setChecked(false); - - INVOKE_MEMFN(RT_UpdateAndDisplay); - - if(m_Output == NULL) - { - ui->render->update(); - ui->pixelcontextgrid->update(); - } -} - -void TextureViewer::on_checkerBack_clicked() -{ - ui->checkerBack->setChecked(true); - ui->backcolorPick->setChecked(false); - - m_TexDisplay.lightBackgroundColor = FloatVector(0.81f, 0.81f, 0.81f, 1.0f); - m_TexDisplay.darkBackgroundColor = FloatVector(0.57f, 0.57f, 0.57f, 1.0f); - - darkBack = QColor::fromRgb(int(m_TexDisplay.darkBackgroundColor.x * 255.0f), - int(m_TexDisplay.darkBackgroundColor.y * 255.0f), - int(m_TexDisplay.darkBackgroundColor.z * 255.0f)); - - lightBack = QColor::fromRgb(int(m_TexDisplay.lightBackgroundColor.x * 255.0f), - int(m_TexDisplay.lightBackgroundColor.y * 255.0f), - int(m_TexDisplay.lightBackgroundColor.z * 255.0f)); - - ui->render->setColours(darkBack, lightBack); - ui->pixelContext->setColours(darkBack, lightBack); - - INVOKE_MEMFN(RT_UpdateAndDisplay); - - if(m_Output == NULL) - { - ui->render->update(); - ui->pixelcontextgrid->update(); - } -} - -void TextureViewer::on_mipLevel_currentIndexChanged(int index) -{ - TextureDescription *texptr = GetCurrentTexture(); - if(texptr == NULL) - return; - - TextureDescription &tex = *texptr; - - uint32_t prevSlice = m_TexDisplay.sliceFace; - - if(tex.mips > 1) - { - m_TexDisplay.mip = (uint32_t)qMax(0, index); - m_TexDisplay.sampleIdx = 0; - } - else - { - m_TexDisplay.mip = 0; - m_TexDisplay.sampleIdx = (uint32_t)qMax(0, index); - if(m_TexDisplay.sampleIdx == tex.msSamp) - m_TexDisplay.sampleIdx = ~0U; - } - - // For 3D textures, update the slice list for this mip - if(tex.depth > 1) - { - uint32_t newSlice = prevSlice >> (int)m_TexDisplay.mip; - - uint32_t numSlices = qMax(1U, tex.depth >> (int)m_TexDisplay.mip); - - ui->sliceFace->clear(); - - for(uint32_t i = 0; i < numSlices; i++) - ui->sliceFace->addItem(tr("Slice %1").arg(i)); - - // changing sliceFace index will handle updating range & re-picking - ui->sliceFace->setCurrentIndex((int)qBound(0U, newSlice, numSlices - 1)); - - return; - } - - INVOKE_MEMFN(RT_UpdateVisualRange); - - if(m_Output != NULL && m_PickedPoint.x() >= 0 && m_PickedPoint.y() >= 0) - { - INVOKE_MEMFN(RT_PickPixelsAndUpdate); - } - - INVOKE_MEMFN(RT_UpdateAndDisplay); -} - -void TextureViewer::on_sliceFace_currentIndexChanged(int index) -{ - TextureDescription *texptr = GetCurrentTexture(); - if(texptr == NULL) - return; - - TextureDescription &tex = *texptr; - m_TexDisplay.sliceFace = (uint32_t)qMax(0, index); - - if(tex.depth > 1) - m_TexDisplay.sliceFace = (uint32_t)(qMax(0, index) << (int)m_TexDisplay.mip); - - INVOKE_MEMFN(RT_UpdateVisualRange); - - if(m_Output != NULL && m_PickedPoint.x() >= 0 && m_PickedPoint.y() >= 0) - { - INVOKE_MEMFN(RT_PickPixelsAndUpdate); - } - - INVOKE_MEMFN(RT_UpdateAndDisplay); -} - -void TextureViewer::on_locationGoto_clicked() -{ - ShowGotoPopup(); -} - -void TextureViewer::ShowGotoPopup() -{ - TextureDescription *texptr = GetCurrentTexture(); - - if(texptr) - { - QPoint p = m_PickedPoint; - - uint32_t mipHeight = qMax(1U, texptr->height >> (int)m_TexDisplay.mip); - - if(m_Ctx.APIProps().pipelineType == GraphicsAPI::OpenGL) - p.setY((int)(mipHeight - 1) - p.y()); - if(m_TexDisplay.FlipY) - p.setY((int)(mipHeight - 1) - p.y()); - - m_Goto->show(ui->render, p); - } -} - -void TextureViewer::on_viewTexBuffer_clicked() -{ - TextureDescription *texptr = GetCurrentTexture(); - - if(texptr) - { - QString baseType; - - QString varName = lit("pixels"); - - uint32_t w = texptr->width; - - switch(texptr->format.specialFormat) - { - case SpecialFormat::BC1: - case SpecialFormat::BC2: - case SpecialFormat::BC3: - case SpecialFormat::BC4: - case SpecialFormat::BC5: - case SpecialFormat::BC6: - case SpecialFormat::BC7: - case SpecialFormat::ETC2: - case SpecialFormat::EAC: - case SpecialFormat::ASTC: - varName = lit("block"); - // display a 4x4 block at a time - w /= 4; - default: break; - } - - switch(texptr->format.specialFormat) - { - case SpecialFormat::Unknown: - { - if(texptr->format.compByteWidth == 1) - baseType = lit("byte"); - else if(texptr->format.compByteWidth == 2) - baseType = lit("short"); - else - baseType = lit("int"); - - baseType = QFormatStr("rgb x%1%2").arg(baseType).arg(texptr->format.compCount); - - break; - } - // 2x4 byte block, for 64-bit block formats - case SpecialFormat::BC1: - case SpecialFormat::BC4: - case SpecialFormat::ETC2: - case SpecialFormat::EAC: - baseType = lit("row_major xint2x1"); - break; - // 4x4 byte block, for 128-bit block formats - case SpecialFormat::BC2: - case SpecialFormat::BC3: - case SpecialFormat::BC5: - case SpecialFormat::BC6: - case SpecialFormat::BC7: - case SpecialFormat::ASTC: baseType = lit("row_major xint4x1"); break; - case SpecialFormat::R10G10B10A2: baseType = lit("uintten"); break; - case SpecialFormat::R11G11B10: baseType = lit("rgb floateleven"); break; - case SpecialFormat::R5G6B5: - case SpecialFormat::R5G5B5A1: baseType = lit("xshort"); break; - case SpecialFormat::R9G9B9E5: baseType = lit("xint"); break; - case SpecialFormat::R4G4B4A4: baseType = lit("xbyte2"); break; - case SpecialFormat::R4G4: baseType = lit("xbyte"); break; - case SpecialFormat::D16S8: - case SpecialFormat::D24S8: - case SpecialFormat::D32S8: - case SpecialFormat::YUV: baseType = lit("xint4"); break; - case SpecialFormat::S8: baseType = lit("xbyte"); break; - } - - QString format = QFormatStr("%1 %2[%3];").arg(baseType).arg(varName).arg(w); - - IBufferViewer *viewer = - m_Ctx.ViewTextureAsBuffer(m_TexDisplay.sliceFace, m_TexDisplay.mip, texptr->ID, format); - - m_Ctx.AddDockWindow(viewer->Widget(), DockReference::AddTo, this); - } -} - -void TextureViewer::on_saveTex_clicked() -{ - TextureDescription *texptr = GetCurrentTexture(); - - if(!texptr || !m_Output) - return; - - TextureSave config; - memset(&config, 0, sizeof(config)); - config.jpegQuality = 90; - - config.id = m_TexDisplay.texid; - config.typeHint = m_TexDisplay.typeHint; - config.slice.sliceIndex = (int)m_TexDisplay.sliceFace; - config.mip = (int)m_TexDisplay.mip; - - if(texptr->depth > 1) - config.slice.sliceIndex = (int)m_TexDisplay.sliceFace >> (int)m_TexDisplay.mip; - - config.channelExtract = -1; - if(m_TexDisplay.Red && !m_TexDisplay.Green && !m_TexDisplay.Blue && !m_TexDisplay.Alpha) - config.channelExtract = 0; - if(!m_TexDisplay.Red && m_TexDisplay.Green && !m_TexDisplay.Blue && !m_TexDisplay.Alpha) - config.channelExtract = 1; - if(!m_TexDisplay.Red && !m_TexDisplay.Green && m_TexDisplay.Blue && !m_TexDisplay.Alpha) - config.channelExtract = 2; - if(!m_TexDisplay.Red && !m_TexDisplay.Green && !m_TexDisplay.Blue && m_TexDisplay.Alpha) - config.channelExtract = 3; - - config.comp.blackPoint = m_TexDisplay.rangemin; - config.comp.whitePoint = m_TexDisplay.rangemax; - config.alphaCol = m_TexDisplay.lightBackgroundColor; - config.alpha = m_TexDisplay.Alpha ? AlphaMapping::BlendToCheckerboard : AlphaMapping::Discard; - if(m_TexDisplay.Alpha && !ui->checkerBack->isChecked()) - config.alpha = AlphaMapping::BlendToColor; - - if(m_TexDisplay.CustomShader != ResourceId()) - { - ResourceId id; - m_Ctx.Replay().BlockInvoke( - [this, &id](IReplayController *r) { id = m_Output->GetCustomShaderTexID(); }); - - if(id != ResourceId()) - config.id = id; - } - - TextureSaveDialog saveDialog(*texptr, config, this); - int res = RDDialog::show(&saveDialog); - - config = saveDialog.config(); - - if(res) - { - bool ret = false; - QString fn = saveDialog.filename(); - - m_Ctx.Replay().BlockInvoke([this, &ret, config, fn](IReplayController *r) { - ret = r->SaveTexture(config, fn.toUtf8().data()); - }); - - if(!ret) - { - RDDialog::critical( - NULL, tr("Error saving texture"), - tr("Error saving texture %1.\n\nCheck diagnostic log in Help menu for more details.").arg(fn)); - } - } -} - -void TextureViewer::on_debugPixelContext_clicked() -{ - if(m_PickedPoint.x() < 0 || m_PickedPoint.y() < 0) - return; - - int x = m_PickedPoint.x() >> (int)m_TexDisplay.mip; - int y = m_PickedPoint.y() >> (int)m_TexDisplay.mip; - - m_Ctx.Replay().AsyncInvoke([this, x, y](IReplayController *r) { - ShaderDebugTrace *trace = r->DebugPixel((uint32_t)x, (uint32_t)y, m_TexDisplay.sampleIdx, ~0U); - - if(trace->states.count == 0) - { - r->FreeTrace(trace); - - // if we couldn't debug the pixel on this event, open up a pixel history - GUIInvoke::call([this]() { on_pixelHistory_clicked(); }); - return; - } - - GUIInvoke::call([this, x, y, trace]() { - QString debugContext = tr("Pixel %1,%2").arg(x).arg(y); - - const ShaderReflection *shaderDetails = - m_Ctx.CurPipelineState().GetShaderReflection(ShaderStage::Pixel); - const ShaderBindpointMapping &bindMapping = - m_Ctx.CurPipelineState().GetBindpointMapping(ShaderStage::Pixel); - - // viewer takes ownership of the trace - IShaderViewer *s = - m_Ctx.DebugShader(&bindMapping, shaderDetails, ShaderStage::Pixel, trace, debugContext); - - m_Ctx.AddDockWindow(s->Widget(), DockReference::AddTo, this); - }); - }); -} - -void TextureViewer::on_pixelHistory_clicked() -{ - TextureDescription *texptr = GetCurrentTexture(); - - if(!texptr || !m_Output) - return; - - int x = m_PickedPoint.x() >> (int)m_TexDisplay.mip; - int y = m_PickedPoint.y() >> (int)m_TexDisplay.mip; - - IPixelHistoryView *hist = m_Ctx.ViewPixelHistory(texptr->ID, x, y, m_TexDisplay); - - m_Ctx.AddDockWindow(hist->Widget(), DockReference::RightOf, this, 0.2f); - - // add a short delay so that controls repainting after a new panel appears can get at the - // render thread before we insert the long blocking pixel history task - LambdaThread *thread = new LambdaThread([this, texptr, x, y, hist]() { - QThread::msleep(150); - m_Ctx.Replay().AsyncInvoke([this, texptr, x, y, hist](IReplayController *r) { - rdctype::array history = - r->PixelHistory(texptr->ID, (uint32_t)x, (int32_t)y, m_TexDisplay.sliceFace, - m_TexDisplay.mip, m_TexDisplay.sampleIdx, m_TexDisplay.typeHint); - - GUIInvoke::call([hist, history] { hist->SetHistory(history); }); - }); - }); - thread->selfDelete(true); - thread->start(); -} - -void TextureViewer::on_texListShow_clicked() -{ - if(ui->textureListFrame->isVisible()) - { - ui->dockarea->moveToolWindow(ui->textureListFrame, ToolWindowManager::NoArea); - } - else - { - ui->textureListFilter->setCurrentText(QString()); - ui->dockarea->moveToolWindow( - ui->textureListFrame, - ToolWindowManager::AreaReference(ToolWindowManager::LeftOf, - ui->dockarea->areaOf(ui->renderContainer), 0.2f)); - ui->dockarea->setToolWindowProperties(ui->textureListFrame, ToolWindowManager::HideOnClose); - } -} - -void TextureViewer::on_cancelTextureListFilter_clicked() -{ - ui->textureListFilter->setCurrentText(QString()); -} - -void TextureViewer::on_textureListFilter_editTextChanged(const QString &text) -{ - TextureListItemModel *model = (TextureListItemModel *)ui->textureList->model(); - - if(model == NULL) - return; - - model->reset(TextureListItemModel::String, text, m_Ctx); -} - -void TextureViewer::on_textureListFilter_currentIndexChanged(int index) -{ - TextureListItemModel *model = (TextureListItemModel *)ui->textureList->model(); - - if(model == NULL) - return; - - if(ui->textureListFilter->currentIndex() == 1) - model->reset(TextureListItemModel::Textures, QString(), m_Ctx); - else if(ui->textureListFilter->currentIndex() == 2) - model->reset(TextureListItemModel::RenderTargets, QString(), m_Ctx); - else - model->reset(TextureListItemModel::String, ui->textureListFilter->currentText(), m_Ctx); -} - -void TextureViewer::on_textureList_clicked(const QModelIndex &index) -{ - ResourceId id = index.model()->data(index, Qt::UserRole).value(); - ViewTexture(id, false); -} - -void TextureViewer::reloadCustomShaders(const QString &filter) -{ - if(!m_Ctx.LogLoaded()) - return; - - if(filter.isEmpty()) - { - QString prevtext = ui->customShader->currentText(); - - QList shaders = m_CustomShaders.values(); - - m_Ctx.Replay().AsyncInvoke([shaders](IReplayController *r) { - for(ResourceId s : shaders) - r->FreeCustomShader(s); - }); - - ui->customShader->clear(); - m_CustomShaders.clear(); - - ui->customShader->setCurrentText(prevtext); - } - else - { - QString fn = QFileInfo(filter).baseName(); - QString key = fn.toUpper(); - - if(m_CustomShaders.contains(key)) - { - if(m_CustomShadersBusy.contains(key)) - return; - - ResourceId freed = m_CustomShaders[key]; - m_Ctx.Replay().AsyncInvoke([freed](IReplayController *r) { r->FreeCustomShader(freed); }); - - m_CustomShaders.remove(key); - - QString text = ui->customShader->currentText(); - - for(int i = 0; i < ui->customShader->count(); i++) - { - if(ui->customShader->itemText(i).compare(fn, Qt::CaseInsensitive) == 0) - { - ui->customShader->removeItem(i); - break; - } - } - - ui->customShader->setCurrentText(text); - } - } - - QStringList files = - QDir(ConfigFilePath(QString())) - .entryList({QFormatStr("*.%1").arg(m_Ctx.CurPipelineState().GetShaderExtension())}, - QDir::Files | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase); - - QStringList watchedFiles = m_Watcher->files(); - if(!watchedFiles.isEmpty()) - m_Watcher->removePaths(watchedFiles); - - for(const QString &f : files) - { - QString fn = QFileInfo(f).baseName(); - QString key = fn.toUpper(); - - m_Watcher->addPath(ConfigFilePath(f)); - - if(!m_CustomShaders.contains(key) && !m_CustomShadersBusy.contains(key)) - { - QFile fileHandle(ConfigFilePath(f)); - if(fileHandle.open(QFile::ReadOnly | QFile::Text)) - { - QTextStream stream(&fileHandle); - QString source = stream.readAll(); - - fileHandle.close(); - - m_CustomShaders[key] = ResourceId(); - m_CustomShadersBusy.push_back(key); - m_Ctx.Replay().AsyncInvoke([this, fn, key, source](IReplayController *r) { - rdctype::str errors; - - ResourceId id; - std::tie(id, errors) = - r->BuildCustomShader("main", source.toUtf8().data(), 0, ShaderStage::Pixel); - - if(m_CustomShaderEditor.contains(key)) - { - IShaderViewer *editor = m_CustomShaderEditor[key]; - GUIInvoke::call([editor, errors]() { editor->ShowErrors(ToQStr(errors)); }); - } - - GUIInvoke::call([this, fn, key, id]() { - QString prevtext = ui->customShader->currentText(); - ui->customShader->addItem(fn); - ui->customShader->setCurrentText(prevtext); - - m_CustomShaders[key] = id; - m_CustomShadersBusy.removeOne(key); - - UI_UpdateChannels(); - }); - }); - } - } - } -} - -void TextureViewer::on_customCreate_clicked() -{ - QString filename = ui->customShader->currentText(); - - if(filename.isEmpty()) - { - RDDialog::critical(this, tr("Error Creating Shader"), - tr("No shader name specified.\nEnter a new name in the textbox")); - return; - } - - if(m_CustomShaders.contains(filename.toUpper())) - { - RDDialog::critical(this, tr("Error Creating Shader"), - tr("Selected shader already exists.\nEnter a new name in the textbox.")); - ui->customShader->setCurrentText(QString()); - UI_UpdateChannels(); - return; - } - - QString path = ConfigFilePath(filename + lit(".") + m_Ctx.CurPipelineState().GetShaderExtension()); - - QString src; - - if(IsD3D(m_Ctx.APIProps().pipelineType)) - { - src = - lit("float4 main(float4 pos : SV_Position, float4 uv : TEXCOORD0) : SV_Target0\n" - "{\n" - " return float4(0,0,0,1);\n" - "}\n"); - } - else - { - src = - lit("#version 420 core\n\n" - "layout (location = 0) in vec2 uv;\n\n" - "layout (location = 0) out vec4 color_out;\n\n" - "void main()\n" - "{\n" - " color_out = vec4(0,0,0,1);\n" - "}\n"); - } - - QFile fileHandle(path); - if(fileHandle.open(QFile::WriteOnly | QIODevice::Truncate | QIODevice::Text)) - { - fileHandle.write(src.toUtf8()); - fileHandle.close(); - } - else - { - RDDialog::critical( - this, tr("Cannot create shader"), - tr("Couldn't create file for shader %1\n%2").arg(filename).arg(fileHandle.errorString())); - } - - // auto-open edit window - on_customEdit_clicked(); - - reloadCustomShaders(filename); -} - -void TextureViewer::on_customEdit_clicked() -{ - QString filename = ui->customShader->currentText(); - QString key = filename.toUpper(); - - if(filename.isEmpty()) - { - RDDialog::critical(this, tr("Error Editing Shader"), - tr("No shader selected.\nSelect a custom shader from the drop-down")); - return; - } - - QString path = ConfigFilePath(filename + lit(".") + m_Ctx.CurPipelineState().GetShaderExtension()); - - QString src; - - QFile fileHandle(path); - if(fileHandle.open(QFile::ReadOnly | QFile::Text)) - { - QTextStream stream(&fileHandle); - src = stream.readAll(); - fileHandle.close(); - } - else - { - RDDialog::critical( - this, tr("Cannot open shader"), - tr("Couldn't open file for shader %1\n%2").arg(filename).arg(fileHandle.errorString())); - return; - } - - QStringMap files; - files[filename] = src; - - IShaderViewer *s = m_Ctx.EditShader( - true, lit("main"), files, - // Save Callback - [this, key, filename, path](ICaptureContext *ctx, IShaderViewer *viewer, - const QStringMap &updatedfiles) { - { - QFile fileHandle(path); - if(fileHandle.open(QFile::WriteOnly | QIODevice::Truncate | QIODevice::Text)) - { - fileHandle.write(updatedfiles[filename].toUtf8()); - fileHandle.close(); - - // watcher doesn't trigger on internal modifications - reloadCustomShaders(filename); - } - else - { - RDDialog::critical( - this, tr("Cannot save shader"), - tr("Couldn't save file for shader %1\n%2").arg(filename).arg(fileHandle.errorString())); - } - } - }, - - [this, key](ICaptureContext *ctx) { m_CustomShaderEditor.remove(key); }); - - m_CustomShaderEditor[key] = s; - - m_Ctx.AddDockWindow(s->Widget(), DockReference::AddTo, this); -} - -void TextureViewer::on_customDelete_clicked() -{ - QString shaderName = ui->customShader->currentText(); - - if(shaderName.isEmpty()) - { - RDDialog::critical(this, tr("Error Deleting Shader"), - tr("No shader selected.\nSelect a custom shader from the drop-down")); - return; - } - - if(!m_CustomShaders.contains(shaderName.toUpper())) - { - RDDialog::critical( - this, tr("Error Deleting Shader"), - tr("Selected shader doesn't exist.\nSelect a custom shader from the drop-down")); - return; - } - - QMessageBox::StandardButton res = - RDDialog::question(this, tr("Deleting Custom Shader"), - tr("Really delete %1?").arg(shaderName), RDDialog::YesNoCancel); - - if(res == QMessageBox::Yes) - { - QString path = - ConfigFilePath(shaderName + lit(".") + m_Ctx.CurPipelineState().GetShaderExtension()); - if(!QFileInfo::exists(path)) - { - RDDialog::critical( - this, tr("Error Deleting Shader"), - tr("Shader file %1 can't be found.\nSelect a custom shader from the drop-down") - .arg(shaderName)); - return; - } - - if(!QFile::remove(path)) - { - RDDialog::critical(this, tr("Error Deleting Shader"), - tr("Error deleting shader %1 from disk").arg(shaderName)); - return; - } - - ui->customShader->setCurrentText(QString()); - UI_UpdateChannels(); - } -} - -void TextureViewer::customShaderModified(const QString &path) -{ - // allow time for modifications to finish - QThread::msleep(15); - - reloadCustomShaders(QString()); -} diff --git a/qrenderdoc/Windows/TextureViewer.h b/qrenderdoc/Windows/TextureViewer.h deleted file mode 100644 index 9d8f58a9e..000000000 --- a/qrenderdoc/Windows/TextureViewer.h +++ /dev/null @@ -1,320 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2016-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. - ******************************************************************************/ - -#pragma once - -#include -#include -#include -#include "Code/CaptureContext.h" - -namespace Ui -{ -class TextureViewer; -} - -class ResourcePreview; -class ThumbnailStrip; -class TextureGoto; -class QFileSystemWatcher; - -enum struct FollowType -{ - OutputColour, - OutputDepth, - ReadWrite, - ReadOnly -}; - -struct Following -{ - FollowType Type; - ShaderStage Stage; - int index; - int arrayEl; - - static const Following Default; - - Following(); - - Following(FollowType t, ShaderStage s, int i, int a); - - bool operator==(const Following &o); - bool operator!=(const Following &o); - static void GetDrawContext(ICaptureContext &ctx, bool ©, bool &clear, bool &compute); - - int GetHighestMip(ICaptureContext &ctx); - int GetFirstArraySlice(ICaptureContext &ctx); - CompType GetTypeHint(ICaptureContext &ctx); - - ResourceId GetResourceId(ICaptureContext &ctx); - BoundResource GetBoundResource(ICaptureContext &ctx, int arrayIdx); - - static QVector GetOutputTargets(ICaptureContext &ctx); - - static BoundResource GetDepthTarget(ICaptureContext &ctx); - - QMap> GetReadWriteResources(ICaptureContext &ctx); - - static QMap> GetReadWriteResources(ICaptureContext &ctx, - ShaderStage stage); - - QMap> GetReadOnlyResources(ICaptureContext &ctx); - - static QMap> GetReadOnlyResources(ICaptureContext &ctx, - ShaderStage stage); - - const ShaderReflection *GetReflection(ICaptureContext &ctx); - static const ShaderReflection *GetReflection(ICaptureContext &ctx, ShaderStage stage); - - const ShaderBindpointMapping &GetMapping(ICaptureContext &ctx); - static const ShaderBindpointMapping &GetMapping(ICaptureContext &ctx, ShaderStage stage); -}; - -struct TexSettings -{ - TexSettings() - { - r = g = b = true; - a = false; - mip = 0; - slice = 0; - minrange = 0.0f; - maxrange = 1.0f; - typeHint = CompType::Typeless; - } - - int displayType; // RGBA, RGBM, Custom - QString customShader; - bool r, g, b, a; - bool depth, stencil; - int mip, slice; - float minrange, maxrange; - CompType typeHint; -}; - -class TextureViewer : public QFrame, public ITextureViewer, public ILogViewer -{ -private: - Q_OBJECT - - Q_PROPERTY(QVariant persistData READ persistData WRITE setPersistData DESIGNABLE false SCRIPTABLE false) - -public: - explicit TextureViewer(ICaptureContext &ctx, QWidget *parent = 0); - ~TextureViewer(); - - // ITextureViewer - QWidget *Widget() override { return this; } - void ViewTexture(ResourceId ID, bool focus) override; - void GotoLocation(int x, int y) override; - - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; - void OnSelectedEventChanged(uint32_t eventID) override {} - void OnEventChanged(uint32_t eventID) override; - - QVariant persistData(); - void setPersistData(const QVariant &persistData); - -private slots: - // automatic slots - void on_renderHScroll_valueChanged(int position); - void on_renderVScroll_valueChanged(int position); - - void on_fitToWindow_toggled(bool checked); - void on_zoomExactSize_clicked(); - void on_zoomOption_currentIndexChanged(int index); - - void on_mipLevel_currentIndexChanged(int index); - void on_sliceFace_currentIndexChanged(int index); - void on_overlay_currentIndexChanged(int index); - - void on_zoomRange_clicked(); - void on_autoFit_clicked(); - void on_reset01_clicked(); - void on_visualiseRange_clicked(); - void on_backcolorPick_clicked(); - void on_checkerBack_clicked(); - - void on_locationGoto_clicked(); - void on_viewTexBuffer_clicked(); - void on_texListShow_clicked(); - void on_saveTex_clicked(); - void on_debugPixelContext_clicked(); - void on_pixelHistory_clicked(); - - void on_customCreate_clicked(); - void on_customEdit_clicked(); - void on_customDelete_clicked(); - - void on_cancelTextureListFilter_clicked(); - void on_textureListFilter_editTextChanged(const QString &text); - void on_textureListFilter_currentIndexChanged(int index); - void on_textureList_clicked(const QModelIndex &index); - - // manual slots - void render_mouseClick(QMouseEvent *e); - void render_mouseMove(QMouseEvent *e); - void render_mouseWheel(QWheelEvent *e); - void render_resize(QResizeEvent *e); - void render_keyPress(QKeyEvent *e); - - void textureTab_Changed(int index); - void textureTab_Closing(int index); - - void thumb_clicked(QMouseEvent *); - void thumb_doubleClicked(QMouseEvent *); - void texContextItem_triggered(); - void showDisabled_triggered(); - void showEmpty_triggered(); - - void zoomOption_returnPressed(); - - void range_rangeUpdated(); - void rangePoint_textChanged(QString text); - void rangePoint_leave(); - void rangePoint_keyPress(QKeyEvent *e); - - void customShaderModified(const QString &path); - - void channelsWidget_mouseClicked(QMouseEvent *event); - void channelsWidget_toggled(bool checked) { UI_UpdateChannels(); } - void channelsWidget_selected(int index) { UI_UpdateChannels(); } -private: - void RT_FetchCurrentPixel(uint32_t x, uint32_t y, PixelValue &pickValue, PixelValue &realValue); - void RT_PickPixelsAndUpdate(IReplayController *); - void RT_PickHoverAndUpdate(IReplayController *); - void RT_UpdateAndDisplay(IReplayController *); - void RT_UpdateVisualRange(IReplayController *); - - void UI_RecreatePanels(); - - void UI_UpdateStatusText(); - void UI_UpdateTextureDetails(); - void UI_OnTextureSelectionChanged(bool newdraw); - - void UI_SetHistogramRange(const TextureDescription *tex, CompType typeHint); - - void UI_UpdateChannels(); - - void SetupTextureTabs(); - - void Reset(); - - ResourcePreview *UI_CreateThumbnail(ThumbnailStrip *strip); - void UI_CreateThumbnails(); - void InitResourcePreview(ResourcePreview *prev, ResourceId id, CompType typeHint, bool force, - Following &follow, const QString &bindName, const QString &slotName); - - void InitStageResourcePreviews(ShaderStage stage, - const rdctype::array &resourceDetails, - const rdctype::array &mapping, - QMap> &ResList, - ThumbnailStrip *prevs, int &prevIndex, bool copy, bool rw); - - void AddResourceUsageEntry(QMenu &menu, uint32_t start, uint32_t end, ResourceUsage usage); - void OpenResourceContextMenu(ResourceId id, const rdctype::array &usage); - - void AutoFitRange(); - void rangePoint_Update(); - - bool currentTextureIsLocked() { return m_LockedId != ResourceId(); } - void setFitToWindow(bool checked); - - void setCurrentZoomValue(float zoom); - float getCurrentZoomValue(); - - bool ScrollUpdateScrollbars = true; - - float CurMaxScrollX(); - float CurMaxScrollY(); - - float GetFitScale(); - - int realRenderWidth() const; - int realRenderHeight() const; - - QPoint getScrollPosition(); - void setScrollPosition(const QPoint &pos); - - TextureDescription *GetCurrentTexture(); - void UI_UpdateCachedTexture(); - - void ShowGotoPopup(); - - void UI_UpdateFittedScale(); - void UI_SetScale(float s); - void UI_SetScale(float s, int x, int y); - void UI_CalcScrollbars(); - - QPoint m_DragStartScroll; - QPoint m_DragStartPos; - - QPoint m_CurHoverPixel; - QPoint m_PickedPoint; - - QSizeF m_PrevSize; - - PixelValue m_CurRealValue; - PixelValue m_CurPixelValue; - PixelValue m_CurHoverValue; - - QColor darkBack; - QColor lightBack; - - int m_HighWaterStatusLength = 0; - int m_PrevFirstArraySlice = -1; - int m_PrevHighestMip = -1; - - bool m_ShowEmpty = false; - bool m_ShowDisabled = false; - - bool m_Visualise = false; - bool m_NoRangePaint = false; - bool m_RangePoint_Dirty = false; - - ResourceId m_LockedId; - QMap m_LockedTabs; - - TextureGoto *m_Goto; - - Ui::TextureViewer *ui; - ICaptureContext &m_Ctx; - IReplayOutput *m_Output = NULL; - - TextureDescription *m_CachedTexture; - Following m_Following = Following::Default; - QMap m_TextureSettings; - - QFileSystemWatcher *m_Watcher = NULL; - QStringList m_CustomShadersBusy; - QMap m_CustomShaders; - QMap m_CustomShaderEditor; - - void reloadCustomShaders(const QString &filter); - - TextureDisplay m_TexDisplay; -}; diff --git a/qrenderdoc/Windows/TextureViewer.ui b/qrenderdoc/Windows/TextureViewer.ui deleted file mode 100644 index c90b1cbcb..000000000 --- a/qrenderdoc/Windows/TextureViewer.ui +++ /dev/null @@ -1,1305 +0,0 @@ - - - TextureViewer - - - - 0 - 0 - 775 - 571 - - - - Texture Viewer - - - - - 50 - 460 - 119 - 100 - - - - - 0 - 0 - - - - - 100 - 100 - - - - false - - - - - - 10 - 120 - 558 - 28 - - - - - 0 - 28 - - - - QFrame::Panel - - - QFrame::Raised - - - - 3 - - - 6 - - - 2 - - - 6 - - - 2 - - - - - Range - - - - - - - - 0 - 0 - - - - 0.0 - - - - - - - - 200 - 0 - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - 1.0 - - - - - - - - 0 - 0 - - - - Zoom the visible range controls to the current black and white points - - - - - - - :/zoom.png:/zoom.png - - - true - - - - - - - - 0 - 0 - - - - Automatically fit the black and white points of the range to the minimum and maximum values contained in the texture - - - - - - - :/wand.png:/wand.png - - - true - - - - - - - - 0 - 0 - - - - Reset to [0, 1] - - - ... - - - - :/arrow_undo.png:/arrow_undo.png - - - true - - - - - - - - 0 - 0 - - - - Show a histogram with the distribution of values on top of the visible range - - - ... - - - - :/chart_curve.png:/chart_curve.png - - - true - - - true - - - - - - - - - 490 - 40 - 129 - 28 - - - - - 0 - 28 - - - - QFrame::Panel - - - QFrame::Raised - - - - 2 - - - 6 - - - 2 - - - 6 - - - 2 - - - - - Overlay - - - - - - - 20 - - - - - - - - - 10 - 80 - 221 - 28 - - - - - 0 - 28 - - - - QFrame::Panel - - - QFrame::Raised - - - - 2 - - - 6 - - - 2 - - - 6 - - - 2 - - - - - Zoom - - - - - - - true - - - Reset the zoom to 100% - - - 1:1 - - - false - - - false - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - true - - - Fit the current texture to the window - - - Fit - - - - :/arrow_out.png:/arrow_out.png - - - true - - - true - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - - 70 - 0 - - - - true - - - QComboBox::NoInsert - - - - - - - Flip the texture in the Y axis - - - - - - - :/flip_y.png:/flip_y.png - - - true - - - true - - - - - - - - - 330 - 40 - 149 - 28 - - - - - 0 - 28 - - - - QFrame::Panel - - - QFrame::Raised - - - - 2 - - - 6 - - - 2 - - - 6 - - - 2 - - - - - Actions - - - - - - - Save selected Texture - - - - - - - :/save.png:/save.png - - - true - - - - - - - Open Texture List - - - - - - - :/page_white_link.png:/page_white_link.png - - - true - - - - - - - Open the texture contents in a raw buffer viewer - - - - - - - :/page_white_code.png:/page_white_code.png - - - true - - - - - - - Enter co-ordinates to select a specific pixel location - - - - - - - :/find.png:/find.png - - - true - - - - - - - - - 10 - 40 - 299 - 28 - - - - - 0 - 0 - - - - - 0 - 28 - - - - QFrame::Panel - - - QFrame::Raised - - - - 2 - - - 6 - - - 2 - - - 6 - - - 2 - - - - - Subresource - - - - - - - Qt::Vertical - - - - - - - Mip - - - - - - - 20 - - - QComboBox::AdjustToContents - - - - - - - Slice/Face - - - - - - - 20 - - - QComboBox::AdjustToContents - - - - - - - - - 3 - 3 - 696 - 28 - - - - - 0 - 0 - - - - - 0 - 28 - - - - QFrame::Panel - - - QFrame::Raised - - - - 2 - - - 6 - - - 2 - - - 6 - - - 2 - - - - - Channels - - - - - - - true - - - - - - - Qt::Vertical - - - - - - - Show Red (Right click to toggle solo) - - - R - - - true - - - true - - - true - - - - - - - Show Green (Right click to toggle solo) - - - G - - - true - - - true - - - true - - - - - - - Show Blue (Right click to toggle solo) - - - B - - - true - - - true - - - QToolButton::DelayedPopup - - - true - - - - - - - Show Alpha (Right click to toggle solo) - - - A - - - true - - - true - - - - - - - Qt::Vertical - - - - - - - Mul: - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - true - - - 128 - - - QComboBox::NoInsert - - - - - - - Depth - - - - - - - Stencil - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - true - - - QComboBox::NoInsert - - - - - - - Create New Custom Shader - - - - - - - :/add.png:/add.png - - - true - - - - - - - Edit Selected Shader - - - - - - - :/page_white_edit.png:/page_white_edit.png - - - true - - - - - - - Delete Custom Shader - - - - - - - :/del.png:/del.png - - - true - - - - - - - Alpha: Pick Solid Background Color - - - - - - - :/color_wheel.png:/color_wheel.png - - - true - - - true - - - - - - - Alpha: Show Checkerboard Background - - - - - - - :/checkerboard.png:/checkerboard.png - - - true - - - true - - - true - - - - - - - Qt::Vertical - - - - - - - - 23 - 22 - - - - Override display of linear data in gamma space - -See FAQ on "Gamma display of linear data" - - - γ - - - true - - - true - - - true - - - - - - - - - 250 - 220 - 291 - 231 - - - - - 0 - 0 - - - - - 100 - 100 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - - - 0 - 0 - - - - - - - - Qt::Vertical - - - - - - - Qt::Horizontal - - - - - - - - - - - - 0 - 0 - - - - - Consolas - - - - texStatusDim - - - - - - - - 0 - 0 - - - - - 32 - 14 - - - - - - - - - 0 - 0 - - - - - Consolas - - - - Status Text - - - - - - - - - - - 40 - 240 - 201 - 181 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - 0 - 0 - - - - - - - - History - - - - - - - Debug - - - - - - - - - - - 40 - 470 - 120 - 80 - - - - - - - 210 - 470 - 120 - 80 - - - - - - - 550 - 210 - 221 - 244 - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 6 - - - 3 - - - 3 - - - 3 - - - 3 - - - - - 0 - - - - - - 0 - 0 - - - - true - - - - - - - - - - - :/cross.png:/cross.png - - - true - - - - - - - - - QFrame::Box - - - QFrame::Sunken - - - QAbstractItemView::NoEditTriggers - - - false - - - Qt::CopyAction - - - QAbstractItemView::NoSelection - - - QListView::ListMode - - - true - - - - - - - - - RDLineEdit - QLineEdit -
Widgets/Extended/RDLineEdit.h
-
- - ToolWindowManager - QWidget -
3rdparty/toolwindowmanager/ToolWindowManager.h
-
- - CustomPaintWidget - QWidget -
Widgets/CustomPaintWidget.h
-
- - ThumbnailStrip - QWidget -
Widgets/ThumbnailStrip.h
- 1 -
- - RDListView - QListView -
Widgets/Extended/RDListView.h
-
- - RangeHistogram - QWidget -
Widgets/RangeHistogram.h
- 1 -
- - RDToolButton - QToolButton -
Widgets/Extended/RDToolButton.h
-
-
- - - - -
diff --git a/qrenderdoc/Windows/TimelineBar.cpp b/qrenderdoc/Windows/TimelineBar.cpp deleted file mode 100644 index deaf74733..000000000 --- a/qrenderdoc/Windows/TimelineBar.cpp +++ /dev/null @@ -1,971 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 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. - ******************************************************************************/ - -#include "TimelineBar.h" -#include -#include -#include -#include -#include "Code/Resources.h" - -QPointF aliasAlign(QPointF pt) -{ - pt.setX(int(pt.x()) + 0.5); - pt.setY(int(pt.y()) + 0.5); - return pt; -} - -QMarginsF uniformMargins(qreal m) -{ - return QMarginsF(m, m, m, m); -} - -QMargins uniformMargins(int m) -{ - return QMargins(m, m, m, m); -} - -TimelineBar::TimelineBar(ICaptureContext &ctx, QWidget *parent) - : QAbstractScrollArea(parent), m_Ctx(ctx) -{ - m_Ctx.AddLogViewer(this); - - setMouseTracking(true); - - setFrameShape(NoFrame); - - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - - QObject::connect(horizontalScrollBar(), &QScrollBar::valueChanged, - [this](int value) { m_pan = -value; }); - - setWindowTitle(tr("Timeline")); -} - -TimelineBar::~TimelineBar() -{ - m_Ctx.BuiltinWindowClosed(this); - - m_Ctx.RemoveLogViewer(this); -} - -void TimelineBar::HighlightResourceUsage(ResourceId id) -{ - m_UsageEvents.clear(); - - TextureDescription *tex = m_Ctx.GetTexture(id); - - if(tex) - m_UsageTarget = ToQStr(tex->name); - - BufferDescription *buf = m_Ctx.GetBuffer(id); - - if(buf) - m_UsageTarget = ToQStr(buf->name); - - m_Ctx.Replay().AsyncInvoke([this, id](IReplayController *r) { - rdctype::array usage = r->GetUsage(id); - - GUIInvoke::call([this, usage]() { - for(const EventUsage &u : usage) - m_UsageEvents << u; - viewport()->update(); - }); - }); - - viewport()->update(); -} - -void TimelineBar::HighlightHistory(ResourceId id, const QList &history) -{ - m_HistoryTarget = QString(); - m_HistoryEvents.clear(); - - if(id != ResourceId()) - { - TextureDescription *tex = m_Ctx.GetTexture(id); - - if(tex) - m_HistoryTarget = ToQStr(tex->name); - - BufferDescription *buf = m_Ctx.GetBuffer(id); - - if(buf) - m_HistoryTarget = ToQStr(buf->name); - - for(const PixelModification &mod : history) - m_HistoryEvents << mod; - } - - viewport()->update(); -} - -void TimelineBar::OnLogfileClosed() -{ - setWindowTitle(tr("Timeline")); - - m_Draws.clear(); - m_RootDraws.clear(); - m_RootMarkers.clear(); - - layout(); -} - -void TimelineBar::OnLogfileLoaded() -{ - setWindowTitle(tr("Timeline - Frame #%1").arg(m_Ctx.FrameInfo().frameNumber)); - - processDraws(m_RootMarkers, m_RootDraws, m_Ctx.CurDrawcalls()); - - m_zoom = 1.0; - m_pan = 0.0; - m_lastPos = QPointF(); - - layout(); -} - -void TimelineBar::OnEventChanged(uint32_t eventID) -{ - viewport()->update(); -} - -QSize TimelineBar::minimumSizeHint() const -{ - return QSize(margin * 4 + borderWidth * 2 + 100, - margin * 4 + borderWidth * 2 + m_eidAxisRect.height() * 2 + - m_highlightingRect.height() + horizontalScrollBar()->sizeHint().height()); -} - -void TimelineBar::resizeEvent(QResizeEvent *e) -{ - layout(); -} - -void TimelineBar::layout() -{ - QFontMetrics fm(Formatter::PreferredFont()); - - // the area of everything - m_area = QRectF(viewport()->rect()).marginsRemoved(uniformMargins(borderWidth + margin)); - - m_titleWidth = fm.width(eidAxisTitle) + fm.height(); - - m_dataArea = m_area; - m_dataArea.setLeft(m_dataArea.left() + m_titleWidth); - - m_eidAxisRect = m_dataArea.marginsRemoved(uniformMargins(margin)); - m_eidAxisRect.setHeight(qMax(fm.height(), dataBarHeight)); - - m_markerRect = m_dataArea.marginsRemoved(uniformMargins(margin)); - m_markerRect.setTop(m_eidAxisRect.bottom() + margin); - - m_highlightingRect = m_area; - m_highlightingRect.setHeight(qMax(fm.height(), dataBarHeight) + highlightingExtra); - m_highlightingRect.moveTop(m_markerRect.bottom() - m_highlightingRect.height()); - - m_markerRect.setBottom(m_highlightingRect.top()); - - uint32_t maxEID = m_Draws.isEmpty() ? 0 : m_Draws.back(); - - int stepSize = 1; - int stepMagnitude = 1; - - m_eidAxisLabelTextWidth = fm.width(QString::number(maxEID)); - m_eidAxisLabelWidth = m_eidAxisLabelTextWidth + fm.height(); - m_eidAxisLabelStep = stepSize * stepMagnitude; - - qreal virtualSize = m_dataArea.width() * m_zoom; - - while(virtualSize > 0 && (maxEID / m_eidAxisLabelStep) * m_eidAxisLabelWidth > virtualSize) - { - // increment 1, 2, 5, 10, 20, 50, 100, ... - if(stepSize == 1) - { - stepSize = 2; - } - else if(stepSize == 2) - { - stepSize = 5; - } - else if(stepSize == 5) - { - stepSize = 1; - stepMagnitude *= 10; - } - - m_eidAxisLabelStep = stepSize * stepMagnitude; - } - - int numLabels = maxEID / m_eidAxisLabelStep + 1; - - m_eidAxisLabelWidth = virtualSize / numLabels; - - m_eidWidth = virtualSize / (maxEID + 1); - - int savedPan = m_pan; - - horizontalScrollBar()->setRange(0, virtualSize - m_dataArea.width()); - horizontalScrollBar()->setSingleStep(m_eidAxisLabelWidth); - horizontalScrollBar()->setPageStep(m_dataArea.width()); - horizontalScrollBar()->setValue(-savedPan); - - viewport()->update(); -} - -void TimelineBar::mousePressEvent(QMouseEvent *e) -{ - m_lastPos = e->localPos(); - - qreal x = e->localPos().x(); - - if((e->modifiers() & Qt::AltModifier) == 0) - { - Marker *marker = findMarker(m_RootMarkers, m_markerRect, m_lastPos); - if(marker) - { - marker->expanded = !marker->expanded; - m_lastPos = QPointF(); - viewport()->update(); - return; - } - - if(m_highlightingRect.contains(m_lastPos)) - { - uint32_t eid = eventAt(x); - - m_lastPos = QPointF(); - - // history events get first crack at any selection, if they exist - if(!m_HistoryEvents.isEmpty()) - { - auto it = std::find_if(m_HistoryEvents.begin(), m_HistoryEvents.end(), - [this, eid](const PixelModification &mod) { - if(mod.eventID == eid) - return true; - - return false; - }); - - if(it != m_HistoryEvents.end()) - m_Ctx.SetEventID({}, eid, eid); - - return; - } - - if(!m_UsageEvents.isEmpty()) - { - auto it = std::find_if(m_UsageEvents.begin(), m_UsageEvents.end(), - [this, eid](const EventUsage &use) { - if(use.eventID == eid) - return true; - - return false; - }); - - if(it != m_UsageEvents.end()) - m_Ctx.SetEventID({}, eid, eid); - } - - return; - } - - if(!m_Draws.isEmpty() && m_dataArea.contains(m_lastPos)) - { - uint32_t eid = eventAt(x); - auto it = std::find_if(m_Draws.begin(), m_Draws.end(), [this, eid](uint32_t d) { - if(d >= eid) - return true; - - return false; - }); - - if(it == m_Draws.end()) - m_Ctx.SetEventID({}, m_Draws.back(), m_Draws.back()); - else - m_Ctx.SetEventID({}, *it, *it); - } - } -} - -void TimelineBar::mouseReleaseEvent(QMouseEvent *e) -{ -} - -void TimelineBar::mouseMoveEvent(QMouseEvent *e) -{ - if(e->buttons() == Qt::LeftButton && m_lastPos != QPointF()) - { - qreal x = e->localPos().x(); - - if(e->modifiers() & Qt::AltModifier) - { - qreal delta = x - m_lastPos.x(); - m_pan += delta; - - m_pan = qBound(-m_eidAxisRect.width() * (m_zoom - 1.0), m_pan, 0.0); - - layout(); - } - else if(!m_Draws.isEmpty() && m_dataArea.contains(e->localPos())) - { - uint32_t eid = eventAt(x); - if(m_Draws.contains(eid) && eid != m_Ctx.CurEvent()) - m_Ctx.SetEventID({}, eid, eid); - } - } - else - { - viewport()->update(); - } - - m_lastPos = e->localPos(); - - Marker *marker = findMarker(m_RootMarkers, m_markerRect, m_lastPos); - if(marker) - setCursor(Qt::PointingHandCursor); - else - unsetCursor(); -} - -void TimelineBar::wheelEvent(QWheelEvent *e) -{ - float mod = (1.0 + e->delta() / 2500.0f); - - qreal prevZoom = m_zoom; - - m_zoom = qMax(1.0, m_zoom * mod); - - qreal zoomDelta = (m_zoom / prevZoom); - - // adjust the pan so that it's still in bounds, and so the zoom acts centred on the mouse - qreal newPan = m_pan; - - newPan -= (e->x() - m_eidAxisRect.left()); - newPan = newPan * zoomDelta; - newPan += (e->x() - m_eidAxisRect.left()); - - m_pan = qBound(-m_dataArea.width() * (m_zoom - 1.0), newPan, 0.0); - - e->accept(); - - layout(); -} - -void TimelineBar::leaveEvent(QEvent *e) -{ - unsetCursor(); - viewport()->update(); -} - -void TimelineBar::paintEvent(QPaintEvent *e) -{ - QPainter p(viewport()); - - p.setFont(font()); - p.setRenderHint(QPainter::TextAntialiasing); - - // draw boundaries and background - { - QRectF r = viewport()->rect(); - - p.fillRect(r, palette().brush(QPalette::Window)); - - r = r.marginsRemoved(QMargins(borderWidth + margin, borderWidth + margin, borderWidth + margin, - borderWidth + margin)); - - p.fillRect(r, palette().brush(QPalette::Base)); - p.drawRect(r); - } - - QTextOption to; - - to.setWrapMode(QTextOption::NoWrap); - to.setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - - QFontMetrics fm = p.fontMetrics(); - - { - QRectF titleRect = m_eidAxisRect; - titleRect.setLeft(titleRect.left() - m_titleWidth); - titleRect.setWidth(m_titleWidth); - - p.setPen(QPen(palette().brush(QPalette::Text), 1.0)); - - // add an extra margin for the text - p.drawText(titleRect.marginsRemoved(QMarginsF(margin, 0, 0, 0)), eidAxisTitle, to); - - titleRect.setLeft(titleRect.left() - margin); - titleRect.setTop(titleRect.top() - margin); - p.drawLine(titleRect.bottomLeft(), titleRect.bottomRight()); - p.drawLine(titleRect.topRight(), titleRect.bottomRight()); - } - - QRectF eidAxisRect = m_eidAxisRect; - - p.drawLine(eidAxisRect.bottomLeft(), eidAxisRect.bottomRight() + QPointF(margin, 0)); - - p.drawLine(m_highlightingRect.topLeft(), m_highlightingRect.topRight()); - - if(m_Draws.isEmpty()) - return; - - eidAxisRect.setLeft(m_eidAxisRect.left() + m_pan); - - uint32_t maxEID = m_Draws.isEmpty() ? 0 : m_Draws.back(); - - to.setAlignment(Qt::AlignCenter | Qt::AlignVCenter); - - p.setFont(Formatter::PreferredFont()); - - QRectF hoverRect = eidAxisRect; - - // clip labels to the visible section - p.setClipRect(m_eidAxisRect.marginsAdded(QMargins(0, margin, margin, 0))); - - // draw where we're hovering - { - QPoint pos = viewport()->mapFromGlobal(QCursor::pos()); - - if(m_dataArea.contains(pos)) - { - uint32_t hoverEID = eventAt(pos.x()); - - hoverRect.setLeft(offsetOf(hoverEID)); - hoverRect.setWidth(m_eidAxisLabelWidth); - - // recentre - hoverRect.moveLeft(hoverRect.left() - m_eidAxisLabelWidth / 2 + m_eidWidth / 2); - - QColor backCol = palette().color(QPalette::Base); - - if(getLuminance(backCol) < 0.2f) - backCol = backCol.lighter(120); - else - backCol = backCol.darker(120); - - QRectF backRect = hoverRect.marginsAdded(QMargins(0, margin - borderWidth, 0, 0)); - - backRect.setLeft(qMax(backRect.left(), m_eidAxisRect.left() + 1)); - - p.fillRect(backRect, backCol); - - p.drawText(hoverRect, QString::number(hoverEID), to); - - // re-add the top margin so the lines match up with the border around the EID axis - hoverRect = hoverRect.marginsAdded(QMargins(0, margin, 0, 0)); - - if(hoverRect.left() >= m_eidAxisRect.left()) - p.drawLine(hoverRect.topLeft(), hoverRect.bottomLeft()); - p.drawLine(hoverRect.topRight(), hoverRect.bottomRight()); - - // shrink the rect a bit for clipping against labels below - hoverRect.setX(qRound(hoverRect.x() + 0.5)); - hoverRect.setWidth(int(hoverRect.width())); - } - else - { - hoverRect = QRectF(); - } - } - - QRectF labelRect = eidAxisRect; - labelRect.setWidth(m_eidAxisLabelWidth); - - // iterate through the EIDs from 0, starting from possible a negative offset if the user has - // panned to the right. - for(uint32_t i = 0; i <= maxEID; i += m_eidAxisLabelStep) - { - labelRect.moveLeft(offsetOf(i) - labelRect.width() / 2 + m_eidWidth / 2); - - // check if this label is visible at all, but don't draw labels that intersect with the hovered - // number - if(labelRect.right() >= 0 && !labelRect.intersects(hoverRect)) - p.drawText(labelRect, QString::number(i), to); - - // check if labelRect is off the edge of the screen - if(labelRect.left() >= m_eidAxisRect.right()) - break; - } - - // stop clipping - p.setClipRect(viewport()->rect()); - - // clip the markers - p.setClipRect(m_markerRect); - - { - QPen pen = p.pen(); - paintMarkers(p, m_RootMarkers, m_RootDraws, m_markerRect); - p.setPen(pen); - } - - // stop clipping - p.setClipRect(viewport()->rect()); - - QRectF currentRect = eidAxisRect; - - // draw the current label and line - { - uint32_t curEID = m_Ctx.CurEvent(); - - currentRect.setLeft(offsetOf(curEID)); - currentRect.setWidth( - qMax(m_eidAxisLabelWidth, m_eidAxisLabelTextWidth + dataBarHeight + margin * 2)); - - // recentre - currentRect.moveLeft(currentRect.left() - currentRect.width() / 2 + m_eidWidth / 2); - - // remember where the middle would have been, without clamping - qreal realMiddle = currentRect.center().x(); - - // clamp the position from the left or right side - if(currentRect.left() < eidAxisRect.left()) - currentRect.moveLeft(eidAxisRect.left()); - else if(currentRect.right() > eidAxisRect.right()) - currentRect.moveRight(eidAxisRect.right()); - - // re-add the top margin so the lines match up with the border around the EID axis - QRectF currentBackRect = currentRect.marginsAdded(QMargins(0, margin, 0, 0)); - - p.fillRect(currentBackRect, palette().brush(QPalette::Base)); - p.drawRect(currentBackRect); - - // draw the 'current marker' pixmap - const QPixmap &px = Pixmaps::flag_green(devicePixelRatio()); - p.drawPixmap(currentRect.topLeft() + QPointF(margin, 1), px, px.rect()); - - // move to where the text should be and draw it - currentRect.setLeft(currentRect.left() + margin * 2 + dataBarHeight); - p.drawText(currentRect, QString::number(curEID), to); - - // draw a line from the bottom of the shadow downwards - QPointF currentTop = currentRect.center(); - currentTop.setX(int(qBound(eidAxisRect.left(), realMiddle, eidAxisRect.right() - 2.0)) + 0.5); - currentTop.setY(currentRect.bottom()); - - QPointF currentBottom = currentTop; - currentBottom.setY(m_markerRect.bottom()); - - p.drawLine(currentTop, currentBottom); - } - - to.setAlignment(Qt::AlignLeft | Qt::AlignTop); - - if(!m_UsageTarget.isEmpty() || !m_HistoryTarget.isEmpty()) - { - p.setRenderHint(QPainter::Antialiasing); - - QRectF highlightLabel = m_highlightingRect.marginsRemoved(uniformMargins(margin)); - - highlightLabel.setX(highlightLabel.x() + margin); - - QString text; - - if(!m_HistoryTarget.isEmpty()) - text = tr("Pixel history for %1").arg(m_HistoryTarget); - else - text = tr("Usage for %1:").arg(m_UsageTarget); - - p.drawText(highlightLabel, text, to); - - const int triRadius = fm.averageCharWidth(); - const int triHeight = fm.ascent(); - - QPainterPath triangle; - triangle.addPolygon( - QPolygonF({QPoint(0, triHeight), QPoint(triRadius * 2, triHeight), QPoint(triRadius, 0)})); - triangle.closeSubpath(); - - enum - { - ReadUsage, - WriteUsage, - ReadWriteUsage, - ClearUsage, - BarrierUsage, - - HistoryPassed, - HistoryFailed, - - UsageCount, - }; - - const QColor colors[UsageCount] = { - // read - QColor(Qt::red), - // write - QColor(Qt::green), - // read/write - QColor(Qt::yellow), - // clear - QColor(Qt::blue), - // barrier - QColor(Qt::magenta), - - // pass - QColor(Qt::green), - // fail - QColor(Qt::red), - }; - - // draw the key - if(m_HistoryTarget.isEmpty()) - { - // advance past the first text to draw the key - highlightLabel.setLeft(highlightLabel.left() + fm.width(text)); - - text = lit(" Reads, "); - p.drawText(highlightLabel, text, to); - highlightLabel.setLeft(highlightLabel.left() + fm.width(text)); - - QPainterPath path = triangle.translated(aliasAlign(highlightLabel.topLeft())); - p.fillPath(path, colors[ReadUsage]); - p.drawPath(path); - highlightLabel.setLeft(highlightLabel.left() + triRadius * 2); - - text = lit(" Writes, "); - p.drawText(highlightLabel, text, to); - highlightLabel.setLeft(highlightLabel.left() + fm.width(text)); - - path = triangle.translated(aliasAlign(highlightLabel.topLeft())); - p.fillPath(path, colors[WriteUsage]); - p.drawPath(path); - highlightLabel.setLeft(highlightLabel.left() + triRadius * 2); - - text = lit(" Read/Write, "); - p.drawText(highlightLabel, text, to); - highlightLabel.setLeft(highlightLabel.left() + fm.width(text)); - - path = triangle.translated(aliasAlign(highlightLabel.topLeft())); - p.fillPath(path, colors[ReadWriteUsage]); - p.drawPath(path); - highlightLabel.setLeft(highlightLabel.left() + triRadius * 2); - - if(m_Ctx.CurPipelineState().SupportsBarriers()) - { - text = lit(" Barriers, "); - p.drawText(highlightLabel, text, to); - highlightLabel.setLeft(highlightLabel.left() + fm.width(text)); - - path = triangle.translated(aliasAlign(highlightLabel.topLeft())); - p.fillPath(path, colors[BarrierUsage]); - p.drawPath(path); - highlightLabel.setLeft(highlightLabel.left() + triRadius * 2); - } - - text = lit(" and Clears "); - p.drawText(highlightLabel, text, to); - highlightLabel.setLeft(highlightLabel.left() + fm.width(text)); - - path = triangle.translated(aliasAlign(highlightLabel.topLeft())); - p.fillPath(path, colors[ClearUsage]); - p.drawPath(path); - highlightLabel.setLeft(highlightLabel.left() + triRadius * 2); - } - - QPainterPath paths[UsageCount]; - - QRectF pipsRect = m_highlightingRect.marginsRemoved(uniformMargins(margin)); - - pipsRect.setX(pipsRect.x() + margin + m_titleWidth); - pipsRect.setHeight(triHeight + margin); - pipsRect.moveBottom(m_highlightingRect.bottom()); - - p.setClipRect(pipsRect); - - if(!m_HistoryEvents.isEmpty()) - { - for(const PixelModification &mod : m_HistoryEvents) - { - QPointF pos; - - pos.setX(offsetOf(mod.eventID) + m_eidWidth / 2 - triRadius); - pos.setY(pipsRect.y()); - - QPainterPath path = triangle.translated(aliasAlign(pos)); - - if(mod.passed()) - paths[HistoryPassed] = paths[HistoryPassed].united(path); - else - paths[HistoryFailed] = paths[HistoryFailed].united(path); - } - } - else - { - for(const EventUsage &use : m_UsageEvents) - { - QPointF pos; - - pos.setX(offsetOf(use.eventID) + m_eidWidth / 2 - triRadius); - pos.setY(pipsRect.y()); - - QPainterPath path = triangle.translated(aliasAlign(pos)); - - if(((int)use.usage >= (int)ResourceUsage::VS_RWResource && - (int)use.usage <= (int)ResourceUsage::All_RWResource) || - use.usage == ResourceUsage::GenMips || use.usage == ResourceUsage::Copy || - use.usage == ResourceUsage::Resolve) - { - paths[ReadWriteUsage] = paths[ReadWriteUsage].united(path); - } - else if(use.usage == ResourceUsage::StreamOut || use.usage == ResourceUsage::ResolveDst || - use.usage == ResourceUsage::ColorTarget || use.usage == ResourceUsage::CopyDst) - { - paths[WriteUsage] = paths[WriteUsage].united(path); - } - else if(use.usage == ResourceUsage::Clear) - { - paths[ClearUsage] = paths[ClearUsage].united(path); - } - else if(use.usage == ResourceUsage::Barrier) - { - paths[BarrierUsage] = paths[BarrierUsage].united(path); - } - else - { - paths[ReadUsage] = paths[ReadUsage].united(path); - } - } - } - - for(int i = 0; i < UsageCount; i++) - { - if(!paths[i].isEmpty()) - { - p.drawPath(paths[i]); - p.fillPath(paths[i], colors[i]); - } - } - } - else - { - QRectF highlightLabel = m_highlightingRect; - highlightLabel = highlightLabel.marginsRemoved(uniformMargins(margin)); - - highlightLabel.setX(highlightLabel.x() + margin); - - p.drawText(highlightLabel, tr("No resource selected for highlighting."), to); - } -} - -TimelineBar::Marker *TimelineBar::findMarker(QVector &markers, QRectF markerRect, QPointF pos) -{ - QFontMetrics fm(Formatter::PreferredFont()); - - for(Marker &m : markers) - { - QRectF r = markerRect; - r.setLeft(qMax(m_markerRect.left() + borderWidth * 2, offsetOf(m.eidStart))); - r.setRight(qMin(m_markerRect.right() - borderWidth, offsetOf(m.eidEnd + 1))); - r.setHeight(fm.height() + borderWidth * 2); - - if(r.width() <= borderWidth * 2) - continue; - - if(r.contains(pos)) - { - return &m; - } - - if(!m.children.isEmpty() && m.expanded) - { - QRectF childRect = r; - childRect.setTop(r.bottom() + borderWidth * 2); - childRect.setBottom(markerRect.bottom()); - - Marker *res = findMarker(m.children, childRect, pos); - - if(res) - return res; - } - } - - return NULL; -} - -void TimelineBar::paintMarkers(QPainter &p, const QVector &markers, - const QVector &draws, QRectF markerRect) -{ - if(markers.isEmpty() && draws.isEmpty()) - return; - - QTextOption to; - - to.setWrapMode(QTextOption::NoWrap); - to.setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - - QFontMetrics fm(Formatter::PreferredFont()); - - // store a reference of what a completely elided string looks like - QString tooshort = fm.elidedText(lit("asd"), Qt::ElideRight, fm.height()); - - for(const Marker &m : markers) - { - QRectF r = markerRect; - r.setLeft(qMax(m_dataArea.left() + borderWidth * 3, offsetOf(m.eidStart))); - r.setRight(qMin(m_dataArea.right() - borderWidth, offsetOf(m.eidEnd + 1))); - r.setHeight(fm.height() + borderWidth * 2); - - if(r.width() <= borderWidth * 2) - continue; - - QColor backColor = m.color; - if(r.contains(m_lastPos)) - backColor.setAlpha(150); - - p.setPen(QPen(palette().brush(QPalette::Text), 1.0)); - p.fillRect(r, QBrush(backColor)); - p.drawRect(r); - - p.setPen(QPen(QBrush(contrastingColor(backColor, palette().color(QPalette::Text))), 1.0)); - - r.setLeft(r.left() + margin); - - int plusWidth = fm.width(QLatin1Char('+')); - if(r.width() > plusWidth) - { - QRectF plusRect = r; - plusRect.setWidth(plusWidth); - - QTextOption plusOption = to; - plusOption.setAlignment(Qt::AlignCenter | Qt::AlignVCenter); - - p.drawText(plusRect, m.expanded ? lit("-") : lit("+"), plusOption); - - r.setLeft(r.left() + plusWidth + margin); - } - - QString elided = fm.elidedText(m.name, Qt::ElideRight, r.width()); - - // if everything was elided, just omit the title entirely - if(elided == tooshort) - elided = QString(); - - QRectF textRect = r; - r.setLeft(qRound(r.left() + margin)); - - p.drawText(r, elided, to); - - if(m.expanded) - { - QRectF childRect = r; - childRect.setTop(r.bottom() + borderWidth * 2); - childRect.setBottom(markerRect.bottom()); - - paintMarkers(p, m.children, m.draws, childRect); - } - } - - p.setRenderHint(QPainter::Antialiasing); - - for(uint32_t d : draws) - { - QRectF r = markerRect; - r.setLeft(qMax(m_dataArea.left() + borderWidth * 3, offsetOf(d))); - r.setRight(qMin(m_dataArea.right() - borderWidth, offsetOf(d + 1))); - r.setHeight(fm.height() + borderWidth * 2); - - QPainterPath path; - path.addRoundedRect(r, 5, 5); - - p.setPen(QPen(palette().brush(QPalette::Text), 1.0)); - p.fillPath(path, Qt::blue); - p.drawPath(path); - } - - p.setRenderHint(QPainter::Antialiasing, false); -} - -uint32_t TimelineBar::eventAt(qreal x) -{ - if(m_Draws.isEmpty()) - return 0; - - // clamp to the visible viewport - x = qBound(m_eidAxisRect.left(), x, m_eidAxisRect.right()); - - // do the reverse of offsetOf() - first make the x relative to the root - x -= m_pan + m_eidAxisRect.left(); - - // multiply up to get a floating point 'steps' - qreal steps = x / m_eidAxisLabelWidth; - - // finally convert to EID and clamp - uint32_t maxEID = m_Draws.back(); - return qMin(maxEID, uint32_t(steps * m_eidAxisLabelStep)); -} - -qreal TimelineBar::offsetOf(uint32_t eid) -{ - int steps = eid / m_eidAxisLabelStep; - - qreal fractionalPart = qreal(eid % m_eidAxisLabelStep) / qreal(m_eidAxisLabelStep); - - return m_eidAxisRect.left() + m_pan + steps * m_eidAxisLabelWidth + - fractionalPart * m_eidAxisLabelWidth; -} - -uint32_t TimelineBar::processDraws(QVector &markers, QVector &draws, - const rdctype::array &curDraws) -{ - uint32_t maxEID = 0; - - for(const DrawcallDescription &d : curDraws) - { - if(d.children.count > 0) - { - markers.push_back(Marker()); - Marker &m = markers.back(); - - m.name = ToQStr(d.name); - m.eidStart = d.eventID; - m.eidEnd = processDraws(m.children, m.draws, d.children); - - maxEID = qMax(maxEID, m.eidEnd); - - if(d.markerColor[3] > 0.0f) - { - m.color = QColor::fromRgb( - qRgb(d.markerColor[0] * 255.0f, d.markerColor[1] * 255.0f, d.markerColor[2] * 255.0f)); - } - else - { - m.color = QColor(Qt::gray); - } - } - else - { - if((d.flags & (DrawFlags::SetMarker | DrawFlags::APICalls)) != DrawFlags::SetMarker) - { - m_Draws.push_back(d.eventID); - draws.push_back(d.eventID); - } - } - - maxEID = qMax(maxEID, d.eventID); - } - - return maxEID; -} diff --git a/qrenderdoc/Windows/TimelineBar.h b/qrenderdoc/Windows/TimelineBar.h deleted file mode 100644 index 11566b3c4..000000000 --- a/qrenderdoc/Windows/TimelineBar.h +++ /dev/null @@ -1,115 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 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. - ******************************************************************************/ - -#pragma once - -#include -#include "Code/CaptureContext.h" - -class TimelineBar : public QAbstractScrollArea, public ITimelineBar, public ILogViewer -{ - Q_OBJECT - -public: - explicit TimelineBar(ICaptureContext &ctx, QWidget *parent = 0); - ~TimelineBar(); - - QSize minimumSizeHint() const override; - - // IStatisticsViewer - QWidget *Widget() override { return this; } - void HighlightResourceUsage(ResourceId id) override; - void HighlightHistory(ResourceId id, const QList &history) override; - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; - void OnSelectedEventChanged(uint32_t eventID) override {} - void OnEventChanged(uint32_t eventID) override; - -protected: - void mousePressEvent(QMouseEvent *e) override; - void mouseReleaseEvent(QMouseEvent *e) override; - void mouseMoveEvent(QMouseEvent *e) override; - void wheelEvent(QWheelEvent *e) override; - void leaveEvent(QEvent *e) override; - void paintEvent(QPaintEvent *e) override; - void resizeEvent(QResizeEvent *e) override; - -private: - ICaptureContext &m_Ctx; - - struct Marker - { - uint32_t eidStart = 0, eidEnd = 0; - - QString name; - QColor color; - bool expanded = false; - - QVector children; - QVector draws; - }; - - QVector m_RootMarkers; - QVector m_RootDraws; - QVector m_Draws; - - QString m_HistoryTarget; - QList m_HistoryEvents; - - QString m_UsageTarget; - QList m_UsageEvents; - - const qreal margin = 2.0; - const qreal borderWidth = 1.0; - const QString eidAxisTitle = lit("EID:"); - const int dataBarHeight = 18; - const int highlightingExtra = 12; - - int m_eidAxisLabelStep = 0; - qreal m_eidAxisLabelTextWidth = 0; - qreal m_eidAxisLabelWidth = 0; - qreal m_eidWidth = 0; - - QRectF m_area; - QRectF m_dataArea; - QRectF m_eidAxisRect; - QRectF m_markerRect; - QRectF m_highlightingRect; - qreal m_titleWidth = 0; - - qreal m_zoom = 1.0; - qreal m_pan = 0.0; - QPointF m_lastPos; - - void layout(); - - uint32_t eventAt(qreal x); - qreal offsetOf(uint32_t eid); - uint32_t processDraws(QVector &markers, QVector &draws, - const rdctype::array &curDraws); - void paintMarkers(QPainter &p, const QVector &markers, const QVector &draws, - QRectF markerRect); - Marker *findMarker(QVector &markers, QRectF markerRect, QPointF pos); -}; diff --git a/qrenderdoc/qrenderdoc.pro b/qrenderdoc/qrenderdoc.pro deleted file mode 100644 index 5a8123b6d..000000000 --- a/qrenderdoc/qrenderdoc.pro +++ /dev/null @@ -1,354 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2015-03-18T20:10:50 -# -#------------------------------------------------- - -QT += core gui widgets svg - -CONFIG += silent - -lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5") - -equals(QT_MAJOR_VERSION, 5): lessThan(QT_MINOR_VERSION, 6): error("requires Qt 5.6") - -TARGET = qrenderdoc -TEMPLATE = app - -# include path for core renderdoc API -INCLUDEPATH += $$_PRO_FILE_PWD_/../renderdoc/api/replay - -# Allow includes relative to the root -INCLUDEPATH += $$_PRO_FILE_PWD_/ - -# For ToolWindowManager -INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/toolwindowmanager -# For FlowLayout -INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/flowlayout -# For Scintilla -INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/scintilla/include/qt -INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/scintilla/include - -# Disable conversions to/from const char * in QString -DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII - -# Different output folders per platform -win32 { - - RC_INCLUDEPATH = $$_PRO_FILE_PWD_/../renderdoc/api/replay - RC_FILE = Resources/qrenderdoc.rc - - # generate pdb files even in release - QMAKE_LFLAGS_RELEASE+=/MAP - QMAKE_CFLAGS_RELEASE += /Zi - QMAKE_LFLAGS_RELEASE +=/debug /opt:ref - - !contains(QMAKE_TARGET.arch, x86_64) { - Debug:DESTDIR = $$_PRO_FILE_PWD_/../Win32/Development - Release:DESTDIR = $$_PRO_FILE_PWD_/../Win32/Release - } else { - Debug:DESTDIR = $$_PRO_FILE_PWD_/../x64/Development - Release:DESTDIR = $$_PRO_FILE_PWD_/../x64/Release - } - - # Run SWIG here, since normally we run it from VS - swig.name = SWIG ${QMAKE_FILE_IN} - swig.input = SWIGSOURCES - swig.output = ${QMAKE_FILE_BASE}_python.cxx - swig.commands = $$_PRO_FILE_PWD_/3rdparty/swig/swig.exe -v -Wextra -Werror -O -c++ -python -modern -modernargs -enumclass -fastunpack -py3 -builtin -I$$_PRO_FILE_PWD_ -I$$_PRO_FILE_PWD_/../renderdoc/api/replay -outdir . -o ${QMAKE_FILE_BASE}_python.cxx ${QMAKE_FILE_IN} - swig.CONFIG += target_predeps - swig.variable_out = GENERATED_SOURCES - silent:swig.commands = @echo SWIG ${QMAKE_FILE_IN} && $$swig.commands - QMAKE_EXTRA_COMPILERS += swig - - # windows only qrc file with qt.conf - RESOURCES += Resources/qtconf.qrc - - SWIGSOURCES += Code/pyrenderdoc/renderdoc.i - SWIGSOURCES += Code/pyrenderdoc/qrenderdoc.i - - # Embed renderdoc.py and qrenderdoc.py - RC_DEFINES = RENDERDOC_PY_PATH=renderdoc.py - RC_DEFINES += QRENDERDOC_PY_PATH=qrenderdoc.py - - # Include and link against python - INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/python/include - !contains(QMAKE_TARGET.arch, x86_64) { - LIBS += $$_PRO_FILE_PWD_/3rdparty/python/Win32/python36.lib - } else { - LIBS += $$_PRO_FILE_PWD_/3rdparty/python/x64/python36.lib - } - - # Include and link against PySide2 - DEFINES += PYSIDE2_ENABLED=1 - INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/pyside/include/shiboken2 - INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/pyside/include/PySide2 - INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/pyside/include/PySide2/QtCore - INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/pyside/include/PySide2/QtGui - INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/pyside/include/PySide2/QtWidgets - !contains(QMAKE_TARGET.arch, x86_64) { - LIBS += $$_PRO_FILE_PWD_/3rdparty/pyside/Win32/shiboken2.lib - } else { - LIBS += $$_PRO_FILE_PWD_/3rdparty/pyside/x64/shiboken2.lib - } - - # Link against the core library - LIBS += $$DESTDIR/renderdoc.lib - - QMAKE_CXXFLAGS_WARN_ON -= -w34100 - DEFINES += RENDERDOC_PLATFORM_WIN32 - -} else { - isEmpty(CMAKE_DIR) { - error("When run from outside CMake, please set the Build Environment Variable CMAKE_DIR to point to your CMake build root. In Qt Creator add CMAKE_DIR=/path/to/renderdoc/build under 'Additional arguments' in the qmake Build Step. If running qmake directly, add CMAKE_DIR=/path/to/renderdoc/build/ to the command line.") - } - - DESTDIR=$$CMAKE_DIR/bin - - include($$CMAKE_DIR/qrenderdoc/qrenderdoc_cmake.pri) - - # Temp files into .obj - MOC_DIR = .obj - UI_DIR = .obj - RCC_DIR = .obj - OBJECTS_DIR = .obj - - # Link against the core library - LIBS += -lrenderdoc - QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN\',-rpath,\'\$$ORIGIN/../lib\'' - - # Add the SWIG files that were generated in cmake - SOURCES += $$CMAKE_DIR/qrenderdoc/renderdoc_python.cxx - SOURCES += $$CMAKE_DIR/qrenderdoc/renderdoc.py.c - SOURCES += $$CMAKE_DIR/qrenderdoc/qrenderdoc_python.cxx - SOURCES += $$CMAKE_DIR/qrenderdoc/qrenderdoc.py.c - - CONFIG += warn_off - CONFIG += c++14 - QMAKE_CFLAGS_WARN_OFF -= -w - QMAKE_CXXFLAGS_WARN_OFF -= -w - - macx: { - DEFINES += RENDERDOC_PLATFORM_POSIX RENDERDOC_PLATFORM_APPLE - ICON = $$OSX_ICONFILE - - INFO_PLIST_PATH = $$shell_quote($$DESTDIR/$${TARGET}.app/Contents/Info.plist) - QMAKE_POST_LINK += $$_PRO_FILE_PWD_/../scripts/set_plist_version.sh $${RENDERDOC_VERSION}.0 $${INFO_PLIST_PATH} - } else { - QT += x11extras - DEFINES += RENDERDOC_PLATFORM_POSIX RENDERDOC_PLATFORM_LINUX RENDERDOC_WINDOWING_XLIB RENDERDOC_WINDOWING_XCB - QMAKE_LFLAGS += '-Wl,--no-as-needed' - - contains(QMAKE_CXXFLAGS, "-DRENDERDOC_SUPPORT_GL") { - # Link against GL - LIBS += -lGL - } - - contains(QMAKE_CXXFLAGS, "-DRENDERDOC_SUPPORT_GLES") { - # Link against EGL - LIBS += -lEGL - } - } -} - -# Add our sources first so Qt Creator adds new files here - -SOURCES += Code/qrenderdoc.cpp \ - Code/qprocessinfo.cpp \ - Code/ReplayManager.cpp \ - Code/CaptureContext.cpp \ - Code/ScintillaSyntax.cpp \ - Code/QRDUtils.cpp \ - Code/FormatElement.cpp \ - Code/Resources.cpp \ - Code/pyrenderdoc/PythonContext.cpp \ - Code/Interface/QRDInterface.cpp \ - Code/Interface/CommonPipelineState.cpp \ - Code/Interface/PersistantConfig.cpp \ - Code/Interface/RemoteHost.cpp \ - Styles/RDStyle/RDStyle.cpp \ - Styles/RDTweakedNativeStyle/RDTweakedNativeStyle.cpp \ - Windows/Dialogs/AboutDialog.cpp \ - Windows/MainWindow.cpp \ - Windows/EventBrowser.cpp \ - Windows/TextureViewer.cpp \ - Widgets/Extended/RDLineEdit.cpp \ - Widgets/Extended/RDTextEdit.cpp \ - Widgets/Extended/RDLabel.cpp \ - Widgets/Extended/RDHeaderView.cpp \ - Widgets/Extended/RDToolButton.cpp \ - Widgets/Extended/RDDoubleSpinBox.cpp \ - Widgets/Extended/RDListView.cpp \ - Widgets/CustomPaintWidget.cpp \ - Widgets/ResourcePreview.cpp \ - Widgets/ThumbnailStrip.cpp \ - Widgets/TextureGoto.cpp \ - Widgets/RangeHistogram.cpp \ - Windows/Dialogs/TextureSaveDialog.cpp \ - Windows/Dialogs/CaptureDialog.cpp \ - Windows/Dialogs/LiveCapture.cpp \ - Widgets/Extended/RDListWidget.cpp \ - Windows/APIInspector.cpp \ - Windows/PipelineState/PipelineStateViewer.cpp \ - Windows/PipelineState/VulkanPipelineStateViewer.cpp \ - Windows/PipelineState/D3D11PipelineStateViewer.cpp \ - Windows/PipelineState/D3D12PipelineStateViewer.cpp \ - Windows/PipelineState/GLPipelineStateViewer.cpp \ - Widgets/Extended/RDTreeView.cpp \ - Widgets/Extended/RDTreeWidget.cpp \ - Windows/ConstantBufferPreviewer.cpp \ - Widgets/BufferFormatSpecifier.cpp \ - Windows/BufferViewer.cpp \ - Widgets/Extended/RDTableView.cpp \ - Windows/DebugMessageView.cpp \ - Windows/StatisticsViewer.cpp \ - Windows/TimelineBar.cpp \ - Windows/Dialogs/SettingsDialog.cpp \ - Windows/Dialogs/OrderedListEditor.cpp \ - Widgets/Extended/RDTableWidget.cpp \ - Windows/Dialogs/SuggestRemoteDialog.cpp \ - Windows/Dialogs/VirtualFileDialog.cpp \ - Windows/Dialogs/RemoteManager.cpp \ - Windows/PixelHistoryView.cpp \ - Widgets/PipelineFlowChart.cpp \ - Windows/Dialogs/EnvironmentEditor.cpp \ - Widgets/FindReplace.cpp \ - Widgets/Extended/RDSplitter.cpp \ - Windows/Dialogs/TipsDialog.cpp \ - Windows/PythonShell.cpp -HEADERS += Code/CaptureContext.h \ - Code/qprocessinfo.h \ - Code/ReplayManager.h \ - Code/ScintillaSyntax.h \ - Code/QRDUtils.h \ - Code/Resources.h \ - Code/pyrenderdoc/PythonContext.h \ - Code/pyrenderdoc/pyconversion.h \ - Code/pyrenderdoc/document_check.h \ - Code/Interface/QRDInterface.h \ - Code/Interface/CommonPipelineState.h \ - Code/Interface/PersistantConfig.h \ - Code/Interface/RemoteHost.h \ - Styles/RDStyle/RDStyle.h \ - Styles/RDTweakedNativeStyle/RDTweakedNativeStyle.h \ - Windows/Dialogs/AboutDialog.h \ - Windows/MainWindow.h \ - Windows/EventBrowser.h \ - Windows/TextureViewer.h \ - Widgets/Extended/RDLineEdit.h \ - Widgets/Extended/RDTextEdit.h \ - Widgets/Extended/RDLabel.h \ - Widgets/Extended/RDHeaderView.h \ - Widgets/Extended/RDToolButton.h \ - Widgets/Extended/RDDoubleSpinBox.h \ - Widgets/Extended/RDListView.h \ - Widgets/CustomPaintWidget.h \ - Widgets/ResourcePreview.h \ - Widgets/ThumbnailStrip.h \ - Widgets/TextureGoto.h \ - Widgets/RangeHistogram.h \ - Windows/Dialogs/TextureSaveDialog.h \ - Windows/Dialogs/CaptureDialog.h \ - Windows/Dialogs/LiveCapture.h \ - Widgets/Extended/RDListWidget.h \ - Windows/APIInspector.h \ - Windows/PipelineState/PipelineStateViewer.h \ - Windows/PipelineState/VulkanPipelineStateViewer.h \ - Windows/PipelineState/D3D11PipelineStateViewer.h \ - Windows/PipelineState/D3D12PipelineStateViewer.h \ - Windows/PipelineState/GLPipelineStateViewer.h \ - Widgets/Extended/RDTreeView.h \ - Widgets/Extended/RDTreeWidget.h \ - Windows/ConstantBufferPreviewer.h \ - Widgets/BufferFormatSpecifier.h \ - Windows/BufferViewer.h \ - Widgets/Extended/RDTableView.h \ - Windows/DebugMessageView.h \ - Windows/StatisticsViewer.h \ - Windows/TimelineBar.h \ - Windows/Dialogs/SettingsDialog.h \ - Windows/Dialogs/OrderedListEditor.h \ - Widgets/Extended/RDTableWidget.h \ - Windows/Dialogs/SuggestRemoteDialog.h \ - Windows/Dialogs/VirtualFileDialog.h \ - Windows/Dialogs/RemoteManager.h \ - Windows/PixelHistoryView.h \ - Widgets/PipelineFlowChart.h \ - Windows/Dialogs/EnvironmentEditor.h \ - Widgets/FindReplace.h \ - Widgets/Extended/RDSplitter.h \ - Windows/Dialogs/TipsDialog.h \ - Windows/PythonShell.h -FORMS += Windows/Dialogs/AboutDialog.ui \ - Windows/MainWindow.ui \ - Windows/EventBrowser.ui \ - Windows/TextureViewer.ui \ - Widgets/ResourcePreview.ui \ - Widgets/ThumbnailStrip.ui \ - Windows/Dialogs/TextureSaveDialog.ui \ - Windows/Dialogs/CaptureDialog.ui \ - Windows/Dialogs/LiveCapture.ui \ - Windows/APIInspector.ui \ - Windows/PipelineState/PipelineStateViewer.ui \ - Windows/PipelineState/VulkanPipelineStateViewer.ui \ - Windows/PipelineState/D3D11PipelineStateViewer.ui \ - Windows/PipelineState/D3D12PipelineStateViewer.ui \ - Windows/PipelineState/GLPipelineStateViewer.ui \ - Windows/ConstantBufferPreviewer.ui \ - Widgets/BufferFormatSpecifier.ui \ - Windows/BufferViewer.ui \ - Windows/ShaderViewer.ui \ - Windows/DebugMessageView.ui \ - Windows/StatisticsViewer.ui \ - Windows/Dialogs/SettingsDialog.ui \ - Windows/Dialogs/OrderedListEditor.ui \ - Windows/Dialogs/SuggestRemoteDialog.ui \ - Windows/Dialogs/VirtualFileDialog.ui \ - Windows/Dialogs/RemoteManager.ui \ - Windows/PixelHistoryView.ui \ - Windows/Dialogs/EnvironmentEditor.ui \ - Widgets/FindReplace.ui \ - Windows/Dialogs/TipsDialog.ui \ - Windows/PythonShell.ui - -RESOURCES += Resources/resources.qrc - -# Add ToolWindowManager - -SOURCES += 3rdparty/toolwindowmanager/ToolWindowManager.cpp \ - 3rdparty/toolwindowmanager/ToolWindowManagerArea.cpp \ - 3rdparty/toolwindowmanager/ToolWindowManagerSplitter.cpp \ - 3rdparty/toolwindowmanager/ToolWindowManagerTabBar.cpp \ - 3rdparty/toolwindowmanager/ToolWindowManagerWrapper.cpp - -HEADERS += 3rdparty/toolwindowmanager/ToolWindowManager.h \ - 3rdparty/toolwindowmanager/ToolWindowManagerArea.h \ - 3rdparty/toolwindowmanager/ToolWindowManagerSplitter.h \ - 3rdparty/toolwindowmanager/ToolWindowManagerTabBar.h \ - 3rdparty/toolwindowmanager/ToolWindowManagerWrapper.h - -# Add FlowLayout - -SOURCES += 3rdparty/flowlayout/FlowLayout.cpp -HEADERS += 3rdparty/flowlayout/FlowLayout.h - -# Add Scintilla last as it has extra search paths - -# Needed for building -DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 SCI_LEXER=1 -INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/scintilla/src -INCLUDEPATH += $$_PRO_FILE_PWD_/3rdparty/scintilla/lexlib - -SOURCES += $$_PRO_FILE_PWD_/3rdparty/scintilla/lexlib/*.cxx \ - $$_PRO_FILE_PWD_/3rdparty/scintilla/lexers/*.cxx \ - $$_PRO_FILE_PWD_/3rdparty/scintilla/src/*.cxx \ - $$_PRO_FILE_PWD_/3rdparty/scintilla/qt/ScintillaEdit/*.cpp \ - $$_PRO_FILE_PWD_/3rdparty/scintilla/qt/ScintillaEditBase/*.cpp \ - Windows/ShaderViewer.cpp - -HEADERS += $$_PRO_FILE_PWD_/3rdparty/scintilla/lexlib/*.h \ - $$_PRO_FILE_PWD_/3rdparty/scintilla/src/*.h \ - $$_PRO_FILE_PWD_/3rdparty/scintilla/qt/ScintillaEdit/*.h \ - $$_PRO_FILE_PWD_/3rdparty/scintilla/qt/ScintillaEditBase/*.h \ - Windows/ShaderViewer.h - diff --git a/qrenderdoc/qrenderdoc_local.vcxproj b/qrenderdoc/qrenderdoc_local.vcxproj deleted file mode 100644 index 99104b144..000000000 --- a/qrenderdoc/qrenderdoc_local.vcxproj +++ /dev/null @@ -1,1636 +0,0 @@ - - - - - Development - Win32 - - - Release - Win32 - - - Release - x64 - - - Development - x64 - - - QTDebug - Win32 - - - QTDebug - x64 - - - - {A14A6AE5-02B1-35FE-BE59-B3E7C273B40B} - qrenderdoc - Qt4VSv1.0 - 8.1 - qrenderdoc - - - - v140 - $(SolutionDir)$(Platform)\$(Configuration)\ - false - NotSet - Application - qrenderdoc - qrenderdoc - true - $(Platform)\$(Configuration)\obj\$(ProjectName)\ - - - $(SolutionDir)$(Platform)\Development\ - $(Platform)\Development\obj\$(ProjectName)\ - - - $(SolutionDir)$(SolutionRelativeIntDir) - $(IntDir) - $(OutputDirectory)\ - - - false - true - - - - - - - $(OutputDirectory) - - - - WIN64;%(PreprocessorDefinitions) - - - WIN64;%(PreprocessorDefinitions) - - - - - RELEASE;QT_MESSAGELOGCONTEXT;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) - - - - - MultiThreadedDLL - true - true - false - false - ProgramDatabase - true - true - $(ProjectDir);$(IntDir)generated\;$(SolutionDir)\renderdoc\api\replay;3rdparty\python\include;3rdparty\pyside\include\PySide2;3rdparty\pyside\include\PySide2\QtCore;3rdparty\pyside\include\PySide2\QtGui;3rdparty\pyside\include\PySide2\QtWidgets;3rdparty\pyside\include\shiboken2;3rdparty\qt\$(Platform)\include;3rdparty\qt\$(Platform)\include\QtWidgets;3rdparty\qt\$(Platform)\include\QtGui;3rdparty\qt\$(Platform)\include\QtCore;3rdparty\qt\$(Platform)\include\QtSvg;%(AdditionalIncludeDirectories) - /Zc:strictStrings /Zc:throwingNew %(AdditionalOptions) - _WINDOWS;UNICODE;WIN32;WIN64;RENDERDOC_PLATFORM_WIN32;PYSIDE2_ENABLED=1;SCINTILLA_QT=1;MAKING_LIBRARY=1;SCI_LEXER=1;QT_NO_CAST_FROM_ASCII;QT_NO_CAST_TO_ASCII;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_SVG_LIB;%(PreprocessorDefinitions) - Level4 - true - 4100;4127;4189;4714;4718;4996;%(DisableSpecificWarnings) - Use - precompiled.h - precompiled.h - - - Windows - shiboken2.lib;python36.lib;qtmain.lib;Qt5Widgets.lib;Qt5Gui.lib;Qt5Core.lib;Qt5Svg.lib;shell32.lib - 3rdparty\pyside\$(Platform);3rdparty\python\$(Platform);3rdparty\qt\$(Platform)\lib;%(AdditionalLibraryDirectories) - true - true - true - true - true - - - true - - - Unsigned - None - 0 - - - _WINDOWS;UNICODE;WIN32;RENDERDOC_PLATFORM_WIN32;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_SVG_LIB;%(PreprocessorDefinitions) - $(SolutionDir)\renderdoc\api\replay - - - - - Disabled - - - - - Disabled - - - - - MaxSpeed - Default - true - true - - - true - true - - - - - MultiThreadedDebugDLL - - - shiboken2.lib;python36.lib;qtmaind.lib;Qt5Widgetsd.lib;Qt5Guid.lib;Qt5Cored.lib;Qt5Svgd.lib;shell32.lib - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - 4458;%(DisableSpecificWarnings) - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - NotUsing - - - - - - - - - - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - - - 3rdparty\scintilla\include;3rdparty\scintilla\include\qt;3rdparty\scintilla\src;3rdparty\scintilla\lexlib;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - - - - - - 4101;4456;4459;%(DisableSpecificWarnings) - - - 4101;4456;4459;%(DisableSpecificWarnings) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NotUsing - - - - - - - - - - - - - - - - - - - - NotUsing - - - - - NotUsing - - - - - NotUsing - - - - - NotUsing - - - - - NotUsing - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp" - MOC %(Filename).h - $(IntDir)generated\moc_%(Filename).cpp - - - - - Document - %(Fullpath);pyconversion.i;document_check.h;$(SolutionDir)renderdoc\api\replay\basic_types.h;$(SolutionDir)renderdoc\api\replay\capture_options.h;$(SolutionDir)renderdoc\api\replay\control_types.h;$(SolutionDir)renderdoc\api\replay\d3d11_pipestate.h;$(SolutionDir)renderdoc\api\replay\d3d12_pipestate.h;$(SolutionDir)renderdoc\api\replay\data_types.h;$(SolutionDir)renderdoc\api\replay\gl_pipestate.h;$(SolutionDir)renderdoc\api\replay\renderdoc_replay.h;$(SolutionDir)renderdoc\api\replay\replay_enums.h;$(SolutionDir)renderdoc\api\replay\shader_types.h;$(SolutionDir)renderdoc\api\replay\vk_pipestate.h;%(AdditionalInputs) - "$(ProjectDir)3rdparty\swig\swig.exe" -v -Wextra -Werror -O -c++ -python -modern -modernargs -enumclass -fastunpack -py3 -builtin -I"$(SolutionDir)renderdoc\api\replay" -outdir "$(IntDir)generated" -o "$(IntDir)generated\%(Filename)_python.cxx" "%(FullPath)" - Compiling SWIG interface - $(IntDir)generated\%(Filename).py;$(IntDir)generated\%(Filename)_python.cxx;%(Outputs) - false - - - Document - %(Fullpath);Code\Interface\QRDInterface.h;Code\Interface\CommonPipelineState.h;Code\Interface\PersistantConfig.h;Code\Interface\RemoteHost.h;$(IntDir)generated\renderdoc.py;%(AdditionalInputs) - "$(ProjectDir)3rdparty\swig\swig.exe" -v -Wextra -Werror -O -c++ -python -modern -modernargs -enumclass -fastunpack -py3 -builtin -I"$(SolutionDir)renderdoc\api\replay" -I"$(ProjectDir)." -outdir "$(IntDir)generated" -o "$(IntDir)generated\%(Filename)_python.cxx" "%(FullPath)" - Compiling SWIG interface - $(IntDir)generated\%(Filename).py;$(IntDir)generated\%(Filename)_python.cxx;%(Outputs) - false - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - Designer - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - Designer - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - - - %(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h" - UIC %(Filename).ui - $(IntDir)generated\ui_%(Filename).h - Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Resources\resources.qrc;$(ProjectDir)3rdparty\qt\$(Platform)\bin\rcc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\rcc.exe" -name resources Resources\resources.qrc -o "$(IntDir)generated\qrc_resources.cpp" - RCC resources.qrc - $(IntDir)generated\qrc_resources.cpp - - - Resources\qtconf.qrc;$(ProjectDir)3rdparty\qt\$(Platform)\bin\rcc.exe;%(AdditionalInputs) - "$(ProjectDir)3rdparty\qt\$(Platform)\bin\rcc.exe" -name qtconf Resources\qtconf.qrc -o "$(IntDir)generated\qrc_qtconf.cpp" - RCC qtconf.qrc - $(IntDir)generated\qrc_qtconf.cpp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - python36.zip - PreserveNewest - false - - - _ctypes.pyd - PreserveNewest - false - - - python36.dll - PreserveNewest - false - - - shiboken2.dll - PreserveNewest - false - - - PySide2\pyside2.dll - PreserveNewest - false - - - PySide2\__init__.py - PreserveNewest - false - - - PySide2\_utils.py - PreserveNewest - false - - - PySide2\QtCore.pyd - PreserveNewest - false - - - PySide2\QtGui.pyd - PreserveNewest - false - - - PySide2\QtWidgets.pyd - PreserveNewest - false - - - qtplugins\platforms\qwindows.dll - PreserveNewest - false - - - qtplugins\imageformats\qsvg.dll - PreserveNewest - false - - - Qt5Core.dll - PreserveNewest - False - - - Qt5Gui.dll - PreserveNewest - false - - - Qt5Widgets.dll - PreserveNewest - false - - - Qt5Svg.dll - PreserveNewest - false - - - Qt5Network.dll - PreserveNewest - false - - - qtplugins\platforms\qwindowsd.dll - PreserveNewest - false - - - qtplugins\imageformats\qsvgd.dll - PreserveNewest - false - - - Qt5Cored.dll - PreserveNewest - False - - - Qt5Cored.dll - PreserveNewest - False - - - Qt5Guid.dll - PreserveNewest - false - - - Qt5Widgetsd.dll - PreserveNewest - false - - - Qt5Svgd.dll - PreserveNewest - false - - - Qt5Networkd.dll - PreserveNewest - false - - - - - {e2b46d67-90e2-40b6-9597-72930e7845e5} - - - - - RENDERDOC_PY_PATH=.\..\$(SolutionRelativeIntDir)\generated\renderdoc.py;QRENDERDOC_PY_PATH=.\..\$(SolutionRelativeIntDir)\generated\qrenderdoc.py;%(PreprocessorDefinitions) - - - - - \ No newline at end of file diff --git a/qrenderdoc/qrenderdoc_local.vcxproj.filters b/qrenderdoc/qrenderdoc_local.vcxproj.filters deleted file mode 100644 index 6c476fad5..000000000 --- a/qrenderdoc/qrenderdoc_local.vcxproj.filters +++ /dev/null @@ -1,1443 +0,0 @@ - - - - - {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} - - - {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} - - - {c6877252-7f18-4c63-a2f7-66b1913d8ada} - - - {476acc91-c8c7-4ba7-9835-c0b566f562dd} - - - {6c205a59-af2f-49ab-bcbf-e83799ce89a3} - - - {c820ead5-74a1-4010-86bb-d5d77b5d13fd} - - - {96c62ca7-39e7-4fca-a6a4-c8e1c3e2a324} - - - {c2e91ed4-8c04-4fdc-accf-8fed288f2cd8} - - - {897f728c-8a11-41c3-ba6f-75815d9e06db} - - - {06b18b38-7ec5-4195-8230-f5be6348ecfb} - - - {633cf7bf-24ec-4927-835b-f6e96e21c288} - - - {42a491e9-4e18-4220-8de2-e07b7cde26bc} - - - {7ba076e7-3417-4e91-be51-9e7f17a19c24} - - - {6c0de148-de6a-4ab3-91ad-fae4a5278c03} - - - {e0300f3d-d087-46c8-9a35-b9d709a212d8} - - - {bd9a022f-7925-4f17-acc3-8d4688b8c0d6} - - - {92b9dc0e-7bb4-402a-bd5e-799d5ccdaa36} - - - {2b0fab33-f1b9-4488-bc9c-f3b65b0e955c} - - - {3dcd3970-3ccb-448b-b596-93c1a272b0fd} - - - {28c1a078-8722-4949-bed4-a1bed6c26082} - - - {e7b5de50-ab5a-4a91-a53f-a524ea51641c} - - - {4a14bfec-662c-410a-8d94-dccf5ba6cb0b} - - - {7986f203-466f-4a74-93a2-6feeaec3b05b} - - - {4869e303-055c-4458-91d6-89ecc827f338} - - - {f74a424c-ce15-4da6-9af4-c6bcf62aa581} - - - {1e176174-0c57-44df-82b1-638ced184b72} - - - {c0be5204-4ee0-4948-87b4-cc957b6f8953} - - - - - 3rdparty\ToolWindowManager - - - 3rdparty\ToolWindowManager - - - 3rdparty\ToolWindowManager - - - 3rdparty\FlowLayout - - - Code - - - Widgets - - - Windows - - - Windows - - - Windows - - - Widgets - - - Widgets - - - Code - - - Widgets - - - Widgets - - - Widgets\Extended - - - Widgets\Extended - - - Widgets\Extended - - - Widgets\Extended - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Code - - - Code - - - Windows\Dialogs - - - Widgets\Extended - - - Windows - - - Windows\PipelineState - - - Windows\PipelineState - - - Windows\PipelineState - - - Windows\PipelineState - - - Windows\PipelineState - - - Widgets\Extended - - - Windows - - - Widgets - - - Windows - - - Widgets\Extended - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexers - - - 3rdparty\Scintilla\lexers - - - 3rdparty\Scintilla\lexers - - - 3rdparty\Scintilla\lexers - - - 3rdparty\Scintilla\lexers - - - 3rdparty\Scintilla\lexers - - - 3rdparty\Scintilla\lexers - - - 3rdparty\Scintilla\lexers - - - 3rdparty\Scintilla\qt\ScintillaEditBase - - - 3rdparty\Scintilla\qt\ScintillaEditBase - - - 3rdparty\Scintilla\qt\ScintillaEditBase - - - 3rdparty\Scintilla\qt\ScintillaEdit - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\qt\ScintillaEdit - - - Windows - - - Code - - - Windows\Dialogs - - - Windows\Dialogs - - - Widgets\Extended - - - Windows\Dialogs - - - Windows\Dialogs - - - Code - - - Windows - - - Windows - - - Windows\Dialogs - - - Windows - - - Widgets\Extended - - - Code - - - Widgets - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Windows\Dialogs - - - Widgets - - - Generated Files - - - Generated Files - - - Widgets\Extended - - - Code\pyrenderdoc - - - Generated Files - - - Generated Files - - - Code\Interface - - - Code\Interface - - - Code\Interface - - - Code\Interface - - - Code - - - Generated Files - - - Windows - - - Widgets\Extended - - - Generated Files - - - PCH - - - Widgets\Extended - - - Generated Files - - - Generated Files - - - 3rdparty\ToolWindowManager - - - 3rdparty\ToolWindowManager - - - Generated Files - - - Generated Files - - - Widgets\Extended - - - Generated Files - - - Windows - - - Generated Files - - - Styles\RDStyle - - - Generated Files - - - Generated Files - - - Styles\RDTweakedNativeStyle - - - - - 3rdparty\FlowLayout - - - Code - - - Code - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\lexlib - - - 3rdparty\Scintilla\include\qt - - - 3rdparty\Scintilla\include\qt - - - 3rdparty\Scintilla\include\qt - - - 3rdparty\Scintilla\include - - - 3rdparty\Scintilla\include - - - 3rdparty\Scintilla\include - - - 3rdparty\Scintilla\include - - - 3rdparty\Scintilla\include - - - 3rdparty\Scintilla\include - - - 3rdparty\Scintilla\qt\ScintillaEditBase - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - 3rdparty\Scintilla\src - - - Code - - - Resources - - - Code - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Generated Files - - - Code\Interface - - - Code\Interface - - - Code\Interface - - - Code\Interface - - - Code\pyrenderdoc - - - Code - - - Generated Files - - - PCH - - - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Resources\Files - - - Code\pyrenderdoc - - - Code\pyrenderdoc - - - - - Resources - - - - - Windows - - - Windows - - - Windows - - - Windows - - - Windows - - - Windows - - - Windows - - - Windows - - - Windows - - - Windows\PipelineState - - - Windows\PipelineState - - - Windows\PipelineState - - - Windows\PipelineState - - - Windows\PipelineState - - - Widgets - - - Widgets - - - Widgets - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Resources - - - Windows - - - Windows - - - Windows - - - Windows - - - Windows - - - Windows - - - Windows - - - Windows - - - Windows - - - Widgets\Extended - - - Widgets\Extended - - - Widgets\Extended - - - Widgets\Extended - - - Widgets\Extended - - - Widgets\Extended - - - Widgets\Extended - - - Widgets\Extended - - - Widgets - - - Widgets - - - Widgets - - - Widgets - - - Widgets - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\PipelineState - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows\PipelineState - - - Windows\PipelineState - - - Windows\PipelineState - - - Windows\PipelineState - - - Code - - - Widgets - - - 3rdparty\ToolWindowManager - - - 3rdparty\ToolWindowManager - - - 3rdparty\ToolWindowManager - - - 3rdparty\Scintilla\qt\ScintillaEdit - - - 3rdparty\Scintilla\qt\ScintillaEdit - - - 3rdparty\Scintilla\qt\ScintillaEditBase - - - 3rdparty\Scintilla\qt\ScintillaEditBase - - - Windows\Dialogs - - - Windows\Dialogs - - - Windows - - - Windows - - - Widgets\Extended - - - Widgets - - - Windows\Dialogs - - - Windows\Dialogs - - - Widgets - - - Widgets - - - Widgets\Extended - - - Code\pyrenderdoc - - - Code\pyrenderdoc - - - Code\pyrenderdoc - - - Widgets\Extended - - - Windows - - - Windows - - - Widgets\Extended - - - 3rdparty\ToolWindowManager - - - 3rdparty\ToolWindowManager - - - Widgets\Extended - - - Resources - - - Windows - - - Styles\RDStyle - - - Styles\RDTweakedNativeStyle - - - \ No newline at end of file diff --git a/qrenderdoc/share/application-x-renderdoc-capture.svg b/qrenderdoc/share/application-x-renderdoc-capture.svg deleted file mode 100644 index d3b7f94dd..000000000 --- a/qrenderdoc/share/application-x-renderdoc-capture.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/qrenderdoc/share/magic b/qrenderdoc/share/magic deleted file mode 100644 index fa8b3e5da..000000000 --- a/qrenderdoc/share/magic +++ /dev/null @@ -1,7 +0,0 @@ -# Magic local data for file(1) command. Format is described in magic(5). -# This can be added to ~/.magic or /etc/magic or anywhere else magic -# data is sourced from. - -# RenderDoc -0 string RDOC RenderDoc Capture File -!:mime application/x-renderdoc-capture diff --git a/qrenderdoc/share/menu b/qrenderdoc/share/menu deleted file mode 100644 index f1f503b4c..000000000 --- a/qrenderdoc/share/menu +++ /dev/null @@ -1,6 +0,0 @@ -?package(local.renderdoc):needs="x11" section="Applications/Programming" \ - title="RenderDoc" \ - command="qrenderdoc" \ - icon="/usr/share/pixmaps/renderdoc-icon-32x32.xpm" \ - icon16x16="/usr/share/pixmaps/renderdoc-icon-16x16.xpm" \ - icon32x32="/usr/share/pixmaps/renderdoc-icon-32x32.xpm" diff --git a/qrenderdoc/share/renderdoc-capture.xml b/qrenderdoc/share/renderdoc-capture.xml deleted file mode 100644 index 7c668a28b..000000000 --- a/qrenderdoc/share/renderdoc-capture.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - RenderDoc capture file - - - - - - diff --git a/qrenderdoc/share/renderdoc-icon-16x16.xpm b/qrenderdoc/share/renderdoc-icon-16x16.xpm deleted file mode 100644 index e5a007e60..000000000 --- a/qrenderdoc/share/renderdoc-icon-16x16.xpm +++ /dev/null @@ -1,63 +0,0 @@ -/* XPM */ -static char *renderdoc_icon_16x16[] = { -/* columns rows colors chars-per-pixel */ -"16 16 41 1 ", -" c #2323AAAA6767", -". c #2323ABAB6868", -"X c #2424ACAC6868", -"o c #2424ADAD6A6A", -"O c #2626AFAF6D6D", -"+ c #2626B0B06E6E", -"@ c #2727B0B06E6E", -"# c #2828B3B37171", -"$ c #2929B3B37272", -"% c #2929B4B47272", -"& c #2929B4B47373", -"* c #2A2AB5B57474", -"= c #3434B2B27373", -"- c #3D3DB0B07575", -"; c #3E3EB5B57979", -": c #4141B6B67C7C", -"> c #4747B5B57C7C", -", c #4F4FBBBB8484", -"< c #5757BABA8787", -"1 c #6565C1C19191", -"2 c #6B6BC6C69898", -"3 c #6B6BC7C79B9B", -"4 c #7A7AC8C89F9F", -"5 c #8A8ACECEAAAA", -"6 c #8C8CCFCFADAD", -"7 c #8E8ED1D1AEAE", -"8 c #9494D3D3B2B2", -"9 c #9797D4D4B4B4", -"0 c #A2A2D7D7BABA", -"q c #A5A5DBDBBFBF", -"w c #B2B2DFDFC8C8", -"e c #C2C2E5E5D2D2", -"r c #C4C4E6E6D4D4", -"t c #C5C5E8E8D6D6", -"y c #CCCCE9E9D9D9", -"u c #D6D6EDEDE0E0", -"i c #D8D8EEEEE2E2", -"p c #DFDFF1F1E8E8", -"a c #EEEEF8F8F3F3", -"s c #F0F0F9F9F4F4", -"d c white", -/* pixels */ -"****************", -"****************", -"******%$*%******", -"*****%@oo@%*****", -"****$o9dd7o%****", -"****Owd0qdqO****", -"***%;d4o 5d=****", -"***%,d>@O c #5F5FC8C89797", -", c #6060C8C89797", -"< c #6666CACA9B9B", -"1 c #6F6FCDCDA1A1", -"2 c #7070CDCDA2A2", -"3 c #7373CECEA3A3", -"4 c #7979D1D1A8A8", -"5 c #7E7ED2D2ABAB", -"6 c #8383D4D4AEAE", -"7 c #8989D6D6B2B2", -"8 c #8E8ED8D8B5B5", -"9 c #9090D8D8B7B7", -"0 c #9D9DDDDDBFBF", -"q c #A1A1DEDEC1C1", -"w c #A7A7E1E1C6C6", -"e c #A9A9E1E1C7C7", -"r c #ADADE3E3CACA", -"t c #B5B5E5E5CFCF", -"y c #BBBBE7E7D3D3", -"u c #C7C7ECECDADA", -"i c #C9C9ECECDCDC", -"p c #CECEEEEEDFDF", -"a c #D3D3F0F0E2E2", -"s c #DADAF2F2E7E7", -"d c #DBDBF3F3E8E8", -"f c #DFDFF4F4EAEA", -"g c #E0E0F4F4EBEB", -"h c #E1E1F5F5EBEB", -"j c #E2E2F5F5ECEC", -"k c #E7E7F7F7EFEF", -"l c #E9E9F7F7F1F1", -"z c #ECECF8F8F2F2", -"x c #EDEDF9F9F4F4", -"c c #F2F2FBFBF7F7", -"v c #F4F4FBFBF8F8", -"b c #F5F5FCFCF8F8", -"n c #F9F9FDFDFBFB", -"m c #FCFCFEFEFDFD", -"M c white", -/* pixels */ -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ${data_objects}) -add_library(renderdoc SHARED ${renderdoc_objects}) +add_library(renderdoc STATIC ${renderdoc_objects}) target_compile_definitions(renderdoc ${RDOC_DEFINITIONS}) target_include_directories(renderdoc ${RDOC_INCLUDES}) target_link_libraries(renderdoc ${RDOC_LIBRARIES}) diff --git a/renderdoc/api/replay/basic_types.h b/renderdoc/api/replay/basic_types.h index d29a83faa..3003f56a4 100644 --- a/renderdoc/api/replay/basic_types.h +++ b/renderdoc/api/replay/basic_types.h @@ -81,14 +81,8 @@ struct array count = 0; } -#ifdef RENDERDOC_EXPORTS static void *allocate(size_t s) { return malloc(s); } static void deallocate(const void *p) { free((void *)p); } -#else - static void *allocate(size_t s) { return RENDERDOC_AllocArrayMem(s); } - static void deallocate(const void *p) { RENDERDOC_FreeArrayMem(p); } -#endif - T &operator[](size_t i) { return elems[i]; } const T &operator[](size_t i) const { return elems[i]; } array(const std::vector &in) diff --git a/renderdoc/api/replay/renderdoc_replay.h b/renderdoc/api/replay/renderdoc_replay.h index eaaacef6a..d3b97ef3a 100644 --- a/renderdoc/api/replay/renderdoc_replay.h +++ b/renderdoc/api/replay/renderdoc_replay.h @@ -71,21 +71,14 @@ typedef uint32_t bool32; #if defined(RENDERDOC_PLATFORM_WIN32) -#ifdef RENDERDOC_EXPORTS -#define RENDERDOC_API __declspec(dllexport) -#else -#define RENDERDOC_API __declspec(dllimport) -#endif +#define RENDERDOC_API + #define RENDERDOC_CC __cdecl #elif defined(RENDERDOC_PLATFORM_LINUX) || defined(RENDERDOC_PLATFORM_APPLE) || \ defined(RENDERDOC_PLATFORM_ANDROID) -#ifdef RENDERDOC_EXPORTS -#define RENDERDOC_API __attribute__((visibility("default"))) -#else #define RENDERDOC_API -#endif #define RENDERDOC_CC @@ -181,12 +174,6 @@ struct GlobalEnvironment // needs to be declared up here for reference in basic_types -extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_FreeArrayMem(const void *mem); -typedef void(RENDERDOC_CC *pRENDERDOC_FreeArrayMem)(const void *mem); - -extern "C" RENDERDOC_API void *RENDERDOC_CC RENDERDOC_AllocArrayMem(uint64_t sz); -typedef void *(RENDERDOC_CC *pRENDERDOC_AllocArrayMem)(uint64_t sz); - #include "basic_types.h" #ifdef RENDERDOC_EXPORTS diff --git a/renderdoc/core/core.cpp b/renderdoc/core/core.cpp index 331f06a11..b45a76b5f 100644 --- a/renderdoc/core/core.cpp +++ b/renderdoc/core/core.cpp @@ -26,6 +26,7 @@ #include "core/core.h" #include #include +#include "3rdparty/tinyfiledialogs/tinyfiledialogs.h" #include "api/replay/version.h" #include "common/common.h" #include "common/dds_readwrite.h" @@ -1149,3 +1150,134 @@ void RenderDoc::RemoveFrameCapturer(void *dev, void *wnd) RDCERR("Removing FrameCapturer for unknown window!"); } } + +static RENDERDOC_API_1_1_1 *checkAPI(void *handle) +{ + if(handle) + { + pRENDERDOC_GetAPI getapi = + (pRENDERDOC_GetAPI)Process::GetFunctionAddress(handle, "RENDERDOC_GetAPI"); + + if(getapi) + { + RENDERDOC_API_1_1_1 *ret = NULL; + getapi(eRENDERDOC_API_Version_1_1_1, (void **)&ret); + + int major = 0, minor = 0, patch = 0; + ret->GetAPIVersion(&major, &minor, &patch); + + uint64_t combined = 0; + combined |= uint64_t(major & 0xffff) << 32; + combined |= uint64_t(minor & 0xffff) << 16; + combined |= uint64_t(patch & 0xffff) << 0; + + uint64_t ver1_1_1 = (1ULL << 32) | (1ULL << 16) | (1ULL << 0); + + // only capture in new renderdoc, above API 1.1.1 + if(combined <= ver1_1_1) + return NULL; + + time_t t = time(NULL); + tm now; + +#if ENABLED(RDOC_WIN32) + localtime_s(&now, &t); +#else + now = *localtime(&t); +#endif + + std::string path; + FileIO::GetExecutableFilename(path); + path = dirname(path) + StringFormat::Fmt("/converted_%04d.%02d.%02d_%02d.%02d.rdc", + 1900 + now.tm_year, now.tm_mon + 1, now.tm_mday, + now.tm_hour, now.tm_min); + + ret->SetLogFilePathTemplate(path.c_str()); + + return ret; + } + } + + return NULL; +} + +RENDERDOC_API_1_1_1 *RENDERDOC_LoadConverter() +{ + RenderDoc::Inst().SetReplayApp(true); + + RenderDoc::Inst().Initialise(); + +#if ENABLED(RDOC_LINUX) + XInitThreads(); + + GlobalEnvironment env; + env.xlibDisplay = XOpenDisplay(NULL); + + RenderDoc::Inst().ProcessGlobalEnvironment(env, {}); +#endif + + const char *modulename = +#if ENABLED(RDOC_WIN32) + "renderdoc.dll"; +#else + "librenderdoc.so"; +#endif + + // try to locate the module in the default search path + void *handle = Process::LoadModule(modulename); + + RENDERDOC_API_1_1_1 *api = checkAPI(handle); + + if(api) + return api; + +#if ENABLED(RDOC_WIN32) + // check in the registry @ HKLM\SOFTWARE\Classes\RenderDoc.RDCCapture.1\DefaultIcon + HKEY key = NULL; + LSTATUS ret = + RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Classes\\RenderDoc.RDCCapture.1\\DefaultIcon", 0, + KEY_READ, &key); + + if(ret == ERROR_SUCCESS) + { + std::wstring exepath; + + DWORD sz = 0; + ret = RegGetValueW(key, NULL, NULL, RRF_RT_ANY, NULL, NULL, &sz); + if(ret == ERROR_MORE_DATA || ret == ERROR_SUCCESS) + { + exepath.resize(sz / sizeof(wchar_t)); + ret = RegGetValueW(key, NULL, NULL, RRF_RT_ANY, NULL, (void *)&exepath[0], &sz); + + if(ret == ERROR_SUCCESS) + { + std::string installpath = dirname(StringFormat::Wide2UTF8(exepath)); + + handle = Process::LoadModule((installpath + "/renderdoc.dll").c_str()); + } + } + } + + if(key) + RegCloseKey(key); + + api = checkAPI(handle); + + if(api) + return api; +#endif + + modulename = tinyfd_openFileDialog("Locate renderdoc module", modulename, 0, NULL, NULL, 0); + + handle = Process::LoadModule(modulename); + + api = checkAPI(handle); + + if(api) + return api; + + tinyfd_messageBox("Coulnd't locate renderdoc module", + "Couldn't locate compatible 1.0+ renderdoc module", "ok", "error", 1); + + return NULL; +} \ No newline at end of file diff --git a/renderdoc/core/core.h b/renderdoc/core/core.h index 919e2ce9c..a7bbea049 100644 --- a/renderdoc/core/core.h +++ b/renderdoc/core/core.h @@ -49,6 +49,9 @@ class Chunk; // not provided by tinyexr, just do by hand bool is_exr_file(FILE *f); +// this becomes non-NULL when we should capture. +extern RENDERDOC_API_1_1_1 *ConverterAPI; + struct ICrashHandler { virtual ~ICrashHandler() {} diff --git a/renderdoc/core/crash_handler.h b/renderdoc/core/crash_handler.h index e85858fd7..5671fb07f 100644 --- a/renderdoc/core/crash_handler.h +++ b/renderdoc/core/crash_handler.h @@ -23,128 +23,5 @@ * THE SOFTWARE. ******************************************************************************/ -// currently breakpad crash-handler is only available on windows -#if ENABLED(RDOC_RELEASE) && RENDERDOC_OFFICIAL_BUILD && ENABLED(RDOC_WIN32) - -#define RDOC_CRASH_HANDLER OPTION_ON - -// breakpad -#include "breakpad/client/windows/common/ipc_protocol.h" -#include "breakpad/client/windows/handler/exception_handler.h" - -class CrashHandler : public ICrashHandler -{ -public: - CrashHandler(ICrashHandler *existing) - { - m_ExHandler = NULL; - - google_breakpad::AppMemoryList mem; - - if(existing) - mem = ((CrashHandler *)existing)->m_ExHandler->QueryRegisteredAppMemory(); - - SAFE_DELETE(existing); - - /////////////////// - - wchar_t tempPath[MAX_PATH] = {0}; - GetTempPathW(MAX_PATH - 1, tempPath); - - wstring dumpFolder = tempPath; - dumpFolder += L"RenderDoc/dumps"; - - CreateDirectoryW(dumpFolder.c_str(), NULL); - - MINIDUMP_TYPE dumpType = MINIDUMP_TYPE(MiniDumpNormal | MiniDumpWithIndirectlyReferencedMemory); - - { - PROCESS_INFORMATION pi; - STARTUPINFOW si; - RDCEraseEl(pi); - RDCEraseEl(si); - - HANDLE waitEvent = CreateEventA(NULL, TRUE, FALSE, "RENDERDOC_CRASHHANDLE"); - - wchar_t radpath[MAX_PATH] = {0}; - GetModuleFileNameW(GetModuleHandleA("renderdoc.dll"), radpath, MAX_PATH - 1); - - wchar_t *slash = wcsrchr(radpath, L'\\'); - - if(slash) - { - *slash = 0; - } - else - { - slash = wcsrchr(radpath, L'/'); - - if(slash) - *slash = 0; - else - { - radpath[0] = L'.'; - radpath[1] = 0; - } - } - - wstring cmdline = L"\""; - cmdline += radpath; - cmdline += L"/renderdoccmd.exe\" crashhandle"; - - wchar_t *paramsAlloc = new wchar_t[512]; - - wcscpy_s(paramsAlloc, 511, cmdline.c_str()); - - CreateProcessW(NULL, paramsAlloc, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); - - WaitForSingleObject(waitEvent, 2000); - - CloseHandle(waitEvent); - } - - static google_breakpad::CustomInfoEntry breakpadCustomInfo[] = { - google_breakpad::CustomInfoEntry(L"version", L""), - google_breakpad::CustomInfoEntry(L"logpath", L""), - google_breakpad::CustomInfoEntry(L"gitcommit", L""), - }; - - wstring wideStr = StringFormat::UTF82Wide(string(MAJOR_MINOR_VERSION_STRING)); - breakpadCustomInfo[0].set_value(wideStr.c_str()); - wideStr = StringFormat::UTF82Wide(string(RDCGETLOGFILE())); - breakpadCustomInfo[1].set_value(wideStr.c_str()); - wideStr = StringFormat::UTF82Wide(string(GIT_COMMIT_HASH)); - breakpadCustomInfo[2].set_value(wideStr.c_str()); - - google_breakpad::CustomClientInfo custom = {&breakpadCustomInfo[0], - ARRAY_COUNT(breakpadCustomInfo)}; - - _CrtSetReportMode(_CRT_ASSERT, 0); - m_ExHandler = new google_breakpad::ExceptionHandler( - dumpFolder.c_str(), NULL, NULL, NULL, google_breakpad::ExceptionHandler::HANDLER_ALL, - dumpType, L"\\\\.\\pipe\\RenderDocBreakpadServer", &custom); - - m_ExHandler->set_handle_debug_exceptions(true); - - for(size_t i = 0; i < mem.size(); i++) - m_ExHandler->RegisterAppMemory((void *)mem[i].ptr, mem[i].length); - } - - virtual ~CrashHandler() { SAFE_DELETE(m_ExHandler); } - void WriteMinidump() { m_ExHandler->WriteMinidump(); } - void WriteMinidump(void *data) - { - m_ExHandler->WriteMinidumpForException((EXCEPTION_POINTERS *)data); - } - - void RegisterMemoryRegion(void *mem, size_t size) { m_ExHandler->RegisterAppMemory(mem, size); } - void UnregisterMemoryRegion(void *mem) { m_ExHandler->UnregisterAppMemory(mem); } -private: - google_breakpad::ExceptionHandler *m_ExHandler; -}; - -#else - +// crash-handler is removed #define RDOC_CRASH_HANDLER OPTION_OFF - -#endif diff --git a/renderdoc/data/renderdoc.rc b/renderdoc/data/renderdoc.rc index 8ce08a39b..08b0b2d1c 100644 --- a/renderdoc/data/renderdoc.rc +++ b/renderdoc/data/renderdoc.rc @@ -61,84 +61,9 @@ END LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK #pragma code_page(1252) -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION RENDERDOC_VERSION_MAJOR,RENDERDOC_VERSION_MINOR,0,0 - PRODUCTVERSION RENDERDOC_VERSION_MAJOR,RENDERDOC_VERSION_MINOR,0,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080904b0" - BEGIN - VALUE "CompanyName", "Baldur Karlsson" - VALUE "FileDescription", "Core DLL for RenderDoc - https://renderdoc.org/" - VALUE "FileVersion", MAJOR_MINOR_VERSION_STRING ".0.0" - VALUE "InternalName", "renderdoc.dll" - VALUE "LegalCopyright", "Copyright © 2016 Baldur Karlsson" - VALUE "OriginalFilename", "renderdoc.dll" - VALUE "ProductName", "RenderDoc" - VALUE "ProductVersion", FULL_VERSION_STRING - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x809, 1200 - END -END - #endif // English (United Kingdom) resources ///////////////////////////////////////////////////////////////////////////// -RESOURCE_debugdisplay_hlsl TYPE_EMBED "hlsl/debugdisplay.hlsl" -RESOURCE_debugtext_hlsl TYPE_EMBED "hlsl/debugtext.hlsl" -RESOURCE_debugcommon_hlsl TYPE_EMBED "hlsl/debugcommon.hlsl" -RESOURCE_histogram_hlsl TYPE_EMBED "hlsl/histogram.hlsl" -RESOURCE_debugcbuffers_h TYPE_EMBED "hlsl/debugcbuffers.h" -RESOURCE_multisample_hlsl TYPE_EMBED "hlsl/multisample.hlsl" -RESOURCE_mesh_hlsl TYPE_EMBED "hlsl/mesh.hlsl" - -RESOURCE_sourcecodepro_ttf TYPE_EMBED "sourcecodepro.ttf" - -RESOURCE_glsl_blit_vert TYPE_EMBED "glsl/blit.vert" -RESOURCE_glsl_checkerboard_frag TYPE_EMBED "glsl/checkerboard.frag" -RESOURCE_glsl_texdisplay_frag TYPE_EMBED "glsl/texdisplay.frag" -RESOURCE_glsl_text_vert TYPE_EMBED "glsl/text.vert" -RESOURCE_glsl_text_frag TYPE_EMBED "glsl/text.frag" -RESOURCE_glsl_fixedcol_frag TYPE_EMBED "glsl/fixedcol.frag" -RESOURCE_glsl_mesh_vert TYPE_EMBED "glsl/mesh.vert" -RESOURCE_glsl_mesh_geom TYPE_EMBED "glsl/mesh.geom" -RESOURCE_glsl_mesh_frag TYPE_EMBED "glsl/mesh.frag" -RESOURCE_glsl_minmaxtile_comp TYPE_EMBED "glsl/minmaxtile.comp" -RESOURCE_glsl_minmaxresult_comp TYPE_EMBED "glsl/minmaxresult.comp" -RESOURCE_glsl_histogram_comp TYPE_EMBED "glsl/histogram.comp" -RESOURCE_glsl_outline_frag TYPE_EMBED "glsl/outline.frag" -RESOURCE_glsl_debuguniforms_h TYPE_EMBED "glsl/debuguniforms.h" -RESOURCE_glsl_gl_texsample_h TYPE_EMBED "glsl/gl_texsample.h" -RESOURCE_glsl_vk_texsample_h TYPE_EMBED "glsl/vk_texsample.h" -RESOURCE_glsl_quadresolve_frag TYPE_EMBED "glsl/quadresolve.frag" -RESOURCE_glsl_quadwrite_frag TYPE_EMBED "glsl/quadwrite.frag" -RESOURCE_glsl_mesh_comp TYPE_EMBED "glsl/mesh.comp" -RESOURCE_glsl_array2ms_comp TYPE_EMBED "glsl/array2ms.comp" -RESOURCE_glsl_ms2array_comp TYPE_EMBED "glsl/ms2array.comp" -RESOURCE_glsl_trisize_geom TYPE_EMBED "glsl/trisize.geom" -RESOURCE_glsl_trisize_frag TYPE_EMBED "glsl/trisize.frag" -RESOURCE_glsl_deptharr2ms_frag TYPE_EMBED "glsl/deptharr2ms.frag" -RESOURCE_glsl_depthms2arr_frag TYPE_EMBED "glsl/depthms2arr.frag" -RESOURCE_glsl_gles_texsample_h TYPE_EMBED "glsl/gles_texsample.h" - #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // diff --git a/renderdoc/data/resource.h b/renderdoc/data/resource.h index e69faa013..4a1c86d32 100644 --- a/renderdoc/data/resource.h +++ b/renderdoc/data/resource.h @@ -2,54 +2,52 @@ // Microsoft Visual C++ generated include file. // Used by renderdoc.rc // -#define TYPE_EMBED 256 +#define TYPE_EMBED 256 -#define RESOURCE_debugdisplay_hlsl 101 -#define RESOURCE_debugtext_hlsl 102 -#define RESOURCE_debugcbuffers_h 103 -#define RESOURCE_debugcommon_hlsl 104 -#define RESOURCE_histogram_hlsl 105 -#define RESOURCE_multisample_hlsl 106 -#define RESOURCE_mesh_hlsl 107 +#define RESOURCE_debugdisplay_hlsl 101 +#define RESOURCE_debugtext_hlsl 102 +#define RESOURCE_debugcbuffers_h 103 +#define RESOURCE_debugcommon_hlsl 104 +#define RESOURCE_histogram_hlsl 105 +#define RESOURCE_multisample_hlsl 106 +#define RESOURCE_mesh_hlsl 107 -#define RESOURCE_sourcecodepro_ttf 301 +#define RESOURCE_sourcecodepro_ttf 301 -#define RESOURCE_glsl_blit_vert 401 +#define RESOURCE_glsl_blit_vert 401 #define RESOURCE_glsl_checkerboard_frag 402 -#define RESOURCE_glsl_texdisplay_frag 403 -#define RESOURCE_glsl_text_vert 404 -#define RESOURCE_glsl_text_frag 405 -#define RESOURCE_glsl_fixedcol_frag 408 -#define RESOURCE_glsl_mesh_vert 409 -#define RESOURCE_glsl_mesh_geom 410 -#define RESOURCE_glsl_mesh_frag 411 -#define RESOURCE_glsl_minmaxtile_comp 412 +#define RESOURCE_glsl_texdisplay_frag 403 +#define RESOURCE_glsl_text_vert 404 +#define RESOURCE_glsl_text_frag 405 +#define RESOURCE_glsl_fixedcol_frag 408 +#define RESOURCE_glsl_mesh_vert 409 +#define RESOURCE_glsl_mesh_geom 410 +#define RESOURCE_glsl_mesh_frag 411 +#define RESOURCE_glsl_minmaxtile_comp 412 #define RESOURCE_glsl_minmaxresult_comp 413 -#define RESOURCE_glsl_histogram_comp 414 -#define RESOURCE_glsl_outline_frag 415 -#define RESOURCE_glsl_debuguniforms_h 416 -#define RESOURCE_glsl_gl_texsample_h 417 -#define RESOURCE_glsl_vk_texsample_h 418 -#define RESOURCE_glsl_quadresolve_frag 419 -#define RESOURCE_glsl_quadwrite_frag 420 -#define RESOURCE_glsl_mesh_comp 421 -#define RESOURCE_glsl_array2ms_comp 422 -#define RESOURCE_glsl_ms2array_comp 423 -#define RESOURCE_glsl_trisize_geom 424 -#define RESOURCE_glsl_trisize_frag 425 -#define RESOURCE_glsl_deptharr2ms_frag 426 -#define RESOURCE_glsl_depthms2arr_frag 427 -#define RESOURCE_glsl_gles_texsample_h 428 +#define RESOURCE_glsl_histogram_comp 414 +#define RESOURCE_glsl_outline_frag 415 +#define RESOURCE_glsl_debuguniforms_h 416 +#define RESOURCE_glsl_gl_texsample_h 417 +#define RESOURCE_glsl_vk_texsample_h 418 +#define RESOURCE_glsl_quadresolve_frag 419 +#define RESOURCE_glsl_quadwrite_frag 420 +#define RESOURCE_glsl_mesh_comp 421 +#define RESOURCE_glsl_array2ms_comp 422 +#define RESOURCE_glsl_ms2array_comp 423 +#define RESOURCE_glsl_trisize_geom 424 +#define RESOURCE_glsl_trisize_frag 425 +#define RESOURCE_glsl_deptharr2ms_frag 426 +#define RESOURCE_glsl_depthms2arr_frag 427 +#define RESOURCE_glsl_gles_texsample_h 428 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 114 -#define _APS_NEXT_COMMAND_VALUE 40029 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 114 +#define _APS_NEXT_COMMAND_VALUE 40029 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 #endif #endif - -#include "api/replay/version.h" diff --git a/renderdoc/driver/d3d11/d3d11_context.cpp b/renderdoc/driver/d3d11/d3d11_context.cpp index d1438a7de..abe15e402 100644 --- a/renderdoc/driver/d3d11/d3d11_context.cpp +++ b/renderdoc/driver/d3d11/d3d11_context.cpp @@ -837,7 +837,8 @@ void WrappedID3D11DeviceContext::ProcessChunk(uint64_t offset, D3D11ChunkType ch if(context->m_DrawcallStack.size() > 1) context->m_DrawcallStack.pop_back(); } - else if(context->m_State == READING) + + if(context->m_State == READING) { if(!m_AddedDrawcall) context->AddEvent(m_pSerialiser->GetDebugStr()); diff --git a/renderdoc/driver/d3d11/d3d11_device.cpp b/renderdoc/driver/d3d11/d3d11_device.cpp index bbe53cf88..c173e6cf4 100644 --- a/renderdoc/driver/d3d11/d3d11_device.cpp +++ b/renderdoc/driver/d3d11/d3d11_device.cpp @@ -2481,6 +2481,9 @@ void WrappedID3D11Device::ReplayLog(uint32_t startEventID, uint32_t endEventID, m_ReplayEventCount = 0; + if(ConverterAPI && replayType != eReplay_OnlyDraw) + ConverterAPI->StartFrameCapture(m_pDevice, NULL); + if(replayType == eReplay_Full) m_pImmediateContext->ReplayLog(EXECUTING, startEventID, endEventID, partial); else if(replayType == eReplay_WithoutDraw) @@ -2494,6 +2497,9 @@ void WrappedID3D11Device::ReplayLog(uint32_t startEventID, uint32_t endEventID, for(int i = 0; i < m_ReplayEventCount; i++) D3D11MarkerRegion::End(); + if(ConverterAPI && replayType != eReplay_OnlyDraw) + ConverterAPI->EndFrameCapture(m_pDevice, NULL); + D3D11MarkerRegion::Set("!!!!RenderDoc Internal: Done replay"); } diff --git a/renderdoc/driver/d3d11/d3d11_replay.cpp b/renderdoc/driver/d3d11/d3d11_replay.cpp index b68cdeefa..1ea61663f 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.cpp +++ b/renderdoc/driver/d3d11/d3d11_replay.cpp @@ -1981,6 +1981,13 @@ void D3D11Replay::SetProxyBufferData(ResourceId bufid, byte *data, size_t dataSi ID3DDevice *GetD3D11DeviceIfAlloc(IUnknown *dev); +extern "C" __declspec(dllexport) HRESULT __cdecl RENDERDOC_CreateWrappedD3D11DeviceAndSwapChain( + __in_opt IDXGIAdapter *pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, UINT Flags, + __in_ecount_opt(FeatureLevels) CONST D3D_FEATURE_LEVEL *pFeatureLevels, UINT FeatureLevels, + UINT SDKVersion, __in_opt CONST DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, + __out_opt IDXGISwapChain **ppSwapChain, __out_opt ID3D11Device **ppDevice, + __out_opt D3D_FEATURE_LEVEL *pFeatureLevel, __out_opt ID3D11DeviceContext **ppImmediateContext); + ReplayStatus D3D11_CreateReplayDevice(const char *logfile, IReplayDriver **driver) { RDCDEBUG("Creating a D3D11 replay device"); @@ -2015,18 +2022,6 @@ ReplayStatus D3D11_CreateReplayDevice(const char *logfile, IReplayDriver **drive return ReplayStatus::APIInitFailed; } - typedef HRESULT(__cdecl * PFN_RENDERDOC_CREATE_DEVICE_AND_SWAP_CHAIN)( - __in_opt IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT, - __in_ecount_opt(FeatureLevels) CONST D3D_FEATURE_LEVEL *, UINT FeatureLevels, UINT, - __in_opt CONST DXGI_SWAP_CHAIN_DESC *, __out_opt IDXGISwapChain **, __out_opt ID3D11Device **, - __out_opt D3D_FEATURE_LEVEL *, __out_opt ID3D11DeviceContext **); - - PFN_RENDERDOC_CREATE_DEVICE_AND_SWAP_CHAIN createDevice = - (PFN_RENDERDOC_CREATE_DEVICE_AND_SWAP_CHAIN)GetProcAddress( - GetModuleHandleA("renderdoc.dll"), "RENDERDOC_CreateWrappedD3D11DeviceAndSwapChain"); - - RDCASSERT(createDevice); - ID3D11Device *device = NULL; D3D11InitParams initParams; @@ -2080,8 +2075,9 @@ ReplayStatus D3D11_CreateReplayDevice(const char *logfile, IReplayDriver **drive // check for feature level 11 support - passing NULL feature level array implicitly checks for // 11_0 before others - hr = createDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, NULL, 0, D3D11_SDK_VERSION, NULL, NULL, - NULL, &maxFeatureLevel, NULL); + hr = RENDERDOC_CreateWrappedD3D11DeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, NULL, + 0, D3D11_SDK_VERSION, NULL, NULL, NULL, + &maxFeatureLevel, NULL); bool warpFallback = false; @@ -2099,7 +2095,7 @@ ReplayStatus D3D11_CreateReplayDevice(const char *logfile, IReplayDriver **drive hr = E_FAIL; for(;;) { - hr = createDevice( + hr = RENDERDOC_CreateWrappedD3D11DeviceAndSwapChain( /*pAdapter=*/NULL, driverType, /*Software=*/NULL, flags, /*pFeatureLevels=*/featureLevelArray, /*nFeatureLevels=*/numFeatureLevels, D3D11_SDK_VERSION, /*pSwapChainDesc=*/NULL, (IDXGISwapChain **)NULL, (ID3D11Device **)&device, diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index ed6c5388e..bbb027c96 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -2523,6 +2523,9 @@ void WrappedID3D12Device::ReplayLog(uint32_t startEventID, uint32_t endEventID, GetQueue(), StringFormat::Fmt("!!!!RenderDoc Internal: RenderDoc Replay %d (%d): %u->%u", (int)replayType, (int)partial, startEventID, endEventID)); + if(ConverterAPI && replayType != eReplay_OnlyDraw) + ConverterAPI->StartFrameCapture(m_pDevice, NULL); + { D3D12CommandData &cmd = *m_Queue->GetCommandData(); @@ -2573,6 +2576,9 @@ void WrappedID3D12Device::ReplayLog(uint32_t startEventID, uint32_t endEventID, #endif } + if(ConverterAPI && replayType != eReplay_OnlyDraw) + ConverterAPI->EndFrameCapture(m_pDevice, NULL); + D3D12MarkerRegion::Set(GetQueue(), "!!!!RenderDoc Internal: Done replay"); // ensure all UAV writes have finished before subsequent work diff --git a/renderdoc/driver/gl/gl_driver.cpp b/renderdoc/driver/gl/gl_driver.cpp index 265e7c514..6acdc1c45 100644 --- a/renderdoc/driver/gl/gl_driver.cpp +++ b/renderdoc/driver/gl/gl_driver.cpp @@ -4515,6 +4515,9 @@ void WrappedOpenGL::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay GLMarkerRegion::Set(StringFormat::Fmt("!!!!RenderDoc Internal: Replay %d (%d): %u->%u", (int)replayType, (int)partial, startEventID, endEventID)); + if(ConverterAPI && replayType != eReplay_OnlyDraw) + ConverterAPI->StartFrameCapture(GetCtx(), NULL); + m_ReplayEventCount = 0; if(replayType == eReplay_Full) @@ -4530,5 +4533,8 @@ void WrappedOpenGL::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay for(int i = 0; i < m_ReplayEventCount; i++) GLMarkerRegion::End(); + if(ConverterAPI && replayType != eReplay_OnlyDraw) + ConverterAPI->EndFrameCapture(GetCtx(), NULL); + GLMarkerRegion::Set("!!!!RenderDoc Internal: Done replay"); } diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index c1883d238..92b36cacb 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -3448,7 +3448,7 @@ bool GLReplay::IsOutputWindowVisible(uint64_t id) // defined in gl_replay_.cpp ReplayStatus GL_CreateReplayDevice(const char *logfile, IReplayDriver **driver); -static DriverRegistration GLDriverRegistration(RDC_OpenGL, "OpenGL", &GL_CreateReplayDevice); +DriverRegistration GLDriverRegistration(RDC_OpenGL, "OpenGL", &GL_CreateReplayDevice); #endif @@ -3457,6 +3457,6 @@ static DriverRegistration GLDriverRegistration(RDC_OpenGL, "OpenGL", &GL_CreateR // defined in gl_replay_egl.cpp ReplayStatus GLES_CreateReplayDevice(const char *logfile, IReplayDriver **driver); -static DriverRegistration GLESDriverRegistration(RDC_OpenGLES, "OpenGLES", &GLES_CreateReplayDevice); +DriverRegistration GLESDriverRegistration(RDC_OpenGLES, "OpenGLES", &GLES_CreateReplayDevice); #endif diff --git a/renderdoc/driver/vulkan/vk_core.cpp b/renderdoc/driver/vulkan/vk_core.cpp index 65c544f7c..df3643195 100644 --- a/renderdoc/driver/vulkan/vk_core.cpp +++ b/renderdoc/driver/vulkan/vk_core.cpp @@ -2367,6 +2367,11 @@ void WrappedVulkan::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay VkMarkerRegion::Set(StringFormat::Fmt("!!!!RenderDoc Internal: RenderDoc Replay %d (%d): %u->%u", (int)replayType, (int)partial, startEventID, endEventID)); +#define RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(inst) (*((void **)(inst))) + + if(ConverterAPI && replayType != eReplay_OnlyDraw) + ConverterAPI->StartFrameCapture(NULL, NULL); + { if(!partial) { @@ -2496,6 +2501,9 @@ void WrappedVulkan::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay #endif } + if(ConverterAPI && replayType != eReplay_OnlyDraw) + ConverterAPI->EndFrameCapture(NULL, NULL); + VkMarkerRegion::Set("!!!!RenderDoc Internal: Done replay"); } diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index e528afa97..5bfa829fd 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -5361,9 +5361,9 @@ ReplayStatus Vulkan_CreateReplayDevice(const char *logfile, IReplayDriver **driv { RDCDEBUG("Creating a VulkanReplay replay device"); - // disable the layer env var, just in case the user left it set from a previous capture run + // *enable* the layer env var so we can capture. Process::RegisterEnvironmentModification( - EnvironmentModification(EnvMod::Set, EnvSep::NoSep, "ENABLE_VULKAN_RENDERDOC_CAPTURE", "0")); + EnvironmentModification(EnvMod::Set, EnvSep::NoSep, "ENABLE_VULKAN_RENDERDOC_CAPTURE", "1")); // disable buggy and user-hostile NV optimus layer, which can completely delete physical devices // (not just rearrange them) and cause problems between capture and replay. @@ -5429,4 +5429,4 @@ struct VulkanDriverRegistration } }; -static VulkanDriverRegistration VkDriverRegistration; +VulkanDriverRegistration VkDriverRegistration; diff --git a/renderdoc/os/posix/posix_libentry.cpp b/renderdoc/os/posix/posix_libentry.cpp index b675f08ab..66df2c47a 100644 --- a/renderdoc/os/posix/posix_libentry.cpp +++ b/renderdoc/os/posix/posix_libentry.cpp @@ -22,70 +22,4 @@ * THE SOFTWARE. ******************************************************************************/ -#include "core/core.h" -#include "hooks/hooks.h" -#include "os/os_specific.h" - -void dlopen_hook_init(); - -void readCapOpts(const char *str, CaptureOptions *opts) -{ - // serialise from string with two chars per byte - byte *b = (byte *)opts; - for(size_t i = 0; i < sizeof(CaptureOptions); i++) - *(b++) = (byte(str[i * 2 + 0] - 'a') << 4) | byte(str[i * 2 + 1] - 'a'); -} - -// DllMain equivalent -void library_loaded() -{ - string curfile; - FileIO::GetExecutableFilename(curfile); - - if(curfile.find("/renderdoccmd") != string::npos || - curfile.find("/renderdocui") != string::npos || curfile.find("/qrenderdoc") != string::npos || - curfile.find("org.renderdoc.renderdoccmd") != string::npos) - { - RDCDEBUG("Not creating hooks - in replay app"); - - RenderDoc::Inst().SetReplayApp(true); - - RenderDoc::Inst().Initialise(); - - return; - } - else - { - RenderDoc::Inst().Initialise(); - - char *logfile = getenv("RENDERDOC_LOGFILE"); - char *opts = getenv("RENDERDOC_CAPTUREOPTS"); - - if(opts) - { - string optstr = opts; - - CaptureOptions optstruct; - readCapOpts(optstr.c_str(), &optstruct); - - RenderDoc::Inst().SetCaptureOptions(optstruct); - } - - if(logfile) - { - RenderDoc::Inst().SetLogFile(logfile); - } - - RDCLOG("Loading into %s", curfile.c_str()); - - LibraryHooks::GetInstance().CreateHooks(); - } -} - -// wrap in a struct to enforce ordering. This file is -// linked last, so all other global struct constructors -// should run first -struct init -{ - init() { library_loaded(); } -} do_init; +// not used in converter \ No newline at end of file diff --git a/renderdoc/os/win32/win32_libentry.cpp b/renderdoc/os/win32/win32_libentry.cpp index 9d51afba2..40e6ad5a4 100644 --- a/renderdoc/os/win32/win32_libentry.cpp +++ b/renderdoc/os/win32/win32_libentry.cpp @@ -23,62 +23,4 @@ * THE SOFTWARE. ******************************************************************************/ -// win32_libentry.cpp : Defines the entry point for the DLL -#include -#include -#include "common/common.h" -#include "core/core.h" -#include "hooks/hooks.h" -#include "serialise/string_utils.h" - -static BOOL add_hooks() -{ - wchar_t curFile[512]; - GetModuleFileNameW(NULL, curFile, 512); - - wstring f = strlower(wstring(curFile)); - - // bail immediately if we're in a system process. We don't want to hook, log, anything - - // this instance is being used for a shell extension. - if(f.find(L"dllhost.exe") != wstring::npos || f.find(L"explorer.exe") != wstring::npos) - { -#ifndef _RELEASE - OutputDebugStringA("Hosting " STRINGIZE(RDOC_DLL_FILE) ".dll in shell process\n"); -#endif - return TRUE; - } - - if(f.find(CONCAT(L, STRINGIZE(RDOC_DLL_FILE)) L"cmd.exe") != wstring::npos || - f.find(CONCAT(L, STRINGIZE(RDOC_DLL_FILE)) L"ui.vshost.exe") != wstring::npos || - f.find(L"q" CONCAT(L, STRINGIZE(RDOC_DLL_FILE)) L".exe") != wstring::npos || - f.find(CONCAT(L, STRINGIZE(RDOC_DLL_FILE)) L"ui.exe") != wstring::npos) - { - RDCDEBUG("Not creating hooks - in replay app"); - - RenderDoc::Inst().SetReplayApp(true); - - RenderDoc::Inst().Initialise(); - - return true; - } - - RenderDoc::Inst().Initialise(); - - RDCLOG("Loading into %ls", curFile); - - LibraryHooks::GetInstance().CreateHooks(); - - return TRUE; -} - -BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) -{ - if(ul_reason_for_call == DLL_PROCESS_ATTACH) - { - BOOL ret = add_hooks(); - SetLastError(0); - return ret; - } - - return TRUE; -} +// not used in converter \ No newline at end of file diff --git a/renderdoc/renderdoc.vcxproj b/renderdoc/renderdoc.vcxproj index 59e9f1486..38cfd4338 100644 --- a/renderdoc/renderdoc.vcxproj +++ b/renderdoc/renderdoc.vcxproj @@ -23,16 +23,17 @@ Win32Proj renderdoc renderdoc + 8.1 - DynamicLibrary + StaticLibrary true Unicode v140 - false + false true diff --git a/renderdoc/replay/entry_points.cpp b/renderdoc/replay/entry_points.cpp index 0c90fe247..67393c84b 100644 --- a/renderdoc/replay/entry_points.cpp +++ b/renderdoc/replay/entry_points.cpp @@ -424,16 +424,6 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC RENDERDOC_GetThumbnail(const char * return true; } -extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_FreeArrayMem(const void *mem) -{ - rdctype::array::deallocate(mem); -} - -extern "C" RENDERDOC_API void *RENDERDOC_CC RENDERDOC_AllocArrayMem(uint64_t sz) -{ - return rdctype::array::allocate((size_t)sz); -} - extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_EnumerateRemoteTargets(const char *host, uint32_t nextIdent) { diff --git a/renderdoccmd/3rdparty/cmdline/cmdline.h b/renderdoccmd/3rdparty/cmdline/cmdline.h deleted file mode 100644 index be35c6042..000000000 --- a/renderdoccmd/3rdparty/cmdline/cmdline.h +++ /dev/null @@ -1,829 +0,0 @@ -/* - Copyright (c) 2009, Hideyuki Tanaka - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY ''AS IS'' AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef max -#undef max -#endif - -namespace cmdline{ - -namespace detail{ - -template -class lexical_cast_t{ -public: - static Target cast(const Source &arg){ - Target ret; - std::stringstream ss; - if (!(ss<>ret && ss.eof())) - throw std::bad_cast(); - - return ret; - } -}; - -template -class lexical_cast_t{ -public: - static Target cast(const Source &arg){ - return arg; - } -}; - -template -class lexical_cast_t{ -public: - static std::string cast(const Source &arg){ - std::ostringstream ss; - ss< -class lexical_cast_t{ -public: - static Target cast(const std::string &arg){ - Target ret; - std::istringstream ss(arg); - if (!(ss>>ret && ss.eof())) - throw std::bad_cast(); - return ret; - } -}; - -template -struct is_same { - static const bool value = false; -}; - -template -struct is_same{ - static const bool value = true; -}; - -template -Target lexical_cast(const Source &arg) -{ - return lexical_cast_t::value>::cast(arg); -} - -template -std::string readable_typename(); - -template -std::string default_value(T def) -{ - return detail::lexical_cast(def); -} - -template <> -inline std::string readable_typename() -{ - return "string"; -} - -template <> -inline std::string readable_typename() -{ - return "int"; -} - -template <> -inline std::string readable_typename() -{ - return "uint"; -} - -} // detail - -//----- - -class cmdline_error : public std::exception { -public: - cmdline_error(const std::string &msg): msg(msg){} - ~cmdline_error() throw() {} - const char *what() const throw() { return msg.c_str(); } -private: - std::string msg; -}; - -template -struct default_reader{ - T operator()(const std::string &str){ - return detail::lexical_cast(str); - } - std::string description() const { return ""; } -}; - -template -struct range_reader{ - range_reader(const T &low, const T &high): low(low), high(high) {} - T operator()(const std::string &s) const { - T ret=default_reader()(s); - if (!(ret>=low && ret<=high)) - throw cmdline::cmdline_error(description()); - return ret; - } - std::string description() const { return "Must be within [" + detail::lexical_cast(low) + ", " + detail::lexical_cast(high) + "]"; } -private: - T low, high; -}; - -template -range_reader range(const T &low, const T &high) -{ - return range_reader(low, high); -} - -template -struct oneof_reader{ - T operator()(const std::string &s){ - T ret=default_reader()(s); - if (std::find(alt.begin(), alt.end(), ret)==alt.end()) - throw cmdline::cmdline_error("'" + s + "' is not one of the accepted values"); - return ret; - } - void add(const T &v){ alt.push_back(v); } - std::string description() const - { - std::string ret = "Options are:"; - for(size_t i=0; i < alt.size(); i++) - ret += "\n * " + detail::lexical_cast(alt[i]); - return ret; - } -private: - std::vector alt; -}; - -template -oneof_reader oneof(T a1) -{ - oneof_reader ret; - ret.add(a1); - return ret; -} - -template -oneof_reader oneof(T a1, T a2) -{ - oneof_reader ret; - ret.add(a1); - ret.add(a2); - return ret; -} - -template -oneof_reader oneof(T a1, T a2, T a3) -{ - oneof_reader ret; - ret.add(a1); - ret.add(a2); - ret.add(a3); - return ret; -} - -template -oneof_reader oneof(T a1, T a2, T a3, T a4) -{ - oneof_reader ret; - ret.add(a1); - ret.add(a2); - ret.add(a3); - ret.add(a4); - return ret; -} - -template -oneof_reader oneof(T a1, T a2, T a3, T a4, T a5) -{ - oneof_reader ret; - ret.add(a1); - ret.add(a2); - ret.add(a3); - ret.add(a4); - ret.add(a5); - return ret; -} - -template -oneof_reader oneof(T a1, T a2, T a3, T a4, T a5, T a6) -{ - oneof_reader ret; - ret.add(a1); - ret.add(a2); - ret.add(a3); - ret.add(a4); - ret.add(a5); - ret.add(a6); - return ret; -} - -template -oneof_reader oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7) -{ - oneof_reader ret; - ret.add(a1); - ret.add(a2); - ret.add(a3); - ret.add(a4); - ret.add(a5); - ret.add(a6); - ret.add(a7); - return ret; -} - -template -oneof_reader oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8) -{ - oneof_reader ret; - ret.add(a1); - ret.add(a2); - ret.add(a3); - ret.add(a4); - ret.add(a5); - ret.add(a6); - ret.add(a7); - ret.add(a8); - return ret; -} - -template -oneof_reader oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8, T a9) -{ - oneof_reader ret; - ret.add(a1); - ret.add(a2); - ret.add(a3); - ret.add(a4); - ret.add(a5); - ret.add(a6); - ret.add(a7); - ret.add(a8); - ret.add(a9); - return ret; -} - -template -oneof_reader oneof(T a1, T a2, T a3, T a4, T a5, T a6, T a7, T a8, T a9, T a10) -{ - oneof_reader ret; - ret.add(a1); - ret.add(a2); - ret.add(a3); - ret.add(a4); - ret.add(a5); - ret.add(a6); - ret.add(a7); - ret.add(a8); - ret.add(a9); - ret.add(a10); - return ret; -} - -//----- - -class parser{ -public: - parser(){ - stop = false; - } - ~parser(){ - for (std::map::iterator p=options.begin(); - p!=options.end(); p++) - delete p->second; - } - - void add(const std::string &name, - char short_name=0, - const std::string &desc=""){ - if (options.count(name)) throw cmdline_error("multiple definition: "+name); - options[name]=new option_without_value(name, short_name, desc); - ordered.push_back(options[name]); - } - - template - void add(const std::string &name, - char short_name=0, - const std::string &desc="", - bool need=true, - const T def=T()){ - add(name, short_name, desc, need, def, default_reader()); - } - - template - void add(const std::string &name, - char short_name=0, - const std::string &desc="", - bool need=true, - const T def=T(), - F reader=F()){ - if (options.count(name)) throw cmdline_error("multiple definition: "+name); - options[name]=new option_with_value_with_reader(name, short_name, need, def, desc, reader); - ordered.push_back(options[name]); - } - - void set_header(const std::string &f){ - hdr=f; - } - - void set_footer(const std::string &f){ - ftr=f; - } - - void stop_at_rest(bool s){ - stop=s; - } - - void set_program_name(const std::string &name){ - prog_name=name; - } - - bool exist(const std::string &name) const { - if (options.count(name)==0) throw cmdline_error("there is no flag: --"+name); - return options.find(name)->second->has_set(); - } - - template - const T &get(const std::string &name) const { - if (options.count(name)==0) throw cmdline_error("there is no flag: --"+name); - const option_with_value *p=dynamic_cast*>(options.find(name)->second); - if (p==NULL) throw cmdline_error("type mismatch flag '"+name+"'"); - return p->get(); - } - - const std::vector &rest() const { - return others; - } - - bool parse(const std::vector &args, bool processed_arg0 = false){ - int argc=static_cast(args.size()); - std::vector argv(argc); - - for (int i=0; i lookup; - for (std::map::iterator p=options.begin(); - p!=options.end(); p++){ - if (p->first.length()==0) continue; - char initial=p->second->short_name(); - if (initial){ - if (lookup.count(initial)>0){ - lookup[initial]=""; - errors.push_back(std::string("short option '")+initial+"' is ambiguous"); - return false; - } - else lookup[initial]=p->first; - } - } - - bool found_others = false; - - for (int i=processed_arg0 ? 0 : 1; imust()) - oss<short_description()<<" "; - } - - oss<<"[options ...] "<name().length()); - } - for (size_t i=0; ishort_name()){ - oss<<" -"<short_name()<<", "; - } - else{ - oss<<" "; - } - - oss<<"--"<name(); - for (size_t j=ordered[i]->name().length(); jdescription(); - - // allow multiline descriptions, align them properly - size_t nl = desc.find('\n'); - - while(nl != std::string::npos) - { - std::string firstline = desc.substr(0, nl); - desc = desc.substr(nl+1); - - // print the first line - oss<set()){ - errors.push_back("option needs value: --"+name); - return; - } - } - - void set_option(const std::string &name, const std::string &value){ - if (options.count(name)==0){ - errors.push_back("undefined option: --"+name); - return; - } - if (!options[name]->set(value)){ - std::string err_details = options[name]->error_details(); - if(err_details.empty()) - errors.push_back("option value is invalid: --"+name+"="+value); - else - errors.push_back("option value is invalid: --"+name+"="+value+" ("+err_details+")"); - return; - } - } - - class option_base{ - public: - virtual ~option_base(){} - - virtual bool has_value() const=0; - virtual bool set()=0; - virtual bool set(const std::string &value)=0; - virtual bool has_set() const=0; - virtual bool valid() const=0; - virtual bool must() const=0; - - virtual const std::string error_details() { return ""; } - - virtual const std::string &name() const=0; - virtual char short_name() const=0; - virtual const std::string &description() const=0; - virtual std::string short_description() const=0; - }; - - class option_without_value : public option_base { - public: - option_without_value(const std::string &name, - char short_name, - const std::string &desc) - :nam(name), snam(short_name), desc(desc), has(false){ - } - ~option_without_value(){} - - bool has_value() const { return false; } - - bool set(){ - has=true; - return true; - } - - bool set(const std::string &){ - return false; - } - - bool has_set() const { - return has; - } - - bool valid() const{ - return true; - } - - bool must() const{ - return false; - } - - const std::string &name() const{ - return nam; - } - - char short_name() const{ - return snam; - } - - const std::string &description() const { - return desc; - } - - std::string short_description() const{ - return "--"+nam; - } - - virtual const std::string error_details() { return nam+" can't have parameter"; } - - private: - std::string nam; - char snam; - std::string desc; - bool has; - }; - - template - class option_with_value : public option_base { - public: - option_with_value(const std::string &name, - char short_name, - bool need, - const T &def, - const std::string &desc) - : nam(name), snam(short_name), need(need), has(false) - , def(def), actual(def) { - this->desc=full_description(desc); - this->error = " (Unknown error)"; - } - ~option_with_value(){} - - const T &get() const { - return actual; - } - - bool has_value() const { return true; } - - bool set(){ - return false; - } - - bool set(const std::string &value){ - try{ - actual=read(value); - has=true; - } - catch(const std::exception &e){ - error = e.what(); - return false; - } - return true; - } - - virtual const std::string error_details() { return error; } - - bool has_set() const{ - return has; - } - - bool valid() const{ - if (need && !has) return false; - return true; - } - - bool must() const{ - return need; - } - - const std::string &name() const{ - return nam; - } - - char short_name() const{ - return snam; - } - - const std::string &description() const { - return desc; - } - - std::string short_description() const{ - return "--"+nam+"=<"+detail::readable_typename() + ">"; - } - - protected: - std::string full_description(const std::string &desc){ - std::string defval = detail::default_value(def); - - return - desc+" ("+ - (need?"":"optional ")+ - detail::readable_typename()+ - (!need && !defval.empty() ? "="+defval : "")+ - ")"; - } - - virtual T read(const std::string &s)=0; - - std::string nam; - char snam; - bool need; - std::string desc; - std::string error; - - bool has; - T def; - T actual; - }; - - template - class option_with_value_with_reader : public option_with_value { - public: - option_with_value_with_reader(const std::string &name, - char short_name, - bool need, - const T def, - const std::string &desc, - F reader) - : option_with_value(name, short_name, need, def, desc), reader(reader){ - std::string reader_description = this->reader.description(); - - if(!reader_description.empty()) - this->desc = this->desc + " " + reader_description; - } - - private: - T read(const std::string &s){ - return reader(s); - } - - F reader; - }; - - std::map options; - std::vector ordered; - std::string hdr; - std::string ftr; - bool stop; - - std::string prog_name; - std::vector others; - - std::vector errors; -}; - -} // cmdline diff --git a/renderdoccmd/CMakeLists.txt b/renderdoccmd/CMakeLists.txt index 0b44b442c..8c0b59e5d 100644 --- a/renderdoccmd/CMakeLists.txt +++ b/renderdoccmd/CMakeLists.txt @@ -1,5 +1,5 @@ set(sources renderdoccmd.cpp) -set(includes PRIVATE ${CMAKE_SOURCE_DIR}/renderdoc/api) +set(includes PRIVATE ${CMAKE_SOURCE_DIR}/renderdoc) set(libraries PRIVATE renderdoc) if(APPLE) @@ -37,6 +37,18 @@ elseif(UNIX) # Make sure that for the target executable we don't throw away # any shared libraries. set(LINKER_FLAGS "-Wl,--no-as-needed") + + if(ENABLE_GL) + set(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--undefined,GLDriverRegistration") + endif() + + if(ENABLE_GLES) + set(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--undefined,GLESDriverRegistration") + endif() + + if(ENABLE_VULKAN) + set(LINKER_FLAGS "${LINKER_FLAGS} -Wl,--undefined,VkDriverRegistration") + endif() endif() if(ANDROID) @@ -48,13 +60,13 @@ else() set(CMAKE_INSTALL_RPATH "$ORIGIN/:$ORIGIN/../lib/") set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}") - add_executable(renderdoccmd ${sources}) + add_executable(rdcconvert ${sources}) endif() -target_include_directories(renderdoccmd ${includes}) -target_link_libraries(renderdoccmd ${libraries}) +target_include_directories(rdcconvert ${includes}) +target_link_libraries(rdcconvert ${libraries}) -install (TARGETS renderdoccmd DESTINATION bin) +install (TARGETS rdcconvert DESTINATION bin) if(ANDROID) if(NOT DEFINED ENV{JAVA_HOME}) diff --git a/qrenderdoc/Resources/icon.ico b/renderdoccmd/icon.ico similarity index 100% rename from qrenderdoc/Resources/icon.ico rename to renderdoccmd/icon.ico diff --git a/renderdoccmd/renderdoccmd.cpp b/renderdoccmd/renderdoccmd.cpp index 9d29bbcc1..8e6ae3d2f 100644 --- a/renderdoccmd/renderdoccmd.cpp +++ b/renderdoccmd/renderdoccmd.cpp @@ -24,857 +24,129 @@ ******************************************************************************/ #include "renderdoccmd.h" -#include -#include +#include +#include #include +#include "3rdparty/tinyfiledialogs/tinyfiledialogs.h" -using std::string; -using std::wstring; +RENDERDOC_API_1_1_1 *ConverterAPI = NULL; +RENDERDOC_API_1_1_1 *RENDERDOC_LoadConverter(); -bool usingKillSignal = false; -volatile uint32_t killSignal = false; - -rdctype::array convertArgs(const std::vector &args) +int renderdoccmd(std::vector &argv) { - rdctype::array ret; - ret.create((int)args.size()); - for(size_t i = 0; i < args.size(); i++) - ret[i] = args[i]; - return ret; -} + std::string filename; -void readCapOpts(const std::string &str, CaptureOptions *opts) -{ - if(str.length() < sizeof(CaptureOptions)) - return; + bool silent = false; - // serialise from string with two chars per byte - byte *b = (byte *)opts; - for(size_t i = 0; i < sizeof(CaptureOptions); i++) - *(b++) = (byte(str[i * 2 + 0] - 'a') << 4) | byte(str[i * 2 + 1] - 'a'); -} - -void DisplayRendererPreview(IReplayController *renderer, uint32_t width, uint32_t height) -{ - if(renderer == NULL) - return; - - rdctype::array texs = renderer->GetTextures(); - - TextureDisplay d; - d.mip = 0; - d.sampleIdx = ~0U; - d.overlay = DebugOverlay::NoOverlay; - d.typeHint = CompType::Typeless; - d.CustomShader = ResourceId(); - d.HDRMul = -1.0f; - d.linearDisplayAsGamma = true; - d.FlipY = false; - d.rangemin = 0.0f; - d.rangemax = 1.0f; - d.scale = 1.0f; - d.offx = 0.0f; - d.offy = 0.0f; - d.sliceFace = 0; - d.rawoutput = false; - d.lightBackgroundColor = FloatVector(0.81f, 0.81f, 0.81f, 1.0f); - d.darkBackgroundColor = FloatVector(0.57f, 0.57f, 0.57f, 1.0f); - d.Red = d.Green = d.Blue = true; - d.Alpha = false; - - for(int32_t i = 0; i < texs.count; i++) + if(argv.size() > 1) { - if(texs[i].creationFlags & TextureCategory::SwapBuffer) + if(argv[1] == "--help" || argv[1] == "-help" || argv[1] == "/help" || argv[1] == "help" || + argv[1] == "--h" || argv[1] == "-h" || argv[1] == "-?" || argv[1] == "/?" || argv[1] == "h") { - d.texid = texs[i].ID; - break; - } - } - - rdctype::array draws = renderer->GetDrawcalls(); - - if(draws.count > 0 && draws[draws.count - 1].flags & DrawFlags::Present) - { - ResourceId id = draws[draws.count - 1].copyDestination; - if(id != ResourceId()) - d.texid = id; - } - - DisplayRendererPreview(renderer, d, width, height); -} - -std::map commands; -std::map aliases; - -void add_command(const std::string &name, Command *cmd) -{ - commands[name] = cmd; -} - -void add_alias(const std::string &alias, const std::string &command) -{ - aliases[alias] = command; -} - -static void clean_up() -{ - for(auto it = commands.begin(); it != commands.end(); ++it) - delete it->second; -} - -static int command_usage(std::string command = "") -{ - if(!command.empty()) - std::cerr << command << " is not a valid command." << std::endl << std::endl; - - std::cerr << "Usage: renderdoccmd [args ...]" << std::endl; - std::cerr << "Command line tool for capture & replay with RenderDoc." << std::endl << std::endl; - - std::cerr << "Command can be one of:" << std::endl; - - size_t max_width = 0; - for(auto it = commands.begin(); it != commands.end(); ++it) - { - if(it->second->IsInternalOnly()) - continue; - - max_width = std::max(max_width, it->first.length()); - } - - for(auto it = commands.begin(); it != commands.end(); ++it) - { - if(it->second->IsInternalOnly()) - continue; - - std::cerr << " " << it->first; - for(size_t n = it->first.length(); n < max_width + 4; n++) - std::cerr << ' '; - std::cerr << it->second->Description() << std::endl; - } - std::cerr << std::endl; - - std::cerr << "To see details of any command, see 'renderdoccmd --help'" << std::endl - << std::endl; - - std::cerr << "For more information, see ." << std::endl; - - return 2; -} - -static std::vector version_lines; - -struct VersionCommand : public Command -{ - VersionCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) {} - virtual const char *Description() { return "Print version information"; } - virtual bool IsInternalOnly() { return false; } - virtual bool IsCaptureCommand() { return false; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &) - { - std::cout << "renderdoccmd " << (sizeof(uintptr_t) == sizeof(uint64_t) ? "x64" : "x86") - << " v" MAJOR_MINOR_VERSION_STRING << " built from " << GIT_COMMIT_HASH << std::endl; - -#if defined(DISTRIBUTION_VERSION) - std::cout << "Packaged for " << DISTRIBUTION_NAME << " (" << DISTRIBUTION_VERSION << ") - " - << DISTRIBUTION_CONTACT << std::endl; -#endif - - for(size_t i = 0; i < version_lines.size(); i++) - std::cout << version_lines[i] << std::endl; - - std::cout << std::endl; - - return 0; - } -}; - -void add_version_line(const std::string &str) -{ - version_lines.push_back(str); -} - -struct HelpCommand : public Command -{ - HelpCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) {} - virtual const char *Description() { return "Print this help message"; } - virtual bool IsInternalOnly() { return false; } - virtual bool IsCaptureCommand() { return false; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &) - { - command_usage(); - return 0; - } -}; - -struct ThumbCommand : public Command -{ - ThumbCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) - { - parser.set_footer(""); - parser.add("out", 'o', "The output filename to save the file to", true, "filename.jpg"); - parser.add("format", 'f', - "The format of the output file. If empty, detected from filename", false, "", - cmdline::oneof("jpg", "png", "bmp", "tga")); - parser.add( - "max-size", 's', - "The maximum dimension of the thumbnail. Default is 0, which is unlimited.", false, 0); - } - virtual const char *Description() { return "Saves a capture's embedded thumbnail to disk."; } - virtual bool IsInternalOnly() { return false; } - virtual bool IsCaptureCommand() { return false; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &) - { - std::vector rest = parser.rest(); - if(rest.empty()) - { - std::cerr << "Error: thumb command requires a capture filename." << std::endl - << std::endl - << parser.usage(); + std::cerr + << "This is the RenderDoc conversion utility to convert v0.x captures to a newer version." + << std::endl; + std::cerr + << "It must be able to find the newer renderdoc.dll. " + << "Either in the library search path or else a prompt will ask you to browse to it." + << std::endl; + std::cerr + << "Run either with a parameter to the file (i.e. drag the file onto this exe) " + << "or else you can run with no parameters and it will prompt you to browse to the file" + << std::endl; return 0; } - string filename = rest[0]; + filename = argv[1]; - rest.erase(rest.begin()); - - RENDERDOC_InitGlobalEnv(m_Env, convertArgs(rest)); - - string outfile = parser.get("out"); - - string format = parser.get("format"); - - FileType type = FileType::JPG; - - if(format == "png") + if(argv.size() > 2 && + (argv[2] == "--silent" || argv[2] == "--quiet" || argv[2] == "-q" || argv[2] == "-s")) { - type = FileType::PNG; + silent = true; } - else if(format == "tga") - { - type = FileType::TGA; - } - else if(format == "bmp") - { - type = FileType::BMP; - } - else - { - const char *dot = strrchr(outfile.c_str(), '.'); + } - if(dot != NULL && strstr(dot, "png")) - type = FileType::PNG; - else if(dot != NULL && strstr(dot, "tga")) - type = FileType::TGA; - else if(dot != NULL && strstr(dot, "bmp")) - type = FileType::BMP; - else if(dot != NULL && strstr(dot, "jpg")) - type = FileType::JPG; - else - std::cerr << "Couldn't guess format from '" << outfile << "', defaulting to jpg." - << std::endl; - } + RENDERDOC_API_1_1_1 *api = RENDERDOC_LoadConverter(); - rdctype::array buf; + if(!api) + return 1; - ICaptureFile *file = RENDERDOC_OpenCaptureFile(filename.c_str()); - if(file->OpenStatus() == ReplayStatus::Succeeded) - { - buf = file->GetThumbnail(FileType::JPG, 0); - } - else - { - std::cerr << "Couldn't open '" << filename << "'" << std::endl; - } - file->Shutdown(); + FILE *f = fopen(filename.c_str(), "rb"); + if(f) + fclose(f); + else + filename.clear(); - if(buf.empty()) - { - std::cerr << "Couldn't fetch the thumbnail in '" << filename << "'" << std::endl; - } - else - { - FILE *f = fopen(outfile.c_str(), "wb"); + if(filename.empty()) + { + const char *filter = "*.rdc"; + const char *ret = + tinyfd_openFileDialog("Locate file to convert", NULL, 1, &filter, "RenderDoc capture", 0); - if(!f) - { - std::cerr << "Couldn't open destination file '" << outfile << "'" << std::endl; - } - else - { - fwrite(buf.elems, 1, buf.count, f); - fclose(f); + if(ret) + filename = ret; + } - std::cout << "Wrote thumbnail from '" << filename << "' to '" << outfile << "'." << std::endl; - } - } + if(filename.empty()) + return 0; + ICaptureFile *file = RENDERDOC_OpenCaptureFile(filename.c_str()); + + if(file->OpenStatus() != ReplayStatus::Succeeded) + { + tinyfd_messageBox("Couldn't load file", "Couldn't load specified capture file", "ok", "error", 1); + return 1; + } + + if(!silent) + tinyfd_messageBox("Capture loading", + "The capture will load when you press OK. " + "This will happen invisibly, please wait.", + "ok", "info", 1); + + IReplayController *renderer = NULL; + ReplayStatus status = ReplayStatus::InternalError; + std::tie(status, renderer) = file->OpenCapture(NULL); + + file->Shutdown(); + + if(status == ReplayStatus::Succeeded) + { + // prime the pump a couple of times + for(size_t i = 0; i < 3; i++) + renderer->SetFrameEvent(10000000, true); + + if(!silent) + tinyfd_messageBox( + "Capture conversion ready", + "The capture is ready to convert. Press OK to begin, this may take a moment...", "ok", + "info", 1); + + // set up for capture and do the replay we'll capture + ConverterAPI = api; + renderer->SetFrameEvent(10000000, true); + ConverterAPI = NULL; + + if(!silent) + tinyfd_messageBox("Capture converted", + "The capture has been converted and output next to this exe.", "ok", "info", + 1); + + renderer->Shutdown(); return 0; } -}; -struct CaptureCommand : public Command -{ - CaptureCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) - { - parser.set_footer(" [program arguments]"); - parser.stop_at_rest(true); - } - virtual const char *Description() { return "Launches the given executable to capture."; } - virtual bool IsInternalOnly() { return false; } - virtual bool IsCaptureCommand() { return true; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &opts) - { - if(parser.rest().empty()) - { - std::cerr << "Error: capture command requires an executable to launch." << std::endl - << std::endl - << parser.usage(); - return 0; - } + tinyfd_messageBox("Capture open failed", "Failed to open and replay capture", "ok", "error", 1); - std::string executable = parser.rest()[0]; - std::string workingDir = parser.get("working-dir"); - std::string cmdLine; - std::string logFile = parser.get("capture-file"); - - for(size_t i = 1; i < parser.rest().size(); i++) - { - if(!cmdLine.empty()) - cmdLine += ' '; - - cmdLine += EscapeArgument(parser.rest()[i]); - } - - RENDERDOC_InitGlobalEnv(m_Env, rdctype::array()); - - std::cout << "Launching '" << executable << "'"; - - if(!cmdLine.empty()) - std::cout << " with params: " << cmdLine; - - std::cout << std::endl; - - rdctype::array env; - - uint32_t ident = RENDERDOC_ExecuteAndInject( - executable.c_str(), workingDir.empty() ? "" : workingDir.c_str(), - cmdLine.empty() ? "" : cmdLine.c_str(), env, logFile.empty() ? "" : logFile.c_str(), opts, - parser.exist("wait-for-exit")); - - if(ident == 0) - { - std::cerr << "Failed to create & inject." << std::endl; - return 2; - } - - if(parser.exist("wait-for-exit")) - { - std::cerr << "'" << executable << "' finished executing." << std::endl; - ident = 0; - } - else - { - std::cerr << "Launched as ID " << ident << std::endl; - } - - return ident; - } - - std::string EscapeArgument(const std::string &arg) - { - // nothing to escape or quote - if(arg.find_first_of(" \t\r\n\"") == std::string::npos) - return arg; - - // return arg in quotes, with any quotation marks escaped - std::string ret = arg; - - size_t i = ret.find('\"'); - while(i != std::string::npos) - { - ret.insert(ret.begin() + i, '\\'); - - i = ret.find('\"', i + 2); - } - - return '"' + ret + '"'; - } -}; - -struct InjectCommand : public Command -{ - InjectCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) - { - parser.add("PID", 0, "The process ID of the process to inject.", true); - } - virtual const char *Description() { return "Injects RenderDoc into a given running process."; } - virtual bool IsInternalOnly() { return false; } - virtual bool IsCaptureCommand() { return true; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &opts) - { - uint32_t PID = parser.get("PID"); - std::string workingDir = parser.get("working-dir"); - std::string logFile = parser.get("capture-file"); - - std::cout << "Injecting into PID " << PID << std::endl; - - rdctype::array env; - - RENDERDOC_InitGlobalEnv(m_Env, convertArgs(parser.rest())); - - uint32_t ident = RENDERDOC_InjectIntoProcess(PID, env, logFile.empty() ? "" : logFile.c_str(), - opts, parser.exist("wait-for-exit")); - - if(ident == 0) - { - std::cerr << "Failed to inject." << std::endl; - return 2; - } - - if(parser.exist("wait-for-exit")) - { - std::cerr << PID << " finished executing." << std::endl; - ident = 0; - } - else - { - std::cerr << "Launched as ID " << ident << std::endl; - } - - return ident; - } -}; - -struct RemoteServerCommand : public Command -{ - RemoteServerCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) - { - parser.add("daemon", 'd', "Go into the background."); - parser.add( - "host", 'h', "The interface to listen on. By default listens on all interfaces", false, ""); - parser.add("port", 'p', "The port to listen on.", false, - RENDERDOC_GetDefaultRemoteServerPort()); - } - virtual const char *Description() - { - return "Start up a server listening as a host for remote replays."; - } - virtual bool IsInternalOnly() { return false; } - virtual bool IsCaptureCommand() { return false; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &) - { - string host = parser.get("host"); - uint32_t port = parser.get("port"); - - RENDERDOC_InitGlobalEnv(m_Env, convertArgs(parser.rest())); - - std::cerr << "Spawning a replay host listening on " << (host.empty() ? "*" : host) << ":" - << port << "..." << std::endl; - - if(parser.exist("daemon")) - { - std::cerr << "Detaching." << std::endl; - Daemonise(); - } - - usingKillSignal = true; - - RENDERDOC_BecomeRemoteServer(host.empty() ? NULL : host.c_str(), port, &killSignal); - - std::cerr << std::endl << "Cleaning up from replay hosting." << std::endl; - - return 0; - } -}; - -struct ReplayCommand : public Command -{ - ReplayCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) - { - parser.set_footer(""); - parser.add("width", 'w', "The preview window width.", false, 1280); - parser.add("height", 'h', "The preview window height.", false, 720); - parser.add("remote-host", 0, - "Instead of replaying locally, replay on this host over the network.", false); - parser.add("remote-port", 0, "If --remote-host is set, use this port.", false, - RENDERDOC_GetDefaultRemoteServerPort()); - } - virtual const char *Description() - { - return "Replay the log file and show the backbuffer on a preview window."; - } - virtual bool IsInternalOnly() { return false; } - virtual bool IsCaptureCommand() { return false; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &) - { - std::vector rest = parser.rest(); - if(rest.empty()) - { - std::cerr << "Error: capture command requires a filename to load." << std::endl - << std::endl - << parser.usage(); - return 0; - } - - string filename = rest[0]; - - rest.erase(rest.begin()); - - RENDERDOC_InitGlobalEnv(m_Env, convertArgs(rest)); - - if(parser.exist("remote-host")) - { - std::cout << "Replaying '" << filename << "' on " << parser.get("remote-host") << ":" - << parser.get("remote-port") << "." << std::endl; - - IRemoteServer *remote = NULL; - ReplayStatus status = RENDERDOC_CreateRemoteServerConnection( - parser.get("remote-host").c_str(), parser.get("remote-port"), &remote); - - if(remote == NULL || status != ReplayStatus::Succeeded) - { - std::cerr << "Error: Couldn't connect to " << parser.get("remote-host") << ":" - << parser.get("remote-port") << "." << std::endl; - std::cerr << " Have you run renderdoccmd remoteserver on '" - << parser.get("remote-host") << "'?" << std::endl; - return 1; - } - - std::cerr << "Copying capture file to remote server" << std::endl; - - rdctype::str remotePath = remote->CopyCaptureToRemote(filename.c_str(), NULL); - - IReplayController *renderer = NULL; - std::tie(status, renderer) = remote->OpenCapture(~0U, remotePath.elems, NULL); - - if(status == ReplayStatus::Succeeded) - { - DisplayRendererPreview(renderer, parser.get("width"), - parser.get("height")); - - remote->CloseCapture(renderer); - } - else - { - std::cerr << "Couldn't load and replay '" << filename << "'." << std::endl; - } - - remote->ShutdownConnection(); - } - else - { - std::cout << "Replaying '" << filename << "' locally.." << std::endl; - - ICaptureFile *file = RENDERDOC_OpenCaptureFile(filename.c_str()); - - if(file->OpenStatus() != ReplayStatus::Succeeded) - { - std::cerr << "Couldn't load '" << filename << "'." << std::endl; - return 1; - } - - IReplayController *renderer = NULL; - ReplayStatus status = ReplayStatus::InternalError; - std::tie(status, renderer) = file->OpenCapture(NULL); - - file->Shutdown(); - - if(status == ReplayStatus::Succeeded) - { - DisplayRendererPreview(renderer, parser.get("width"), - parser.get("height")); - - renderer->Shutdown(); - } - else - { - std::cerr << "Couldn't load and replay '" << filename << "'." << std::endl; - return 1; - } - } - return 0; - } -}; - -struct CapAltBitCommand : public Command -{ - CapAltBitCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) - { - parser.add("pid", 0, ""); - parser.add("log", 0, ""); - parser.add("debuglog", 0, ""); - parser.add("capopts", 0, ""); - parser.stop_at_rest(true); - } - virtual const char *Description() { return "Internal use only!"; } - virtual bool IsInternalOnly() { return true; } - virtual bool IsCaptureCommand() { return false; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &) - { - CaptureOptions cmdopts; - readCapOpts(parser.get("capopts").c_str(), &cmdopts); - - RENDERDOC_InitGlobalEnv(m_Env, rdctype::array()); - - std::vector rest = parser.rest(); - - if(rest.size() % 3 != 0) - { - std::cerr << "Invalid generated capaltbit command rest.size() == " << rest.size() << std::endl; - return 0; - } - - int numEnvs = int(rest.size() / 3); - - rdctype::array env; - env.create(numEnvs); - - for(int i = 0; i < numEnvs; i++) - { - string typeString = rest[i * 3 + 0]; - - EnvMod type = EnvMod::Set; - EnvSep sep = EnvSep::NoSep; - - if(typeString == "+env-replace") - { - type = EnvMod::Set; - sep = EnvSep::NoSep; - } - else if(typeString == "+env-append-platform") - { - type = EnvMod::Append; - sep = EnvSep::Platform; - } - else if(typeString == "+env-append-semicolon") - { - type = EnvMod::Append; - sep = EnvSep::SemiColon; - } - else if(typeString == "+env-append-colon") - { - type = EnvMod::Append; - sep = EnvSep::Colon; - } - else if(typeString == "+env-append") - { - type = EnvMod::Append; - sep = EnvSep::NoSep; - } - else if(typeString == "+env-prepend-platform") - { - type = EnvMod::Prepend; - sep = EnvSep::Platform; - } - else if(typeString == "+env-prepend-semicolon") - { - type = EnvMod::Prepend; - sep = EnvSep::SemiColon; - } - else if(typeString == "+env-prepend-colon") - { - type = EnvMod::Prepend; - sep = EnvSep::Colon; - } - else if(typeString == "+env-prepend") - { - type = EnvMod::Prepend; - sep = EnvSep::NoSep; - } - else - { - std::cerr << "Invalid generated capaltbit env '" << rest[i * 3 + 0] << std::endl; - return 0; - } - - env[i] = EnvironmentModification(type, sep, rest[i * 3 + 1].c_str(), rest[i * 3 + 2].c_str()); - } - - string debuglog = parser.get("debuglog"); - - RENDERDOC_SetDebugLogFile(debuglog.c_str()); - - int ret = RENDERDOC_InjectIntoProcess(parser.get("pid"), env, - parser.get("log").c_str(), cmdopts, false); - - return ret; - } -}; - -int renderdoccmd(const GlobalEnvironment &env, std::vector &argv) -{ - try - { - // add basic commands, and common aliases - add_command("version", new VersionCommand(env)); - - add_alias("--version", "version"); - add_alias("-v", "version"); - // for windows - add_alias("/version", "version"); - add_alias("/v", "version"); - - add_command("help", new HelpCommand(env)); - - add_alias("--help", "help"); - add_alias("-h", "help"); - add_alias("-?", "help"); - - // for windows - add_alias("/help", "help"); - add_alias("/h", "help"); - add_alias("/?", "help"); - - // add platform agnostic commands - add_command("thumb", new ThumbCommand(env)); - add_command("capture", new CaptureCommand(env)); - add_command("inject", new InjectCommand(env)); - add_command("remoteserver", new RemoteServerCommand(env)); - add_command("replay", new ReplayCommand(env)); - add_command("capaltbit", new CapAltBitCommand(env)); - - if(argv.size() <= 1) - { - int ret = command_usage(); - clean_up(); - return ret; - } - - // std::string programName = argv[0]; - - argv.erase(argv.begin()); - - std::string command = *argv.begin(); - - argv.erase(argv.begin()); - - auto it = commands.find(command); - - if(it == commands.end()) - { - auto a = aliases.find(command); - if(a != aliases.end()) - it = commands.find(a->second); - } - - if(it == commands.end()) - { - int ret = command_usage(command); - clean_up(); - return ret; - } - - cmdline::parser cmd; - - cmd.set_program_name("renderdoccmd"); - cmd.set_header(command); - - it->second->AddOptions(cmd); - - if(it->second->IsCaptureCommand()) - { - cmd.add("working-dir", 'd', "Set the working directory of the program, if launched.", - false); - cmd.add("capture-file", 'c', - "Set the filename template for new captures. Frame number will be " - "automatically appended.", - false); - cmd.add("wait-for-exit", 'w', "Wait for the target program to exit, before returning."); - - // CaptureOptions - cmd.add("opt-disallow-vsync", 0, - "Capturing Option: Disallow the application from enabling vsync."); - cmd.add("opt-disallow-fullscreen", 0, - "Capturing Option: Disallow the application from enabling fullscreen."); - cmd.add("opt-api-validation", 0, - "Capturing Option: Record API debugging events and messages."); - cmd.add("opt-api-validation-unmute", 0, - "Capturing Option: Unmutes API debugging output from --opt-api-validation."); - cmd.add("opt-capture-callstacks", 0, - "Capturing Option: Capture CPU callstacks for API events."); - cmd.add("opt-capture-callstacks-only-draws", 0, - "Capturing Option: When capturing CPU callstacks, only capture them from drawcalls."); - cmd.add("opt-delay-for-debugger", 0, - "Capturing Option: Specify a delay in seconds to wait for a debugger to attach.", - false, 0, cmdline::range(0, 10000)); - cmd.add("opt-verify-map-writes", 0, - "Capturing Option: Verify any writes to mapped buffers, by bounds checking."); - cmd.add("opt-hook-children", 0, - "Capturing Option: Hooks any system API calls that create child processes."); - cmd.add("opt-ref-all-resources", 0, - "Capturing Option: Include all live resources, not just those used by a frame."); - cmd.add("opt-save-all-initials", 0, - "Capturing Option: Save all initial resource contents at frame start."); - cmd.add("opt-capture-all-cmd-lists", 0, - "Capturing Option: In D3D11, record all command lists from application start."); - } - - cmd.parse_check(argv, true); - - CaptureOptions opts; - RENDERDOC_GetDefaultCaptureOptions(&opts); - - if(it->second->IsCaptureCommand()) - { - if(cmd.exist("opt-disallow-vsync")) - opts.AllowVSync = false; - if(cmd.exist("opt-disallow-fullscreen")) - opts.AllowFullscreen = false; - if(cmd.exist("opt-api-validation")) - opts.APIValidation = true; - if(cmd.exist("opt-api-validation-unmute")) - opts.DebugOutputMute = false; - if(cmd.exist("opt-capture-callstacks")) - opts.CaptureCallstacks = true; - if(cmd.exist("opt-capture-callstacks-only-draws")) - opts.CaptureCallstacksOnlyDraws = true; - if(cmd.exist("opt-verify-map-writes")) - opts.VerifyMapWrites = true; - if(cmd.exist("opt-hook-children")) - opts.HookIntoChildren = true; - if(cmd.exist("opt-ref-all-resources")) - opts.RefAllResources = true; - if(cmd.exist("opt-save-all-initials")) - opts.SaveAllInitials = true; - if(cmd.exist("opt-capture-all-cmd-lists")) - opts.CaptureAllCmdLists = true; - - opts.DelayForDebugger = (uint32_t)cmd.get("opt-delay-for-debugger"); - } - - if(cmd.exist("help")) - { - std::cerr << cmd.usage() << std::endl; - clean_up(); - return 0; - } - - int ret = it->second->Execute(cmd, opts); - clean_up(); - return ret; - } - catch(std::exception e) - { - fprintf(stderr, "Unexpected exception: %s\n", e.what()); - - exit(1); - } + return 0; } -int renderdoccmd(const GlobalEnvironment &env, int argc, char **c_argv) +int renderdoccmd(int argc, char **c_argv) { std::vector argv; argv.resize(argc); for(int i = 0; i < argc; i++) argv[i] = c_argv[i]; - return renderdoccmd(env, argv); + return renderdoccmd(argv); } diff --git a/renderdoccmd/renderdoccmd.h b/renderdoccmd/renderdoccmd.h index 59acb01f0..10da52f98 100644 --- a/renderdoccmd/renderdoccmd.h +++ b/renderdoccmd/renderdoccmd.h @@ -24,37 +24,7 @@ #pragma once -#include -#include "3rdparty/cmdline/cmdline.h" +#include -struct Command -{ - Command(const GlobalEnvironment &env) { m_Env = env; } - virtual ~Command() {} - virtual void AddOptions(cmdline::parser &parser) = 0; - virtual int Execute(cmdline::parser &parser, const CaptureOptions &opts) = 0; - virtual const char *Description() = 0; - - virtual bool IsInternalOnly() = 0; - virtual bool IsCaptureCommand() = 0; - - GlobalEnvironment m_Env; -}; - -extern bool usingKillSignal; -extern volatile uint32_t killSignal; - -void add_version_line(const std::string &str); - -void add_command(const std::string &name, Command *cmd); -void add_alias(const std::string &alias, const std::string &command); - -int renderdoccmd(const GlobalEnvironment &env, int argc, char **argv); -int renderdoccmd(const GlobalEnvironment &env, std::vector &argv); - -void readCapOpts(const std::string &str, CaptureOptions *opts); - -// these must be defined in platform .cpps -void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width, - uint32_t height); -void Daemonise(); +int renderdoccmd(int argc, char **argv); +int renderdoccmd(std::vector &argv); \ No newline at end of file diff --git a/renderdoccmd/renderdoccmd.rc b/renderdoccmd/renderdoccmd.rc index 9288b8195..3a848802b 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..20a768229 100644 --- a/renderdoccmd/renderdoccmd.vcxproj +++ b/renderdoccmd/renderdoccmd.vcxproj @@ -22,7 +22,7 @@ {D03DF2F9-513C-4084-BBDD-1DEE8D9250D7} Win32Proj renderdoccmd - renderdoccmd + rdcconvert @@ -101,7 +101,7 @@ Level3 Disabled WIN32;_CRT_SECURE_NO_WARNINGS;RENDERDOC_PLATFORM_WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(SolutionDir)renderdocshim\;$(SolutionDir)renderdoc\api\;$(SolutionDir)renderdoc\api\replay;$(SolutionDir)renderdoc\3rdparty\ + $(SolutionDir)renderdoc;$(SolutionDir)renderdoc\api\replay;$(SolutionDir)renderdoc\3rdparty\ MultiThreadedDLL true ProgramDatabase @@ -109,10 +109,10 @@ Windows true - psapi.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies) + Shlwapi.lib;psapi.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies) - $(SolutionDir)renderdoc\api\replay + $(SolutionDir)renderdoc @@ -122,7 +122,7 @@ Level3 Disabled WIN32;_CRT_SECURE_NO_WARNINGS;WIN64;RENDERDOC_PLATFORM_WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(SolutionDir)renderdocshim\;$(SolutionDir)renderdoc\api\;$(SolutionDir)renderdoc\api\replay;$(SolutionDir)renderdoc\3rdparty\ + $(SolutionDir)renderdoc;$(SolutionDir)renderdoc\api\replay;$(SolutionDir)renderdoc\3rdparty\ MultiThreadedDLL true ProgramDatabase @@ -130,10 +130,10 @@ Windows true - psapi.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies) + Shlwapi.lib;psapi.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies) - $(SolutionDir)renderdoc\api\replay + $(SolutionDir)renderdoc @@ -145,7 +145,7 @@ true true WIN32;_CRT_SECURE_NO_WARNINGS;RENDERDOC_PLATFORM_WIN32;NDEBUG;RELEASE;_CONSOLE;%(PreprocessorDefinitions) - $(SolutionDir)renderdocshim\;$(SolutionDir)renderdoc\api\;$(SolutionDir)renderdoc\api\replay;$(SolutionDir)renderdoc\3rdparty\ + $(SolutionDir)renderdoc;$(SolutionDir)renderdoc\api\replay;$(SolutionDir)renderdoc\3rdparty\ true @@ -153,10 +153,10 @@ true true true - $(SolutionDir)$(Platform)\$(Configuration)\breakpad_common.lib;$(SolutionDir)$(Platform)\$(Configuration)\crash_generation_server.lib;psapi.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies) + Shlwapi.lib;psapi.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies) - $(SolutionDir)renderdoc\api\replay + $(SolutionDir)renderdoc @@ -168,7 +168,7 @@ true true WIN32;_CRT_SECURE_NO_WARNINGS;WIN64;RENDERDOC_PLATFORM_WIN32;NDEBUG;RELEASE;_CONSOLE;%(PreprocessorDefinitions) - $(SolutionDir)renderdocshim\;$(SolutionDir)renderdoc\api\;$(SolutionDir)renderdoc\api\replay;$(SolutionDir)renderdoc\3rdparty\ + $(SolutionDir)renderdoc;$(SolutionDir)renderdoc\api\replay;$(SolutionDir)renderdoc\3rdparty\ true @@ -176,14 +176,13 @@ true true true - $(SolutionDir)$(Platform)\$(Configuration)\breakpad_common.lib;$(SolutionDir)$(Platform)\$(Configuration)\crash_generation_server.lib;psapi.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies) + Shlwapi.lib;psapi.lib;ws2_32.lib;Wininet.lib;%(AdditionalDependencies) - $(SolutionDir)renderdoc\api\replay + $(SolutionDir)renderdoc - true @@ -200,8 +199,6 @@ - - @@ -216,7 +213,7 @@ true false true - false + true diff --git a/renderdoccmd/renderdoccmd.vcxproj.filters b/renderdoccmd/renderdoccmd.vcxproj.filters index e0601464b..f5acc7c16 100644 --- a/renderdoccmd/renderdoccmd.vcxproj.filters +++ b/renderdoccmd/renderdoccmd.vcxproj.filters @@ -3,9 +3,6 @@ - - 3rdparty - @@ -17,21 +14,12 @@ Resources - - 3rdparty - - - 3rdparty - {3979a11e-8029-4886-a51e-a2a9bb91d69f} - - {a8ca84b9-239b-4640-95e9-f9bd141ef465} - diff --git a/renderdoccmd/renderdoccmd_linux.cpp b/renderdoccmd/renderdoccmd_linux.cpp index 48e5e7b5a..850ecdb65 100644 --- a/renderdoccmd/renderdoccmd_linux.cpp +++ b/renderdoccmd/renderdoccmd_linux.cpp @@ -24,432 +24,8 @@ ******************************************************************************/ #include "renderdoccmd.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(RENDERDOC_WINDOWING_XLIB) -#include -#endif - -#include - -using std::string; -using std::vector; - -void Daemonise() -{ - // don't change dir, but close stdin/stdou - daemon(1, 0); -} - -struct VulkanRegisterCommand : public Command -{ - VulkanRegisterCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) - { - parser.add("ignore", 'i', "Do nothing and don't warn about Vulkan layer issues."); - parser.add( - "system", '\0', - "Install layer registration to /etc instead of $HOME/.local (requires root privileges)"); - } - virtual const char *Description() - { - return "Attempt to automatically fix Vulkan layer registration issues"; - } - virtual bool IsInternalOnly() { return false; } - virtual bool IsCaptureCommand() { return false; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &) - { - bool ignore = (parser.exist("ignore")); - - if(ignore) - { - std::cout << "Not fixing vulkan layer issues, and suppressing future warnings." << std::endl; - std::cout << "To undo, remove '$HOME/.renderdoc/ignore_vulkan_layer_issues'." << std::endl; - - string ignorePath = string(getenv("HOME")) + "/.renderdoc/"; - - mkdir(ignorePath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); - - ignorePath += "ignore_vulkan_layer"; - - FILE *f = fopen(ignorePath.c_str(), "w"); - - if(f) - { - fputs("This file suppresses any checks for vulkan layer issues.\n", f); - fputs("Delete this file to restore default checking.\n", f); - - fclose(f); - } - else - { - std::cerr << "Couldn't create '$HOME/.renderdoc/ignore_vulkan_layer_issues'." << std::endl; - } - - return 0; - } - - RENDERDOC_UpdateVulkanLayerRegistration(parser.exist("system")); - - return 0; - } -}; - -void VerifyVulkanLayer(const GlobalEnvironment &env, int argc, char *argv[]) -{ - VulkanLayerFlags flags = VulkanLayerFlags::NoFlags; - rdctype::array myJSONs; - rdctype::array otherJSONs; - - bool needUpdate = RENDERDOC_NeedVulkanLayerRegistration(&flags, &myJSONs, &otherJSONs); - - if(!needUpdate) - { - if(!(flags & VulkanLayerFlags::Unfixable)) - add_command("vulkanregister", new VulkanRegisterCommand(env)); - return; - } - - std::cerr << "*************************************************************************" - << std::endl; - std::cerr << "** Warning: Vulkan capture possibly not configured. **" - << std::endl; - std::cerr << std::endl; - - if(flags & VulkanLayerFlags::OtherInstallsRegistered) - std::cerr << "Multiple RenderDoc layers are registered, possibly from different builds." - << std::endl; - - if(!(flags & VulkanLayerFlags::ThisInstallRegistered)) - std::cerr << "This build's RenderDoc layer is not registered." << std::endl; - - std::cerr << "To fix this, the following actions must take place: " << std::endl << std::endl; - - const bool registerAll = bool(flags & VulkanLayerFlags::RegisterAll); - const bool updateAllowed = bool(flags & VulkanLayerFlags::UpdateAllowed); - - for(const rdctype::str &j : otherJSONs) - std::cerr << (updateAllowed ? "Unregister/update: " : "Unregister: ") << j.c_str() << std::endl; - - if(!(flags & VulkanLayerFlags::ThisInstallRegistered)) - { - if(registerAll) - { - for(const rdctype::str &j : myJSONs) - std::cerr << (updateAllowed ? "Register/update: " : "Register: ") << j.c_str() << std::endl; - } - else - { - std::cerr << (updateAllowed ? "Register one of:" : "Register/update one of:") << std::endl; - for(const rdctype::str &j : myJSONs) - std::cerr << " -- " << j.c_str() << "\n"; - } - } - - std::cerr << std::endl; - - if(flags & VulkanLayerFlags::Unfixable) - { - std::cerr << "NOTE: The renderdoc layer registered in /usr is reserved for distribution" - << std::endl; - std::cerr << "controlled packages. RenderDoc cannot automatically unregister this even" - << std::endl; - std::cerr << "with root permissions, you must fix this conflict manually." << std::endl - << std::endl; - - std::cerr << "*************************************************************************" - << std::endl; - std::cerr << std::endl; - - return; - } - - std::cerr << "NOTE: Automatically removing or changing the layer registered in /etc" << std::endl; - std::cerr << "will require root privileges." << std::endl << std::endl; - - std::cerr << "To fix these issues run the 'vulkanregister' command." << std::endl; - std::cerr << "Use 'vulkanregister --help' to see more information." << std::endl; - std::cerr << std::endl; - - std::cerr << "By default 'vulkanregister' will register the layer to your $HOME folder." - << std::endl; - std::cerr << "This does not require root permissions." << std::endl; - std::cerr << std::endl; - std::cerr << "If you want to install to the system, run 'vulkanregister --system'." << std::endl; - std::cerr << "This requires root permissions to write to /etc/vulkan/." << std::endl; - - // just in case there's a strange install that is misdetected or something then allow - // users to suppress this message and just say "I know what I'm doing". - std::cerr << std::endl; - std::cerr << "To suppress this warning in future, run 'vulkanregister --ignore'." << std::endl; - - std::cerr << "*************************************************************************" - << std::endl; - std::cerr << std::endl; - - add_command("vulkanregister", new VulkanRegisterCommand(env)); -} - -static Display *display = NULL; - -void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width, - uint32_t height) -{ -// we only have the preview implemented for platforms that have xlib & xcb. It's unlikely -// a meaningful platform exists with only one, and at the time of writing no other windowing -// systems are supported on linux for the replay -#if defined(RENDERDOC_WINDOWING_XLIB) && defined(RENDERDOC_WINDOWING_XCB) - // need to create a hybrid setup xlib and xcb in case only one or the other is supported. - // We'll prefer xcb - - if(display == NULL) - { - std::cerr << "Couldn't open X Display" << std::endl; - return; - } - - int scr = DefaultScreen(display); - - xcb_connection_t *connection = XGetXCBConnection(display); - - if(connection == NULL) - { - XCloseDisplay(display); - std::cerr << "Couldn't get XCB connection from Xlib Display" << std::endl; - return; - } - - XSetEventQueueOwner(display, XCBOwnsEventQueue); - - const xcb_setup_t *setup = xcb_get_setup(connection); - xcb_screen_iterator_t iter = xcb_setup_roots_iterator(setup); - while(scr-- > 0) - xcb_screen_next(&iter); - - xcb_screen_t *screen = iter.data; - - uint32_t value_mask, value_list[32]; - - xcb_window_t window = xcb_generate_id(connection); - - value_mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK; - value_list[0] = screen->black_pixel; - value_list[1] = - XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_STRUCTURE_NOTIFY; - - xcb_create_window(connection, XCB_COPY_FROM_PARENT, window, screen->root, 0, 0, width, height, 0, - XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->root_visual, value_mask, value_list); - - /* Magic code that will send notification when window is destroyed */ - xcb_intern_atom_cookie_t cookie = xcb_intern_atom(connection, 1, 12, "WM_PROTOCOLS"); - xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply(connection, cookie, 0); - - xcb_intern_atom_cookie_t cookie2 = xcb_intern_atom(connection, 0, 16, "WM_DELETE_WINDOW"); - xcb_intern_atom_reply_t *atom_wm_delete_window = xcb_intern_atom_reply(connection, cookie2, 0); - - xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, - 8, sizeof("renderdoccmd") - 1, "renderdoccmd"); - - xcb_change_property(connection, XCB_PROP_MODE_REPLACE, window, (*reply).atom, 4, 32, 1, - &(*atom_wm_delete_window).atom); - free(reply); - - xcb_map_window(connection, window); - - rdctype::array systems = renderer->GetSupportedWindowSystems(); - - bool xcb = false, xlib = false; - - for(int32_t i = 0; i < systems.count; i++) - { - if(systems[i] == WindowingSystem::Xlib) - xlib = true; - if(systems[i] == WindowingSystem::XCB) - xcb = true; - } - - IReplayOutput *out = NULL; - - // prefer xcb - if(xcb) - { - XCBWindowData windowData; - windowData.connection = connection; - windowData.window = window; - - out = renderer->CreateOutput(WindowingSystem::XCB, &windowData, ReplayOutputType::Texture); - } - else if(xlib) - { - XlibWindowData windowData; - windowData.display = display; - windowData.window = (Drawable)window; // safe to cast types - - out = renderer->CreateOutput(WindowingSystem::Xlib, &windowData, ReplayOutputType::Texture); - } - else - { - std::cerr << "Neither XCB nor XLib are supported, can't create window." << std::endl; - std::cerr << "Supported systems: "; - for(int32_t i = 0; i < systems.count; i++) - std::cerr << (uint32_t)systems[i] << std::endl; - std::cerr << std::endl; - return; - } - - out->SetTextureDisplay(displayCfg); - - xcb_flush(connection); - - bool done = false; - while(!done) - { - xcb_generic_event_t *event; - - event = xcb_poll_for_event(connection); - if(event) - { - switch(event->response_type & 0x7f) - { - case XCB_EXPOSE: - renderer->SetFrameEvent(10000000, true); - out->Display(); - break; - case XCB_CLIENT_MESSAGE: - if((*(xcb_client_message_event_t *)event).data.data32[0] == (*atom_wm_delete_window).atom) - { - done = true; - } - break; - case XCB_KEY_RELEASE: - { - const xcb_key_release_event_t *key = (const xcb_key_release_event_t *)event; - - if(key->detail == 0x9) - done = true; - } - break; - case XCB_DESTROY_NOTIFY: done = true; break; - default: break; - } - free(event); - } - - renderer->SetFrameEvent(10000000, true); - out->Display(); - - usleep(100000); - } -#else - std::cerr << "No supporting windowing systems defined at build time (xlib and xcb)" << std::endl; -#endif -} - -void sig_handler(int signo) -{ - if(usingKillSignal) - killSignal = true; - else - exit(1); -} int main(int argc, char *argv[]) { - setlocale(LC_CTYPE, ""); - - signal(SIGINT, sig_handler); - signal(SIGTERM, sig_handler); - - GlobalEnvironment env; - -#if defined(RENDERDOC_WINDOWING_XLIB) || defined(RENDERDOC_WINDOWING_XCB) - // call XInitThreads - although we don't use xlib concurrently the driver might need to. - XInitThreads(); - - // we don't check if display successfully opened, it's only a problem if it's needed later. - display = env.xlibDisplay = XOpenDisplay(NULL); -#endif - -#if defined(RENDERDOC_SUPPORT_VULKAN) - VerifyVulkanLayer(env, argc, argv); -#endif - - // add compiled-in support to version line - { - string support = "APIs supported at compile-time: "; - int count = 0; - -#if defined(RENDERDOC_SUPPORT_VULKAN) - support += "Vulkan, "; - count++; -#endif - -#if defined(RENDERDOC_SUPPORT_GL) - support += "GL, "; - count++; -#endif - -#if defined(RENDERDOC_SUPPORT_GLES) - support += "GLES, "; - count++; -#endif - - if(count == 0) - { - support += "None."; - } - else - { - // remove trailing ', ' - support.pop_back(); - support.pop_back(); - support += "."; - } - - add_version_line(support); - - support = "Windowing systems supported at compile-time: "; - count = 0; - -#if defined(RENDERDOC_WINDOWING_XLIB) - support += "xlib, "; - count++; -#endif - -#if defined(RENDERDOC_WINDOWING_XCB) - support += "XCB, "; - count++; -#endif - -#if defined(RENDERDOC_SUPPORT_VULKAN) - support += "Vulkan KHR_display, "; - count++; -#endif - - if(count == 0) - { - support += "None."; - } - else - { - // remove trailing ', ' - support.pop_back(); - support.pop_back(); - support += "."; - } - - add_version_line(support); - } - - return renderdoccmd(env, argc, argv); + return renderdoccmd(argc, argv); } diff --git a/renderdoccmd/renderdoccmd_win32.cpp b/renderdoccmd/renderdoccmd_win32.cpp index b9ce300a5..8d96a2872 100644 --- a/renderdoccmd/renderdoccmd_win32.cpp +++ b/renderdoccmd/renderdoccmd_win32.cpp @@ -24,813 +24,9 @@ ******************************************************************************/ #include "renderdoccmd.h" -#include -#include #include #include #include -#include "miniz/miniz.h" -#include "resource.h" - -#include -#include - -using std::string; -using std::wstring; -using std::vector; - -HINSTANCE hInstance = NULL; - -#if defined(RELEASE) -// breakpad -#include "breakpad/client/windows/crash_generation/client_info.h" -#include "breakpad/client/windows/crash_generation/crash_generation_server.h" -#include "breakpad/common/windows/http_upload.h" - -using google_breakpad::ClientInfo; -using google_breakpad::CrashGenerationServer; - -bool exitServer = false; - -static HINSTANCE CrashHandlerInst = 0; -static HWND CrashHandlerWnd = 0; - -bool uploadReport = false; -bool uploadDump = false; -bool uploadLog = false; -string reproSteps = ""; - -wstring dump = L""; -vector customInfo; -wstring logpath = L""; - -INT_PTR CALLBACK CrashHandlerProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch(message) - { - case WM_INITDIALOG: - { - HANDLE hIcon = LoadImage(CrashHandlerInst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0); - - if(hIcon) - { - SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); - SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - } - - SetDlgItemTextW( - hDlg, IDC_WELCOMETEXT, - L"RenderDoc has encountered an unhandled exception or other similar unrecoverable " - L"error.\n\n" - L"If you had captured but not saved a logfile it should still be available in %TEMP% and " - L"will not be deleted," - L"you can try loading it again.\n\n" - L"A minidump has been created and the RenderDoc diagnostic log (NOT any capture logfile) " - L"is available if you would like " - L"to send them back to be analysed. The path for both is found below if you would like " - L"to inspect their contents and censor as appropriate.\n\n" - L"Neither contains any significant private information, the minidump has some internal " - 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"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 " - L"e.g. for updates about its status just include your email & name. Thank you!\n\n" - L"Baldur (baldurk@baldurk.org)"); - - SetDlgItemTextW(hDlg, IDC_DUMPPATH, dump.c_str()); - SetDlgItemTextW(hDlg, IDC_LOGPATH, logpath.c_str()); - - CheckDlgButton(hDlg, IDC_SENDDUMP, BST_CHECKED); - CheckDlgButton(hDlg, IDC_SENDLOG, BST_CHECKED); - - { - RECT r; - GetClientRect(hDlg, &r); - - int xPos = (GetSystemMetrics(SM_CXSCREEN) - r.right) / 2; - int yPos = (GetSystemMetrics(SM_CYSCREEN) - r.bottom) / 2; - - SetWindowPos(hDlg, HWND_TOPMOST, xPos, yPos, 0, 0, SWP_NOSIZE); - } - - return (INT_PTR)TRUE; - } - - case WM_SHOWWINDOW: - { - { - RECT r; - GetClientRect(hDlg, &r); - - int xPos = (GetSystemMetrics(SM_CXSCREEN) - r.right) / 2; - int yPos = (GetSystemMetrics(SM_CYSCREEN) - r.bottom) / 2; - - SetWindowPos(hDlg, HWND_NOTOPMOST, xPos, yPos, 0, 0, SWP_NOSIZE); - } - - return (INT_PTR)TRUE; - } - - case WM_COMMAND: - { - int ID = LOWORD(wParam); - - if(ID == IDC_DONTSEND) - { - EndDialog(hDlg, 0); - return (INT_PTR)TRUE; - } - else if(ID == IDC_SEND) - { - uploadReport = true; - uploadDump = (IsDlgButtonChecked(hDlg, IDC_SENDDUMP) != 0); - uploadLog = (IsDlgButtonChecked(hDlg, IDC_SENDLOG) != 0); - - char notes[4097] = {0}; - - GetDlgItemTextA(hDlg, IDC_NAME, notes, 4096); - notes[4096] = 0; - - reproSteps = "Name: "; - reproSteps += notes; - reproSteps += "\n"; - - memset(notes, 0, 4096); - GetDlgItemTextA(hDlg, IDC_EMAIL, notes, 4096); - notes[4096] = 0; - - reproSteps += "Email: "; - reproSteps += notes; - reproSteps += "\n\n"; - - memset(notes, 0, 4096); - GetDlgItemTextA(hDlg, IDC_REPRO, notes, 4096); - notes[4096] = 0; - - reproSteps += notes; - - EndDialog(hDlg, 0); - return (INT_PTR)TRUE; - } - } - break; - - case WM_QUIT: - case WM_DESTROY: - case WM_CLOSE: - { - EndDialog(hDlg, 0); - return (INT_PTR)TRUE; - } - break; - } - return (INT_PTR)FALSE; -} - -static void _cdecl OnClientCrashed(void *context, const ClientInfo *client_info, - const wstring *dump_path) -{ - if(dump_path) - { - dump = *dump_path; - - google_breakpad::CustomClientInfo custom = client_info->GetCustomInfo(); - - for(size_t i = 0; i < custom.count; i++) - customInfo.push_back(custom.entries[i]); - } - - exitServer = true; -} - -static void _cdecl OnClientExited(void *context, const ClientInfo *client_info) -{ - exitServer = true; -} -#endif - -LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - if(msg == WM_CLOSE) - { - DestroyWindow(hwnd); - return 0; - } - if(msg == WM_DESTROY) - { - PostQuitMessage(0); - return 0; - } - return DefWindowProc(hwnd, msg, wParam, lParam); -} - -void Daemonise() -{ - // nothing really to do, windows version of renderdoccmd is already 'detached' -} - -void DisplayRendererPreview(IReplayController *renderer, TextureDisplay &displayCfg, uint32_t width, - uint32_t height) -{ - RECT wr = {0, 0, (LONG)width, (LONG)height}; - AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, FALSE); - - HWND wnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"renderdoccmd", L"renderdoccmd", WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, wr.right - wr.left, wr.bottom - wr.top, - NULL, NULL, hInstance, NULL); - - if(wnd == NULL) - return; - - ShowWindow(wnd, SW_SHOW); - UpdateWindow(wnd); - - IReplayOutput *out = renderer->CreateOutput(WindowingSystem::Win32, wnd, ReplayOutputType::Texture); - - out->SetTextureDisplay(displayCfg); - - MSG msg; - ZeroMemory(&msg, sizeof(msg)); - while(true) - { - // Check to see if any messages are waiting in the queue - while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - // Translate the message and dispatch it to WindowProc() - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - // If the message is WM_QUIT, exit the while loop - if(msg.message == WM_QUIT) - break; - - // set to random event beyond the end of the frame to ensure output is marked as dirty - renderer->SetFrameEvent(10000000, true); - out->Display(); - - Sleep(40); - } - - DestroyWindow(wnd); -} - -struct UpgradeCommand : public Command -{ - UpgradeCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) { parser.add("path", 0, ""); } - virtual const char *Description() { return "Internal use only!"; } - virtual bool IsInternalOnly() { return true; } - virtual bool IsCaptureCommand() { return false; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &) - { - string originalpath = parser.get("path"); - - wstring wide_path; - - { - wchar_t *conv = new wchar_t[originalpath.size() + 1]; - - MultiByteToWideChar(CP_UTF8, 0, originalpath.c_str(), -1, conv, int(originalpath.size() + 1)); - - wide_path = conv; - - delete[] conv; - } - - // Wait for UI to exit - Sleep(3000); - - mz_zip_archive zip; - ZeroMemory(&zip, sizeof(zip)); - - bool successful = false; - wstring failReason; - - mz_bool b = mz_zip_reader_init_file(&zip, "./update.zip", 0); - - if(b) - { - mz_uint numfiles = mz_zip_reader_get_num_files(&zip); - - // first create directories - for(mz_uint i = 0; i < numfiles; i++) - { - if(mz_zip_reader_is_file_a_directory(&zip, i)) - { - mz_zip_archive_file_stat zstat; - mz_zip_reader_file_stat(&zip, i, &zstat); - - const char *fn = zstat.m_filename; - // skip first directory because it's RenderDoc_Version_Bitness/ - fn = strchr(fn, '/'); - if(fn) - fn++; - - if(fn && *fn) - { - wchar_t conv[MAX_PATH] = {0}; - wchar_t *wfn = conv; - - // I know the zip only contains ASCII chars, just upcast - while(*fn) - *(wfn++) = wchar_t(*(fn++)); - - wstring target = wide_path + conv; - - wfn = &target[0]; - - // convert slashes because CreateDirectory barfs on - // proper slashes. - while(*(wfn++)) - { - if(*wfn == L'/') - *wfn = L'\\'; - } - - CreateDirectoryW(target.c_str(), NULL); - } - } - } - - // next make sure we can get read+write access to every file. If not - // one might be in use, but we definitely can't update it - successful = true; - - for(mz_uint i = 0; successful && i < numfiles; i++) - { - if(!mz_zip_reader_is_file_a_directory(&zip, i)) - { - mz_zip_archive_file_stat zstat; - mz_zip_reader_file_stat(&zip, i, &zstat); - - const char *fn = zstat.m_filename; - // skip first directory because it's RenderDoc_Version_Bitness/ - fn = strchr(fn, '/'); - if(fn) - fn++; - - if(fn && *fn) - { - wchar_t conv[MAX_PATH] = {0}; - wchar_t *wfn = conv; - - // I know the zip only contains ASCII chars, just upcast - while(*fn) - *(wfn++) = wchar_t(*(fn++)); - - wstring target = wide_path + conv; - - wfn = &target[0]; - - // convert slashes just to be consistent - while(*(wfn++)) - { - if(*wfn == L'/') - *wfn = L'\\'; - } - - FILE *f = NULL; - _wfopen_s(&f, target.c_str(), L"a+"); - if(!f) - { - failReason = L"\"Couldn't modify an install file - likely file is in use.\""; - successful = false; - } - else - { - fclose(f); - } - } - } - } - - for(mz_uint i = 0; successful && i < numfiles; i++) - { - if(!mz_zip_reader_is_file_a_directory(&zip, i)) - { - mz_zip_archive_file_stat zstat; - mz_zip_reader_file_stat(&zip, i, &zstat); - - const char *fn = zstat.m_filename; - // skip first directory because it's RenderDoc_Version_Bitness/ - fn = strchr(fn, '/'); - if(fn) - fn++; - - if(fn && *fn) - { - wchar_t conv[MAX_PATH] = {0}; - wchar_t *wfn = conv; - - // I know the zip only contains ASCII chars, just upcast - while(*fn) - *(wfn++) = wchar_t(*(fn++)); - - wstring target = wide_path + conv; - - wfn = &target[0]; - - // convert slashes just to be consistent - while(*(wfn++)) - { - if(*wfn == L'/') - *wfn = L'\\'; - } - - mz_zip_reader_extract_to_wfile(&zip, i, target.c_str(), 0); - } - } - } - } - else - { - failReason = L"\"Failed to open update .zip file - possibly corrupted.\""; - } - - // run original UI exe and tell it an update succeeded - wstring cmdline = L"\""; - cmdline += wide_path; - cmdline += L"/renderdocui.exe\" "; - if(successful) - cmdline += L"--updatedone"; - else - cmdline += L"--updatefailed " + failReason; - - wchar_t *paramsAlloc = new wchar_t[512]; - - ZeroMemory(paramsAlloc, sizeof(wchar_t) * 512); - - wcscpy_s(paramsAlloc, sizeof(wchar_t) * 511, cmdline.c_str()); - - PROCESS_INFORMATION pi; - STARTUPINFOW si; - ZeroMemory(&pi, sizeof(pi)); - ZeroMemory(&si, sizeof(si)); - - CreateProcessW(NULL, paramsAlloc, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); - - if(pi.dwProcessId != 0) - { - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - } - - delete[] paramsAlloc; - - return 0; - } -}; - -#if defined(RELEASE) -struct CrashHandlerCommand : public Command -{ - CrashHandlerCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) {} - virtual const char *Description() { return "Internal use only!"; } - virtual bool IsInternalOnly() { return true; } - virtual bool IsCaptureCommand() { return false; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &) - { - CrashGenerationServer *crashServer = NULL; - - wchar_t tempPath[MAX_PATH] = {0}; - GetTempPathW(MAX_PATH - 1, tempPath); - - Sleep(100); - - wstring dumpFolder = tempPath; - dumpFolder += L"RenderDoc/dumps"; - - CreateDirectoryW(dumpFolder.c_str(), NULL); - - crashServer = new CrashGenerationServer(L"\\\\.\\pipe\\RenderDocBreakpadServer", NULL, NULL, - NULL, OnClientCrashed, NULL, OnClientExited, NULL, NULL, - NULL, true, &dumpFolder); - - if(!crashServer->Start()) - { - delete crashServer; - crashServer = NULL; - return 1; - } - - CrashHandlerInst = hInstance; - - CrashHandlerWnd = - CreateWindowEx(WS_EX_CLIENTEDGE, L"renderdoccmd", L"renderdoccmd", WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, 10, 10, NULL, NULL, hInstance, NULL); - - HANDLE hIcon = LoadImage(CrashHandlerInst, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0); - - if(hIcon) - { - SendMessage(CrashHandlerWnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); - SendMessage(CrashHandlerWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - } - - ShowWindow(CrashHandlerWnd, SW_HIDE); - - HANDLE readyEvent = CreateEventA(NULL, TRUE, FALSE, "RENDERDOC_CRASHHANDLE"); - - if(readyEvent != NULL) - { - SetEvent(readyEvent); - - CloseHandle(readyEvent); - } - - MSG msg; - ZeroMemory(&msg, sizeof(msg)); - while(!exitServer) - { - // Check to see if any messages are waiting in the queue - while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) - { - // Translate the message and dispatch it to WindowProc() - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - // If the message is WM_QUIT, exit the while loop - if(msg.message == WM_QUIT) - break; - - Sleep(100); - } - - delete crashServer; - crashServer = NULL; - - if(!dump.empty()) - { - logpath = L""; - - string report = ""; - - for(size_t i = 0; i < customInfo.size(); i++) - { - wstring name = customInfo[i].name; - wstring val = customInfo[i].value; - - if(name == L"logpath") - { - logpath = val; - } - else if(name == L"ptime") - { - // breakpad uptime, ignore. - } - else - { - report += string(name.begin(), name.end()) + ": " + string(val.begin(), val.end()) + "\n"; - } - } - - DialogBox(CrashHandlerInst, MAKEINTRESOURCE(IDD_CRASH_HANDLER), CrashHandlerWnd, - (DLGPROC)CrashHandlerProc); - - 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; - ZeroMemory(&zip, sizeof(zip)); - - wstring destzip = dumpFolder + L"\\report.zip"; - - DeleteFileW(destzip.c_str()); - - mz_zip_writer_init_wfile(&zip, destzip.c_str(), 0); - mz_zip_writer_add_mem(&zip, "report.txt", report.c_str(), report.length(), - MZ_BEST_COMPRESSION); - - if(uploadDump && !dump.empty()) - mz_zip_writer_add_wfile(&zip, "minidump.dmp", dump.c_str(), NULL, 0, MZ_BEST_COMPRESSION); - - if(uploadLog && !logpath.empty()) - mz_zip_writer_add_wfile(&zip, "error.log", logpath.c_str(), NULL, 0, MZ_BEST_COMPRESSION); - - mz_zip_writer_finalize_archive(&zip); - mz_zip_writer_end(&zip); - - int timeout = 10000; - wstring body = L""; - int code = 0; - - std::map params; - - google_breakpad::HTTPUpload::SendRequest(L"https://renderdoc.org/bugsubmit", params, - dumpFolder + L"\\report.zip", L"report", &timeout, - &body, &code); - - DeleteFileW(destzip.c_str()); - } - } - - if(!dump.empty()) - DeleteFileW(dump.c_str()); - - if(!logpath.empty()) - DeleteFileW(logpath.c_str()); - - return 0; - } -}; -#endif - -struct GlobalHookCommand : public Command -{ - GlobalHookCommand(const GlobalEnvironment &env) : Command(env) {} - virtual void AddOptions(cmdline::parser &parser) - { - parser.add("match", 0, ""); - parser.add("logfile", 0, ""); - parser.add("debuglog", 0, ""); - parser.add("capopts", 0, ""); - } - virtual const char *Description() { return "Internal use only!"; } - virtual bool IsInternalOnly() { return true; } - virtual bool IsCaptureCommand() { return false; } - virtual int Execute(cmdline::parser &parser, const CaptureOptions &) - { - string pathmatch = parser.get("match"); - string logfile = parser.get("logfile"); - string debuglog = parser.get("debuglog"); - - CaptureOptions cmdopts; - readCapOpts(parser.get("capopts").c_str(), &cmdopts); - - size_t len = pathmatch.length(); - wstring wpathmatch; - wpathmatch.resize(len); - MultiByteToWideChar(CP_UTF8, 0, pathmatch.c_str(), -1, &wpathmatch[0], (int)len); - wpathmatch.resize(wcslen(wpathmatch.c_str())); - - // make sure the user doesn't accidentally run this with 'a' as a parameter or something. - // "a.exe" is over 4 characters so this limit should not be a problem. - if(wpathmatch.length() < 4) - { - std::cerr - << "globalhook path match is too short/general. Danger of matching too many processes!" - << std::endl; - return 1; - } - - wchar_t rdocpath[1024]; - - // fetch path to our matching renderdoc.dll - HMODULE rdoc = GetModuleHandleA("renderdoc.dll"); - - if(rdoc == NULL) - { - std::cerr << "globalhook couldn't find renderdoc.dll!" << std::endl; - return 1; - } - - GetModuleFileNameW(rdoc, rdocpath, _countof(rdocpath) - 1); - FreeLibrary(rdoc); - - // Create stdin pipe from parent program, to stay open until requested to close - HANDLE pipe = GetStdHandle(STD_INPUT_HANDLE); - - if(pipe == INVALID_HANDLE_VALUE) - { - std::cerr << "globalhook couldn't open stdin pipe.\n" << std::endl; - return 1; - } - - HANDLE datahandle = OpenFileMappingA(FILE_MAP_READ, FALSE, GLOBAL_HOOK_DATA_NAME); - - if(datahandle != NULL) - { - CloseHandle(pipe); - CloseHandle(datahandle); - std::cerr << "globalhook found pre-existing global data, not creating second global hook." - << std::endl; - return 1; - } - - datahandle = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(ShimData), - GLOBAL_HOOK_DATA_NAME); - - if(datahandle) - { - ShimData *shimdata = (ShimData *)MapViewOfFile(datahandle, FILE_MAP_WRITE | FILE_MAP_READ, 0, - 0, sizeof(ShimData)); - - if(shimdata) - { - memset(shimdata, 0, sizeof(ShimData)); - - wcsncpy_s(shimdata->pathmatchstring, wpathmatch.c_str(), _TRUNCATE); - wcsncpy_s(shimdata->rdocpath, rdocpath, _TRUNCATE); - strncpy_s(shimdata->logfile, logfile.c_str(), _TRUNCATE); - strncpy_s(shimdata->debuglog, debuglog.c_str(), _TRUNCATE); - memcpy(shimdata->opts, &cmdopts, sizeof(CaptureOptions)); - - static_assert(sizeof(CaptureOptions) <= sizeof(shimdata->opts), - "ShimData options is too small"); - - // wait until a write comes in over the pipe - char buf[16] = {0}; - DWORD read = 0; - ReadFile(pipe, buf, 16, &read, NULL); - - UnmapViewOfFile(shimdata); - } - else - { - std::cerr << "globalhook couldn't map global data store." << std::endl; - } - - CloseHandle(datahandle); - } - else - { - std::cerr << "globalhook couldn't create global data store." << std::endl; - } - - CloseHandle(pipe); - - return 0; - } -}; - -// from http://stackoverflow.com/q/29939893/4070143 -// and http://stackoverflow.com/a/4570213/4070143 - -std::string getParentExe() -{ - DWORD pid = GetCurrentProcessId(); - HANDLE h = NULL; - PROCESSENTRY32 pe = {0}; - DWORD ppid = 0; - pe.dwSize = sizeof(PROCESSENTRY32); - h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); - if(Process32First(h, &pe)) - { - do - { - if(pe.th32ProcessID == pid) - { - ppid = pe.th32ParentProcessID; - break; - } - } while(Process32Next(h, &pe)); - } - CloseHandle(h); - - if(ppid == 0) - return ""; - - h = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, ppid); - if(h) - { - char buf[MAX_PATH]; - if(GetModuleFileNameExA(h, 0, buf, MAX_PATH)) - { - CloseHandle(h); - return buf; - } - CloseHandle(h); - } - - return ""; -} int WINAPI wWinMain(_In_ HINSTANCE hInst, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nShowCmd) @@ -861,56 +57,5 @@ int WINAPI wWinMain(_In_ HINSTANCE hInst, _In_opt_ HINSTANCE hPrevInstance, _In_ LocalFree(wargv); - // if launched from cmd.exe, be friendly and redirect output - std::string parent = getParentExe(); - for(size_t i = 0; i < parent.length(); i++) - { - parent[i] = tolower(parent[i]); - if(parent[i] == '\\') - parent[i] = '/'; - } - - if(strstr(parent.c_str(), "/cmd.exe") && AttachConsole(ATTACH_PARENT_PROCESS)) - { - freopen("CONOUT$", "w", stdout); - freopen("CONOUT$", "w", stderr); - } - - hInstance = hInst; - - WNDCLASSEX wc; - wc.cbSize = sizeof(WNDCLASSEX); - wc.style = 0; - wc.lpfnWndProc = WndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = 0; - wc.hInstance = hInstance; - wc.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_ICON)); - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wc.lpszMenuName = NULL; - wc.lpszClassName = L"renderdoccmd"; - wc.hIconSm = LoadIcon(NULL, MAKEINTRESOURCE(IDI_ICON)); - - if(!RegisterClassEx(&wc)) - { - return 1; - } - - GlobalEnvironment env; - - // perform an upgrade of the UI - add_command("upgrade", new UpgradeCommand(env)); - -#if defined(RELEASE) - // special WIN32 option for launching the crash handler - add_command("crashhandle", new CrashHandlerCommand(env)); -#endif - - // this installs a global windows hook pointing at renderdocshim*.dll that filters all running - // processes and loads renderdoc.dll in the target one. In any other process it unloads as soon as - // possible - add_command("globalhook", new GlobalHookCommand(env)); - - return renderdoccmd(env, argv); + return renderdoccmd(argv); } diff --git a/renderdoccmd/resource.h b/renderdoccmd/resource.h index 9c8e4c9f4..85dc56628 100644 Binary files a/renderdoccmd/resource.h and b/renderdoccmd/resource.h differ diff --git a/renderdocshim/renderdocshim.cpp b/renderdocshim/renderdocshim.cpp deleted file mode 100644 index 87348dee9..000000000 --- a/renderdocshim/renderdocshim.cpp +++ /dev/null @@ -1,177 +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. - ******************************************************************************/ - -// This project deliberately references only kernel32.dll (ie. not even the CRT) -// so that when inserted into an application it has as small an overhead/impact -// as possible. Ideally it would be present only to be a pass-through hook and -// the first time only to allocate a little, check if this process should be hooked -// and load the renderdoc dll. -// -// The no-CRT restriction causes some awkward bits and pieces but the dll is simple -// enough that it's not a big issue. - -#include "renderdocshim.h" -#include - -struct CaptureOptions; -typedef void(__cdecl *pINTERNAL_SetCaptureOptions)(const CaptureOptions *opts); -typedef void(__cdecl *pINTERNAL_SetLogFile)(const char *logfile); -typedef void(__cdecl *pRENDERDOC_SetDebugLogFile)(const char *logfile); - -#if defined(RELEASE) -#define LOGPRINT(txt) \ - do \ - { \ - } while(0) -#else -// define this to something to get logging -//#define LOGPRINT(txt) OutputDebugStringW(txt) -#define LOGPRINT(txt) \ - do \ - { \ - } while(0) -#endif - -void CheckHook() -{ - ShimData *data = NULL; - - HANDLE datahandle = OpenFileMappingA(FILE_MAP_READ, FALSE, GLOBAL_HOOK_DATA_NAME); - - if(datahandle == NULL) - { - LOGPRINT(L"renderdocshim: can't open global data\n"); - return; - } - - data = (ShimData *)MapViewOfFile(datahandle, FILE_MAP_READ, 0, 0, sizeof(ShimData)); - - if(data == NULL) - { - CloseHandle(datahandle); - LOGPRINT(L"renderdocshim: can't map global data\n"); - return; - } - - if(data->pathmatchstring[0] == 0 || data->pathmatchstring[1] == 0 || - data->pathmatchstring[2] == 0 || data->pathmatchstring[3] == 0) - { - LOGPRINT(L"renderdocshim: invalid pathmatchstring: '"); - LOGPRINT(data->pathmatchstring); - LOGPRINT(L"'\n"); - - UnmapViewOfFile(data); - CloseHandle(datahandle); - return; - } - - // no new[], need to use VirtualAlloc - const int exepathLen = 1024; - wchar_t *exepath = (wchar_t *)VirtualAlloc(NULL, exepathLen * sizeof(wchar_t), - MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); - - if(exepath) - { - // no memset :). - for(int i = 0; i < exepathLen; i++) - exepath[i] = 0; - - GetModuleFileNameW(NULL, exepath, exepathLen - 1); - - // no str*cmp functions - int find = FindStringOrdinal(FIND_FROMSTART, exepath, -1, data->pathmatchstring, -1, TRUE); - - if(find >= 0) - { - LOGPRINT(L"renderdocshim: Hooking into '"); - LOGPRINT(exepath); - LOGPRINT(L"', based on '"); - LOGPRINT(data->pathmatchstring); - LOGPRINT(L"'\n"); - - HMODULE mod = LoadLibraryW(data->rdocpath); - - if(mod) - { - pINTERNAL_SetCaptureOptions setopts = - (pINTERNAL_SetCaptureOptions)GetProcAddress(mod, "INTERNAL_SetCaptureOptions"); - pINTERNAL_SetLogFile setlogfile = - (pINTERNAL_SetLogFile)GetProcAddress(mod, "INTERNAL_SetLogFile"); - pRENDERDOC_SetDebugLogFile setdebuglog = - (pRENDERDOC_SetDebugLogFile)GetProcAddress(mod, "RENDERDOC_SetDebugLogFile"); - - if(setopts) - setopts((const CaptureOptions *)data->opts); - - if(setlogfile && data->logfile[0]) - setlogfile(data->logfile); - - if(setdebuglog && data->debuglog[0]) - setdebuglog(data->debuglog); - } - } - else - { - LOGPRINT(L"renderdocshim: NOT Hooking into '"); - LOGPRINT(exepath); - LOGPRINT(L"', based on '"); - LOGPRINT(data->pathmatchstring); - LOGPRINT(L"'\n"); - } - - VirtualFree(exepath, 0, MEM_RELEASE); - } - else - { - LOGPRINT(L"renderdocshim: Failed to allocate exepath\n"); - } - - UnmapViewOfFile(data); - CloseHandle(datahandle); -} - -DWORD CheckHookThread(LPVOID param) -{ - CheckHook(); - - // this makes sure that we remove the reference to the shim dll and unload from - // the target process. That minimises the impact of having the dll inserted into - // every process - FreeLibraryAndExitThread((HMODULE)param, 0); - return 0; -} - -BOOL APIENTRY dll_entry(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) -{ - if(ul_reason_for_call == DLL_PROCESS_ATTACH) - { - DisableThreadLibraryCalls(hModule); - - // create a thread so that we can perform more complex actions (DllMain must be minimal - // in size, even this is a bit dodgy). - CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&CheckHookThread, (LPVOID)hModule, 0, NULL); - } - - return TRUE; -} diff --git a/renderdocshim/renderdocshim.h b/renderdocshim/renderdocshim.h deleted file mode 100644 index dc6e6b4c9..000000000 --- a/renderdocshim/renderdocshim.h +++ /dev/null @@ -1,41 +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. - ******************************************************************************/ - -struct ShimData -{ - wchar_t pathmatchstring[2048]; - wchar_t rdocpath[2048]; - char debuglog[2048]; - char logfile[2048]; - - unsigned char opts[512]; -}; - -#ifdef WIN64 -#define GLOBAL_HOOK_DATA_NAME "RenderDocGlobalHookData64" -#define SHIM_DLL_NAME "renderdocshim64.dll" -#else -#define GLOBAL_HOOK_DATA_NAME "RenderDocGlobalHookData32" -#define SHIM_DLL_NAME "renderdocshim32.dll" -#endif diff --git a/renderdocshim/renderdocshim.vcxproj b/renderdocshim/renderdocshim.vcxproj deleted file mode 100644 index e6344a4e4..000000000 --- a/renderdocshim/renderdocshim.vcxproj +++ /dev/null @@ -1,203 +0,0 @@ - - - - - Development - Win32 - - - Development - x64 - - - Release - Win32 - - - Release - x64 - - - - {6DEE3F12-F2F8-42CA-865A-578D0FD11387} - Win32Proj - renderdocshim - - - - DynamicLibrary - true - Unicode - v140 - - - DynamicLibrary - true - Unicode - v140 - - - DynamicLibrary - false - true - Unicode - v140 - - - DynamicLibrary - false - true - Unicode - v140 - - - - - - - - - - - - - - - - - - - $(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\ - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(ProjectName)32 - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(ProjectName)64 - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(ProjectName)32 - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(ProjectName)64 - - - - - - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - Default - false - false - ProgramDatabase - MultiThreaded - true - false - - - Windows - true - kernel32.lib;user32.lib - true - dll_entry - Default - - - - - - - Level3 - Disabled - WIN32;WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - MultiThreaded - Default - false - false - ProgramDatabase - true - false - - - Windows - true - kernel32.lib;user32.lib - true - dll_entry - Default - - - - - Level3 - - - MaxSpeed - true - true - WIN32;RELEASE;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - Default - false - false - ProgramDatabase - MultiThreaded - true - - - Windows - true - true - true - kernel32.lib;user32.lib - true - dll_entry - UseLinkTimeCodeGeneration - - - - - Level3 - - - MaxSpeed - true - true - WIN32;WIN64;RELEASE;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - MultiThreaded - Default - false - false - ProgramDatabase - true - - - Windows - true - true - true - kernel32.lib;user32.lib - true - dll_entry - UseLinkTimeCodeGeneration - - - - - - - - - - - - \ No newline at end of file diff --git a/renderdocshim/renderdocshim.vcxproj.filters b/renderdocshim/renderdocshim.vcxproj.filters deleted file mode 100644 index 1de862269..000000000 --- a/renderdocshim/renderdocshim.vcxproj.filters +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file 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 82519c973..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("0.92.0.0")] -[assembly: AssemblyFileVersion("0.92.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 - - - - -