1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 04:23:51 +00:00

Update imguicolortextedit.

339d5ef00edcfb849c1281bcf176113199828522
This commit is contained in:
Bartosz Taudul 2018-10-30 22:52:57 +01:00
parent 6f9977638d
commit d8a9d6d3bf
2 changed files with 778 additions and 226 deletions

File diff suppressed because it is too large Load Diff

View File

@ -133,7 +133,7 @@ public:
struct Glyph
{
Char mChar;
PaletteIndex mColorIndex : 7;
PaletteIndex mColorIndex = PaletteIndex::Default;
bool mMultiLineComment : 1;
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::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;
Keywords mKeywords;
Identifiers mIdentifiers;
Identifiers mPreprocIdentifiers;
std::string mCommentStart, mCommentEnd;
bool mAutoIndentation;
TokenizeCallback mTokenize;
TokenRegexStrings mTokenRegexStrings;
bool mCaseSensitive;
static LanguageDefinition CPlusPlus();
static LanguageDefinition HLSL();
static LanguageDefinition GLSL();
static LanguageDefinition C();
static LanguageDefinition SQL();
static LanguageDefinition AngelScript();
static LanguageDefinition Lua();
LanguageDefinition()
: mTokenize(nullptr)
{
}
static const LanguageDefinition& CPlusPlus();
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();
@ -179,16 +188,18 @@ public:
void SetBreakpoints(const Breakpoints& aMarkers) { mBreakpoints = aMarkers; }
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 GetSelectedText() const;
std::string GetCurrentLineText()const;
int GetTotalLines() const { return (int)mLines.size(); }
bool IsOverwrite() const { return mOverwrite; }
void SetReadOnly(bool aValue);
bool IsReadOnly() const { return mReadOnly; }
bool IsTextChanged() const { return mTextChanged; }
bool IsCursorPositionChanged() const { return mCursorPositionChanged; }
Coordinates GetCursorPosition() const { return GetActualCursorCoordinates(); }
void SetCursorPosition(const Coordinates& aPosition);
@ -275,7 +286,7 @@ private:
void Colorize(int aFromLine = 0, int aCount = -1);
void ColorizeRange(int aFromLine = 0, int aToLine = 0);
void ColorizeInternal();
int TextDistanceToLineStart(const Coordinates& aFrom) const;
float TextDistanceToLineStart(const Coordinates& aFrom) const;
void EnsureCursorVisible();
int GetPageSize() const;
int AppendBuffer(std::string& aBuffer, char chr, int aIndex);
@ -293,7 +304,7 @@ private:
void RemoveLine(int aStart, int aEnd);
void RemoveLine(int aIndex);
Line& InsertLine(int aIndex);
void EnterCharacter(Char aChar);
void EnterCharacter(Char aChar, bool aShift);
void BackSpace();
void DeleteSelection();
std::string GetWordUnderCursor() const;
@ -311,6 +322,9 @@ private:
bool mWithinRender;
bool mScrollToCursor;
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;
SelectionMode mSelectionMode;