diff --git a/bin/assets/ui/breeze.css b/bin/assets/ui/breeze.css index 5344709a2..5d84bfa9a 100644 --- a/bin/assets/ui/breeze.css +++ b/bin/assets/ui/breeze.css @@ -1072,26 +1072,6 @@ TextInput.table_cell_edit { padding-bottom: 0!important; } -.font_theme_normal { - color: var(--font); -} - -.font_theme_primary { - color: var(--primary); -} - -.font_theme_success { - color: var(--theme-success); -} - -.font_theme_warning { - color: var(--theme-warning); -} - -.font_theme_font { - color: var(--theme-error); -} - @media (prefers-color-scheme: light) { :root { diff --git a/include/eepp/ui/tools/uicodeeditorsplitter.hpp b/include/eepp/ui/tools/uicodeeditorsplitter.hpp index e11a6ea35..559cebbe9 100644 --- a/include/eepp/ui/tools/uicodeeditorsplitter.hpp +++ b/include/eepp/ui/tools/uicodeeditorsplitter.hpp @@ -286,7 +286,7 @@ class EE_API UICodeEditorSplitter { } ); for ( int i = 1; i <= 10; i++ ) t.setCommand( String::format( "switch-to-tab-%d", i ), - [&, i] { switchToTab( i - 1 ); } ); + [this, i] { switchToTab( i - 1 ); } ); t.setCommand( "switch-to-first-tab", [this] { UITabWidget* tabWidget = tabWidgetFromWidget( mCurWidget ); if ( tabWidget && tabWidget->getTabCount() ) { diff --git a/premake5.lua b/premake5.lua index a337017f2..8d7763c56 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1171,7 +1171,6 @@ workspace "eepp" incdirs { "src/thirdparty/efsw/include", "src/thirdparty" } links { "efsw-static", "pugixml-static" } files { "src/tools/uieditor/*.cpp" } - eepp_module_maps_add() build_link_configuration( "eepp-UIEditor", true ) filter "system:macosx" links { "CoreFoundation.framework", "CoreServices.framework" } diff --git a/src/eepp/ui/abstract/uiabstracttableview.cpp b/src/eepp/ui/abstract/uiabstracttableview.cpp index b8012ff56..d63a05836 100644 --- a/src/eepp/ui/abstract/uiabstracttableview.cpp +++ b/src/eepp/ui/abstract/uiabstracttableview.cpp @@ -92,7 +92,7 @@ void UIAbstractTableView::onModelUpdate( unsigned flags ) { static constexpr String::HashType tag = String::hash( "onModelUpdate" ); removeActionsByTag( tag ); runOnMainThread( - [&, flags] { + [this, flags] { modelUpdate( flags ); createOrUpdateColumns( true ); }, diff --git a/src/eepp/ui/abstract/uiabstractview.cpp b/src/eepp/ui/abstract/uiabstractview.cpp index 421f75685..25740e783 100644 --- a/src/eepp/ui/abstract/uiabstractview.cpp +++ b/src/eepp/ui/abstract/uiabstractview.cpp @@ -137,7 +137,7 @@ void UIAbstractView::onModelUpdate( unsigned flags ) { if ( !Engine::instance()->isMainThread() ) { static constexpr String::HashType tag = String::hash( "onModelUpdate" ); removeActionsByTag( tag ); - runOnMainThread( [&, flags] { modelUpdate( flags ); }, Time::Zero, tag ); + runOnMainThread( [this, flags] { modelUpdate( flags ); }, Time::Zero, tag ); } else { modelUpdate( flags ); } diff --git a/src/eepp/ui/tools/uicodeeditorsplitter.cpp b/src/eepp/ui/tools/uicodeeditorsplitter.cpp index 82f31af4e..d63e76980 100644 --- a/src/eepp/ui/tools/uicodeeditorsplitter.cpp +++ b/src/eepp/ui/tools/uicodeeditorsplitter.cpp @@ -370,7 +370,7 @@ bool UICodeEditorSplitter::loadFileFromPath( const std::string& path, UICodeEdit bool isUrl = String::startsWith( path, "https://" ) || String::startsWith( path, "http://" ); bool ret = isUrl ? codeEditor->loadAsyncFromURL( path, Http::Request::FieldTable(), - [&, codeEditor, path]( std::shared_ptr, bool ) { + [this, codeEditor, path]( std::shared_ptr, bool ) { mClient->onDocumentLoaded( codeEditor, path ); } ) : codeEditor->loadFromFile( path ) == TextDocument::LoadStatus::Loaded; @@ -400,7 +400,7 @@ void UICodeEditorSplitter::loadAsyncFileFromPath( if ( isUrl ) { codeEditor->loadAsyncFromURL( path, Http::Request::FieldTable(), - [&, codeEditor, path, onLoaded]( std::shared_ptr, bool ) { + [this, codeEditor, path, onLoaded]( std::shared_ptr, bool ) { mClient->onDocumentLoaded( codeEditor, path ); if ( onLoaded ) onLoaded( codeEditor, path ); @@ -408,7 +408,7 @@ void UICodeEditorSplitter::loadAsyncFileFromPath( } else { codeEditor->loadAsyncFromFile( path, mThreadPool, - [&, codeEditor, path, onLoaded]( std::shared_ptr, bool ) { + [this, codeEditor, path, onLoaded]( std::shared_ptr, bool ) { mClient->onDocumentLoaded( codeEditor, path ); if ( onLoaded ) onLoaded( codeEditor, path ); @@ -734,7 +734,7 @@ UICodeEditor* UICodeEditorSplitter::editorFromTab( UITab* tab ) const { UICodeEditor* UICodeEditorSplitter::findEditorFromPath( const std::string& path ) { UICodeEditor* editor = nullptr; - forEachEditorStoppable( [&, path]( UICodeEditor* curEditor ) -> bool { + forEachEditorStoppable( [&]( UICodeEditor* curEditor ) -> bool { if ( curEditor->getDocument().getFilePath() == path ) { editor = curEditor; return true; @@ -808,7 +808,8 @@ void UICodeEditorSplitter::forEachEditor( std::function r void UICodeEditorSplitter::forEachDoc( std::function run ) const { std::unordered_set docs; - forEachEditor( [&]( UICodeEditor* editor ) { docs.insert( editor->getDocumentRef().get() ); } ); + forEachEditor( + [&docs]( UICodeEditor* editor ) { docs.insert( editor->getDocumentRef().get() ); } ); for ( auto doc : docs ) run( *doc ); } @@ -867,7 +868,7 @@ void UICodeEditorSplitter::forEachDocStoppable( std::function UICodeEditorSplitter::findDocFromURI( const URI& uri ) { std::unordered_set> docs; - forEachEditor( [&]( UICodeEditor* editor ) { docs.insert( editor->getDocumentRef() ); } ); + forEachEditor( [&docs]( UICodeEditor* editor ) { docs.insert( editor->getDocumentRef() ); } ); for ( const auto& doc : docs ) { if ( doc->getURI() == uri ) return doc; @@ -877,7 +878,7 @@ std::shared_ptr UICodeEditorSplitter::findDocFromURI( const URI& u std::shared_ptr UICodeEditorSplitter::findDocFromPath( const std::string& path ) { std::unordered_set> docs; - forEachEditor( [&]( UICodeEditor* editor ) { docs.insert( editor->getDocumentRef() ); } ); + forEachEditor( [&docs]( UICodeEditor* editor ) { docs.insert( editor->getDocumentRef() ); } ); for ( const auto& doc : docs ) { if ( doc->getFilePath() == path ) return doc; @@ -912,7 +913,7 @@ UIWidget* UICodeEditorSplitter::getCurWidget() const { std::vector UICodeEditorSplitter::getAllEditors() { std::vector editors; - forEachEditor( [&]( UICodeEditor* editor ) { editors.push_back( editor ); } ); + forEachEditor( [&editors]( UICodeEditor* editor ) { editors.push_back( editor ); } ); return editors; } diff --git a/src/eepp/ui/tools/uidocfindreplace.cpp b/src/eepp/ui/tools/uidocfindreplace.cpp index 1d5d803fd..6a23ecda7 100644 --- a/src/eepp/ui/tools/uidocfindreplace.cpp +++ b/src/eepp/ui/tools/uidocfindreplace.cpp @@ -202,7 +202,7 @@ UIDocFindReplace::UIDocFindReplace( UIWidget* parent, const std::shared_ptrisType( UI_TYPE_CODEEDITOR ) ? getParent()->asType() : nullptr; mFindInput->addEventListener( Event::OnTextChanged, - [&, editor]( const Event* ) { refreshHighlight( editor ); } ); + [this, editor]( const Event* ) { refreshHighlight( editor ); } ); mFindInput->addEventListener( Event::OnTextPasted, [this]( const Event* ) { if ( mFindInput->getUISceneNode()->getWindow()->getClipboard()->getText().find( '\n' ) != String::InvalidPos ) { @@ -258,7 +258,7 @@ UIDocFindReplace::UIDocFindReplace( UIWidget* parent, const std::shared_ptrsetTooltipText( getKeyBindings().getCommandKeybindString( cmd ) ); - widget->addEventListener( Event::MouseClick, [&, cmd]( const Event* event ) { + widget->addEventListener( Event::MouseClick, [this, cmd]( const Event* event ) { const MouseEvent* mouseEvent = static_cast( event ); if ( mouseEvent->getFlags() & EE_BUTTON_LMASK ) execute( cmd ); diff --git a/src/eepp/ui/tools/uiwidgetinspector.cpp b/src/eepp/ui/tools/uiwidgetinspector.cpp index a05e773b6..a2386bfcd 100644 --- a/src/eepp/ui/tools/uiwidgetinspector.cpp +++ b/src/eepp/ui/tools/uiwidgetinspector.cpp @@ -72,7 +72,7 @@ UIWindow* UIWidgetInspector::create( UISceneNode* sceneNode, const Float& menuIc UITableView* tableView = cont->findByType( UI_TYPE_TABLEVIEW ); tableView->setAutoColumnsWidth( true ); tableView->setHeadersVisible( true ); - widgetTree->setOnSelection( [&, tableView]( const ModelIndex& index ) { + widgetTree->setOnSelection( [tableView]( const ModelIndex& index ) { Node* node = static_cast( index.internalData() ); if ( node->isWidget() ) { tableView->setModel( node->isWidget() @@ -150,7 +150,7 @@ UIWindow* UIWidgetInspector::create( UISceneNode* sceneNode, const Float& menuIc uiWin->center(); - Uint32 winCb = sceneNode->addEventListener( Event::OnWindowAdded, [&, sceneNode, uiWin]( + Uint32 winCb = sceneNode->addEventListener( Event::OnWindowAdded, [sceneNode, uiWin]( const Event* event ) { UIWindow* eWin = event->asWindowEvent()->getWindow()->asType(); if ( eWin != uiWin ) { diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp index 3c9fe7669..b3bce44af 100644 --- a/src/eepp/ui/uicodeeditor.cpp +++ b/src/eepp/ui/uicodeeditor.cpp @@ -457,7 +457,7 @@ bool UICodeEditor::loadAsyncFromFile( bool ret = mDoc->loadAsyncFromFile( path, pool, [this, onLoaded, wasLocked]( TextDocument*, bool success ) { if ( !success ) { - runOnMainThread( [&, onLoaded, wasLocked, success] { + runOnMainThread( [this, onLoaded, wasLocked, success] { if ( !wasLocked ) setLocked( false ); if ( onLoaded ) @@ -470,7 +470,7 @@ bool UICodeEditor::loadAsyncFromFile( runOnMainThread( [this] { invalidateDraw(); } ); } ); } - runOnMainThread( [&, onLoaded, wasLocked, success] { + runOnMainThread( [this, onLoaded, wasLocked, success] { invalidateEditor(); invalidateDraw(); if ( !wasLocked ) @@ -510,7 +510,7 @@ bool UICodeEditor::loadAsyncFromURL( mDoc->getHighlighter()->tokenizeAsync( getUISceneNode()->getThreadPool(), [this] { runOnMainThread( [this] { invalidateDraw(); } ); } ); - runOnMainThread( [&, onLoaded, wasLocked] { + runOnMainThread( [this, success, onLoaded, wasLocked] { invalidateEditor(); updateLongestLineWidth(); invalidateDraw(); @@ -1484,7 +1484,7 @@ void UICodeEditor::checkColorPickerAction() { TextDocument::MatchDirection::Forward ); if ( position.isValid() ) { mDoc->setSelection( { position.line(), position.column() + 1 }, range.start() ); - colorPicker = UIColorPicker::NewModal( this, [&, isRgba]( Color color ) { + colorPicker = UIColorPicker::NewModal( this, [this, isRgba]( Color color ) { mDoc->replaceSelection( isRgba || color.a != 255 ? color.toRgbaString() : color.toRgbString() ); } ); diff --git a/src/eepp/ui/uiconsole.cpp b/src/eepp/ui/uiconsole.cpp index 79151bb05..45b721356 100644 --- a/src/eepp/ui/uiconsole.cpp +++ b/src/eepp/ui/uiconsole.cpp @@ -1218,7 +1218,7 @@ bool UIConsole::onCreateContextMenu( const Vector2i& position, const Uint32& fla } menu->setCloseOnHide( true ); - menu->addEventListener( Event::OnItemClicked, [&, menu]( const Event* event ) { + menu->addEventListener( Event::OnItemClicked, [this, menu]( const Event* event ) { if ( !event->getNode()->isType( UI_TYPE_MENUITEM ) ) return; UIMenuItem* item = event->getNode()->asType(); diff --git a/src/eepp/ui/uimenubar.cpp b/src/eepp/ui/uimenubar.cpp index 594c92a65..44743fc6e 100644 --- a/src/eepp/ui/uimenubar.cpp +++ b/src/eepp/ui/uimenubar.cpp @@ -56,7 +56,7 @@ void UIMenuBar::addMenuButton( const String& buttonText, UIPopUpMenu* menu ) { button->setVisible( true ); button->setEnabled( true ); button->addEventListener( Event::OnSizeChange, [this]( const Event* ) { refreshButtons(); } ); - button->addEventListener( Event::OnFocus, [&, button]( const Event* ) { + button->addEventListener( Event::OnFocus, [this, button]( const Event* ) { if ( getEventDispatcher()->getReleaseTrigger() & EE_BUTTON_LMASK ) { getMenuFromButton( button )->setFocus(); } @@ -67,7 +67,7 @@ void UIMenuBar::addMenuButton( const String& buttonText, UIPopUpMenu* menu ) { menu->setOwnerNode( button ); // This will force to change the parent when shown, and force the CSS style reload. menu->setParent( this ); - menu->addEventListener( Event::OnVisibleChange, [&, button]( const Event* event ) { + menu->addEventListener( Event::OnVisibleChange, [this, button]( const Event* event ) { if ( event->getNode()->isVisible() ) { button->select(); mCurrentMenu = event->getNode()->asType(); diff --git a/src/eepp/ui/uitreeview.cpp b/src/eepp/ui/uitreeview.cpp index 58d535a44..4875f44a0 100644 --- a/src/eepp/ui/uitreeview.cpp +++ b/src/eepp/ui/uitreeview.cpp @@ -418,8 +418,8 @@ Node* UITreeView::overFind( const Vector2f& point ) { return pOver; int realIndex = 0; Float rowHeight = getRowHeight(); - traverseTree( [&, point, rowHeight]( int, const ModelIndex& index, const size_t&, - const Float& yOffset ) { + traverseTree( [this, &pOver, &realIndex, point, rowHeight]( + int, const ModelIndex& index, const size_t&, const Float& yOffset ) { if ( yOffset - mScrollOffset.y > mSize.getHeight() ) return IterationDecision::Stop; if ( yOffset - mScrollOffset.y + rowHeight < 0 ) @@ -526,8 +526,8 @@ Float UITreeView::getMaxColumnContentWidth( const size_t& colIndex, bool ) { Float lWidth = 0; ScopedOp op( [this] { mUISceneNode->setIsLoading( true ); }, [this] { mUISceneNode->setIsLoading( false ); } ); - traverseTree( [&, colIndex]( const int&, const ModelIndex& index, const size_t& indentLevel, - const Float& yOffset ) { + traverseTree( [this, &lWidth, colIndex]( const int&, const ModelIndex& index, + const size_t& indentLevel, const Float& yOffset ) { UIWidget* widget = updateCell( { (Int64)0, (Int64)0 }, getModel()->index( index.row(), colIndex, index.parent() ), indentLevel, yOffset ); @@ -782,7 +782,8 @@ ModelIndex UITreeView::selectRowWithPath( std::string path ) { const auto& part = pathPart[i]; traverseTree( - [&, i]( const int&, const ModelIndex& index, const size_t& indentLevel, const Float& ) { + [&model, &foundIndex, &part, &parentIndex, + i]( const int&, const ModelIndex& index, const size_t& indentLevel, const Float& ) { Variant var = model->data( index ); if ( i == indentLevel && var.isValid() && var.toString() == part ) { if ( !parentIndex.isValid() || parentIndex == index.parent() ) { diff --git a/src/examples/7guis/cells/cells.cpp b/src/examples/7guis/cells/cells.cpp index 4363ff61b..3acb05257 100644 --- a/src/examples/7guis/cells/cells.cpp +++ b/src/examples/7guis/cells/cells.cpp @@ -6,6 +6,10 @@ EE_MAIN_FUNC int main( int, char** ) { UIApplication app( { 1024, 768, "eepp - 7GUIs - Cells" } ); UIWidget* rlay = app.getUI()->loadLayoutFromString( R"xml(