diff --git a/bin/assets/ui/breeze.css b/bin/assets/ui/breeze.css index d5b0fc27b..87f95a2a8 100644 --- a/bin/assets/ui/breeze.css +++ b/bin/assets/ui/breeze.css @@ -4,7 +4,6 @@ --back: #31363b; --font: #eff0f1; --font-hint: #898b8d; - --menu-font-disabled: #6e7275; --button-back: #30353a; --button-border: #6b6f73; --button-radius: 2dp; @@ -25,18 +24,19 @@ --tab-line: #616569; --tab-active: #31363b; --tab-hover: #334e5e; + --tab-close: #909396; + --tab-close-hover: #863d47; --icon: #b6bbc2; --icon-active: white; + --icon-back-hover: #eff0f1; + --icon-line-hover: #3d4246; + --icon-back-alert: #e49aa2; --menu-back: #2d3136; --menu-font: #eff0f1; --menu-border: #616569; --menu-font-active: white; - --icon-back-hover: #eff0f1; - --icon-line-hover: #3d4246; - --icon-back-alert: #e49aa2; + --menu-font-disabled: #6e7275; --win-icon: #dbdbdd; - --tab-close: #909396; - --tab-close-hover: #863d47; } CheckBox, @@ -168,7 +168,7 @@ Table { ListBox::item { padding-left: 4dp; background-color: transparent; - background-image: linear-gradient( to right, #232629, #383a3d ), linear-gradient( to right, #383a3d, #232629 ); + background-image: linear-gradient( to right, var(--list-back), var(--separator) ), linear-gradient( to right, var(--separator), var(--list-back) ); background-size: 50% 1dp, 50% 1dp; background-position: left bottom, right bottom; } @@ -652,10 +652,6 @@ Menu::SubMenu:disabled > Menu::SubMenu::text { color: var(--menu-font-disabled); } -Menu::SubMenu::arrow { - margin-right: 1dp; -} - Menu::Item:hover > Menu::Item::text, Menu::CheckBox:hover > Menu::Item::text, Menu::RadioButton:hover > Menu::Item::text, @@ -678,6 +674,7 @@ Menu::Separator { Menu::SubMenu::Arrow { width: 16dp; height: 16dp; + margin-right: 1dp; foreground-image: poly(line, var(--icon), "5dp 3dp, 10dp 8dp"), poly(line, var(--icon), "5dp 13dp, 10dp 8dp"); } @@ -786,8 +783,16 @@ TableView > ScrollBar { background-color: var(--list-back); } -table::header::column::arrow { - margin-left: 2dp; +table::header::column::arrow-up { + width: 16dp; + height: 12dp; + foreground-image: poly(line, var(--icon), "1dp 4dp, 5dp 7dp"), poly(line, var(--icon), "5dp 7dp, 9dp 4dp"); +} + +table::header::column::arrow-down { + width: 16dp; + height: 12dp; + foreground-image: poly(line, var(--icon), "1dp 7dp, 5dp 4dp"), poly(line, var(--icon), "5dp 4dp, 9dp 7dp"); } .appbackground { diff --git a/include/eepp/ui/abstract/uiabstracttableview.hpp b/include/eepp/ui/abstract/uiabstracttableview.hpp index c29794972..976b91747 100644 --- a/include/eepp/ui/abstract/uiabstracttableview.hpp +++ b/include/eepp/ui/abstract/uiabstracttableview.hpp @@ -72,6 +72,12 @@ class EE_API UIAbstractTableView : public UIAbstractView { void setIconSize( const size_t& iconSize ); + const size_t& getSortIconSize() const; + + void setSortIconSize( const size_t& sortIconSize ); + + void setColumnsVisible( const std::vector columns ); + protected: friend class EE::UI::UITableHeaderColumn; @@ -88,7 +94,8 @@ class EE_API UIAbstractTableView : public UIAbstractView { mutable std::vector> mWidgets; UILinearLayout* mHeader; Float mDragBorderDistance{8}; - size_t mIconSize{16}; + size_t mIconSize{12}; + size_t mSortIconSize{16}; bool mAutoExpandOnSingleColumn{false}; virtual ~UIAbstractTableView(); diff --git a/include/eepp/ui/uitableheadercolumn.hpp b/include/eepp/ui/uitableheadercolumn.hpp index d248ea1d5..951aba637 100644 --- a/include/eepp/ui/uitableheadercolumn.hpp +++ b/include/eepp/ui/uitableheadercolumn.hpp @@ -36,6 +36,10 @@ class EE_API UITableHeaderColumn : public UIPushButton { Uint32 onMouseDoubleClick( const Vector2i& position, const Uint32& flags ); Uint32 onDragStop( const Vector2i& pos, const Uint32& flags ); + + Sizef updateLayout(); + + virtual void updateSortIconPosition(); }; }} // namespace EE::UI diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index 6eacdb00a..743393d53 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -89,7 +89,7 @@ {6d057187-158a-4883-8d5b-d470a6b6b025} 10 0 - 19 + 15 ../../make/linux diff --git a/src/eepp/ui/abstract/uiabstracttableview.cpp b/src/eepp/ui/abstract/uiabstracttableview.cpp index 815c9f0c1..a9c44dcb0 100644 --- a/src/eepp/ui/abstract/uiabstracttableview.cpp +++ b/src/eepp/ui/abstract/uiabstracttableview.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -10,7 +11,8 @@ namespace EE { namespace UI { namespace Abstract { UIAbstractTableView::UIAbstractTableView( const std::string& tag ) : UIAbstractView( tag ), mDragBorderDistance( PixelDensity::dpToPx( 4 ) ), - mIconSize( PixelDensity::dpToPxI( 12 ) ) { + mIconSize( PixelDensity::dpToPxI( 12 ) ), + mSortIconSize( PixelDensity::dpToPxI( 20 ) ) { mHeader = UILinearLayout::NewWithTag( "table::header", UIOrientation::Horizontal ); mHeader->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed ); mHeader->setParent( this ); @@ -267,6 +269,16 @@ void UIAbstractTableView::setColumnsHidden( const std::vector columns, b createOrUpdateColumns(); } +void UIAbstractTableView::setColumnsVisible( const std::vector columns ) { + if ( !getModel() ) + return; + for ( size_t i = 0; i < getModel()->columnCount(); i++ ) + columnData( i).visible = false; + for ( auto col : columns ) + columnData( col ).visible = true; + createOrUpdateColumns(); +} + UITableRow* UIAbstractTableView::createRow() { mUISceneNode->invalidateStyle( this ); mUISceneNode->invalidateStyleState( this, true ); @@ -395,6 +407,14 @@ void UIAbstractTableView::setIconSize( const size_t& iconSize ) { mIconSize = iconSize; } +const size_t& UIAbstractTableView::getSortIconSize() const { + return mSortIconSize; +} + +void UIAbstractTableView::setSortIconSize( const size_t& sortIconSize ) { + mSortIconSize = sortIconSize; +} + void UIAbstractTableView::onOpenModelIndex( const ModelIndex& index ) { ModelEvent event( getModel(), index, this ); sendEvent( &event ); @@ -413,11 +433,17 @@ void UIAbstractTableView::onSortColumn( const size_t& colIndex ) { } SortOrder sortOrder = model->sortOrder() == SortOrder::Ascending ? SortOrder::Descending : SortOrder::Ascending; - Drawable* icon = mUISceneNode->findIconDrawable( - sortOrder == SortOrder::Ascending ? "arrow-down" : "arrow-up", mIconSize ); - UIImage* image = columnData( colIndex ).widget->getExtraInnerWidget()->asType(); - if ( image && icon ) - image->setDrawable( icon ); + UIPushButton* button = columnData( colIndex ).widget; + UIImage* image = button->getExtraInnerWidget()->asType(); + std::string tag = button->getElementTag() + "::arrow"; + image->setElementTag( sortOrder == SortOrder::Ascending ? tag + "-up" : tag + "-down" ); + image->reloadStyle(); + if ( image && image->getForeground() == nullptr ) { + Drawable* icon = mUISceneNode->findIconDrawable( + sortOrder == SortOrder::Ascending ? "arrow-down" : "arrow-up", mSortIconSize ); + if ( icon ) + image->setDrawable( icon ); + } model->setKeyColumnAndSortOrder( colIndex, sortOrder ); } } diff --git a/src/eepp/ui/models/filesystemmodel.cpp b/src/eepp/ui/models/filesystemmodel.cpp index de0855a9b..0f276aed6 100644 --- a/src/eepp/ui/models/filesystemmodel.cpp +++ b/src/eepp/ui/models/filesystemmodel.cpp @@ -180,10 +180,8 @@ Variant FileSystemModel::data( const ModelIndex& index, Model::Role role ) const auto& node = this->nodeRef( index ); - if ( role == Role::Custom ) { - eeASSERT( index.column() == Column::Name ); + if ( role == Role::Custom ) return Variant( node.info().getFilepath().c_str() ); - } if ( role == Role::Sort ) { switch ( index.column() ) { diff --git a/src/eepp/ui/uiimage.cpp b/src/eepp/ui/uiimage.cpp index de1ca8689..ca9364084 100644 --- a/src/eepp/ui/uiimage.cpp +++ b/src/eepp/ui/uiimage.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -240,18 +241,20 @@ bool UIImage::applyProperty( const StyleSheetProperty& attribute ) { switch ( attribute.getPropertyDefinition()->getPropertyId() ) { case PropertyId::Src: { std::string path( attribute.getValue() ); + bool ownIt; + Drawable* createdDrawable = + CSS::StyleSheetSpecification::instance()->getDrawableImageParser().createDrawable( + path, mSize, ownIt, this ); + if ( createdDrawable ) { + setDrawable( createdDrawable, ownIt ); + } else { + Drawable* res = NULL; + if ( NULL != ( res = DrawableSearcher::searchByName( path ) ) ) { + if ( res->getDrawableType() == Drawable::SPRITE ) + mDrawableOwner = true; - FunctionString func( FunctionString::parse( path ) ); - if ( !func.getParameters().empty() && func.getName() == "url" ) { - path = func.getParameters().at( 0 ); - } - - Drawable* res = NULL; - if ( NULL != ( res = DrawableSearcher::searchByName( path ) ) ) { - if ( res->getDrawableType() == Drawable::SPRITE ) - mDrawableOwner = true; - - setDrawable( res ); + setDrawable( res ); + } } break; } diff --git a/src/eepp/ui/uipushbutton.cpp b/src/eepp/ui/uipushbutton.cpp index 5e70a0761..55d665c84 100644 --- a/src/eepp/ui/uipushbutton.cpp +++ b/src/eepp/ui/uipushbutton.cpp @@ -213,7 +213,7 @@ Sizef UIPushButton::updateLayout() { size = packLayout( {mIcon, mTextBox, getExtraInnerWidget()}, autoPadding ); break; } - return size; + return size.ceil(); } void UIPushButton::onPaddingChange() { diff --git a/src/eepp/ui/uitableheadercolumn.cpp b/src/eepp/ui/uitableheadercolumn.cpp index 6cc21bd3c..af49f2d4f 100644 --- a/src/eepp/ui/uitableheadercolumn.cpp +++ b/src/eepp/ui/uitableheadercolumn.cpp @@ -10,10 +10,9 @@ UITableHeaderColumn::UITableHeaderColumn( UIAbstractTableView* view, const size_ mInnerWidgetOrientation = InnerWidgetOrientation::Right; auto cb = [&]( const Event* ) { updateLayout(); }; mImage = UIImage::NewWithTag( mTag + "::arrow" ); - mImage->setScaleType( UIScaleType::FitInside ) - ->setLayoutSizePolicy( SizePolicy::WrapContent, SizePolicy::WrapContent ) + mImage->setLayoutSizePolicy( SizePolicy::WrapContent, SizePolicy::WrapContent ) ->setFlags( UI_VALIGN_CENTER | UI_HALIGN_CENTER ) - ->setParent( const_cast( this ) ); + ->setParent( this ); mImage->setEnabled( false ); mImage->addEventListener( Event::OnPaddingChange, cb ); mImage->addEventListener( Event::OnMarginChange, cb ); @@ -41,6 +40,19 @@ Uint32 UITableHeaderColumn::onCalculateDrag( const Vector2f& position, const Uin return 1; } +Sizef UITableHeaderColumn::updateLayout() { + Sizef res = UIPushButton::updateLayout(); + updateSortIconPosition(); + return res; +} + +void UITableHeaderColumn::updateSortIconPosition() { + mImage->setPixelsPosition( getPixelsSize().getWidth() - mImage->getPixelsSize().getWidth() - + mImage->getLayoutPixelsMargin().Right, + 0 ); + mImage->centerVertical(); +} + Uint32 UITableHeaderColumn::onMouseDown( const Vector2i& position, const Uint32& flags ) { Vector2f localPos( convertToNodeSpace( position.asFloat() ) ); if ( NULL != getEventDispatcher() && !getEventDispatcher()->isNodeDragging() && diff --git a/src/tests/ui_perf_test/ui_perf_test.cpp b/src/tests/ui_perf_test/ui_perf_test.cpp index 7b062b36f..dccb40c0b 100644 --- a/src/tests/ui_perf_test/ui_perf_test.cpp +++ b/src/tests/ui_perf_test/ui_perf_test.cpp @@ -164,8 +164,8 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) { addIcon( "tree-expanded", 0xea50 ); addIcon( "tree-contracted", 0xea54 ); addIcon( "file", 0xecc3 ); - addIcon( "arrow-up", 0xea77 ); - addIcon( "arrow-down", 0xea4d ); + //addIcon( "arrow-up", 0xea78 ); + //addIcon( "arrow-down", 0xea4e ); UISceneNode* uiSceneNode = UISceneNode::New(); SceneManager::instance()->add( uiSceneNode ); uiSceneNode->getUIThemeManager()->setDefaultFont( font ); diff --git a/src/tools/codeeditor/codeeditor.cpp b/src/tools/codeeditor/codeeditor.cpp index 8fc9f576e..424b1b722 100644 --- a/src/tools/codeeditor/codeeditor.cpp +++ b/src/tools/codeeditor/codeeditor.cpp @@ -790,6 +790,7 @@ void App::showFindView() { mSearchBarLayout->setEnabled( true )->setVisible( true ); UITextInput* findInput = mSearchBarLayout->find( "search_find" ); + findInput->getDocument().selectAll(); findInput->setFocus(); const TextDocument& doc = editor->getDocument();