TDME2 1.9.121
TextEditorTabView.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5
6#include <tdme/tdme.h>
18
19using std::string;
20using std::vector;
21
32
33/**
34 * Text editor tab view
35 * @author Andreas Drewke
36 * @version $Id$
37 */
39 : public TabView
40{
41protected:
42 Engine* engine { nullptr };
43
44private:
45 EditorView* editorView { nullptr };
46 string tabId;
47 PopUps* popUps { nullptr };
50
51 // These were grabbed from gedit, yaaaa, not sure about License
54 GUIColor literalColor { "#eabc19" };
55 GUIColor keyword1Color { "#cb551a" };
56 GUIColor keyword2Color { "#8ae234" };
58
59 struct Language {
60 vector<string> extensions;
67 string keywords1;
68 string keywords2;
70 };
71
73 // I have taken CPP keywords1+2 from NotePad++, not sure about license
74 .extensions = {"cpp", "hpp", "h", "c"},
75 .commentLine = "//",
76 .commentInlineStart = "/*",
77 .commentInlineEnd = "*/",
78 .preprocessorLineKeywords = "#if #ifdef #ifndef #elif #else #endif #define #include #pragma #undef #error",
79 .keywordDelimiters = " \t\n:;=-+*/%&|!~<>{}()[],?",
80 .keywordQuotes = "\"\'",
81 .keywords1 = "alignof and and_eq bitand bitor break case catch compl const_cast continue default delete do dynamic_cast else false for goto if namespace new not not_eq nullptr operator or or_eq reinterpret_cast return sizeof static_assert static_cast switch this throw true try typedef typeid using while xor xor_eq NULL",
82 .keywords2 = "alignas asm auto bool char char16_t char32_t class clock_t concept const consteval constexpr constinit decltype double enum explicit export extern final float friend inline int int8_t int16_t int32_t int64_t int_fast8_t int_fast16_t int_fast32_t int_fast64_t intmax_t intptr_t long mutable noexcept override private protected ptrdiff_t public register requires short signed size_t ssize_t static struct template thread_local time_t typename uint8_t uint16_t uint32_t uint64_t uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t uintmax_t uintptr_t union unsigned virtual void volatile wchar_t",
83 .datatypeLiteralSuffixes = "u U l L ul uL Ul UL lu lU Lu LU ll LL ull uLL Ull ULL llu llU LLu LLU f F l L"
84 };
85
87 // see: https://www.lighthouse3d.com/2013/01/notepad-glsl-4-3-syntax-highlight/
88 .extensions = {"glsl", "frag", "vert"},
89 .commentLine = "//",
90 .commentInlineStart = "/*",
91 .commentInlineEnd = "*/",
92 .preprocessorLineKeywords = "#if #ifdef #ifndef #elif #else #endif #define #include #pragma #undef #error #extension #version #line",
93 .keywordDelimiters = " \t\n:;=-+*/%&|!~<>{}()[],?",
94 .keywordQuotes = "\"\'",
95 .keywords1 = "radians degrees sin cos tan asin acos atan sinh cosh tanh asinh acosh atanh pow exp log exp2 log2 sqrt inversqrt 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 findLSB bitCount findMSB textureSize textureQueryLod textureQueryLevels texture textureProj textureLod textureOffset texelFetch texelFetchOffset textureProjOffset textureLodOffset textureProjLod textureProjLodOffset textureGrad textureGradOffset textureProjGrad textureProjGradOffset textureGather textureGatherOffset textureGatherOffsets texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod atomicCounterIncrement atomicCounterDecrement atomicCounter atomicAdd atomicMin atomicMax atomicAnd atomicOr atomicXor atomicExchange atomicCompSwap imageSize imageLoad imageStore imageAtomicAdd imageAtomicMin imageAtomicMax imageAtomicAnd imageAtomicOr imageAtomicXor imageAtomicExchange imageAtomicCompSwap dFdx dFdy fwidth interpolateAtCentroid interpolateAtSample interpolateAtOffset noise1 noise2 noise3 noise4 EmitStreamVertex EndStreamPrimitive EmitVertex EndPrimitive barrier memoryBarrier memoryBarrierAtomicCounter memoryBarrierBuffer memoryBarrierShared memoryBarrierImage groupMemoryBarrier",
96 .keywords2 = "attribute const uniform varying buffer shared coherent volatile restrict readonly writeonly struct layout centroid flat smooth noperspective patch sample break continue do for while switch case default if else subroutine in out inout true false invariant discard return lowp mediump highp precision 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 atomic_uint 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 float double int void bool uint uvec2 uvec3 uvec4",
97 .datatypeLiteralSuffixes = ""
98 // TODO: global variables: gl_NumWorkGroups gl_WorkGroupSize gl_WorkGroupID gl_LocalInvocationID gl_GlobalInvocationID gl_LocalInvocationIndex gl_VertexID gl_InstanceID gl_PerVertex gl_Position gl_PointSize gl_ClipDistance gl_in gl_PrimitiveIDIn gl_InvocationID gl_Layer gl_ViewportIndex gl_PatchVerticesIn gl_InvocationID gl_out gl_TessLevelOuter gl_TessLevelInner gl_PatchVerticesIn gl_PrimitiveID gl_TessCoord gl_FragCoord gl_FrontFacing gl_ClipDistance gl_PointCoord gl_PrimitiveID gl_SampleID gl_SamplePosition gl_SampleMaskIn gl_Layer gl_ViewportIndex gl_FragDepth gl_SampleMask
99 // TODO: constraints: 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_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
100 };
101
102 vector<Language> languages { cpp, glsl };
103
104 struct XMLLanguage {
105 vector<string> extensions = { "xml" };
106 string commentInlineStart = "<!--";
107 string commentInlineEnd = "-->";
108 string delimiters = " \t\n=";
109 string quotes = "\"\'";
111
113 vector<string> extensions = { "properties" };
114 char comment = '#';
115 char delimiter = '=';
116 string whitespaces = " \t";
118
119public:
120 /**
121 * Public constructor
122 * @param editorView editor view
123 * @param tabId tab id
124 * @param screenNode screenNode
125 * @param extension extension
126 */
127 TextEditorTabView(EditorView* editorView, const string& tabId, GUIScreenNode* screenNode, const string& extension);
128
129 /**
130 * Destructor
131 */
133
134 /**
135 * @return editor view
136 */
138 return editorView;
139 }
140
141 /**
142 * @return associated tab controller
143 */
144 inline TabController* getTabController() override {
146 }
147
148 /**
149 * @return pop up views
150 */
151 inline PopUps* getPopUps() {
152 return popUps;
153 }
154
155 // overridden methods
156 void handleInputEvents() override;
157 void display() override;
158 inline const string& getTabId() override {
159 return tabId;
160 }
161 void initialize() override;
162 void dispose() override;
163 Engine* getEngine() override;
164 void activate() override;
165 void deactivate() override;
166 void reloadOutliner() override;
167 inline bool hasFixedSize() override{ return false; };
168 void updateRendering() override;
169
170};
Engine main class.
Definition: Engine.h:122
Frame buffer class.
Definition: FrameBuffer.h:21
Scene definition.
Definition: Scene.h:41
GUI screen node that represents a screen that can be rendered via GUI system.
Definition: GUIScreenNode.h:57
Pop ups controller accessor class.
Definition: PopUps.h:19
TextEditorTabView(EditorView *editorView, const string &tabId, GUIScreenNode *screenNode, const string &extension)
Public constructor.
bool hasFixedSize() override
If this viewport framebuffer has a fixed size.
struct tdme::tools::editor::tabviews::TextEditorTabView::XMLLanguage xmlLanguage
void initialize() override
Initiates the view.
struct tdme::tools::editor::tabviews::TextEditorTabView::PropertiesLanguage propertiesLanguage
void handleInputEvents() override
Handle input events that have not yet been processed.
void updateRendering() override
Update rendering.
Tab controller, which connects UI with logic.
Definition: TabController.h:23