diff --git a/include/eepp/scene/node.hpp b/include/eepp/scene/node.hpp index 51b6e82d4..777ff5f7e 100644 --- a/include/eepp/scene/node.hpp +++ b/include/eepp/scene/node.hpp @@ -219,7 +219,7 @@ class EE_API Node : public Transformable { void childsCloseAll(); - std::string getId() const; + const std::string& getId() const; virtual Node* setId( const std::string& id ); diff --git a/include/eepp/version.hpp b/include/eepp/version.hpp index 4305dfad6..01750df06 100644 --- a/include/eepp/version.hpp +++ b/include/eepp/version.hpp @@ -5,9 +5,9 @@ #include #define EEPP_MAJOR_VERSION 2 -#define EEPP_MINOR_VERSION 3 +#define EEPP_MINOR_VERSION 4 #define EEPP_PATCH_LEVEL 0 -#define EEPP_CODENAME "Anāgāmin" +#define EEPP_CODENAME "Vimuttimagga" /** The compiled version of the library */ #define EEPP_VERSION( x ) \ @@ -45,7 +45,10 @@ class EE_API Version { static std::string getCodename(); /** @return The build time of the library */ - static std::string getBuildTime(); + + static inline std::string getBuildTime() { + return std::string( __DATE__ ) + " " + std::string( __TIME__ ); + } }; } // namespace EE diff --git a/projects/linux/ee.files b/projects/linux/ee.files index 57e458d88..0b08f5176 100644 --- a/projects/linux/ee.files +++ b/projects/linux/ee.files @@ -1129,6 +1129,8 @@ ../../src/tools/ecode/uicodeeditorsplitter.hpp ../../src/tools/ecode/uitreeviewglobalsearch.cpp ../../src/tools/ecode/uitreeviewglobalsearch.hpp +../../src/tools/ecode/version.cpp +../../src/tools/ecode/version.hpp ../../src/tools/ecode/widgetcommandexecuter.hpp ../../src/tools/mapeditor/mapeditor.cpp ../../src/tools/textureatlaseditor/textureatlaseditor.cpp diff --git a/src/eepp/core/version.cpp b/src/eepp/core/version.cpp index 8cd5802f7..43a52edd8 100644 --- a/src/eepp/core/version.cpp +++ b/src/eepp/core/version.cpp @@ -23,8 +23,4 @@ std::string Version::getCodename() { return std::string( EEPP_CODENAME ); } -std::string Version::getBuildTime() { - return std::string( __DATE__ ) + " " + std::string( __TIME__ ); -} - } // namespace EE diff --git a/src/eepp/scene/node.cpp b/src/eepp/scene/node.cpp index 0f9520f27..3699b2c04 100644 --- a/src/eepp/scene/node.cpp +++ b/src/eepp/scene/node.cpp @@ -705,7 +705,7 @@ void Node::childsCloseAll() { writeNodeFlag( NODE_FLAG_CLOSING_CHILDREN, 0 ); } -std::string Node::getId() const { +const std::string& Node::getId() const { return mId; } diff --git a/src/tools/ecode/appconfig.cpp b/src/tools/ecode/appconfig.cpp index 348e0409b..59e085942 100644 --- a/src/tools/ecode/appconfig.cpp +++ b/src/tools/ecode/appconfig.cpp @@ -8,6 +8,8 @@ using namespace EE::Network; using json = nlohmann::json; +namespace ecode { + static PanelPosition panelPositionFromString( const std::string& str ) { if ( String::toLower( str ) == "right" ) return PanelPosition::Right; @@ -389,3 +391,5 @@ void AppConfig::loadProject( std::string projectFolder, UICodeEditorSplitter* ed } } } + +} diff --git a/src/tools/ecode/appconfig.hpp b/src/tools/ecode/appconfig.hpp index 641924760..2d3d03506 100644 --- a/src/tools/ecode/appconfig.hpp +++ b/src/tools/ecode/appconfig.hpp @@ -1,5 +1,5 @@ -#ifndef APPCONFIG_HPP -#define APPCONFIG_HPP +#ifndef ECODE_APPCONFIG_HPP +#define ECODE_APPCONFIG_HPP #include "widgetcommandexecuter.hpp" #include @@ -17,6 +17,8 @@ using namespace EE::UI::Tools; using namespace EE::System; using namespace EE::Window; +namespace ecode { + enum class PanelPosition { Left, Right }; struct UIConfig { @@ -125,4 +127,6 @@ struct AppConfig { std::shared_ptr pool ); }; -#endif // APPCONFIG_HPP +} // namespace ecode + +#endif // ECODE_APPCONFIG_HPP diff --git a/src/tools/ecode/docsearchcontroller.cpp b/src/tools/ecode/docsearchcontroller.cpp index 5872bf4e1..3bac6e6ec 100644 --- a/src/tools/ecode/docsearchcontroller.cpp +++ b/src/tools/ecode/docsearchcontroller.cpp @@ -1,6 +1,8 @@ #include "docsearchcontroller.hpp" #include "ecode.hpp" +namespace ecode { + DocSearchController::DocSearchController( UICodeEditorSplitter* editorSplitter, App* app ) : mEditorSplitter( editorSplitter ), mApp( app ) {} @@ -369,3 +371,5 @@ SearchBarConfig DocSearchController::getSearchBarConfig() const { searchBarConfig.escapeSequence = escapeSequenceChk->isChecked(); return searchBarConfig; } + +} diff --git a/src/tools/ecode/docsearchcontroller.hpp b/src/tools/ecode/docsearchcontroller.hpp index ac24903f2..43d53e1c1 100644 --- a/src/tools/ecode/docsearchcontroller.hpp +++ b/src/tools/ecode/docsearchcontroller.hpp @@ -1,9 +1,11 @@ -#ifndef DOCSEARCHCONTROLLER_HPP -#define DOCSEARCHCONTROLLER_HPP +#ifndef ECODE_DOCSEARCHCONTROLLER_HPP +#define ECODE_DOCSEARCHCONTROLLER_HPP #include "appconfig.hpp" #include +namespace ecode { + struct SearchState { UICodeEditor* editor{ nullptr }; String text; @@ -35,8 +37,7 @@ class DocSearchController { DocSearchController( UICodeEditorSplitter*, App* app ); void initSearchBar( - UISearchBar* searchBar, - const SearchBarConfig& searchBarConfig, + UISearchBar* searchBar, const SearchBarConfig& searchBarConfig, std::unordered_map keybindings = getDefaultKeybindings() ); void showFindView(); @@ -67,4 +68,6 @@ class DocSearchController { String mLastSearch; }; -#endif // DOCSEARCHCONTROLLER_HPP +} // namespace ecode + +#endif // ECODE_DOCSEARCHCONTROLLER_HPP diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 6887b1b6c..e6ebcc323 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -2,9 +2,12 @@ #include "plugins/autocomplete/autocompleteplugin.hpp" #include "plugins/formatter/formatterplugin.hpp" #include "plugins/linter/linterplugin.hpp" +#include "version.hpp" #include #include +namespace ecode { + Clock globalClock; bool firstFrame = true; App* appInstance = nullptr; @@ -568,6 +571,27 @@ void App::setUIColorScheme( const ColorSchemePreference& colorScheme ) { mUISceneNode->setColorSchemePreference( colorScheme ); } +UIMenu* App::createHelpMenu() { + UIPopUpMenu* helpMenu = UIPopUpMenu::New(); + helpMenu->add( i18n( "ecode_source", "ecode source code..." ), findIcon( "github" ) ) + ->setId( "ecode_source" ); + helpMenu->add( i18n( "about_ecode", "About ecode..." ) )->setId( "about_ecode" ); + helpMenu->addEventListener( Event::OnItemClicked, [&]( const Event* event ) { + const std::string& id = event->getNode()->getId(); + + if ( "ecode_source" == id ) { + Engine::instance()->openURL( "https://github.com/SpartanJ/ecode" ); + } else if ( "about_ecode" == id ) { + String msg( ecode::Version::getVersionName() + + " (codename: \"" + ecode::Version::getCodename() + "\")" ); + UIMessageBox* msgBox = UIMessageBox::New( UIMessageBox::OK, msg ); + msgBox->setTitle( i18n( "about_ecode", "About ecode..." ) ); + msgBox->show(); + } + } ); + return helpMenu; +} + UIMenu* App::createWindowMenu() { mWindowMenu = UIPopUpMenu::New(); UIPopUpMenu* colorsMenu = UIPopUpMenu::New(); @@ -2246,6 +2270,7 @@ void App::createSettingsMenu() { mSettingsMenu->addSubMenu( "View", nullptr, createViewMenu() ); mSettingsMenu->addSubMenu( "Tools", nullptr, createToolsMenu() ); mSettingsMenu->addSubMenu( "Window", nullptr, createWindowMenu() ); + mSettingsMenu->addSubMenu( "Help", findIcon( "help" ), createHelpMenu() ); mSettingsMenu->addSeparator(); mSettingsMenu->add( "Close", findIcon( "document-close" ), getKeybind( "close-doc" ) ); mSettingsMenu->add( "Close Folder", findIcon( "document-close" ), @@ -2804,6 +2829,9 @@ void App::init( std::string file, const Float& pidelDensity, const std::string& contextSettings.SharedGLContext = true; mWindow = engine->createWindow( winSettings, contextSettings ); + Log::info( "%s (codename: \"%s\") initializing", ecode::Version::getVersionName().c_str(), + ecode::Version::getCodename().c_str() ); + if ( mWindow->isOpen() ) { Log::info( "Window creation took: %.2fms", globalClock.getElapsedTime().asMilliseconds() ); @@ -3125,6 +3153,7 @@ void App::init( std::string file, const Float& pidelDensity, const std::string& { "color-scheme", 0xebd4 }, { "global-settings", 0xedcf }, { "folder-user", 0xed84 }, + { "help", 0xf045 }, }; for ( const auto& icon : icons ) iconTheme->add( UIGlyphIcon::New( icon.first, iconFont, icon.second ) ); @@ -3161,7 +3190,7 @@ void App::init( std::string file, const Float& pidelDensity, const std::string& { "filetype-dockerfile", 61758 }, { "file", 61766 }, { "file-symlink", 61774 }, { "folder", 0xF23B }, { "folder-open", 0xF23C }, { "tree-expanded", 0xF11E }, - { "tree-contracted", 0xF120 }, + { "tree-contracted", 0xF120 }, { "github", 0xF184 }, }; for ( const auto& icon : mimeIcons ) iconTheme->add( UIGlyphIcon::New( icon.first, mimeIconFont, icon.second ) ); @@ -3313,3 +3342,5 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) { return EXIT_SUCCESS; } + +} // namespace ecode diff --git a/src/tools/ecode/ecode.hpp b/src/tools/ecode/ecode.hpp index 22c314dd7..fcd2fe4de 100644 --- a/src/tools/ecode/ecode.hpp +++ b/src/tools/ecode/ecode.hpp @@ -1,5 +1,5 @@ -#ifndef EE_TOOLS_CODEEDITOR_HPP -#define EE_TOOLS_CODEEDITOR_HPP +#ifndef ECODE_HPP +#define ECODE_HPP #include "appconfig.hpp" #include "docsearchcontroller.hpp" @@ -14,6 +14,8 @@ #include #include +namespace ecode { + class AutoCompletePlugin; class LinterPlugin; class FormatterPlugin; @@ -194,6 +196,8 @@ class App : public UICodeEditorSplitter::Client { UIMenu* createWindowMenu(); + UIMenu* createHelpMenu(); + Drawable* findIcon( const std::string& name ); String i18n( const std::string& key, const String& def ); @@ -268,4 +272,6 @@ class App : public UICodeEditorSplitter::Client { void setUIColorScheme( const ColorSchemePreference& colorScheme ); }; -#endif // EE_TOOLS_CODEEDITOR_HPP +} // namespace ecode + +#endif // ECODE_HPP diff --git a/src/tools/ecode/filelocator.cpp b/src/tools/ecode/filelocator.cpp index 4999d3c94..44313253a 100644 --- a/src/tools/ecode/filelocator.cpp +++ b/src/tools/ecode/filelocator.cpp @@ -1,6 +1,8 @@ #include "filelocator.hpp" #include "ecode.hpp" +namespace ecode { + static int LOCATEBAR_MAX_VISIBLE_ITEMS = 18; static int LOCATEBAR_MAX_RESULTS = 100; @@ -145,3 +147,5 @@ void FileLocator::showLocateBar() { } updateLocateBar(); } + +} diff --git a/src/tools/ecode/filelocator.hpp b/src/tools/ecode/filelocator.hpp index dbed66905..c10ad9252 100644 --- a/src/tools/ecode/filelocator.hpp +++ b/src/tools/ecode/filelocator.hpp @@ -1,9 +1,11 @@ -#ifndef FILELOCATOR_HPP -#define FILELOCATOR_HPP +#ifndef ECODE_FILELOCATOR_HPP +#define ECODE_FILELOCATOR_HPP #include "widgetcommandexecuter.hpp" #include +namespace ecode { + class App; class FileLocator { @@ -31,4 +33,6 @@ class FileLocator { void updateLocateBar(); }; -#endif // FILELOCATOR_HPP +} // namespace ecode + +#endif // ECODE_FILELOCATOR_HPP diff --git a/src/tools/ecode/filesystemlistener.cpp b/src/tools/ecode/filesystemlistener.cpp index 54b49e069..36395eff5 100644 --- a/src/tools/ecode/filesystemlistener.cpp +++ b/src/tools/ecode/filesystemlistener.cpp @@ -1,5 +1,7 @@ #include "filesystemlistener.hpp" +namespace ecode { + FileSystemListener::FileSystemListener( UICodeEditorSplitter* splitter, std::shared_ptr fileSystemModel ) : mSplitter( splitter ), mFileSystemModel( fileSystemModel ) {} @@ -76,3 +78,5 @@ void FileSystemListener::notifyMove( const FileInfo& oldFile, const FileInfo& ne doc.notifyDocumentMoved( newFile.getFilepath() ); } ); } + +} diff --git a/src/tools/ecode/filesystemlistener.hpp b/src/tools/ecode/filesystemlistener.hpp index 2a4308e32..bb6d108b9 100644 --- a/src/tools/ecode/filesystemlistener.hpp +++ b/src/tools/ecode/filesystemlistener.hpp @@ -1,5 +1,5 @@ -#ifndef FILESYSTEMLISTENER_HPP -#define FILESYSTEMLISTENER_HPP +#ifndef ECODE_FILESYSTEMLISTENER_HPP +#define ECODE_FILESYSTEMLISTENER_HPP #include "projectdirectorytree.hpp" #include @@ -13,6 +13,8 @@ using namespace EE::UI; using namespace EE::UI::Models; using namespace EE::UI::Tools; +namespace ecode { + class FileSystemListener : public efsw::FileWatchListener { public: FileSystemListener( UICodeEditorSplitter* codeSplitter, @@ -39,4 +41,6 @@ class FileSystemListener : public efsw::FileWatchListener { void notifyMove( const FileInfo& oldFile, const FileInfo& newFile ); }; -#endif // FILESYSTEMLISTENER_HPP +} // namespace ecode + +#endif // ECODE_FILESYSTEMLISTENER_HPP diff --git a/src/tools/ecode/globalsearchcontroller.cpp b/src/tools/ecode/globalsearchcontroller.cpp index 85e5f7234..d3935d34d 100644 --- a/src/tools/ecode/globalsearchcontroller.cpp +++ b/src/tools/ecode/globalsearchcontroller.cpp @@ -2,6 +2,7 @@ #include "ecode.hpp" #include "uitreeviewglobalsearch.hpp" +namespace ecode { static int LOCATEBAR_MAX_VISIBLE_ITEMS = 18; GlobalSearchController::GlobalSearchController( UICodeEditorSplitter* editorSplitter, @@ -531,3 +532,5 @@ void GlobalSearchController::initGlobalSearchTree( UITreeViewGlobalSearch* searc } } ); } + +} diff --git a/src/tools/ecode/globalsearchcontroller.hpp b/src/tools/ecode/globalsearchcontroller.hpp index bc1440886..1f19e5207 100644 --- a/src/tools/ecode/globalsearchcontroller.hpp +++ b/src/tools/ecode/globalsearchcontroller.hpp @@ -1,13 +1,15 @@ -#ifndef GLOBALSEARCHCONTROLLER_HPP -#define GLOBALSEARCHCONTROLLER_HPP +#ifndef ECODE_GLOBALSEARCHCONTROLLER_HPP +#define ECODE_GLOBALSEARCHCONTROLLER_HPP #include "appconfig.hpp" #include "projectsearch.hpp" #include -class App; +namespace ecode { + class UIGlobalSearchBar; class UITreeViewGlobalSearch; +class App; class GlobalSearchController { public: @@ -77,4 +79,6 @@ class GlobalSearchController { void onLoadDone( const Variant& lineNum, const Variant& colNum ); }; -#endif // GLOBALSEARCHCONTROLLER_HPP +} // namespace ecode + +#endif // ECODE_GLOBALSEARCHCONTROLLER_HPP diff --git a/src/tools/ecode/ignorematcher.cpp b/src/tools/ecode/ignorematcher.cpp index ec100f2d2..07dcc6371 100644 --- a/src/tools/ecode/ignorematcher.cpp +++ b/src/tools/ecode/ignorematcher.cpp @@ -2,6 +2,8 @@ #include #include +namespace ecode { + // Author: Robert A. van Engelen, engelen@genivia.com // Date: August 5, 2019 // License: The Code Project Open License (CPOL) @@ -214,3 +216,5 @@ const std::string& IgnoreMatcherManager::getPath() const { eeASSERT( foundMatch() ); return mMatcher->getPath(); } + +} diff --git a/src/tools/ecode/ignorematcher.hpp b/src/tools/ecode/ignorematcher.hpp index 348f87491..345f35e20 100644 --- a/src/tools/ecode/ignorematcher.hpp +++ b/src/tools/ecode/ignorematcher.hpp @@ -1,5 +1,5 @@ -#ifndef EE_TOOLS_IGNOREMATCHER_HPP -#define EE_TOOLS_IGNOREMATCHER_HPP +#ifndef ECODE_IGNOREMATCHER_HPP +#define ECODE_IGNOREMATCHER_HPP #include #include @@ -9,6 +9,8 @@ using namespace EE; using namespace EE::System; +namespace ecode { + class IgnoreMatcher { public: IgnoreMatcher( const std::string& rootPath ); @@ -56,4 +58,6 @@ class IgnoreMatcherManager { std::unique_ptr mMatcher; }; -#endif // EE_TOOLS_IGNOREMATCHER_HPP +} // namespace ecode + +#endif // ECODE_IGNOREMATCHER_HPP diff --git a/src/tools/ecode/notificationcenter.cpp b/src/tools/ecode/notificationcenter.cpp index fb3480e29..e44a07b6d 100644 --- a/src/tools/ecode/notificationcenter.cpp +++ b/src/tools/ecode/notificationcenter.cpp @@ -1,5 +1,7 @@ #include "notificationcenter.hpp" +namespace ecode { + NotificationCenter::NotificationCenter( UILayout* layout ) : mLayout( layout ) {} UITextView* NotificationCenter::addNotification( const String& text ) { @@ -20,3 +22,5 @@ UITextView* NotificationCenter::addNotification( const String& text ) { tv->runAction( sequence ); return tv; } + +} diff --git a/src/tools/ecode/notificationcenter.hpp b/src/tools/ecode/notificationcenter.hpp index 3b801681a..f1193d943 100644 --- a/src/tools/ecode/notificationcenter.hpp +++ b/src/tools/ecode/notificationcenter.hpp @@ -1,8 +1,10 @@ -#ifndef NOTIFICATIONCENTER_HPP -#define NOTIFICATIONCENTER_HPP +#ifndef ECODE_NOTIFICATIONCENTER_HPP +#define ECODE_NOTIFICATIONCENTER_HPP #include +namespace ecode { + class NotificationCenter { public: NotificationCenter( UILayout* layout ); @@ -13,4 +15,6 @@ class NotificationCenter { UILayout* mLayout{ nullptr }; }; -#endif // NOTIFICATIONCENTER_HPP +} // namespace ecode + +#endif // ECODE_NOTIFICATIONCENTER_HPP diff --git a/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp b/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp index cfbcf3c15..20ee50d0e 100644 --- a/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp +++ b/src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp @@ -7,6 +7,8 @@ using namespace EE::Graphics; using namespace EE::System; +namespace ecode { + #if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN || defined( __EMSCRIPTEN_PTHREADS__ ) #define AUTO_COMPLETE_THREADED 1 #else @@ -475,3 +477,5 @@ void AutoCompletePlugin::updateSuggestions( const std::string& symbol, UICodeEdi #endif } } + +} diff --git a/src/tools/ecode/plugins/autocomplete/autocompleteplugin.hpp b/src/tools/ecode/plugins/autocomplete/autocompleteplugin.hpp index 180d00b96..0071dbc01 100644 --- a/src/tools/ecode/plugins/autocomplete/autocompleteplugin.hpp +++ b/src/tools/ecode/plugins/autocomplete/autocompleteplugin.hpp @@ -1,5 +1,5 @@ -#ifndef AUTOCOMPLETEPLUGIN_HPP -#define AUTOCOMPLETEPLUGIN_HPP +#ifndef ECODE_AUTOCOMPLETEPLUGIN_HPP +#define ECODE_AUTOCOMPLETEPLUGIN_HPP #include #include @@ -12,6 +12,8 @@ using namespace EE; using namespace EE::System; using namespace EE::UI; +namespace ecode { + class AutoCompletePlugin : public UICodeEditorPlugin { public: typedef std::unordered_set SymbolsList; @@ -112,4 +114,6 @@ class AutoCompletePlugin : public UICodeEditorPlugin { void pickSuggestion( UICodeEditor* editor ); }; -#endif // AUTOCOMPLETEPLUGIN_HPP +} + +#endif // ECODE_AUTOCOMPLETEPLUGIN_HPP diff --git a/src/tools/ecode/plugins/formatter/formatterplugin.cpp b/src/tools/ecode/plugins/formatter/formatterplugin.cpp index ef85019f1..9b5ab35fe 100644 --- a/src/tools/ecode/plugins/formatter/formatterplugin.cpp +++ b/src/tools/ecode/plugins/formatter/formatterplugin.cpp @@ -8,6 +8,8 @@ using json = nlohmann::json; +namespace ecode { + #if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN || defined( __EMSCRIPTEN_PTHREADS__ ) #define FORMATTER_THREADED 1 #else @@ -206,3 +208,5 @@ FormatterPlugin::Formatter FormatterPlugin::supportsFormatter( std::shared_ptr #include @@ -10,6 +10,8 @@ using namespace EE; using namespace EE::System; using namespace EE::UI; +namespace ecode { + class FormatterPlugin : public UICodeEditorPlugin { public: FormatterPlugin( const std::string& formatterPath, std::shared_ptr pool ); @@ -54,4 +56,6 @@ class FormatterPlugin : public UICodeEditorPlugin { FormatterPlugin::Formatter supportsFormatter( std::shared_ptr doc ); }; -#endif // FORMATTERPLUGIN_HPP +} + +#endif // ECODE_FORMATTERPLUGIN_HPP diff --git a/src/tools/ecode/plugins/linter/linterplugin.cpp b/src/tools/ecode/plugins/linter/linterplugin.cpp index 3e5c8268d..fda07e4a9 100644 --- a/src/tools/ecode/plugins/linter/linterplugin.cpp +++ b/src/tools/ecode/plugins/linter/linterplugin.cpp @@ -11,6 +11,8 @@ using json = nlohmann::json; +namespace ecode { + #if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN || defined( __EMSCRIPTEN_PTHREADS__ ) #define LINTER_THREADED 1 #else @@ -497,3 +499,5 @@ void LinterPlugin::invalidateEditors( TextDocument* doc ) { it.first->invalidateDraw(); } } + +} diff --git a/src/tools/ecode/plugins/linter/linterplugin.hpp b/src/tools/ecode/plugins/linter/linterplugin.hpp index 5a891b4d8..f6f6a05c1 100644 --- a/src/tools/ecode/plugins/linter/linterplugin.hpp +++ b/src/tools/ecode/plugins/linter/linterplugin.hpp @@ -1,5 +1,5 @@ -#ifndef LINTERPLUGIN_HPP -#define LINTERPLUGIN_HPP +#ifndef ECODE_LINTERPLUGIN_HPP +#define ECODE_LINTERPLUGIN_HPP #include #include @@ -10,6 +10,8 @@ using namespace EE; using namespace EE::System; using namespace EE::UI; +namespace ecode { + enum class LinterType { Notice, Warning, Error }; struct Linter { @@ -101,4 +103,6 @@ class LinterPlugin : public UICodeEditorPlugin { std::string getMatchString( const LinterType& type ); }; -#endif // LINTERPLUGIN_HPP +} + +#endif // ECODE_LINTERPLUGIN_HPP diff --git a/src/tools/ecode/projectdirectorytree.cpp b/src/tools/ecode/projectdirectorytree.cpp index be67a2b76..8eac6024b 100644 --- a/src/tools/ecode/projectdirectorytree.cpp +++ b/src/tools/ecode/projectdirectorytree.cpp @@ -2,6 +2,8 @@ #include #include +namespace ecode { + ProjectDirectoryTree::ProjectDirectoryTree( const std::string& path, std::shared_ptr threadPool ) : mPath( path ), mPool( threadPool ), mIsReady( false ), mIgnoreMatcher( path ) { @@ -348,3 +350,5 @@ size_t ProjectDirectoryTree::findFileIndex( const std::string& path ) { } return std::string::npos; } + +} diff --git a/src/tools/ecode/projectdirectorytree.hpp b/src/tools/ecode/projectdirectorytree.hpp index 678bf32ce..9fd1ad2c6 100644 --- a/src/tools/ecode/projectdirectorytree.hpp +++ b/src/tools/ecode/projectdirectorytree.hpp @@ -1,5 +1,5 @@ -#ifndef EE_TOOLS_PROJECTDIRECTORYTREE_HPP -#define EE_TOOLS_PROJECTDIRECTORYTREE_HPP +#ifndef ECODE_PROJECTDIRECTORYTREE_HPP +#define ECODE_PROJECTDIRECTORYTREE_HPP #include "ignorematcher.hpp" #include @@ -16,6 +16,8 @@ using namespace EE; using namespace EE::System; using namespace EE::UI::Models; +namespace ecode { + class FileListModel : public Model { public: FileListModel( const std::vector& files, const std::vector& names ) : @@ -121,4 +123,6 @@ class ProjectDirectoryTree { size_t findFileIndex( const std::string& path ); }; -#endif // EE_TOOLS_PROJECTDIRECTORYTREE_HPP +} + +#endif // ECODE_PROJECTDIRECTORYTREE_HPP diff --git a/src/tools/ecode/projectsearch.cpp b/src/tools/ecode/projectsearch.cpp index 58ad9fb23..ac095c3cc 100644 --- a/src/tools/ecode/projectsearch.cpp +++ b/src/tools/ecode/projectsearch.cpp @@ -2,6 +2,8 @@ #include #include +namespace ecode { + static int countNewLines( const std::string& text, const size_t& start, const size_t& end ) { const char* startPtr = text.c_str() + start; const char* endPtr = text.c_str() + end; @@ -185,3 +187,5 @@ void ProjectSearch::find( const std::vector files, std::string stri } ); } } + +} diff --git a/src/tools/ecode/projectsearch.hpp b/src/tools/ecode/projectsearch.hpp index 9fd9d0969..a7b1f4eb1 100644 --- a/src/tools/ecode/projectsearch.hpp +++ b/src/tools/ecode/projectsearch.hpp @@ -1,5 +1,5 @@ -#ifndef PROJECTSEARCH_HPP -#define PROJECTSEARCH_HPP +#ifndef ECODE_PROJECTSEARCH_HPP +#define ECODE_PROJECTSEARCH_HPP #include #include @@ -14,6 +14,8 @@ using namespace EE::System; using namespace EE::UI::Doc; using namespace EE::UI::Models; +namespace ecode { + class ProjectSearch { public: struct ResultData { @@ -203,4 +205,6 @@ class ProjectSearch { const TextDocument::FindReplaceType& type = TextDocument::FindReplaceType::Normal ); }; -#endif // PROJECTSEARCH_HPP +} // namespace ecode + +#endif // ECODE_PROJECTSEARCH_HPP diff --git a/src/tools/ecode/uitreeviewglobalsearch.cpp b/src/tools/ecode/uitreeviewglobalsearch.cpp index 3905ca1ec..986ce9116 100644 --- a/src/tools/ecode/uitreeviewglobalsearch.cpp +++ b/src/tools/ecode/uitreeviewglobalsearch.cpp @@ -7,6 +7,8 @@ #include #include +namespace ecode { + UITreeViewGlobalSearch::UITreeViewGlobalSearch( const SyntaxColorScheme& colorScheme, bool searchReplace ) : UITreeView(), mColorScheme( colorScheme ), mSearchReplace( searchReplace ) { @@ -221,3 +223,5 @@ void UITreeViewCellGlobalSearch::updateCell( Model* ) { } } } + +} diff --git a/src/tools/ecode/uitreeviewglobalsearch.hpp b/src/tools/ecode/uitreeviewglobalsearch.hpp index fd59350de..1c2672d3e 100644 --- a/src/tools/ecode/uitreeviewglobalsearch.hpp +++ b/src/tools/ecode/uitreeviewglobalsearch.hpp @@ -1,5 +1,5 @@ -#ifndef UITREEVIEWGLOBALSEARCH_HPP -#define UITREEVIEWGLOBALSEARCH_HPP +#ifndef ECODE_UITREEVIEWGLOBALSEARCH_HPP +#define ECODE_UITREEVIEWGLOBALSEARCH_HPP #include "projectsearch.hpp" #include @@ -8,6 +8,8 @@ using namespace EE::UI; using namespace EE::UI::Doc; +namespace ecode { + class UITreeViewCellGlobalSearch : public UITreeViewCell { public: static UITreeViewCellGlobalSearch* New( bool selectionEnabled ) { @@ -66,7 +68,8 @@ class UITreeViewGlobalSearch : public UITreeView { bool mSearchReplace{ false }; virtual Uint32 onKeyDown( const KeyEvent& event ); - }; -#endif // UITREEVIEWGLOBALSEARCH_HPP +} // namespace ecode + +#endif // ECODE_UITREEVIEWGLOBALSEARCH_HPP diff --git a/src/tools/ecode/version.cpp b/src/tools/ecode/version.cpp new file mode 100644 index 000000000..219ff4325 --- /dev/null +++ b/src/tools/ecode/version.cpp @@ -0,0 +1,26 @@ +#include "version.hpp" +#include + +namespace ecode { + +Version Version::getVersion() { + Version ver; + ECODE_VERSION( &ver ); + return ver; +} + +Uint32 Version::getVersionNum() { + Version ver = getVersion(); + return ECODE_VERSIONNUM( ver.major, ver.minor, ver.patch ); +} + +std::string Version::getVersionName() { + Version ver = getVersion(); + return String::format( "ecode version %d.%d.%d", ver.major, ver.minor, ver.patch ); +} + +std::string Version::getCodename() { + return std::string( ECODE_CODENAME ); +} + +} // namespace ecode diff --git a/src/tools/ecode/version.hpp b/src/tools/ecode/version.hpp new file mode 100644 index 000000000..2a2185347 --- /dev/null +++ b/src/tools/ecode/version.hpp @@ -0,0 +1,58 @@ +#ifndef ECODE_VERSION_HPP +#define ECODE_VERSION_HPP + +#include +#include + +using namespace EE; + +#define ECODE_MAJOR_VERSION 0 +#define ECODE_MINOR_VERSION 1 +#define ECODE_PATCH_LEVEL 0 +#define ECODE_CODENAME "Viriya" + +/** The compiled version of the library */ +#define ECODE_VERSION( x ) \ + { \ + ( x )->major = ECODE_MAJOR_VERSION; \ + ( x )->minor = ECODE_MINOR_VERSION; \ + ( x )->patch = ECODE_PATCH_LEVEL; \ + } + +#define ECODE_VERSIONNUM( X, Y, Z ) ( (X)*1000 + (Y)*100 + ( Z ) ) + +#define ECODE_COMPILEDVERSION \ + ECODE_VERSIONNUM( ECODE_MAJOR_VERSION, ECODE_MINOR_VERSION, ECODE_PATCH_LEVEL ) + +#define ECODE_VERSION_ATLEAST( X, Y, Z ) ( ECODE_COMPILEDVERSION >= ECODE_VERSIONNUM( X, Y, Z ) ) + +namespace ecode { + +class Version { + public: + Uint8 major; /**< major version */ + Uint8 minor; /**< minor version */ + Uint8 patch; /**< update version */ + + /** @return The linked version of the library */ + static Version getVersion(); + + /** @return The linked version number of the library */ + static Uint32 getVersionNum(); + + /** @return The library version name: "eepp version major.minor.patch" */ + static std::string getVersionName(); + + /** @return The version codename */ + static std::string getCodename(); + + /** @return The build time of the library */ + + static inline std::string getBuildTime() { + return std::string( __DATE__ ) + " " + std::string( __TIME__ ); + } +}; + +} // namespace ecode + +#endif diff --git a/src/tools/ecode/widgetcommandexecuter.hpp b/src/tools/ecode/widgetcommandexecuter.hpp index 22a1b163a..c5251fe22 100644 --- a/src/tools/ecode/widgetcommandexecuter.hpp +++ b/src/tools/ecode/widgetcommandexecuter.hpp @@ -1,8 +1,10 @@ -#ifndef WIDGETCOMMANDEXECUTER_HPP -#define WIDGETCOMMANDEXECUTER_HPP +#ifndef ECODE_WIDGETCOMMANDEXECUTER_HPP +#define ECODE_WIDGETCOMMANDEXECUTER_HPP #include +namespace ecode { + class WidgetCommandExecuter { public: typedef std::function CommandCallback; @@ -75,4 +77,6 @@ class UIGlobalSearchBar : public UILinearLayout, public WidgetCommandExecuter { } }; -#endif // WIDGETCOMMANDEXECUTER_HPP +} // namespace ecode + +#endif // ECODE_WIDGETCOMMANDEXECUTER_HPP