diff --git a/include/eepp/ui/abstract/uiabstracttableview.hpp b/include/eepp/ui/abstract/uiabstracttableview.hpp index 44cbc59c7..0d5ed3309 100644 --- a/include/eepp/ui/abstract/uiabstracttableview.hpp +++ b/include/eepp/ui/abstract/uiabstracttableview.hpp @@ -55,9 +55,13 @@ class EE_API UIAbstractTableView : public UIAbstractView { /** In pixels. */ void setColumnWidth( const size_t& colIndex, const Float& width ); + void setColumnMaxWidth( const size_t& colIndex, const Float& width ); + /** In pixels. */ void setColumnsWidth( const Float& width ); + void setColumnsMaxWidth( const Float& width ); + const Float& getColumnWidth( const size_t& colIndex ) const; virtual Float getMaxColumnContentWidth( const size_t& colIndex, bool bestGuess = false ); @@ -138,6 +142,7 @@ class EE_API UIAbstractTableView : public UIAbstractView { struct ColumnData { Float minWidth{ 0 }; Float minHeight{ 0 }; + Float maxWidth{ 0 }; Float width{ 0 }; bool visible{ true }; UIPushButton* widget{ nullptr }; diff --git a/src/eepp/ui/abstract/uiabstracttableview.cpp b/src/eepp/ui/abstract/uiabstracttableview.cpp index afaf44884..08c98dcf7 100644 --- a/src/eepp/ui/abstract/uiabstracttableview.cpp +++ b/src/eepp/ui/abstract/uiabstracttableview.cpp @@ -58,6 +58,17 @@ void UIAbstractTableView::setColumnWidth( const size_t& colIndex, const Float& w } } +void UIAbstractTableView::setColumnMaxWidth( const size_t& colIndex, const Float& width ) { + if ( columnData( colIndex ).maxWidth != width ) { + columnData( colIndex ).maxWidth = width; + if ( columnData( colIndex ).width > width ) { + updateHeaderSize(); + onColumnSizeChange( colIndex ); + createOrUpdateColumns( false ); + } + } +} + void UIAbstractTableView::setColumnsWidth( const Float& width ) { if ( !getModel() ) return; @@ -69,6 +80,22 @@ void UIAbstractTableView::setColumnsWidth( const Float& width ) { createOrUpdateColumns( false ); } +void UIAbstractTableView::setColumnsMaxWidth( const Float& width ) { + if ( !getModel() ) + return; + bool needsRefresh = false; + for ( size_t i = 0; i < getModel()->columnCount(); i++ ) { + if ( columnData( i ).width > width ) + needsRefresh = true; + columnData( i ).maxWidth = width; + onColumnSizeChange( i ); + } + if ( needsRefresh ) { + updateHeaderSize(); + createOrUpdateColumns( false ); + } +} + const Float& UIAbstractTableView::getColumnWidth( const size_t& colIndex ) const { return columnData( colIndex ).width; } @@ -111,6 +138,7 @@ void UIAbstractTableView::resetColumnData() { for ( size_t i = 0; i < count; i++ ) { ColumnData& col = columnData( i ); col.minWidth = 0; + col.maxWidth = 0; } } @@ -145,7 +173,8 @@ void UIAbstractTableView::createOrUpdateColumns( bool resetColumnData ) { col.minWidth = col.widget->getPixelsSize().getWidth(); col.minHeight = col.widget->getPixelsSize().getHeight(); } - col.width = eeceil( eemax( col.width, col.minWidth ) ); + col.width = eeceil( col.maxWidth != 0 ? eeclamp( col.width, col.minWidth, col.maxWidth ) + : eemax( col.width, col.minWidth ) ); col.widget->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed ); col.widget->setPixelsSize( col.width, getHeaderHeight() ); } @@ -198,7 +227,8 @@ void UIAbstractTableView::createOrUpdateColumns( bool resetColumnData ) { ColumnData& col = columnData( i ); if ( !col.visible ) continue; - col.width = eeceil( eemax( col.width, col.minWidth ) ); + col.width = eeceil( col.maxWidth != 0 ? eeclamp( col.width, col.minWidth, col.maxWidth ) + : eemax( col.width, col.minWidth ) ); col.widget->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed ); col.widget->setPixelsSize( col.width, getHeaderHeight() ); totalWidth += col.width; diff --git a/src/tools/ecode/plugins/debugger/debuggerplugin.cpp b/src/tools/ecode/plugins/debugger/debuggerplugin.cpp index 8011ab7de..b46b70333 100644 --- a/src/tools/ecode/plugins/debugger/debuggerplugin.cpp +++ b/src/tools/ecode/plugins/debugger/debuggerplugin.cpp @@ -448,6 +448,7 @@ void DebuggerPlugin::loadDAPConfig( const std::string& path, bool updateConfigFi } if ( mKeyBindings.empty() ) { + mKeyBindings["debugger-start"] = "mod+f5"; mKeyBindings["debugger-continue-interrupt"] = "f5"; mKeyBindings["debugger-breakpoint-toggle"] = "f9"; mKeyBindings["debugger-breakpoint-enable-toggle"] = "mod+f9";