Minor clean up.

This commit is contained in:
Martín Lucas Golini
2024-02-10 20:46:05 -03:00
parent 0a23b3682b
commit a09377f8e6
7 changed files with 36 additions and 34 deletions
+8
View File
@@ -108,6 +108,10 @@ class EE_API SceneNode : public Node {
const Float& getDPI() const;
bool getVerbose() const;
void setVerbose( bool verbose );
protected:
friend class Node;
typedef UnorderedSet<Node*> CloseList;
@@ -117,6 +121,7 @@ class EE_API SceneNode : public Node {
FrameBuffer* mFrameBuffer;
EventDispatcher* mEventDispatcher;
CloseList mCloseList;
Clock mClock;
bool mFrameBufferBound;
bool mUseInvalidation;
bool mUseGlobalCursors;
@@ -127,6 +132,9 @@ class EE_API SceneNode : public Node {
bool mHighlightOver;
bool mHighlightFocus;
bool mHighlightInvalidation;
bool mFirstUpdate{ true };
bool mFirstFrame{ true };
bool mVerbose{ false };
Color mHighlightFocusColor;
Color mHighlightOverColor;
Color mHighlightInvalidationColor;
+2 -9
View File
@@ -99,10 +99,6 @@ class EE_API UISceneNode : public SceneNode {
UIWidget* getRoot() const;
bool getVerbose() const;
void setVerbose( bool verbose );
void invalidateStyle( UIWidget* widget );
void invalidateStyleState( UIWidget* widget, bool disableCSSAnimations = false );
@@ -179,11 +175,8 @@ class EE_API UISceneNode : public SceneNode {
Translator mTranslator;
std::vector<UIWindow*> mWindowsList;
CSS::StyleSheet mStyleSheet;
bool mIsLoading;
bool mVerbose;
bool mUpdatingLayouts;
bool mFirstUpdate{ true };
Clock mClock;
bool mIsLoading{ false };
bool mUpdatingLayouts{ false };
UIThemeManager* mUIThemeManager{ nullptr };
UIIconThemeManager* mUIIconThemeManager{ nullptr };
std::vector<Font*> mFontFaces;
+14
View File
@@ -127,6 +127,12 @@ void SceneNode::draw() {
mWindow->setView( prevView );
GlobalBatchRenderer::instance()->draw();
if ( mVerbose && mFirstFrame ) {
mFirstFrame = false;
Log::info( "First frame in SceneNode took %.2f ms",
mClock.getElapsedTime().asMilliseconds() );
}
}
void SceneNode::update( const Time& time ) {
@@ -499,4 +505,12 @@ const Float& SceneNode::getDPI() const {
return mDPI;
}
bool SceneNode::getVerbose() const {
return mVerbose;
}
void SceneNode::setVerbose( bool verbose ) {
mVerbose = verbose;
}
}} // namespace EE::Scene
+1 -3
View File
@@ -18,9 +18,7 @@ UIAbstractTableView::UIAbstractTableView( const std::string& tag ) :
mSortIconSize( PixelDensity::dpToPxI( 20 ) ) {
mHeader = UILinearLayout::NewWithTag( mTag + "::header", UIOrientation::Horizontal );
mHeader->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed );
mHeader->setParent( this );
mHeader->setVisible( true );
mHeader->setEnabled( true );
mHeader->setParent( this )->setVisible( true )->setEnabled( true );
mVScroll->on( Event::OnAlphaChange, [this]( const Event* ) {
if ( mVScroll->getAlpha() == 0.f || mVScroll->getAlpha() == 1.f )
updateColumnsWidth();
-9
View File
@@ -37,7 +37,6 @@ UISceneNode::UISceneNode( EE::Window::Window* window ) :
SceneNode( window ),
mRoot( NULL ),
mIsLoading( false ),
mVerbose( false ),
mUpdatingLayouts( false ),
mUIThemeManager( UIThemeManager::New() ),
mUIIconThemeManager( UIIconThemeManager::New()->setFallbackThemeManager( mUIThemeManager ) ),
@@ -665,14 +664,6 @@ UIWidget* UISceneNode::getRoot() const {
return mRoot;
}
bool UISceneNode::getVerbose() const {
return mVerbose;
}
void UISceneNode::setVerbose( bool verbose ) {
mVerbose = verbose;
}
void UISceneNode::invalidateStyle( UIWidget* node ) {
eeASSERT( NULL != node );
+6 -6
View File
@@ -4,6 +4,8 @@
#include <eepp/ui/uiscrollbar.hpp>
#include <eepp/ui/uitableview.hpp>
#include <eepp/system/scopedop.hpp>
namespace EE { namespace UI {
UITableView* UITableView::New() {
@@ -56,13 +58,12 @@ void UITableView::drawChilds() {
}
Node* UITableView::overFind( const Vector2f& point ) {
mUISceneNode->setIsLoading( true );
ScopedOp op( [this] { mUISceneNode->setIsLoading( true ); },
[this] { mUISceneNode->setIsLoading( false ); } );
Node* pOver = NULL;
if ( mEnabled && mVisible ) {
ConditionalLock l( getModel() != nullptr,
getModel() ? &getModel()->resourceMutex() : nullptr );
updateWorldPolygon();
if ( mWorldBounds.contains( point ) && mPoly.pointInside( point ) ) {
writeNodeFlag( NODE_FLAG_MOUSEOVER_ME_OR_CHILD, 1 );
@@ -103,7 +104,6 @@ Node* UITableView::overFind( const Vector2f& point ) {
}
}
mUISceneNode->setIsLoading( false );
return pOver;
}
@@ -112,7 +112,8 @@ Float UITableView::getMaxColumnContentWidth( const size_t& colIndex, bool bestGu
ConditionalLock l( getModel() != nullptr, getModel() ? &getModel()->resourceMutex() : nullptr );
if ( getModel()->rowCount() == 0 )
return lWidth;
getUISceneNode()->setIsLoading( true );
ScopedOp op( [this] { mUISceneNode->setIsLoading( true ); },
[this] { mUISceneNode->setIsLoading( false ); } );
Float yOffset = getHeaderHeight();
auto worstCaseFunc = [&]( const ModelIndex& index ) {
UIWidget* widget = updateCell( index.row(), index, 0, yOffset );
@@ -148,7 +149,6 @@ Float UITableView::getMaxColumnContentWidth( const size_t& colIndex, bool bestGu
for ( size_t i = 0; i < getItemCount(); i++ )
worstCaseFunc( getModel()->index( i, colIndex ) );
}
getUISceneNode()->setIsLoading( false );
return lWidth;
}
+5 -7
View File
@@ -1,6 +1,7 @@
#include <deque>
#include <eepp/graphics/renderer/renderer.hpp>
#include <eepp/system/lock.hpp>
#include <eepp/system/scopedop.hpp>
#include <eepp/ui/keyboardshortcut.hpp>
#include <eepp/ui/uilinearlayout.hpp>
#include <eepp/ui/uipushbutton.hpp>
@@ -384,8 +385,8 @@ void UITreeView::drawChilds() {
}
Node* UITreeView::overFind( const Vector2f& point ) {
mUISceneNode->setIsLoading( true );
ScopedOp op( [this] { mUISceneNode->setIsLoading( true ); },
[this] { mUISceneNode->setIsLoading( false ); } );
Node* pOver = NULL;
if ( mEnabled && mVisible ) {
updateWorldPolygon();
@@ -416,9 +417,6 @@ Node* UITreeView::overFind( const Vector2f& point ) {
pOver = this;
}
}
mUISceneNode->setIsLoading( false );
return pOver;
}
@@ -509,7 +507,8 @@ void UITreeView::setExpandersAsIcons( bool expandersAsIcons ) {
Float UITreeView::getMaxColumnContentWidth( const size_t& colIndex, bool ) {
Float lWidth = 0;
getUISceneNode()->setIsLoading( true );
ScopedOp op( [this] { mUISceneNode->setIsLoading( true ); },
[this] { mUISceneNode->setIsLoading( false ); } );
traverseTree( [&, colIndex]( const int&, const ModelIndex& index, const size_t& indentLevel,
const Float& yOffset ) {
UIWidget* widget = updateCell(
@@ -521,7 +520,6 @@ Float UITreeView::getMaxColumnContentWidth( const size_t& colIndex, bool ) {
}
return IterationDecision::Continue;
} );
getUISceneNode()->setIsLoading( false );
return lWidth;
}