From 4e5605622247a93a7743a92580bbcff5cf4207af Mon Sep 17 00:00:00 2001 From: Adam Grzegorzewski Date: Sun, 12 Sep 2021 10:22:43 +0200 Subject: [PATCH] [API] Bindings for ImGuiColorTextEdit (#79) * Add ImGuiColorTextEdit submodule * ImGuiColorTextEdit integration * Remove unused Identifier class (oops) * Fix checkstyle * Small tweaks and fixes * Remove empty line before imports Co-authored-by: SpaiR --- .gitmodules | 3 + README.md | 2 + .../groovy/tool/generator/GenerateLibs.groovy | 3 +- .../main/java/ExampleImGuiColorTextEdit.java | 138 +++++++ example/src/main/java/Extra.java | 6 + .../extension/texteditor/TextEditor.java | 377 ++++++++++++++++++ .../TextEditorLanguageDefinition.java | 205 ++++++++++ .../flag/TextEditorPaletteIndex.java | 29 ++ .../flag/TextEditorSelectionMode.java | 10 + imgui-binding/src/main/native/_texteditor.h | 13 + include/ImGuiColorTextEdit | 1 + 11 files changed, 786 insertions(+), 1 deletion(-) create mode 100644 example/src/main/java/ExampleImGuiColorTextEdit.java create mode 100644 imgui-binding/src/main/java/imgui/extension/texteditor/TextEditor.java create mode 100644 imgui-binding/src/main/java/imgui/extension/texteditor/TextEditorLanguageDefinition.java create mode 100644 imgui-binding/src/main/java/imgui/extension/texteditor/flag/TextEditorPaletteIndex.java create mode 100644 imgui-binding/src/main/java/imgui/extension/texteditor/flag/TextEditorSelectionMode.java create mode 100644 imgui-binding/src/main/native/_texteditor.h create mode 160000 include/ImGuiColorTextEdit diff --git a/.gitmodules b/.gitmodules index 743a143..508622b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "include/implot"] path = include/implot url = https://github.com/epezent/implot.git +[submodule "include/ImGuiColorTextEdit"] + path = include/ImGuiColorTextEdit + url = https://github.com/BalazsJako/ImGuiColorTextEdit diff --git a/README.md b/README.md index ae75647..53c804e 100644 --- a/README.md +++ b/README.md @@ -256,6 +256,8 @@ dependencies { Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui. - [implot](https://github.com/epezent/implot/tree/555ff688a8134bc0c602123149abe9c17d577475) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.84.1.0/example/src/main/java/ExampleImPlot.java)
Advanced 2D Plotting for Dear ImGui. +- [ImGuiColorTextEdit](https://github.com/BalazsJako/ImGuiColorTextEdit/tree/0a88824f7de8d0bd11d8419066caa7d3469395c4) | [Example](https://github.com/SpaiR/imgui-java/blob/v1.84.1.0/example/src/main/java/ExampleImGuiColorTextEdit.java)
+ Syntax highlighting text editor for ImGui. ## Freetype By default, Dear ImGui uses stb-truetype to render fonts. Yet there is an option to use FreeType font renderer. Go to the [imgui_freetype](https://github.com/ocornut/imgui/tree/256594575d95d56dda616c544c509740e74906b4/misc/freetype) to read about the difference. diff --git a/buildSrc/src/main/groovy/tool/generator/GenerateLibs.groovy b/buildSrc/src/main/groovy/tool/generator/GenerateLibs.groovy index c253106..ddc16b1 100644 --- a/buildSrc/src/main/groovy/tool/generator/GenerateLibs.groovy +++ b/buildSrc/src/main/groovy/tool/generator/GenerateLibs.groovy @@ -46,7 +46,8 @@ class GenerateLibs extends DefaultTask { // Copy ImGui h/cpp files project.copy { CopySpec spec -> - ['include/imgui', 'include/imnodes', 'include/imgui-node-editor', 'include/imguizmo', 'include/implot'].each { + ['include/imgui', 'include/imnodes', 'include/imgui-node-editor', + 'include/imguizmo', 'include/implot', 'include/ImGuiColorTextEdit'].each { spec.from(project.rootProject.file(it)) { CopySpec s -> s.include('*.h', '*.cpp', '*.inl') } } spec.from(project.rootProject.file('imgui-binding/src/main/native')) diff --git a/example/src/main/java/ExampleImGuiColorTextEdit.java b/example/src/main/java/ExampleImGuiColorTextEdit.java new file mode 100644 index 0000000..68b500d --- /dev/null +++ b/example/src/main/java/ExampleImGuiColorTextEdit.java @@ -0,0 +1,138 @@ +import imgui.ImGui; +import imgui.extension.texteditor.TextEditor; +import imgui.extension.texteditor.TextEditorLanguageDefinition; +import imgui.flag.ImGuiWindowFlags; +import imgui.type.ImBoolean; + +import java.util.HashMap; +import java.util.Map; + +public class ExampleImGuiColorTextEdit { + private static final TextEditor EDITOR = new TextEditor(); + + static { + TextEditorLanguageDefinition lang = TextEditorLanguageDefinition.c(); + + String[] ppnames = { + "NULL", "PM_REMOVE", + "ZeroMemory", "DXGI_SWAP_EFFECT_DISCARD", "D3D_FEATURE_LEVEL", "D3D_DRIVER_TYPE_HARDWARE", "WINAPI", "D3D11_SDK_VERSION", "assert"}; + String[] ppvalues = { + "#define NULL ((void*)0)", + "#define PM_REMOVE (0x0001)", + "Microsoft's own memory zapper function\n(which is a macro actually)\nvoid ZeroMemory(\n\t[in] PVOID Destination,\n\t[in] SIZE_T Length\n); ", + "enum DXGI_SWAP_EFFECT::DXGI_SWAP_EFFECT_DISCARD = 0", + "enum D3D_FEATURE_LEVEL", + "enum D3D_DRIVER_TYPE::D3D_DRIVER_TYPE_HARDWARE = ( D3D_DRIVER_TYPE_UNKNOWN + 1 )", + "#define WINAPI __stdcall", + "#define D3D11_SDK_VERSION (7)", + " #define assert(expression) (void)( \n" + + " (!!(expression)) || \n" + + " (_wassert(_CRT_WIDE(#expression), _CRT_WIDE(__FILE__), (unsigned)(__LINE__)), 0) \n" + + " )" + }; + + // Adding custom preproc identifiers + Map preprocIdentifierMap = new HashMap<>(); + for (int i = 0; i < ppnames.length; ++i) { + preprocIdentifierMap.put(ppnames[i], ppvalues[i]); + } + lang.setPreprocIdentifiers(preprocIdentifierMap); + + String[] identifiers = { + "HWND", "HRESULT", "LPRESULT","D3D11_RENDER_TARGET_VIEW_DESC", "DXGI_SWAP_CHAIN_DESC","MSG","LRESULT","WPARAM", "LPARAM","UINT","LPVOID", + "ID3D11Device", "ID3D11DeviceContext", "ID3D11Buffer", "ID3D11Buffer", "ID3D10Blob", "ID3D11VertexShader", "ID3D11InputLayout", "ID3D11Buffer", + "ID3D10Blob", "ID3D11PixelShader", "ID3D11SamplerState", "ID3D11ShaderResourceView", "ID3D11RasterizerState", "ID3D11BlendState", "ID3D11DepthStencilState", + "IDXGISwapChain", "ID3D11RenderTargetView", "ID3D11Texture2D", "TextEditor" }; + String[] idecls = { + "typedef HWND_* HWND", "typedef long HRESULT", "typedef long* LPRESULT", "struct D3D11_RENDER_TARGET_VIEW_DESC", "struct DXGI_SWAP_CHAIN_DESC", + "typedef tagMSG MSG\n * Message structure","typedef LONG_PTR LRESULT","WPARAM", "LPARAM","UINT","LPVOID", + "ID3D11Device", "ID3D11DeviceContext", "ID3D11Buffer", "ID3D11Buffer", "ID3D10Blob", "ID3D11VertexShader", "ID3D11InputLayout", "ID3D11Buffer", + "ID3D10Blob", "ID3D11PixelShader", "ID3D11SamplerState", "ID3D11ShaderResourceView", "ID3D11RasterizerState", "ID3D11BlendState", "ID3D11DepthStencilState", + "IDXGISwapChain", "ID3D11RenderTargetView", "ID3D11Texture2D", "class TextEditor" }; + + // Adding custom identifiers + Map identifierMap = new HashMap<>(); + for (int i = 0; i < ppnames.length; ++i) { + identifierMap.put(identifiers[i], idecls[i]); + } + lang.setIdentifiers(identifierMap); + + EDITOR.setLanguageDefinition(lang); + + // Adding error markers + Map errorMarkers = new HashMap<>(); + errorMarkers.put(1, "Expected '>'"); + EDITOR.setErrorMarkers(errorMarkers); + + EDITOR.setTextLines(new String[]{ + "#include SetLanguageDefinition(*((TextEditor::LanguageDefinition*)ptr)); + */ + + public native int[] getPalette(); /* + const auto& palette = TEXT_EDITOR->GetPalette(); + + jintArray res = env->NewIntArray(palette.size()); + + jint arr[palette.size()]; + for (int i = 0; i < palette.size(); i++) { + arr[i] = palette[i]; + } + + env->SetIntArrayRegion(res, 0, palette.size(), arr); + + return res; + */ + + public void setPalette(final int[] palette) { + nSetPalette(palette, palette.length); + } + + public native void nSetPalette(int[] palette, int length); /* + std::array arr; + + for (int i = 0; i < length; i++) { + arr[i] = palette[i]; + } + + TEXT_EDITOR->SetPalette(arr); + */ + + public void setErrorMarkers(final Map errorMarkers) { + final int[] keys = errorMarkers.keySet().stream().mapToInt(i -> i).toArray(); + final String[] values = errorMarkers.values().toArray(new String[0]); + + nSetErrorMarkers(keys, keys.length, values, values.length); + } + + private native void nSetErrorMarkers(int[] keys, int keysLen, String[] values, int valuesLen); /* + std::map markers; + + for (int i = 0; i < keysLen; i++) { + int key = keys[i]; + jstring string = (jstring)env->GetObjectArrayElement(values, i); + const char* value = env->GetStringUTFChars(string, JNI_FALSE); + + markers.emplace(std::pair(key, std::string(value))); + } + + TEXT_EDITOR->SetErrorMarkers(markers); + */ + + public void setBreakpoints(final int[] breakpoints) { + nSetBreakpoints(breakpoints, breakpoints.length); + } + + private native void nSetBreakpoints(int[] breakpoints, int length); /* + std::unordered_set set; + + for (int i = 0; i < length; i++) { + set.emplace(breakpoints[i]); + } + + TEXT_EDITOR->SetBreakpoints(set); + */ + + public native void render(String title); /* + TEXT_EDITOR->Render(title); + */ + + public native void setText(String text); /* + TEXT_EDITOR->SetText(text); + */ + + public native String getText(); /* + return env->NewStringUTF(TEXT_EDITOR->GetText().c_str()); + */ + + public void setTextLines(final String[] lines) { + nSetTextLines(lines, lines.length); + } + + private native void nSetTextLines(String[] lines, int length); /* + std::vector vec; + vec.reserve(length); + + for (int i = 0; i < length; i++) { + jstring string = (jstring)env->GetObjectArrayElement(lines, i); + const char* raw = env->GetStringUTFChars(string, JNI_FALSE); + + vec.emplace_back(std::string(raw)); + } + + TEXT_EDITOR->SetTextLines(vec); + */ + + public native String[] getTextLines(); /* + const auto lines = TEXT_EDITOR->GetTextLines(); + + jobjectArray arr = (jobjectArray)env->NewObjectArray(lines.size(), + env->FindClass("java/lang/String"), + env->NewStringUTF("")); + + for (int i = 0; i < lines.size(); i++) { + const auto& str = lines[i]; + + env->SetObjectArrayElement(arr, i, env->NewStringUTF(str.c_str())); + } + + return arr; + */ + + public native String getSelectedText(); /* + return env->NewStringUTF(TEXT_EDITOR->GetSelectedText().c_str()); + */ + + public native String getCurrentLineText(); /* + return env->NewStringUTF(TEXT_EDITOR->GetCurrentLineText().c_str()); + */ + + public native int getTotalLines(); /* + return TEXT_EDITOR->GetTotalLines(); + */ + + public native boolean isOverwrite(); /* + return TEXT_EDITOR->IsOverwrite(); + */ + + public native void setReadOnly(boolean value); /* + TEXT_EDITOR->SetReadOnly(value); + */ + + public native boolean isReadOnly(); /* + return TEXT_EDITOR->IsReadOnly(); + */ + + public native boolean isTextChanged(); /* + return TEXT_EDITOR->IsTextChanged(); + */ + + public native boolean isCursorPositionChanged(); /* + return TEXT_EDITOR->IsCursorPositionChanged(); + */ + + public native boolean isColorizerEnabled(); /* + return TEXT_EDITOR->IsColorizerEnabled(); + */ + + public native void setColorizerEnable(boolean value); /* + TEXT_EDITOR->SetColorizerEnable(value); + */ + + public native int getCursorPositionLine(); /* + return TEXT_EDITOR->GetCursorPosition().mLine; + */ + + public native int getCursorPositionColumn(); /* + return TEXT_EDITOR->GetCursorPosition().mColumn; + */ + + public native void setCursorPosition(int line, int column); /* + TEXT_EDITOR->SetCursorPosition({ line, column }); + */ + + public native void setHandleMouseInputs(boolean value); /* + TEXT_EDITOR->SetHandleMouseInputs(value); + */ + + public native boolean isHandleMouseInputsEnabled(); /* + return TEXT_EDITOR->IsHandleMouseInputsEnabled(); + */ + + public native void setHandleKeyboardInputs(boolean value); /* + TEXT_EDITOR->SetHandleKeyboardInputs(value); + */ + + public native boolean isHandleKeyboardInputsEnabled(); /* + return TEXT_EDITOR->IsHandleKeyboardInputsEnabled(); + */ + + public native void setImGuiChildIgnored(boolean value); /* + TEXT_EDITOR->SetImGuiChildIgnored(value); + */ + + public native boolean isImGuiChildIgnored(); /* + return TEXT_EDITOR->IsImGuiChildIgnored(); + */ + + public native void setShowWhitespaces(boolean value); /* + TEXT_EDITOR->SetShowWhitespaces(value); + */ + + public native boolean isShowingWhitespaces(); /* + return TEXT_EDITOR->IsShowingWhitespaces(); + */ + + public native void setTabSize(int value); /* + TEXT_EDITOR->SetTabSize(value); + */ + + public native int getTabSize(); /* + return TEXT_EDITOR->GetTabSize(); + */ + + public native void insertText(String value); /* + TEXT_EDITOR->InsertText(value); + */ + + public native void moveUp(int amount, boolean select); /* + TEXT_EDITOR->MoveUp(amount, select); + */ + + public native void moveDown(int amount, boolean select); /* + TEXT_EDITOR->MoveDown(amount, select); + */ + + public native void moveLeft(int amount, boolean select, boolean wordMode); /* + TEXT_EDITOR->MoveLeft(amount, select, wordMode); + */ + + public native void moveRight(int amount, boolean select, boolean wordMode); /* + TEXT_EDITOR->MoveRight(amount, select, wordMode); + */ + + public native void moveTop(boolean select); /* + TEXT_EDITOR->MoveTop(select); + */ + + public native void moveBottom(boolean select); /* + TEXT_EDITOR->MoveBottom(select); + */ + + public native void moveHome(boolean select); /* + TEXT_EDITOR->MoveHome(select); + */ + + public native void moveEnd(boolean select); /* + TEXT_EDITOR->MoveEnd(select); + */ + + public native void setSelectionStart(int line, int column); /* + TEXT_EDITOR->SetSelectionStart({ line, column }); + */ + + public native void setSelectionEnd(int line, int column); /* + TEXT_EDITOR->SetSelectionEnd({ line, column }); + */ + + public native void setSelection(int lineStart, int columnStart, int lineEnd, int columnEnd, int selectionMode); /* + TEXT_EDITOR->SetSelection({ lineStart, columnStart }, { lineEnd, columnEnd }, + static_cast(selectionMode)); + */ + + public native void selectWordUnderCursor(); /* + TEXT_EDITOR->SelectWordUnderCursor(); + */ + + public native void selectAll(); /* + TEXT_EDITOR->SelectAll(); + */ + + public native boolean hasSelection(); /* + return TEXT_EDITOR->HasSelection(); + */ + + public native void copy(); /* + TEXT_EDITOR->Copy(); + */ + + public native void cut(); /* + TEXT_EDITOR->Cut(); + */ + + public native void paste(); /* + TEXT_EDITOR->Paste(); + */ + + public native void delete(); /* + TEXT_EDITOR->Delete(); + */ + + public native boolean canUndo(); /* + return TEXT_EDITOR->CanUndo(); + */ + + public native boolean canRedo(); /* + return TEXT_EDITOR->CanRedo(); + */ + + public native void undo(int steps); /* + TEXT_EDITOR->Undo(steps); + */ + + public native void redo(int steps); /* + TEXT_EDITOR->Redo(steps); + */ + + public native int[] getDarkPalette(); /* + const auto& palette = TEXT_EDITOR->GetDarkPalette(); + + jintArray res = env->NewIntArray(palette.size()); + + jint arr[palette.size()]; + for (int i = 0; i < palette.size(); i++) { + arr[i] = palette[i]; + } + + env->SetIntArrayRegion(res, 0, palette.size(), arr); + + return res; + */ + + public native int[] getLightPalette(); /* + const auto& palette = TEXT_EDITOR->GetLightPalette(); + + jintArray res = env->NewIntArray(palette.size()); + + jint arr[palette.size()]; + for (int i = 0; i < palette.size(); i++) { + arr[i] = palette[i]; + } + + env->SetIntArrayRegion(res, 0, palette.size(), arr); + + return res; + */ + + public native int[] getRetroBluePalette(); /* + const auto& palette = TEXT_EDITOR->GetRetroBluePalette(); + + jintArray res = env->NewIntArray(palette.size()); + + jint arr[palette.size()]; + for (int i = 0; i < palette.size(); i++) { + arr[i] = palette[i]; + } + + env->SetIntArrayRegion(res, 0, palette.size(), arr); + + return res; + */ +} diff --git a/imgui-binding/src/main/java/imgui/extension/texteditor/TextEditorLanguageDefinition.java b/imgui-binding/src/main/java/imgui/extension/texteditor/TextEditorLanguageDefinition.java new file mode 100644 index 0000000..322a0df --- /dev/null +++ b/imgui-binding/src/main/java/imgui/extension/texteditor/TextEditorLanguageDefinition.java @@ -0,0 +1,205 @@ +package imgui.extension.texteditor; + +import imgui.binding.ImGuiStructDestroyable; + +import java.util.Map; + +public final class TextEditorLanguageDefinition extends ImGuiStructDestroyable { + /*JNI + #include "_texteditor.h" + + #define LANG_DEF ((TextEditor::LanguageDefinition*)STRUCT_PTR) + */ + + public TextEditorLanguageDefinition() { + } + + public TextEditorLanguageDefinition(final long ptr) { + super(ptr); + } + + @Override + protected long create() { + return nCreate(); + } + + private native long nCreate(); /* + return (intptr_t)(new TextEditor::LanguageDefinition()); + */ + + public native void setName(String name); /* + LANG_DEF->mName = name; + */ + + public void setKeywords(final String[] keywords) { + nSetKeywords(keywords, keywords.length); + } + + private native void nSetKeywords(String[] keywords, int length); /* + std::unordered_set set; + + for (int i = 0; i < length; i++) { + jstring string = (jstring)env->GetObjectArrayElement(keywords, i); + const char* raw = env->GetStringUTFChars(string, JNI_FALSE); + + set.emplace(std::string(raw)); + } + + LANG_DEF->mKeywords = set; + */ + + public void setIdentifiers(final Map identifiers) { + final String[] keys = identifiers.keySet().toArray(new String[0]); + final String[] decl = identifiers.values().toArray(new String[0]); + + nSetIdentifiers(keys, keys.length, decl, decl.length); + } + + private native void nSetIdentifiers(String[] keys, int keysLen, String[] decl, int declLen); /* + std::unordered_map identifiers; + + for (int i = 0; i < keysLen; i++) { + jstring string1 = (jstring)env->GetObjectArrayElement(keys, i); + const char* key = env->GetStringUTFChars(string1, JNI_FALSE); + + jstring string2 = (jstring)env->GetObjectArrayElement(decl, i); + const char* value = env->GetStringUTFChars(string2, JNI_FALSE); + + TextEditor::Identifier id; + id.mDeclaration = std::string(value); + + identifiers.insert(std::pair(std::string(key), id)); + } + + LANG_DEF->mIdentifiers = identifiers; + */ + + public void setPreprocIdentifiers(final Map identifiers) { + final String[] keys = identifiers.keySet().toArray(new String[0]); + final String[] decl = identifiers.values().toArray(new String[0]); + + nSetPreprocIdentifiers(keys, keys.length, decl, decl.length); + } + + private native void nSetPreprocIdentifiers(String[] keys, int keysLen, String[] decl, int declLen); /* + std::unordered_map preprocIdentifiers; + + for (int i = 0; i < keysLen; i++) { + jstring string1 = (jstring)env->GetObjectArrayElement(keys, i); + const char* key = env->GetStringUTFChars(string1, JNI_FALSE); + + jstring string2 = (jstring)env->GetObjectArrayElement(decl, i); + const char* value = env->GetStringUTFChars(string2, JNI_FALSE); + + TextEditor::Identifier id; + id.mDeclaration = std::string(value); + + preprocIdentifiers.insert(std::pair(std::string(key), id)); + } + + LANG_DEF->mPreprocIdentifiers = preprocIdentifiers; + */ + + public native void setCommentStart(String value); /* + LANG_DEF->mCommentStart = value; + */ + + public native void setCommentEnd(String value); /* + LANG_DEF->mCommentEnd = value; + */ + + public native void setSingleLineComment(String value); /* + LANG_DEF->mSingleLineComment = value; + */ + + public native void setPreprocChar(char value); /* + LANG_DEF->mPreprocChar = value; + */ + + public native void setAutoIdentation(boolean value); /* + LANG_DEF->mAutoIndentation = value; + */ + + public void setTokenRegexStrings(final Map tokenRegexStrings) { + final String[] keys = tokenRegexStrings.keySet().toArray(new String[0]); + final int[] paletteIndexes = tokenRegexStrings.values().stream().mapToInt(i -> i).toArray(); + + nSetTokenRegexStrings(keys, keys.length, paletteIndexes, paletteIndexes.length); + } + + private native void nSetTokenRegexStrings(String[] keys, int keysLen, int[] paletteIndexes, int paletteIndexesLen); /* + std::vector> tokenRegexStrings; + + for (int i = 0; i < keysLen; i++) { + jstring string = (jstring)env->GetObjectArrayElement(keys, i); + const char* key = env->GetStringUTFChars(string, JNI_FALSE); + + int value = paletteIndexes[i]; + + tokenRegexStrings.emplace_back(std::pair(std::string(key), + static_cast(value))); + } + + LANG_DEF->mTokenRegexStrings = tokenRegexStrings; + */ + + private native void setCaseSensitive(boolean value); /* + LANG_DEF->mCaseSensitive = value; + */ + + public static TextEditorLanguageDefinition cPlusPlus() { + return new TextEditorLanguageDefinition(nCPlusPlus()); + } + + public static TextEditorLanguageDefinition hlsl() { + return new TextEditorLanguageDefinition(nHLSL()); + } + + public static TextEditorLanguageDefinition glsl() { + return new TextEditorLanguageDefinition(nGLSL()); + } + + public static TextEditorLanguageDefinition c() { + return new TextEditorLanguageDefinition(nC()); + } + + public static TextEditorLanguageDefinition sql() { + return new TextEditorLanguageDefinition(nSQL()); + } + + public static TextEditorLanguageDefinition angelScript() { + return new TextEditorLanguageDefinition(nAngelScript()); + } + + public static TextEditorLanguageDefinition lua() { + return new TextEditorLanguageDefinition(nLua()); + } + + private static native long nCPlusPlus(); /* + return (intptr_t)&TextEditor::LanguageDefinition::CPlusPlus(); + */ + + private static native long nHLSL(); /* + return (intptr_t)&TextEditor::LanguageDefinition::HLSL(); + */ + + private static native long nGLSL(); /* + return (intptr_t)&TextEditor::LanguageDefinition::GLSL(); + */ + + private static native long nC(); /* + return (intptr_t)&TextEditor::LanguageDefinition::C(); + */ + + private static native long nSQL(); /* + return (intptr_t)&TextEditor::LanguageDefinition::SQL(); + */ + + private static native long nAngelScript(); /* + return (intptr_t)&TextEditor::LanguageDefinition::AngelScript(); + */ + + private static native long nLua(); /* + return (intptr_t)&TextEditor::LanguageDefinition::Lua(); + */ +} diff --git a/imgui-binding/src/main/java/imgui/extension/texteditor/flag/TextEditorPaletteIndex.java b/imgui-binding/src/main/java/imgui/extension/texteditor/flag/TextEditorPaletteIndex.java new file mode 100644 index 0000000..4829aa7 --- /dev/null +++ b/imgui-binding/src/main/java/imgui/extension/texteditor/flag/TextEditorPaletteIndex.java @@ -0,0 +1,29 @@ +package imgui.extension.texteditor.flag; + +public final class TextEditorPaletteIndex { + private TextEditorPaletteIndex() { + } + + public static final int Default = 0; + public static final int Keyword = 1; + public static final int Number = 2; + public static final int String = 3; + public static final int CharLiteral = 4; + public static final int Punctuation = 5; + public static final int Preprocessor = 6; + public static final int Identifier = 7; + public static final int KnownIdentifier = 8; + public static final int PreprocIdentifier = 9; + public static final int Comment = 10; + public static final int MultiLineComment = 11; + public static final int Background = 12; + public static final int Cursor = 13; + public static final int Selection = 14; + public static final int ErrorMarker = 15; + public static final int Breakpoint = 16; + public static final int LineNumber = 17; + public static final int CurrentLineFill = 18; + public static final int CurrentLineFillInactive = 19; + public static final int CurrentLineEdge = 20; + public static final int Max = 21; +} diff --git a/imgui-binding/src/main/java/imgui/extension/texteditor/flag/TextEditorSelectionMode.java b/imgui-binding/src/main/java/imgui/extension/texteditor/flag/TextEditorSelectionMode.java new file mode 100644 index 0000000..1ff5034 --- /dev/null +++ b/imgui-binding/src/main/java/imgui/extension/texteditor/flag/TextEditorSelectionMode.java @@ -0,0 +1,10 @@ +package imgui.extension.texteditor.flag; + +public final class TextEditorSelectionMode { + private TextEditorSelectionMode() { + } + + public static final int Normal = 0; + public static final int Word = 1; + public static final int Line = 2; +} diff --git a/imgui-binding/src/main/native/_texteditor.h b/imgui-binding/src/main/native/_texteditor.h new file mode 100644 index 0000000..fcc0508 --- /dev/null +++ b/imgui-binding/src/main/native/_texteditor.h @@ -0,0 +1,13 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include "_base.h" +#include "_binding.h" +#include "TextEditor.h" diff --git a/include/ImGuiColorTextEdit b/include/ImGuiColorTextEdit new file mode 160000 index 0000000..0a88824 --- /dev/null +++ b/include/ImGuiColorTextEdit @@ -0,0 +1 @@ +Subproject commit 0a88824f7de8d0bd11d8419066caa7d3469395c4