mirror of
https://github.com/wolfpld/tracy
synced 2025-05-02 05:33:53 +00:00
Update ImGuiColorTextEdit to 0a88824f7de8d.
This commit is contained in:
parent
18cef20db9
commit
53fe688bff
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,6 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
#include "../imgui/imgui.h"
|
#include "../imgui/imgui.h"
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
@ -62,6 +61,13 @@ public:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Represents a character coordinate from the user's point of view,
|
||||||
|
// i. e. consider an uniform grid (assuming fixed-width font) on the
|
||||||
|
// screen as it is rendered, and each cell has its own coordinate, starting from 0.
|
||||||
|
// Tabs are counted as [1..mTabSize] count empty spaces, depending on
|
||||||
|
// how many space is necessary to reach the next tab stop.
|
||||||
|
// For example, coordinate (1, 5) represents the character 'B' in a line "\tABC", when mTabSize = 4,
|
||||||
|
// because it is rendered as " ABC" on the screen.
|
||||||
struct Coordinates
|
struct Coordinates
|
||||||
{
|
{
|
||||||
int mLine, mColumn;
|
int mLine, mColumn;
|
||||||
@ -128,7 +134,7 @@ public:
|
|||||||
typedef std::map<int, std::string> ErrorMarkers;
|
typedef std::map<int, std::string> ErrorMarkers;
|
||||||
typedef std::unordered_set<int> Breakpoints;
|
typedef std::unordered_set<int> Breakpoints;
|
||||||
typedef std::array<ImU32, (unsigned)PaletteIndex::Max> Palette;
|
typedef std::array<ImU32, (unsigned)PaletteIndex::Max> Palette;
|
||||||
typedef char Char;
|
typedef uint8_t Char;
|
||||||
|
|
||||||
struct Glyph
|
struct Glyph
|
||||||
{
|
{
|
||||||
@ -149,7 +155,7 @@ public:
|
|||||||
{
|
{
|
||||||
typedef std::pair<std::string, PaletteIndex> TokenRegexString;
|
typedef std::pair<std::string, PaletteIndex> TokenRegexString;
|
||||||
typedef std::vector<TokenRegexString> TokenRegexStrings;
|
typedef std::vector<TokenRegexString> TokenRegexStrings;
|
||||||
typedef bool (*TokenizeCallback)(const char * in_begin, const char * in_end, const char *& out_begin, const char *& out_end, PaletteIndex & paletteIndex);
|
typedef bool(*TokenizeCallback)(const char * in_begin, const char * in_end, const char *& out_begin, const char *& out_end, PaletteIndex & paletteIndex);
|
||||||
|
|
||||||
std::string mName;
|
std::string mName;
|
||||||
Keywords mKeywords;
|
Keywords mKeywords;
|
||||||
@ -193,9 +199,11 @@ public:
|
|||||||
|
|
||||||
void Render(const char* aTitle, const ImVec2& aSize = ImVec2(), bool aBorder = false);
|
void Render(const char* aTitle, const ImVec2& aSize = ImVec2(), bool aBorder = false);
|
||||||
void SetText(const std::string& aText);
|
void SetText(const std::string& aText);
|
||||||
void SetTextLines(const std::vector<std::string>& aLines);
|
|
||||||
std::string GetText() const;
|
std::string GetText() const;
|
||||||
|
|
||||||
|
void SetTextLines(const std::vector<std::string>& aLines);
|
||||||
std::vector<std::string> GetTextLines() const;
|
std::vector<std::string> GetTextLines() const;
|
||||||
|
|
||||||
std::string GetSelectedText() const;
|
std::string GetSelectedText() const;
|
||||||
std::string GetCurrentLineText()const;
|
std::string GetCurrentLineText()const;
|
||||||
|
|
||||||
@ -207,9 +215,27 @@ public:
|
|||||||
bool IsTextChanged() const { return mTextChanged; }
|
bool IsTextChanged() const { return mTextChanged; }
|
||||||
bool IsCursorPositionChanged() const { return mCursorPositionChanged; }
|
bool IsCursorPositionChanged() const { return mCursorPositionChanged; }
|
||||||
|
|
||||||
|
bool IsColorizerEnabled() const { return mColorizerEnabled; }
|
||||||
|
void SetColorizerEnable(bool aValue);
|
||||||
|
|
||||||
Coordinates GetCursorPosition() const { return GetActualCursorCoordinates(); }
|
Coordinates GetCursorPosition() const { return GetActualCursorCoordinates(); }
|
||||||
void SetCursorPosition(const Coordinates& aPosition);
|
void SetCursorPosition(const Coordinates& aPosition);
|
||||||
|
|
||||||
|
inline void SetHandleMouseInputs (bool aValue){ mHandleMouseInputs = aValue;}
|
||||||
|
inline bool IsHandleMouseInputsEnabled() const { return mHandleKeyboardInputs; }
|
||||||
|
|
||||||
|
inline void SetHandleKeyboardInputs (bool aValue){ mHandleKeyboardInputs = aValue;}
|
||||||
|
inline bool IsHandleKeyboardInputsEnabled() const { return mHandleKeyboardInputs; }
|
||||||
|
|
||||||
|
inline void SetImGuiChildIgnored (bool aValue){ mIgnoreImGuiChild = aValue;}
|
||||||
|
inline bool IsImGuiChildIgnored() const { return mIgnoreImGuiChild; }
|
||||||
|
|
||||||
|
inline void SetShowWhitespaces(bool aValue) { mShowWhitespaces = aValue; }
|
||||||
|
inline bool IsShowingWhitespaces() const { return mShowWhitespaces; }
|
||||||
|
|
||||||
|
void SetTabSize(int aValue);
|
||||||
|
inline int GetTabSize() const { return mTabSize; }
|
||||||
|
|
||||||
void InsertText(const std::string& aValue);
|
void InsertText(const std::string& aValue);
|
||||||
void InsertText(const char* aValue);
|
void InsertText(const char* aValue);
|
||||||
|
|
||||||
@ -295,7 +321,6 @@ private:
|
|||||||
float TextDistanceToLineStart(const Coordinates& aFrom) const;
|
float TextDistanceToLineStart(const Coordinates& aFrom) const;
|
||||||
void EnsureCursorVisible();
|
void EnsureCursorVisible();
|
||||||
int GetPageSize() const;
|
int GetPageSize() const;
|
||||||
int AppendBuffer(std::string& aBuffer, char chr, int aIndex);
|
|
||||||
std::string GetText(const Coordinates& aStart, const Coordinates& aEnd) const;
|
std::string GetText(const Coordinates& aStart, const Coordinates& aEnd) const;
|
||||||
Coordinates GetActualCursorCoordinates() const;
|
Coordinates GetActualCursorCoordinates() const;
|
||||||
Coordinates SanitizeCoordinates(const Coordinates& aValue) const;
|
Coordinates SanitizeCoordinates(const Coordinates& aValue) const;
|
||||||
@ -306,12 +331,17 @@ private:
|
|||||||
Coordinates ScreenPosToCoordinates(const ImVec2& aPosition) const;
|
Coordinates ScreenPosToCoordinates(const ImVec2& aPosition) const;
|
||||||
Coordinates FindWordStart(const Coordinates& aFrom) const;
|
Coordinates FindWordStart(const Coordinates& aFrom) const;
|
||||||
Coordinates FindWordEnd(const Coordinates& aFrom) const;
|
Coordinates FindWordEnd(const Coordinates& aFrom) const;
|
||||||
|
Coordinates FindNextWord(const Coordinates& aFrom) const;
|
||||||
|
int GetCharacterIndex(const Coordinates& aCoordinates) const;
|
||||||
|
int GetCharacterColumn(int aLine, int aIndex) const;
|
||||||
|
int GetLineCharacterCount(int aLine) const;
|
||||||
|
int GetLineMaxColumn(int aLine) const;
|
||||||
bool IsOnWordBoundary(const Coordinates& aAt) const;
|
bool IsOnWordBoundary(const Coordinates& aAt) const;
|
||||||
void RemoveLine(int aStart, int aEnd);
|
void RemoveLine(int aStart, int aEnd);
|
||||||
void RemoveLine(int aIndex);
|
void RemoveLine(int aIndex);
|
||||||
Line& InsertLine(int aIndex);
|
Line& InsertLine(int aIndex);
|
||||||
void EnterCharacter(Char aChar, bool aShift);
|
void EnterCharacter(ImWchar aChar, bool aShift);
|
||||||
void BackSpace();
|
void Backspace();
|
||||||
void DeleteSelection();
|
void DeleteSelection();
|
||||||
std::string GetWordUnderCursor() const;
|
std::string GetWordUnderCursor() const;
|
||||||
std::string GetWordAt(const Coordinates& aCoords) const;
|
std::string GetWordAt(const Coordinates& aCoords) const;
|
||||||
@ -334,11 +364,16 @@ private:
|
|||||||
bool mScrollToCursor;
|
bool mScrollToCursor;
|
||||||
bool mScrollToTop;
|
bool mScrollToTop;
|
||||||
bool mTextChanged;
|
bool mTextChanged;
|
||||||
|
bool mColorizerEnabled;
|
||||||
float mTextStart; // position (in pixels) where a code line starts relative to the left of the TextEditor.
|
float mTextStart; // position (in pixels) where a code line starts relative to the left of the TextEditor.
|
||||||
int mLeftMargin;
|
int mLeftMargin;
|
||||||
bool mCursorPositionChanged;
|
bool mCursorPositionChanged;
|
||||||
int mColorRangeMin, mColorRangeMax;
|
int mColorRangeMin, mColorRangeMax;
|
||||||
SelectionMode mSelectionMode;
|
SelectionMode mSelectionMode;
|
||||||
|
bool mHandleKeyboardInputs;
|
||||||
|
bool mHandleMouseInputs;
|
||||||
|
bool mIgnoreImGuiChild;
|
||||||
|
bool mShowWhitespaces;
|
||||||
|
|
||||||
Palette mPaletteBase;
|
Palette mPaletteBase;
|
||||||
Palette mPalette;
|
Palette mPalette;
|
||||||
@ -350,6 +385,8 @@ private:
|
|||||||
ErrorMarkers mErrorMarkers;
|
ErrorMarkers mErrorMarkers;
|
||||||
ImVec2 mCharAdvance;
|
ImVec2 mCharAdvance;
|
||||||
Coordinates mInteractiveStart, mInteractiveEnd;
|
Coordinates mInteractiveStart, mInteractiveEnd;
|
||||||
|
std::string mLineBuffer;
|
||||||
|
uint64_t mStartTime;
|
||||||
|
|
||||||
float mLastClick;
|
float mLastClick;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user