diff --git a/.gitignore b/.gitignore index 78c9c4a2f..656fb7f20 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ eepp.kdev4 eepp.tags eepp.geany /bin/assets/icon/ee.aps +/bin/.htaccess diff --git a/README.md b/README.md index cab028933..0084f4898 100644 --- a/README.md +++ b/README.md @@ -344,7 +344,7 @@ Since eepp supports emscripten you can take a quick look on some of the examples the library currently provides. Please be aware that you'll find some differences based on the limitations that emscripten have at the moment (no threads, no access to the file system, no custom cursors, etc). Note: please wait some seconds until the resources are loaded, currently there is no loading indicator. -Also please use a modern browser with WebGL and WASM support. +Also please use a modern browser with good WebGL and WASM support (Chrome/ium 70+ or Firefox 80+). * **[ecode - Text Editor](https://web.ensoft.dev/eepp/demo-fs.html?run=ecode.js)** diff --git a/include/eepp/network/http.hpp b/include/eepp/network/http.hpp index ab8db51b9..97460713d 100644 --- a/include/eepp/network/http.hpp +++ b/include/eepp/network/http.hpp @@ -79,6 +79,9 @@ class EE_API Http : NonCopyable { /** @return The status string */ static const char* statusToString( const Status& status ); + /** @return True if the value is a valid Status */ + static Status intAsStatus( const int& value ); + /** Creates a faked response. Useful for testing. */ static Response createFakeResponse( const FieldTable& fields, Status& status, const std::string& body, unsigned int majorVersion = 1, diff --git a/include/eepp/ui/doc/syntaxcolorscheme.hpp b/include/eepp/ui/doc/syntaxcolorscheme.hpp index 6997e99bc..76ceaf069 100644 --- a/include/eepp/ui/doc/syntaxcolorscheme.hpp +++ b/include/eepp/ui/doc/syntaxcolorscheme.hpp @@ -1,5 +1,5 @@ -#ifndef EE_UI_DOC_SYNTAXSTYLE_HPP -#define EE_UI_DOC_SYNTAXSTYLE_HPP +#ifndef EE_UI_DOC_SYNTAXCOLORSCHEME_HPP +#define EE_UI_DOC_SYNTAXCOLORSCHEME_HPP #include #include @@ -81,4 +81,4 @@ class EE_API SyntaxColorScheme { }}} // namespace EE::UI::Doc -#endif // EE_UI_DOC_SYNTAXSTYLE_HPP +#endif // EE_UI_DOC_SYNTAXCOLORSCHEME_HPP diff --git a/premake4.lua b/premake4.lua index 7fc20e6b9..882235adc 100644 --- a/premake4.lua +++ b/premake4.lua @@ -152,6 +152,7 @@ newoption { trigger = "with-gles2", description = "Compile with GLES2 support" } newoption { trigger = "with-gles1", description = "Compile with GLES1 support" } newoption { trigger = "with-mojoal", description = "Compile with mojoAL as OpenAL implementation instead of using openal-soft (requires SDL2 backend)" } newoption { trigger = "use-frameworks", description = "In macOS it will try to link the external libraries from its frameworks. For example, instead of linking against SDL2 it will link agains SDL2.framework." } +newoption { trigger = "with-emscripten-pthreads", description = "Enables emscripten build to use posix threads" } newoption { trigger = "with-backend", description = "Select the backend to use for window and input handling.\n\t\t\tIf no backend is selected or if the selected is not installed the script will search for a backend present in the system, and will use it.", @@ -184,11 +185,11 @@ function os.get_real() return "android" end - if _OPTIONS.platform == "mingw32" then + if _OPTIONS.platform == "mingw32" then return _OPTIONS.platform end - if _OPTIONS.platform == "emscripten" then + if _OPTIONS.platform == "emscripten" then return _OPTIONS.platform end @@ -316,6 +317,12 @@ function build_base_configuration( package_name ) buildoptions{ "-Wall", "-std=gnu99" } end targetname ( package_name ) + + configuration "emscripten" + buildoptions { "-O3 -s USE_SDL=2 -s PRECISE_F32=1 -s ENVIRONMENT=worker,web" } + if _OPTIONS["with-emscripten-pthreads"] then + buildoptions { "-s USE_PTHREADS=1" } + end end function build_base_cpp_configuration( package_name ) @@ -341,6 +348,12 @@ function build_base_cpp_configuration( package_name ) buildoptions{ "-Wall" } end targetname ( package_name ) + + configuration "emscripten" + buildoptions { "-O3 -s USE_SDL=2 -s PRECISE_F32=1 -s ENVIRONMENT=worker,web" } + if _OPTIONS["with-emscripten-pthreads"] then + buildoptions { "-s USE_PTHREADS=1" } + end end function add_cross_config_links() @@ -460,9 +473,14 @@ function build_link_configuration( package_name, use_ee_icon ) add_cross_config_links() configuration "emscripten" - linkoptions { "-O3 -s TOTAL_MEMORY=67108864 -s VERBOSE=1" } + linkoptions { "-O3 -s TOTAL_MEMORY=67108864" } linkoptions { "-s USE_SDL=2" } - buildoptions { "-O3 -s USE_SDL=2 -s PRECISE_F32=1 -s ENVIRONMENT=web" } + buildoptions { "-O3 -s USE_SDL=2 -s PRECISE_F32=1 -s ENVIRONMENT=worker,web" } + + if _OPTIONS["with-emscripten-pthreads"] then + buildoptions { "-s USE_PTHREADS=1" } + linkoptions { "-s USE_PTHREADS=1" } + end if _OPTIONS["with-gles1"] and ( not _OPTIONS["with-gles2"] or _OPTIONS["force-gles1"] ) then linkoptions{ "-s LEGACY_GL_EMULATION=1" } diff --git a/premake5.lua b/premake5.lua index af90a8285..3164d7af9 100644 --- a/premake5.lua +++ b/premake5.lua @@ -7,6 +7,7 @@ newoption { trigger = "with-gles1", description = "Compile with GLES1 support" } newoption { trigger = "with-mojoal", description = "Compile with mojoAL as OpenAL implementation instead of using openal-soft (requires SDL2 backend)" } newoption { trigger = "use-frameworks", description = "In macOS it will try to link the external libraries from its frameworks. For example, instead of linking against SDL2 it will link against SDL2.framework." } newoption { trigger = "windows-vc-build", description = "This is used to build the framework in Visual Studio downloading its external dependencies and making them available to the VS project without having to install them manually." } +newoption { trigger = "with-emscripten-pthreads", description = "Enables emscripten build to use posix threads" } newoption { trigger = "with-backend", description = "Select the backend to use for window and input handling.\n\t\t\tIf no backend is selected or if the selected is not installed the script will search for a backend present in the system, and will use it.", @@ -143,6 +144,12 @@ function build_base_configuration( package_name ) filter "action:vs*" incdirs { "src/thirdparty/libzip/vs" } + + filter "system:emscripten" + buildoptions { "-O3 -s USE_SDL=2 -s PRECISE_F32=1 -s ENVIRONMENT=worker,web" } + if _OPTIONS["with-emscripten-pthreads"] then + buildoptions { "-s USE_PTHREADS=1" } + end end function build_base_cpp_configuration( package_name ) @@ -164,6 +171,12 @@ function build_base_cpp_configuration( package_name ) filter "configurations:release*" optimize "Speed" targetname ( package_name ) + + filter "system:emscripten" + buildoptions { "-O3 -s USE_SDL=2 -s PRECISE_F32=1 -s ENVIRONMENT=worker,web" } + if _OPTIONS["with-emscripten-pthreads"] then + buildoptions { "-s USE_PTHREADS=1" } + end end function build_link_configuration( package_name, use_ee_icon ) @@ -236,8 +249,14 @@ function build_link_configuration( package_name, use_ee_icon ) filter "system:emscripten" targetname ( package_name .. extension ) - linkoptions{ "-O2 -s TOTAL_MEMORY=67108864 -s ASM_JS=1 -s VERBOSE=1 -s DISABLE_EXCEPTION_CATCHING=0 -s USE_SDL=2 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ERROR_ON_MISSING_LIBRARIES=0 -s FULL_ES3=1 -s \"BINARYEN_TRAP_MODE='clamp'\"" } - buildoptions { "-fno-strict-aliasing -O2 -s USE_SDL=2 -s PRECISE_F32=1 -s ENVIRONMENT=web" } + linkoptions { "-O3 -s TOTAL_MEMORY=67108864" } + linkoptions { "-s USE_SDL=2" } + buildoptions { "-O3 -s USE_SDL=2 -s PRECISE_F32=1 -s ENVIRONMENT=worker,web" } + + if _OPTIONS["with-emscripten-pthreads"] then + buildoptions { "-s USE_PTHREADS=1" } + linkoptions { "-s USE_PTHREADS=1" } + end if _OPTIONS["with-gles1"] and ( not _OPTIONS["with-gles2"] or _OPTIONS["force-gles1"] ) then linkoptions{ "-s LEGACY_GL_EMULATION=1" } diff --git a/projects/emscripten/make.sh b/projects/emscripten/make.sh index c626a55c4..803a5f767 100755 --- a/projects/emscripten/make.sh +++ b/projects/emscripten/make.sh @@ -7,5 +7,3 @@ premake4 --file=../../premake4.lua --with-gles2 --with-static-eepp --platform=em cd ../../make/emscripten/ ln -sf ../../bin/assets/ ./ emmake make -j`nproc` $@ -# Fix a bug in emscripten, see my patch: https://github.com/emscripten-core/emscripten/pull/10208 -sed -i 's/function _alGetSource3f(source,/function _alGetSource3f(sourceId,/' ../../bin/*.js diff --git a/projects/emscripten/make_mt.sh b/projects/emscripten/make_mt.sh new file mode 100755 index 000000000..5399f1fef --- /dev/null +++ b/projects/emscripten/make_mt.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Currently latest emsdk tested and working version: latest-fastcomp +# remember to first set the environment +# source /path/to/emsdk/emsdk_env.sh +cd $(dirname "$0") +premake4 --file=../../premake4.lua --with-emscripten-pthreads --with-gles2 --with-static-eepp --platform=emscripten --with-backend=SDL2 gmake +cd ../../make/emscripten/ +ln -sf ../../bin/assets/ ./ +emmake make -j`nproc` $@ diff --git a/src/eepp/network/http.cpp b/src/eepp/network/http.cpp index 1974d4468..1fcc244da 100644 --- a/src/eepp/network/http.cpp +++ b/src/eepp/network/http.cpp @@ -317,6 +317,37 @@ const char* Http::Response::statusToString( const Http::Response::Status& status } } +Http::Response::Status Http::Response::intAsStatus( const int& value ) { + switch ( value ) { + case Ok: + case Created: + case Accepted: + case NoContent: + case ResetContent: + case PartialContent: + case MultipleChoices: + case MovedPermanently: + case MovedTemporarily: + case NotModified: + case BadRequest: + case Unauthorized: + case Forbidden: + case NotFound: + case RangeNotSatisfiable: + case InternalServerError: + case NotImplemented: + case BadGateway: + case ServiceNotAvailable: + case GatewayTimeout: + case VersionNotSupported: + case InvalidResponse: + case ConnectionFailed: + return (Status)value; + default: + return InternalServerError; + } +} + Http::Response Http::Response::createFakeResponse( const Http::Response::FieldTable& fields, Http::Response::Status& status, const std::string& body, @@ -1154,21 +1185,29 @@ bool Http::isProxied() const { return !mProxy.empty(); } +#if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN struct WGetAsyncRequest { Http* http; Http::Request request; Http::AsyncResponseCallback cb; + IOStream* writeTo{nullptr}; }; -#if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN void emscripten_async_wget2_got_data( unsigned, void* vwget, void* buffer, unsigned bufferSize ) { WGetAsyncRequest* wget = reinterpret_cast( vwget ); - std::string responseBody; Http::Response::Status status = Http::Response::Status::Ok; - responseBody.insert( 0, (const char*)buffer, bufferSize ); - Http::Response response = - Http::Response::createFakeResponse( Http::Response::FieldTable(), status, responseBody ); - wget->cb( *wget->http, wget->request, response ); + if ( wget->writeTo ) { + wget->writeTo->write( (const char*)buffer, bufferSize ); + Http::Response response = + Http::Response::createFakeResponse( Http::Response::FieldTable(), status, "" ); + wget->cb( *wget->http, wget->request, response ); + } else { + std::string responseBody; + responseBody.insert( 0, (const char*)buffer, bufferSize ); + Http::Response response = Http::Response::createFakeResponse( Http::Response::FieldTable(), + status, responseBody ); + wget->cb( *wget->http, wget->request, response ); + } delete wget; } @@ -1185,7 +1224,7 @@ void emscripten_async_wget2_got_error_data( unsigned, void* vwget, int errorCode const char* errorDescription ) { WGetAsyncRequest* wget = reinterpret_cast( vwget ); std::string responseBody; - Http::Response::Status status = Http::Response::Status::InternalServerError; + Http::Response::Status status = Http::Response::intAsStatus( errorCode ); Http::Response response = Http::Response::createFakeResponse( Http::Response::FieldTable(), status, responseBody ); wget->cb( *wget->http, wget->request, response ); @@ -1195,7 +1234,7 @@ void emscripten_async_wget2_got_error_data( unsigned, void* vwget, int errorCode void emscripten_async_wget2_got_error_file( unsigned int, void* vwget, int errorCode ) { WGetAsyncRequest* wget = reinterpret_cast( vwget ); std::string responseBody; - Http::Response::Status status = Http::Response::Status::InternalServerError; + Http::Response::Status status = Http::Response::intAsStatus( errorCode ); Http::Response response = Http::Response::createFakeResponse( Http::Response::FieldTable(), status, responseBody ); wget->cb( *wget->http, wget->request, response ); @@ -1231,6 +1270,18 @@ void Http::sendAsyncRequest( const Http::AsyncResponseCallback& cb, const Http:: void Http::downloadAsyncRequest( const Http::AsyncResponseCallback& cb, const Http::Request& request, IOStream& writeTo, Time timeout ) { +#if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN + WGetAsyncRequest* wget = new WGetAsyncRequest(); + wget->http = this; + wget->cb = cb; + wget->writeTo = &writeTo; + wget->request = Http::Request( request ); + emscripten_async_wget2_data( ( getURI().toString() + request.getUri() ).c_str(), + Request::methodToString( request.getMethod() ).c_str(), + URI( request.getUri() ).getQuery().c_str(), wget, 1, + emscripten_async_wget2_got_data, + emscripten_async_wget2_got_error_data, NULL ); +#else AsyncRequest* thread = eeNew( AsyncRequest, ( this, cb, request, writeTo, timeout ) ); thread->launch(); @@ -1241,6 +1292,7 @@ void Http::downloadAsyncRequest( const Http::AsyncResponseCallback& cb, removeOldThreads(); mThreads.push_back( thread ); +#endif } void Http::downloadAsyncRequest( const Http::AsyncResponseCallback& cb, diff --git a/src/eepp/system/sys.cpp b/src/eepp/system/sys.cpp index b3e1e371d..fbf84904e 100644 --- a/src/eepp/system/sys.cpp +++ b/src/eepp/system/sys.cpp @@ -47,6 +47,10 @@ #include #endif +#if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN +#include +#endif + namespace EE { namespace System { #if EE_PLATFORM == EE_PLATFORM_WIN @@ -717,6 +721,8 @@ int Sys::getCPUCount() { #elif EE_PLATFORM == EE_PLATFORM_LINUX || EE_PLATFORM == EE_PLATFORM_SOLARIS || \ EE_PLATFORM == EE_PLATFORM_ANDROID nprocs = sysconf( _SC_NPROCESSORS_ONLN ); +#elif EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN + return EM_ASM_INT( { return navigator.hardwareConcurrency; } ); #elif EE_PLATFORM == EE_PLATFORM_MACOSX || EE_PLATFORM == EE_PLATFORM_BSD || \ EE_PLATFORM == EE_PLATFORM_IOS int mib[2]; diff --git a/src/eepp/window/backend/SDL2/cursormanagersdl2.cpp b/src/eepp/window/backend/SDL2/cursormanagersdl2.cpp index e792e2f70..ac098d8fd 100644 --- a/src/eepp/window/backend/SDL2/cursormanagersdl2.cpp +++ b/src/eepp/window/backend/SDL2/cursormanagersdl2.cpp @@ -9,9 +9,7 @@ static SDL_Cursor* SDL_SYS_CURSORS[Cursor::SysCursorCount] = {0}; static SDL_Cursor* getLoadCursor( const Cursor::SysType& cursor ) { if ( 0 == SDL_SYS_CURSORS[cursor] ) { -#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN SDL_SYS_CURSORS[cursor] = SDL_CreateSystemCursor( (SDL_SystemCursor)cursor ); -#endif } return SDL_SYS_CURSORS[cursor]; diff --git a/src/eepp/window/backend/SDL2/windowsdl2.cpp b/src/eepp/window/backend/SDL2/windowsdl2.cpp index c5d93cf0c..92ae1f937 100644 --- a/src/eepp/window/backend/SDL2/windowsdl2.cpp +++ b/src/eepp/window/backend/SDL2/windowsdl2.cpp @@ -373,9 +373,7 @@ bool WindowSDL::create( WindowSettings Settings, ContextSettings Context ) { return false; } -#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN SDL_GL_SetSwapInterval( ( mWindow.ContextConfig.VSync ? 1 : 0 ) ); // VSync -#endif SDL_GL_MakeCurrent( mSDLWindow, mGLContext ); diff --git a/src/eepp/window/engine.cpp b/src/eepp/window/engine.cpp index 08d04f7b4..6203f3465 100644 --- a/src/eepp/window/engine.cpp +++ b/src/eepp/window/engine.cpp @@ -358,7 +358,7 @@ bool Engine::isSharedGLContextEnabled() { } bool Engine::isThreaded() { -#if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN +#if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN && !defined(__EMSCRIPTEN_PTHREADS__) return false; #else return true; diff --git a/src/tests/test_all/test.cpp b/src/tests/test_all/test.cpp index 635a3bd46..4db2b245c 100644 --- a/src/tests/test_all/test.cpp +++ b/src/tests/test_all/test.cpp @@ -208,10 +208,8 @@ void EETest::init() { physicsCreate(); -#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN - launch(); -#endif - + if ( EE->isThreaded() ) + launch(); } else { Engine::destroySingleton(); @@ -2161,9 +2159,8 @@ void EETest::update() { render(); -#if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN - updateParticles(); -#endif + if ( !EE->isThreaded() ) + updateParticles(); if ( KM->isKeyUp( KEY_F12 ) ) mWindow->takeScreenshot( MyPath + "screenshots/" ); // After render and before Display diff --git a/src/tools/codeeditor/autocompletemodule.cpp b/src/tools/codeeditor/autocompletemodule.cpp index 22d2cf8a3..303706ede 100644 --- a/src/tools/codeeditor/autocompletemodule.cpp +++ b/src/tools/codeeditor/autocompletemodule.cpp @@ -7,7 +7,7 @@ using namespace EE::Graphics; using namespace EE::System; -#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN +#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN || defined(__EMSCRIPTEN_PTHREADS__) #define AUTO_COMPLETE_THREADED 1 #else #define AUTO_COMPLETE_THREADED 0 diff --git a/src/tools/codeeditor/codeeditor.cpp b/src/tools/codeeditor/codeeditor.cpp index 9ed09ebd3..fb45cf5b5 100644 --- a/src/tools/codeeditor/codeeditor.cpp +++ b/src/tools/codeeditor/codeeditor.cpp @@ -770,7 +770,7 @@ void App::initGlobalSearchBar() { std::string search( mGlobalSearchInput->getText().toUtf8() ); ProjectSearch::findHorspool( mDirTree->getFiles(), search, -#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN +#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN || defined(__EMSCRIPTEN_PTHREADS__) mThreadPool, #endif [&, clock, search, loader]( const ProjectSearch::Result& res ) { diff --git a/src/tools/codeeditor/projectdirectorytree.cpp b/src/tools/codeeditor/projectdirectorytree.cpp index 3bbff640c..9ebb9fc08 100644 --- a/src/tools/codeeditor/projectdirectorytree.cpp +++ b/src/tools/codeeditor/projectdirectorytree.cpp @@ -12,7 +12,7 @@ ProjectDirectoryTree::ProjectDirectoryTree( const std::string& path, void ProjectDirectoryTree::scan( const ProjectDirectoryTree::ScanCompleteEvent& scanComplete, const std::vector& acceptedPattern, const bool& ignoreHidden ) { -#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN +#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN || defined(__EMSCRIPTEN_PTHREADS__) mPool->run( [&, acceptedPattern, ignoreHidden] { #endif @@ -45,11 +45,11 @@ void ProjectDirectoryTree::scan( const ProjectDirectoryTree::ScanCompleteEvent& getDirectoryFiles( mFiles, mNames, mPath, info, ignoreHidden, mIgnoreMatcher ); } mIsReady = true; -#if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN +#if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN && !defined(__EMSCRIPTEN_PTHREADS__) if ( scanComplete ) scanComplete( *this ); #endif -#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN +#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN || defined(__EMSCRIPTEN_PTHREADS__) }, [scanComplete, this] { if ( scanComplete ) diff --git a/src/tools/codeeditor/uitreeviewglobalsearch.cpp b/src/tools/codeeditor/uitreeviewglobalsearch.cpp index 6e627069c..1c5724727 100644 --- a/src/tools/codeeditor/uitreeviewglobalsearch.cpp +++ b/src/tools/codeeditor/uitreeviewglobalsearch.cpp @@ -1,19 +1,23 @@ #include "uitreeviewglobalsearch.hpp" +#include +#include +#include +#include -UITreeViewGlobalSearch::UITreeViewGlobalSearch(const SyntaxColorScheme& colorScheme) : +UITreeViewGlobalSearch::UITreeViewGlobalSearch( const SyntaxColorScheme& colorScheme ) : UITreeView(), mColorScheme( colorScheme ) { mLineNumColor = Color::fromString( - mUISceneNode->getRoot()->getUIStyle()->getVariable( "--font-hint" ).getValue() ); + mUISceneNode->getRoot()->getUIStyle()->getVariable( "--font-hint" ).getValue() ); } -UIWidget* UITreeViewGlobalSearch::createCell(UIWidget* rowWidget, const ModelIndex& index) { +UIWidget* UITreeViewGlobalSearch::createCell( UIWidget* rowWidget, const ModelIndex& index ) { UITableCell* widget = index.column() == (Int64)getModel()->treeColumn() - ? UITreeViewCellGlobalSearch::New() - : UITableCell::New(); + ? UITreeViewCellGlobalSearch::New() + : UITableCell::New(); return setupCell( widget, rowWidget, index ); } -UIPushButton* UITreeViewCellGlobalSearch::setText(const String& text) { +UIPushButton* UITreeViewCellGlobalSearch::setText( const String& text ) { if ( text != mTextBox->getText() ) { mTextBox->setVisible( !text.empty() ); mTextBox->setText( text ); @@ -23,7 +27,7 @@ UIPushButton* UITreeViewCellGlobalSearch::setText(const String& text) { return this; } -UIPushButton* UITreeViewCellGlobalSearch::updateText(const String& text) { +UIPushButton* UITreeViewCellGlobalSearch::updateText( const String& text ) { if ( getCurIndex().internalId() != -1 ) { UITreeViewGlobalSearch* pp = getParent()->getParent()->asType(); @@ -32,7 +36,7 @@ UIPushButton* UITreeViewCellGlobalSearch::updateText(const String& text) { auto styleDef = SyntaxDefinitionManager::instance()->getStyleByExtension( res->file ); auto tokens = - SyntaxTokenizer::tokenize( styleDef, text, SYNTAX_TOKENIZER_STATE_NONE ).first; + SyntaxTokenizer::tokenize( styleDef, text, SYNTAX_TOKENIZER_STATE_NONE ).first; size_t start = 0; for ( auto& token : tokens ) { diff --git a/src/tools/codeeditor/uitreeviewglobalsearch.hpp b/src/tools/codeeditor/uitreeviewglobalsearch.hpp index 480b9596d..f3e35eceb 100644 --- a/src/tools/codeeditor/uitreeviewglobalsearch.hpp +++ b/src/tools/codeeditor/uitreeviewglobalsearch.hpp @@ -1,8 +1,12 @@ #ifndef UITREEVIEWGLOBALSEARCH_HPP #define UITREEVIEWGLOBALSEARCH_HPP -#include #include "projectsearch.hpp" +#include +#include + +using namespace EE::UI; +using namespace EE::UI::Doc; class UITreeViewCellGlobalSearch : public UITreeViewCell { public: