mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-28 17:16:29 +03:00
Speed up load time by loading asynchronously some resources before window creation and avoiding creating some of the largest submenues in settings menu.
This commit is contained in:
@@ -15,4 +15,5 @@
|
||||
../../src/tools/ecode
|
||||
../../src/thirdparty/mojoAL/
|
||||
../../src/thirdparty/pcre2/src
|
||||
../../src/modules/languages-syntax-highlighting/src
|
||||
/usr/include/freetype2/
|
||||
|
||||
@@ -30,7 +30,7 @@ SINGLETON_DECLARE_IMPLEMENTATION( SyntaxDefinitionManager )
|
||||
SyntaxDefinitionManager*
|
||||
SyntaxDefinitionManager::createSingleton( std::size_t reserveSpaceForLanguages ) {
|
||||
if ( NULL == ms_singleton ) {
|
||||
ms_singleton = eeNew( SyntaxDefinitionManager, () );
|
||||
ms_singleton = eeNew( SyntaxDefinitionManager, ( reserveSpaceForLanguages ) );
|
||||
}
|
||||
|
||||
return ms_singleton;
|
||||
|
||||
@@ -1727,51 +1727,50 @@ std::map<KeyBindings::Shortcut, std::string> App::getDefaultKeybindings() {
|
||||
std::map<KeyBindings::Shortcut, std::string> App::getLocalKeybindings() {
|
||||
return {
|
||||
{ { KEY_RETURN, KEYMOD_LALT | KEYMOD_LCTRL }, "fullscreen-toggle" },
|
||||
{ { KEY_F3, KEYMOD_NONE }, "repeat-find" }, { { KEY_F3, KEYMOD_SHIFT }, "find-prev" },
|
||||
{ { KEY_F12, KEYMOD_NONE }, "console-toggle" },
|
||||
{ { KEY_F, KeyMod::getDefaultModifier() }, "find-replace" },
|
||||
{ { KEY_Q, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "close-app" },
|
||||
{ { KEY_O, KeyMod::getDefaultModifier() }, "open-file" },
|
||||
{ { KEY_W, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "download-file-web" },
|
||||
{ { KEY_O, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-folder" },
|
||||
{ { KEY_F11, KEYMOD_NONE }, "debug-widget-tree-view" },
|
||||
{ { KEY_K, KeyMod::getDefaultModifier() }, "open-locatebar" },
|
||||
{ { KEY_P, KeyMod::getDefaultModifier() }, "open-command-palette" },
|
||||
{ { KEY_F, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-global-search" },
|
||||
{ { KEY_L, KeyMod::getDefaultModifier() }, "go-to-line" },
|
||||
{ { KEY_F3, KEYMOD_NONE }, "repeat-find" },
|
||||
{ { KEY_F3, KEYMOD_SHIFT }, "find-prev" },
|
||||
{ { KEY_F12, KEYMOD_NONE }, "console-toggle" },
|
||||
{ { KEY_F, KeyMod::getDefaultModifier() }, "find-replace" },
|
||||
{ { KEY_Q, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "close-app" },
|
||||
{ { KEY_O, KeyMod::getDefaultModifier() }, "open-file" },
|
||||
{ { KEY_W, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "download-file-web" },
|
||||
{ { KEY_O, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-folder" },
|
||||
{ { KEY_F11, KEYMOD_NONE }, "debug-widget-tree-view" },
|
||||
{ { KEY_K, KeyMod::getDefaultModifier() }, "open-locatebar" },
|
||||
{ { KEY_P, KeyMod::getDefaultModifier() }, "open-command-palette" },
|
||||
{ { KEY_F, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-global-search" },
|
||||
{ { KEY_L, KeyMod::getDefaultModifier() }, "go-to-line" },
|
||||
#if EE_PLATFORM == EE_PLATFORM_MACOS
|
||||
{ { KEY_M, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "menu-toggle" },
|
||||
{ { KEY_M, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "menu-toggle" },
|
||||
#else
|
||||
{ { KEY_M, KeyMod::getDefaultModifier() }, "menu-toggle" },
|
||||
{ { KEY_M, KeyMod::getDefaultModifier() }, "menu-toggle" },
|
||||
#endif
|
||||
{ { KEY_S, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "save-all" },
|
||||
{ { KEY_F9, KEYMOD_LALT }, "switch-side-panel" },
|
||||
{ { KEY_J, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"terminal-split-left" },
|
||||
{ { KEY_L, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"terminal-split-right" },
|
||||
{ { KEY_I, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"terminal-split-top" },
|
||||
{ { KEY_K, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"terminal-split-bottom" },
|
||||
{ { KEY_S, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"terminal-split-swap" },
|
||||
{ { KEY_T, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"reopen-closed-tab" },
|
||||
{ { KEY_1, KEYMOD_LALT }, "toggle-status-locate-bar" },
|
||||
{ { KEY_2, KEYMOD_LALT }, "toggle-status-global-search-bar" },
|
||||
{ { KEY_3, KEYMOD_LALT }, "toggle-status-terminal" },
|
||||
{ { KEY_4, KEYMOD_LALT }, "toggle-status-build-output" },
|
||||
{ { KEY_5, KEYMOD_LALT }, "toggle-status-app-output" },
|
||||
{ { KEY_B, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "project-build-start" },
|
||||
{ { KEY_C, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "project-build-cancel" },
|
||||
{ { KEY_F5, KEYMOD_NONE }, "project-build-and-run" },
|
||||
{ { KEY_O, KEYMOD_LALT | KEYMOD_SHIFT }, "show-open-documents" },
|
||||
{ { KEY_K, KeyMod::getDefaultModifier() | KEYMOD_SHIFT },
|
||||
"open-workspace-symbol-search" },
|
||||
{ { KEY_P, KeyMod::getDefaultModifier() | KEYMOD_SHIFT },
|
||||
"open-document-symbol-search" },
|
||||
{ { KEY_N, KEYMOD_SHIFT | KEYMOD_LALT }, "create-new-window" },
|
||||
{ { KEY_S, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "save-all" },
|
||||
{ { KEY_F9, KEYMOD_LALT }, "switch-side-panel" },
|
||||
{ { KEY_J, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"terminal-split-left" },
|
||||
{ { KEY_L, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"terminal-split-right" },
|
||||
{ { KEY_I, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"terminal-split-top" },
|
||||
{ { KEY_K, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"terminal-split-bottom" },
|
||||
{ { KEY_S, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"terminal-split-swap" },
|
||||
{ { KEY_T, KeyMod::getDefaultModifier() | KEYMOD_LALT | KEYMOD_SHIFT },
|
||||
"reopen-closed-tab" },
|
||||
{ { KEY_1, KEYMOD_LALT }, "toggle-status-locate-bar" },
|
||||
{ { KEY_2, KEYMOD_LALT }, "toggle-status-global-search-bar" },
|
||||
{ { KEY_3, KEYMOD_LALT }, "toggle-status-terminal" },
|
||||
{ { KEY_4, KEYMOD_LALT }, "toggle-status-build-output" },
|
||||
{ { KEY_5, KEYMOD_LALT }, "toggle-status-app-output" },
|
||||
{ { KEY_B, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "project-build-start" },
|
||||
{ { KEY_C, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "project-build-cancel" },
|
||||
{ { KEY_F5, KEYMOD_NONE }, "project-build-and-run" },
|
||||
{ { KEY_O, KEYMOD_LALT | KEYMOD_SHIFT }, "show-open-documents" },
|
||||
{ { KEY_K, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-workspace-symbol-search" },
|
||||
{ { KEY_P, KeyMod::getDefaultModifier() | KEYMOD_SHIFT }, "open-document-symbol-search" },
|
||||
{ { KEY_N, KEYMOD_SHIFT | KEYMOD_LALT }, "create-new-window" },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1780,15 +1779,15 @@ std::map<KeyBindings::Shortcut, std::string> App::getLocalKeybindings() {
|
||||
std::map<std::string, std::string> App::getMigrateKeybindings() {
|
||||
return {
|
||||
{ "fullscreen-toggle", "alt+return" }, { "switch-to-tab-1", "alt+1" },
|
||||
{ "switch-to-tab-2", "alt+2" }, { "switch-to-tab-3", "alt+3" },
|
||||
{ "switch-to-tab-4", "alt+4" }, { "switch-to-tab-5", "alt+5" },
|
||||
{ "switch-to-tab-6", "alt+6" }, { "switch-to-tab-7", "alt+7" },
|
||||
{ "switch-to-tab-8", "alt+8" }, { "switch-to-tab-9", "alt+9" },
|
||||
{ "switch-to-last-tab", "alt+0" },
|
||||
{ "switch-to-tab-2", "alt+2" }, { "switch-to-tab-3", "alt+3" },
|
||||
{ "switch-to-tab-4", "alt+4" }, { "switch-to-tab-5", "alt+5" },
|
||||
{ "switch-to-tab-6", "alt+6" }, { "switch-to-tab-7", "alt+7" },
|
||||
{ "switch-to-tab-8", "alt+8" }, { "switch-to-tab-9", "alt+9" },
|
||||
{ "switch-to-last-tab", "alt+0" },
|
||||
#if EE_PLATFORM == EE_PLATFORM_MACOS
|
||||
{ "menu-toggle", "mod+shift+m" },
|
||||
{ "menu-toggle", "mod+shift+m" },
|
||||
#endif
|
||||
{ "lock-toggle", "mod+shift+l" },
|
||||
{ "lock-toggle", "mod+shift+l" },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3402,6 +3401,44 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
|
||||
|
||||
mConfig.context.SharedGLContext = true;
|
||||
|
||||
mThreadPool->run( [this] {
|
||||
// Load language definitions
|
||||
Clock defClock;
|
||||
SyntaxDefinitionManager::createSingleton( 104 );
|
||||
Language::LanguagesSyntaxHighlighting::load();
|
||||
SyntaxDefinitionManager::instance()->setLanguageExtensionsPriority(
|
||||
mConfig.languagesExtensions.priorities );
|
||||
Log::info( "Syntax definitions loaded in %s.",
|
||||
defClock.getElapsedTimeAndReset().toString() );
|
||||
|
||||
// Load user defined languages definitions
|
||||
Clock customLangsClock;
|
||||
SyntaxDefinitionManager::instance()->loadFromFolder( mLanguagesPath );
|
||||
Log::info( "SyntaxDefinitionManager loaded custom languages in: %s.",
|
||||
customLangsClock.getElapsedTime().toString() );
|
||||
|
||||
// Load editor color schemes
|
||||
mColorSchemes =
|
||||
( SyntaxColorScheme::loadFromFile( mResPath + "colorschemes/colorschemes.conf" ) );
|
||||
if ( FileSystem::isDirectory( mColorSchemesPath ) ) {
|
||||
auto colorSchemesFiles = FileSystem::filesGetInPath( mColorSchemesPath );
|
||||
for ( const auto& curFile : colorSchemesFiles ) {
|
||||
auto colorSchemesInFile =
|
||||
SyntaxColorScheme::loadFromFile( mColorSchemesPath + curFile );
|
||||
for ( auto& colorScheme : colorSchemesInFile )
|
||||
mColorSchemes.emplace_back( colorScheme );
|
||||
}
|
||||
} else {
|
||||
FileSystem::makeDir( mColorSchemesPath, true );
|
||||
}
|
||||
|
||||
// Load terminal color schemes
|
||||
mTerminalManager->loadTerminalColorSchemes();
|
||||
|
||||
mAsyncResourcesLoaded = true;
|
||||
mAsyncResourcesLoadCond.notify_all();
|
||||
} );
|
||||
|
||||
mWindow = engine->createWindow( winSettings, mConfig.context );
|
||||
Log::info( "%s (codename: \"%s\") initializing", ecode::Version::getVersionFullName(),
|
||||
ecode::Version::getCodename() );
|
||||
@@ -3657,14 +3694,6 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
|
||||
mMenuIconSize = mConfig.ui.fontSize.asPixels( 0, Sizef(), mDisplayDPI );
|
||||
IconManager::init( mUISceneNode, iconFont, mimeIconFont, codIconFont );
|
||||
|
||||
Clock defClock;
|
||||
SyntaxDefinitionManager::createSingleton( 104 );
|
||||
Language::LanguagesSyntaxHighlighting::load();
|
||||
SyntaxDefinitionManager::instance()->setLanguageExtensionsPriority(
|
||||
mConfig.languagesExtensions.priorities );
|
||||
Log::info( "Syntax definitions loaded in %.2f ms.",
|
||||
defClock.getElapsedTimeAndReset().asMilliseconds() );
|
||||
|
||||
UIWidgetCreator::registerWidget( "searchbar", UISearchBar::New );
|
||||
UIWidgetCreator::registerWidget( "locatebar", UILocateBar::New );
|
||||
UIWidgetCreator::registerWidget( "globalsearchbar", UIGlobalSearchBar::New );
|
||||
@@ -3695,28 +3724,13 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
|
||||
if ( !mConfig.ui.showSidePanel )
|
||||
showSidePanel( mConfig.ui.showSidePanel );
|
||||
|
||||
auto colorSchemes(
|
||||
SyntaxColorScheme::loadFromFile( mResPath + "colorschemes/colorschemes.conf" ) );
|
||||
if ( FileSystem::isDirectory( mColorSchemesPath ) ) {
|
||||
auto colorSchemesFiles = FileSystem::filesGetInPath( mColorSchemesPath );
|
||||
for ( const auto& curFile : colorSchemesFiles ) {
|
||||
auto colorSchemesInFile =
|
||||
SyntaxColorScheme::loadFromFile( mColorSchemesPath + curFile );
|
||||
for ( auto& coloScheme : colorSchemesInFile )
|
||||
colorSchemes.emplace_back( coloScheme );
|
||||
}
|
||||
} else {
|
||||
FileSystem::makeDir( mColorSchemesPath, true );
|
||||
if ( !mAsyncResourcesLoaded ) {
|
||||
std::unique_lock<std::mutex> syntaxLanguagesLock( mAsyncResourcesLoadMutex );
|
||||
mAsyncResourcesLoadCond.wait( syntaxLanguagesLock,
|
||||
[this]() { return mAsyncResourcesLoaded; } );
|
||||
}
|
||||
|
||||
Clock customLangsClock;
|
||||
SyntaxDefinitionManager::instance()->loadFromFolder( mLanguagesPath );
|
||||
Log::info( "SyntaxDefinitionManager loaded custom languages in: %.2f ms",
|
||||
customLangsClock.getElapsedTime().asMilliseconds() );
|
||||
|
||||
mTerminalManager->loadTerminalColorSchemes();
|
||||
|
||||
mSplitter = UICodeEditorSplitter::New( this, mUISceneNode, mThreadPool, colorSchemes,
|
||||
mSplitter = UICodeEditorSplitter::New( this, mUISceneNode, mThreadPool, mColorSchemes,
|
||||
mInitColorScheme );
|
||||
mSplitter->setHideTabBarOnSingleTab( mConfig.editor.hideTabBarOnSingleTab );
|
||||
mSplitter->setOnTabWidgetCreateCb( [this]( UITabWidget* tabWidget ) {
|
||||
|
||||
@@ -561,6 +561,10 @@ class App : public UICodeEditorSplitter::Client {
|
||||
std::unique_ptr<SettingsActions> mSettingsActions;
|
||||
std::vector<std::string> mPathsToLoad;
|
||||
Uint64 mIpcListenerId{ 0 };
|
||||
std::mutex mAsyncResourcesLoadMutex;
|
||||
std::condition_variable mAsyncResourcesLoadCond;
|
||||
std::vector<SyntaxColorScheme> mColorSchemes;
|
||||
bool mAsyncResourcesLoaded{ false };
|
||||
|
||||
void saveAllProcess();
|
||||
|
||||
|
||||
@@ -204,8 +204,8 @@ void SettingsMenu::createSettingsMenu( App* app, UIMenuBar* menuBar ) {
|
||||
Log::info( "Settings Menu took: %s", clock.getElapsedTime().toString() );
|
||||
}
|
||||
|
||||
UIMenu* SettingsMenu::createFileTypeMenu() {
|
||||
mFileTypeMenuesCreatedWithHeight = mUISceneNode->getPixelsSize().getHeight();
|
||||
UIMenu* SettingsMenu::createFileTypeMenu( bool emptyMenu ) {
|
||||
mFileTypeMenuesCreatedWithHeight = emptyMenu ? 0 : mUISceneNode->getPixelsSize().getHeight();
|
||||
size_t maxItems = 19;
|
||||
auto* dM = SyntaxDefinitionManager::instance();
|
||||
auto names = dM->getLanguageNames();
|
||||
@@ -223,6 +223,9 @@ UIMenu* SettingsMenu::createFileTypeMenu() {
|
||||
mFileTypeMenues.push_back( menu );
|
||||
size_t total = 0;
|
||||
|
||||
if ( emptyMenu )
|
||||
return mFileTypeMenues[0];
|
||||
|
||||
for ( const auto& name : names ) {
|
||||
menu->addRadioButton(
|
||||
name, mSplitter->curEditorExistsAndFocused() &&
|
||||
@@ -249,8 +252,8 @@ UIMenu* SettingsMenu::createFileTypeMenu() {
|
||||
return mFileTypeMenues[0];
|
||||
}
|
||||
|
||||
UIMenu* SettingsMenu::createColorSchemeMenu() {
|
||||
mColorSchemeMenuesCreatedWithHeight = mUISceneNode->getPixelsSize().getHeight();
|
||||
UIMenu* SettingsMenu::createColorSchemeMenu( bool emptyMenu ) {
|
||||
mColorSchemeMenuesCreatedWithHeight = emptyMenu ? 0 : mUISceneNode->getPixelsSize().getHeight();
|
||||
size_t maxItems = 19;
|
||||
auto cb = [this]( const Event* event ) {
|
||||
UIMenuItem* item = event->getNode()->asType<UIMenuItem>();
|
||||
@@ -264,6 +267,9 @@ UIMenu* SettingsMenu::createColorSchemeMenu() {
|
||||
size_t total = 0;
|
||||
const auto& colorSchemes = mSplitter->getColorSchemes();
|
||||
|
||||
if ( emptyMenu )
|
||||
return mColorSchemeMenues[0];
|
||||
|
||||
for ( auto& colorScheme : colorSchemes ) {
|
||||
menu->addRadioButton( colorScheme.first,
|
||||
mSplitter->getCurrentColorSchemeName() == colorScheme.first );
|
||||
@@ -305,7 +311,7 @@ UIMenu* SettingsMenu::createDocumentMenu() {
|
||||
->setId( "auto_indent_cur" );
|
||||
|
||||
UIMenuSubMenu* fileTypeMenu = mDocMenu->addSubMenu(
|
||||
i18n( "file_type", "File Type" ), findIcon( "file-code" ), createFileTypeMenu() );
|
||||
i18n( "file_type", "File Type" ), findIcon( "file-code" ), createFileTypeMenu( true ) );
|
||||
|
||||
fileTypeMenu->on( Event::OnMenuShow, [this, fileTypeMenu]( const Event* ) {
|
||||
if ( mFileTypeMenuesCreatedWithHeight != mUISceneNode->getPixelsSize().getHeight() ) {
|
||||
@@ -468,7 +474,7 @@ UIMenu* SettingsMenu::createDocumentMenu() {
|
||||
|
||||
UIMenuSubMenu* colorSchemeMenu =
|
||||
mDocMenu->addSubMenu( i18n( "syntax_color_scheme", "Syntax Color Scheme" ),
|
||||
findIcon( "palette" ), createColorSchemeMenu() );
|
||||
findIcon( "palette" ), createColorSchemeMenu( true ) );
|
||||
colorSchemeMenu->on( Event::OnMenuShow, [this, colorSchemeMenu]( const Event* ) {
|
||||
if ( mColorSchemeMenuesCreatedWithHeight != mUISceneNode->getPixelsSize().getHeight() ) {
|
||||
for ( UIPopUpMenu* menu : mColorSchemeMenues )
|
||||
@@ -912,7 +918,7 @@ UIMenu* SettingsMenu::createTerminalMenu() {
|
||||
#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN
|
||||
UIMenuSubMenu* termColorSchemeMenu = mTerminalMenu->addSubMenu(
|
||||
i18n( "terminal_color_scheme", "Terminal Color Scheme" ), findIcon( "palette" ),
|
||||
mApp->getTerminalManager()->createColorSchemeMenu() );
|
||||
mApp->getTerminalManager()->createColorSchemeMenu( true ) );
|
||||
termColorSchemeMenu->on( Event::OnMenuShow, [this, termColorSchemeMenu]( const Event* ) {
|
||||
mApp->getTerminalManager()->updateMenuColorScheme( termColorSchemeMenu );
|
||||
} );
|
||||
@@ -1058,7 +1064,7 @@ UIMenu* SettingsMenu::createWindowMenu() {
|
||||
colorsMenu
|
||||
->addRadioButton( i18n( "light", "Light" ),
|
||||
mApp->getUIColorScheme() == ColorSchemePreference::Light )
|
||||
->setOnShouldCloseCb( shouldCloseCb )
|
||||
->setOnShouldCloseCb( shouldCloseCb )
|
||||
->setId( "light" );
|
||||
colorsMenu
|
||||
->addRadioButton( i18n( "dark", "Dark" ),
|
||||
|
||||
@@ -18,9 +18,9 @@ class SettingsMenu {
|
||||
|
||||
void runCommand( const std::string& command );
|
||||
|
||||
UIMenu* createFileTypeMenu();
|
||||
UIMenu* createFileTypeMenu( bool emptyMenu = false );
|
||||
|
||||
UIMenu* createColorSchemeMenu();
|
||||
UIMenu* createColorSchemeMenu( bool emptyMenu = false );
|
||||
|
||||
UIMenu* createDocumentMenu();
|
||||
|
||||
|
||||
@@ -241,8 +241,9 @@ void TerminalManager::configureTerminalScrollback() {
|
||||
} );
|
||||
}
|
||||
|
||||
UIMenu* TerminalManager::createColorSchemeMenu() {
|
||||
mColorSchemeMenuesCreatedWithHeight = mApp->uiSceneNode()->getPixelsSize().getHeight();
|
||||
UIMenu* TerminalManager::createColorSchemeMenu( bool emptyMenu ) {
|
||||
mColorSchemeMenuesCreatedWithHeight =
|
||||
emptyMenu ? 0 : mApp->uiSceneNode()->getPixelsSize().getHeight();
|
||||
size_t maxItems = 19;
|
||||
auto cb = [this]( const Event* event ) {
|
||||
UIMenuItem* item = event->getNode()->asType<UIMenuItem>();
|
||||
@@ -256,6 +257,9 @@ UIMenu* TerminalManager::createColorSchemeMenu() {
|
||||
size_t total = 0;
|
||||
const auto& colorSchemes = mTerminalColorSchemes;
|
||||
|
||||
if ( emptyMenu )
|
||||
return mColorSchemeMenues[0];
|
||||
|
||||
for ( auto& colorScheme : colorSchemes ) {
|
||||
menu->addRadioButton( colorScheme.first, mTerminalCurrentColorScheme == colorScheme.first );
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class TerminalManager {
|
||||
|
||||
void setTerminalColorSchemesPath( const std::string& terminalColorSchemesPath );
|
||||
|
||||
UIMenu* createColorSchemeMenu();
|
||||
UIMenu* createColorSchemeMenu( bool emptyMenu = false );
|
||||
|
||||
void updateMenuColorScheme( UIMenuSubMenu* colorSchemeMenu );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user