diff --git a/Doxyfile b/Doxyfile index 5ff28b401..b1758f087 100644 --- a/Doxyfile +++ b/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "eepp" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 2.2 +PROJECT_NUMBER = 2.9.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/include/eepp/ui/uiapplication.hpp b/include/eepp/ui/uiapplication.hpp index a795a65a3..776722341 100644 --- a/include/eepp/ui/uiapplication.hpp +++ b/include/eepp/ui/uiapplication.hpp @@ -17,7 +17,8 @@ class EE_API UIApplication { Settings() {} Settings( std::optional pixelDensity, bool loadBaseResources = true, - Font* baseFont = nullptr, std::optional baseStyleSheetPath = {}, Font* emojiFont = nullptr ); + Font* baseFont = nullptr, std::optional baseStyleSheetPath = {}, + Font* emojiFont = nullptr ); //! Not setting anything will automatically try to detect the main screen pixel density std::optional pixelDensity; diff --git a/include/eepp/ui/uiwindow.hpp b/include/eepp/ui/uiwindow.hpp index 717808ff6..a6902fdc5 100644 --- a/include/eepp/ui/uiwindow.hpp +++ b/include/eepp/ui/uiwindow.hpp @@ -236,6 +236,7 @@ class EE_API UIWindow : public UIWidget { bool mFrameBufferBound; bool mWindowReady{ false }; bool mShowWhenReady{ false }; + bool mClosing{ false }; KeyBindings mKeyBindings; std::map mKeyBindingCommands; diff --git a/src/eepp/ui/uiwindow.cpp b/src/eepp/ui/uiwindow.cpp index be5f5d7bc..908390e6a 100644 --- a/src/eepp/ui/uiwindow.cpp +++ b/src/eepp/ui/uiwindow.cpp @@ -115,6 +115,7 @@ UIWindow::UIWindow( UIWindow::WindowBaseContainerType type, const StyleConfig& w } UIWindow::~UIWindow() { + mClosing = true; if ( NULL != getUISceneNode() && !SceneManager::instance()->isShuttingDown() ) { if ( NULL != mModalNode ) { mModalNode->setEnabled( false ); @@ -448,6 +449,9 @@ bool UIWindow::isType( const Uint32& type ) const { } void UIWindow::closeWindow() { + if ( mClosing ) + return; + if ( NULL != mButtonClose ) mButtonClose->setEnabled( false ); diff --git a/src/tools/ecode/plugins/debugger/debuggerclientlistener.cpp b/src/tools/ecode/plugins/debugger/debuggerclientlistener.cpp index 21104fae6..6b37fb22f 100644 --- a/src/tools/ecode/plugins/debugger/debuggerclientlistener.cpp +++ b/src/tools/ecode/plugins/debugger/debuggerclientlistener.cpp @@ -45,6 +45,79 @@ DebuggerClientListener::~DebuggerClientListener() { } } +void DebuggerClientListener::createAndShowVariableMenu( ModelIndex idx ) { + auto context = mPlugin->getPluginContext(); + UIPopUpMenu* menu = UIPopUpMenu::New(); + + ModelVariableNode* node = static_cast( idx.internalData() ); + Variable var( node->var ); + + menu->add( context->i18n( "debugger_copy_variable_value", "Copy Value" ), + context->findIcon( "copy" ) ) + ->setId( "debugger_copy_variable_value" ); + + menu->add( context->i18n( "debugger_copy_variable_name", "Copy Name" ), + context->findIcon( "copy" ) ) + ->setId( "debugger_copy_variable_name" ); + + if ( var.type ) { + menu->add( context->i18n( "debugger_copy_variable_type", "Copy Type" ), + context->findIcon( "copy" ) ) + ->setId( "debugger_copy_variable_type" ); + } + + if ( var.evaluateName ) { + menu->add( context->i18n( "debugger_copy_variable_evaluate_name", "Copy Evaluate Name" ), + context->findIcon( "copy" ) ) + ->setId( "debugger_copy_variable_evaluate_name" ); + } + + if ( var.memoryReference ) { + menu->add( + context->i18n( "debugger_copy_variable_memory_reference", "Copy Memory Reference" ), + context->findIcon( "copy" ) ) + ->setId( "debugger_copy_variable_memory_reference" ); + } + + menu->add( context->i18n( "debugger_value_viewer", "Value Viewer" ), + context->findIcon( "eye" ) ) + ->setId( "debugger_value_viewer" ); + + menu->on( Event::OnItemClicked, [this, var = std::move( var )]( const Event* event ) { + UIMenuItem* item = event->getNode()->asType(); + std::string id( item->getId() ); + if ( id == "debugger_copy_variable_value" ) { + mPlugin->getUISceneNode()->getWindow()->getClipboard()->setText( var.value ); + } else if ( id == "debugger_copy_variable_name" ) { + mPlugin->getUISceneNode()->getWindow()->getClipboard()->setText( var.name ); + } else if ( id == "debugger_copy_variable_type" ) { + mPlugin->getUISceneNode()->getWindow()->getClipboard()->setText( *var.type ); + } else if ( id == "debugger_copy_variable_evaluate_name" ) { + mPlugin->getUISceneNode()->getWindow()->getClipboard()->setText( *var.evaluateName ); + } else if ( id == "debugger_copy_variable_memory_reference" ) { + mPlugin->getUISceneNode()->getWindow()->getClipboard()->setText( *var.memoryReference ); + } else if ( id == "debugger_value_viewer" ) { + static constexpr auto VALUE_VIEWER_LAYOUT = R"html( + + + + + + )html"; + UIWindow* win = mPlugin->getUISceneNode() + ->loadLayoutFromString( VALUE_VIEWER_LAYOUT ) + ->asType(); + win->setTitle( String::format( "%s:", var.name ) ); + UITextEdit* input = win->find( "value_input" )->asType(); + input->setText( var.value ); + win->center(); + win->showWhenReady(); + } + } ); + + menu->showOverMouseCursor(); +} + void DebuggerClientListener::initUI() { auto sdc = getStatusDebuggerController(); @@ -104,80 +177,7 @@ void DebuggerClientListener::initUI() { mVariablesHolder->removeExpandedState( idx ); } else if ( modelEvent->getModelEventType() == Abstract::ModelEventType::OpenMenu && idx.isValid() ) { - - auto context = mPlugin->getPluginContext(); - UIPopUpMenu* menu = UIPopUpMenu::New(); - - ModelVariableNode* node = static_cast( idx.internalData() ); - Variable var( node->var ); - - menu->add( context->i18n( "debugger_copy_variable_value", "Copy Value" ), - context->findIcon( "copy" ) ) - ->setId( "debugger_copy_variable_value" ); - - menu->add( context->i18n( "debugger_copy_variable_name", "Copy Name" ), - context->findIcon( "copy" ) ) - ->setId( "debugger_copy_variable_name" ); - - if ( var.type ) { - menu->add( context->i18n( "debugger_copy_variable_type", "Copy Type" ), - context->findIcon( "copy" ) ) - ->setId( "debugger_copy_variable_type" ); - } - - if ( var.evaluateName ) { - menu->add( context->i18n( "debugger_copy_variable_evaluate_name", - "Copy Evaluate Name" ), - context->findIcon( "copy" ) ) - ->setId( "debugger_copy_variable_evaluate_name" ); - } - - if ( var.memoryReference ) { - menu->add( context->i18n( "debugger_copy_variable_memory_reference", - "Copy Memory Reference" ), - context->findIcon( "copy" ) ) - ->setId( "debugger_copy_variable_memory_reference" ); - } - - menu->add( context->i18n( "debugger_value_viewer", "Value Viewer" ), - context->findIcon( "eye" ) ) - ->setId( "debugger_value_viewer" ); - - menu->on( Event::OnItemClicked, [this, var = std::move( var )]( const Event* event ) { - UIMenuItem* item = event->getNode()->asType(); - std::string id( item->getId() ); - if ( id == "debugger_copy_variable_value" ) { - mPlugin->getUISceneNode()->getWindow()->getClipboard()->setText( var.value ); - } else if ( id == "debugger_copy_variable_name" ) { - mPlugin->getUISceneNode()->getWindow()->getClipboard()->setText( var.name ); - } else if ( id == "debugger_copy_variable_type" ) { - mPlugin->getUISceneNode()->getWindow()->getClipboard()->setText( *var.type ); - } else if ( id == "debugger_copy_variable_evaluate_name" ) { - mPlugin->getUISceneNode()->getWindow()->getClipboard()->setText( - *var.evaluateName ); - } else if ( id == "debugger_copy_variable_memory_reference" ) { - mPlugin->getUISceneNode()->getWindow()->getClipboard()->setText( - *var.memoryReference ); - } else if ( id == "debugger_value_viewer" ) { - static constexpr auto VALUE_VIEWER_LAYOUT = R"html( - - - - - - )html"; - UIWindow* win = mPlugin->getUISceneNode() - ->loadLayoutFromString( VALUE_VIEWER_LAYOUT ) - ->asType(); - win->setTitle( String::format( "%s:", var.name ) ); - UITextEdit* input = win->find( "value_input" )->asType(); - input->setText( var.value ); - win->center(); - win->showWhenReady(); - } - } ); - - menu->showOverMouseCursor(); + createAndShowVariableMenu( idx ); } } ); diff --git a/src/tools/ecode/plugins/debugger/debuggerclientlistener.hpp b/src/tools/ecode/plugins/debugger/debuggerclientlistener.hpp index b37dd274c..aabf9c2f7 100644 --- a/src/tools/ecode/plugins/debugger/debuggerclientlistener.hpp +++ b/src/tools/ecode/plugins/debugger/debuggerclientlistener.hpp @@ -119,6 +119,8 @@ class DebuggerClientListener : public DebuggerClient::Listener { void setUnstableFrameId( bool unstableFrameId ); + void createAndShowVariableMenu( ModelIndex idx ); + protected: mutable Mutex mMutex; DebuggerClient* mClient{ nullptr }; diff --git a/src/tools/ecode/plugins/debugger/debuggerplugin.cpp b/src/tools/ecode/plugins/debugger/debuggerplugin.cpp index 784153f7c..5458b2538 100644 --- a/src/tools/ecode/plugins/debugger/debuggerplugin.cpp +++ b/src/tools/ecode/plugins/debugger/debuggerplugin.cpp @@ -2392,9 +2392,11 @@ void DebuggerPlugin::displayTooltip( UICodeEditor* editor, const std::string& ex tv->setFocusOnSelection( false ); tv->on( Event::OnModelEvent, [this]( const Event* event ) { + if ( !mDebugger || !mListener ) + return; const ModelEvent* modelEvent = static_cast( event ); - if ( mDebugger && mListener && - modelEvent->getModelEventType() == Abstract::ModelEventType::OpenTree ) { + auto idx( modelEvent->getModelIndex() ); + if ( modelEvent->getModelEventType() == Abstract::ModelEventType::OpenTree ) { ModelVariableNode* node = static_cast( modelEvent->getModelIndex().internalData() ); mDebugger->variables( @@ -2403,6 +2405,9 @@ void DebuggerPlugin::displayTooltip( UICodeEditor* editor, const std::string& ex mHoverExpressionsHolder->addVariables( variablesReference, std::move( vars ) ); } ); + } else if ( modelEvent->getModelEventType() == Abstract::ModelEventType::OpenMenu && + idx.isValid() ) { + mListener->createAndShowVariableMenu( idx ); } } );