mirror of
https://github.com/wolfpld/tracy
synced 2025-05-02 13:43:52 +00:00
Update imguicolortextedit.
339d5ef00edcfb849c1281bcf176113199828522
This commit is contained in:
parent
6f9977638d
commit
d8a9d6d3bf
File diff suppressed because it is too large
Load Diff
@ -133,7 +133,7 @@ public:
|
|||||||
struct Glyph
|
struct Glyph
|
||||||
{
|
{
|
||||||
Char mChar;
|
Char mChar;
|
||||||
PaletteIndex mColorIndex : 7;
|
PaletteIndex mColorIndex = PaletteIndex::Default;
|
||||||
bool mMultiLineComment : 1;
|
bool mMultiLineComment : 1;
|
||||||
|
|
||||||
Glyph(Char aChar, PaletteIndex aColorIndex) : mChar(aChar), mColorIndex(aColorIndex), mMultiLineComment(false) {}
|
Glyph(Char aChar, PaletteIndex aColorIndex) : mChar(aChar), mColorIndex(aColorIndex), mMultiLineComment(false) {}
|
||||||
@ -146,24 +146,33 @@ 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);
|
||||||
|
|
||||||
std::string mName;
|
std::string mName;
|
||||||
Keywords mKeywords;
|
Keywords mKeywords;
|
||||||
Identifiers mIdentifiers;
|
Identifiers mIdentifiers;
|
||||||
Identifiers mPreprocIdentifiers;
|
Identifiers mPreprocIdentifiers;
|
||||||
std::string mCommentStart, mCommentEnd;
|
std::string mCommentStart, mCommentEnd;
|
||||||
|
bool mAutoIndentation;
|
||||||
|
|
||||||
|
TokenizeCallback mTokenize;
|
||||||
|
|
||||||
TokenRegexStrings mTokenRegexStrings;
|
TokenRegexStrings mTokenRegexStrings;
|
||||||
|
|
||||||
bool mCaseSensitive;
|
bool mCaseSensitive;
|
||||||
|
|
||||||
static LanguageDefinition CPlusPlus();
|
LanguageDefinition()
|
||||||
static LanguageDefinition HLSL();
|
: mTokenize(nullptr)
|
||||||
static LanguageDefinition GLSL();
|
{
|
||||||
static LanguageDefinition C();
|
}
|
||||||
static LanguageDefinition SQL();
|
|
||||||
static LanguageDefinition AngelScript();
|
static const LanguageDefinition& CPlusPlus();
|
||||||
static LanguageDefinition Lua();
|
static const LanguageDefinition& HLSL();
|
||||||
|
static const LanguageDefinition& GLSL();
|
||||||
|
static const LanguageDefinition& C();
|
||||||
|
static const LanguageDefinition& SQL();
|
||||||
|
static const LanguageDefinition& AngelScript();
|
||||||
|
static const LanguageDefinition& Lua();
|
||||||
};
|
};
|
||||||
|
|
||||||
TextEditor();
|
TextEditor();
|
||||||
@ -179,16 +188,18 @@ public:
|
|||||||
void SetBreakpoints(const Breakpoints& aMarkers) { mBreakpoints = aMarkers; }
|
void SetBreakpoints(const Breakpoints& aMarkers) { mBreakpoints = aMarkers; }
|
||||||
|
|
||||||
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 char* aText);
|
void SetText(const std::string& aText);
|
||||||
std::string GetText() const;
|
std::string GetText() const;
|
||||||
std::string GetSelectedText() const;
|
std::string GetSelectedText() const;
|
||||||
|
std::string GetCurrentLineText()const;
|
||||||
|
|
||||||
int GetTotalLines() const { return (int)mLines.size(); }
|
int GetTotalLines() const { return (int)mLines.size(); }
|
||||||
bool IsOverwrite() const { return mOverwrite; }
|
bool IsOverwrite() const { return mOverwrite; }
|
||||||
|
|
||||||
void SetReadOnly(bool aValue);
|
void SetReadOnly(bool aValue);
|
||||||
bool IsReadOnly() const { return mReadOnly; }
|
bool IsReadOnly() const { return mReadOnly; }
|
||||||
bool IsTextChanged() const { return mTextChanged; }
|
bool IsTextChanged() const { return mTextChanged; }
|
||||||
|
bool IsCursorPositionChanged() const { return mCursorPositionChanged; }
|
||||||
|
|
||||||
Coordinates GetCursorPosition() const { return GetActualCursorCoordinates(); }
|
Coordinates GetCursorPosition() const { return GetActualCursorCoordinates(); }
|
||||||
void SetCursorPosition(const Coordinates& aPosition);
|
void SetCursorPosition(const Coordinates& aPosition);
|
||||||
@ -275,7 +286,7 @@ private:
|
|||||||
void Colorize(int aFromLine = 0, int aCount = -1);
|
void Colorize(int aFromLine = 0, int aCount = -1);
|
||||||
void ColorizeRange(int aFromLine = 0, int aToLine = 0);
|
void ColorizeRange(int aFromLine = 0, int aToLine = 0);
|
||||||
void ColorizeInternal();
|
void ColorizeInternal();
|
||||||
int 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);
|
int AppendBuffer(std::string& aBuffer, char chr, int aIndex);
|
||||||
@ -293,7 +304,7 @@ private:
|
|||||||
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);
|
void EnterCharacter(Char aChar, bool aShift);
|
||||||
void BackSpace();
|
void BackSpace();
|
||||||
void DeleteSelection();
|
void DeleteSelection();
|
||||||
std::string GetWordUnderCursor() const;
|
std::string GetWordUnderCursor() const;
|
||||||
@ -311,6 +322,9 @@ private:
|
|||||||
bool mWithinRender;
|
bool mWithinRender;
|
||||||
bool mScrollToCursor;
|
bool mScrollToCursor;
|
||||||
bool mTextChanged;
|
bool mTextChanged;
|
||||||
|
float mTextStart; // position (in pixels) where a code line starts relative to the left of the TextEditor.
|
||||||
|
int mLeftMargin;
|
||||||
|
bool mCursorPositionChanged;
|
||||||
int mColorRangeMin, mColorRangeMax;
|
int mColorRangeMin, mColorRangeMax;
|
||||||
SelectionMode mSelectionMode;
|
SelectionMode mSelectionMode;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user