diff --git a/bin/assets/i18n/en.xml b/bin/assets/i18n/en.xml
index 89a79acba..f611d2171 100644
--- a/bin/assets/i18n/en.xml
+++ b/bin/assets/i18n/en.xml
@@ -500,8 +500,8 @@ controls whether a new window is created or not.
Pattern
Pick Widget
Please enter the file URL...
- Plugin Manager
- Plugin Manager Open
+ Plugins Manager
+ Open Plugins Manager
Description
Enabled
Id
diff --git a/src/tools/ecode/ecode.hpp b/src/tools/ecode/ecode.hpp
index 4e3cbe891..541cea80e 100644
--- a/src/tools/ecode/ecode.hpp
+++ b/src/tools/ecode/ecode.hpp
@@ -190,7 +190,19 @@ class App : public UICodeEditorSplitter::Client, public PluginContextProvider {
SettingsMenu* getSettingsMenu() const { return mSettings.get(); }
template void registerUnlockedCommands( T& t ) {
- t.setCommand( "keybindings", [this] { loadFileFromPath( mKeybindingsPath ); } );
+ t.setCommand( "keybindings", [this] {
+ loadFileFromPath( mKeybindingsPath );
+
+ if ( mNotificationCenter ) {
+ mNotificationCenter->addInteractiveNotification(
+ i18n( "keybindings_clarification",
+ "More keybindings can be set for each active plugin at the Plugins "
+ "Manager.\nBe aware that many of the core keybindings can be found "
+ "there." ),
+ i18n( "plugin_manager_open", "Open Plugins Manager" ),
+ [this] { runCommand( "plugin-manager-open" ); }, Seconds( 10 ) );
+ }
+ } );
t.setCommand( "debug-draw-boxes-toggle", [this] { debugDrawBoxesToggle(); } );
t.setCommand( "debug-draw-highlight-toggle", [this] { debugDrawHighlightToggle(); } );
t.setCommand( "debug-draw-debug-data", [this] { debugDrawData(); } );
diff --git a/src/tools/ecode/notificationcenter.cpp b/src/tools/ecode/notificationcenter.cpp
index 2186d3ab5..6c6eb1b24 100644
--- a/src/tools/ecode/notificationcenter.cpp
+++ b/src/tools/ecode/notificationcenter.cpp
@@ -52,10 +52,7 @@ void NotificationCenter::addNotification( const String& text, const Time& delay,
Log::info( "Displayed notification:\n%s", text.toUtf8() );
};
- if ( Engine::isRunninMainThread() )
- action();
- else
- mLayout->runOnMainThread( action );
+ mLayout->ensureMainThread( action );
}
void NotificationCenter::addShowRequest( const String& uri, const String& actionText,
@@ -87,10 +84,48 @@ void NotificationCenter::addShowRequest( const String& uri, const String& action
lay->runAction( sequence );
};
- if ( Engine::isRunninMainThread() )
- action();
- else
- mLayout->runOnMainThread( action );
+ mLayout->ensureMainThread( action );
+}
+
+void NotificationCenter::addInteractiveNotification( String text, String actionText,
+ std::function onInteraction,
+ const Time& delay, bool allowCopy ) {
+ auto action = [this, text = std::move( text ), actionText = std::move( actionText ), delay,
+ allowCopy, onInteraction = std::move( onInteraction )]() {
+ static const auto layout = R"xml(
+
+
+
+
+
+
+ )xml";
+ UILinearLayout* lay = mLayout->getUISceneNode()
+ ->loadLayoutFromString( layout, mLayout )
+ ->asType();
+ UITextView* tv = lay->findByType( UI_TYPE_TEXTVIEW )->asType();
+ tv->setText( text );
+ tv->setTextSelection( allowCopy );
+ tv->on( Event::MouseClick, [allowCopy, lay]( const Event* event ) {
+ const MouseEvent* mouseEvent = static_cast( event );
+ if ( mouseEvent->getFlags() &
+ ( allowCopy ? EE_BUTTON_MMASK : ( EE_BUTTON_LMASK | EE_BUTTON_RMASK ) ) )
+ lay->close();
+ } );
+ UIPushButton* pb = lay->findByType( UI_TYPE_PUSHBUTTON )->asType();
+ pb->setText( actionText );
+ pb->onClick(
+ [actionText, onInteraction = std::move( onInteraction )]( const MouseEvent* event ) {
+ if ( onInteraction )
+ onInteraction();
+ } );
+ Action* sequence = Actions::Sequence::New(
+ { Actions::FadeIn::New( Seconds( 0.125 ) ), Actions::Delay::New( delay ),
+ Actions::FadeOut::New( Seconds( 0.125 ) ), Actions::Close::New() } );
+ lay->runAction( sequence );
+ };
+
+ mLayout->ensureMainThread( action );
}
} // namespace ecode
diff --git a/src/tools/ecode/notificationcenter.hpp b/src/tools/ecode/notificationcenter.hpp
index 29be1beb2..f425bd430 100644
--- a/src/tools/ecode/notificationcenter.hpp
+++ b/src/tools/ecode/notificationcenter.hpp
@@ -15,6 +15,10 @@ class NotificationCenter {
void addShowRequest( const String& uri, const String& actionText,
const Time& delay = Seconds( 2.5 ) );
+ void addInteractiveNotification( String text, String actionText,
+ std::function onInteraction,
+ const Time& delay = Seconds( 7.5 ), bool allowCopy = false );
+
protected:
UILayout* mLayout{ nullptr };
PluginManager* mPluginManager{ nullptr };
diff --git a/src/tools/ecode/plugins/pluginmanager.cpp b/src/tools/ecode/plugins/pluginmanager.cpp
index 7ea610035..a0b36a4ab 100644
--- a/src/tools/ecode/plugins/pluginmanager.cpp
+++ b/src/tools/ecode/plugins/pluginmanager.cpp
@@ -468,7 +468,7 @@ UIWindow* UIPluginManager::New( UISceneNode* sceneNode, PluginManager* manager,
id="plugin-manager-window"
lw="800dp" lh="400dp"
padding="8dp"
- window-title="@string(plugin_manager, Plugin Manager)"
+ window-title="@string(plugin_manager, Plugins Manager)"
window-flags="default|maximize|shadow"
window-min-size="300dp 300dp">
diff --git a/src/tools/ecode/settingsmenu.cpp b/src/tools/ecode/settingsmenu.cpp
index def563533..b016df3c6 100644
--- a/src/tools/ecode/settingsmenu.cpp
+++ b/src/tools/ecode/settingsmenu.cpp
@@ -1669,7 +1669,7 @@ UIMenu* SettingsMenu::createViewMenu() {
UIPopUpMenu* SettingsMenu::createToolsMenu() {
mToolsMenu = UIPopUpMenu::New();
- mToolsMenu->add( i18n( "plugin_manager", "Plugin Manager" ), findIcon( "extensions" ) )
+ mToolsMenu->add( i18n( "plugin_manager", "Plugins Manager" ), findIcon( "extensions" ) )
->setId( "plugin-manager-open" );
mToolsMenu->addSeparator();
diff --git a/src/tools/ecode/uiwelcomescreen.cpp b/src/tools/ecode/uiwelcomescreen.cpp
index bb3d86a73..195414c1c 100644
--- a/src/tools/ecode/uiwelcomescreen.cpp
+++ b/src/tools/ecode/uiwelcomescreen.cpp
@@ -118,7 +118,7 @@ static const auto LAYOUT = R"xml(
-
+