diff --git a/bin/assets/ui/breeze.css b/bin/assets/ui/breeze.css index 58d5fc64c..4a28a36b4 100644 --- a/bin/assets/ui/breeze.css +++ b/bin/assets/ui/breeze.css @@ -8,7 +8,7 @@ --button-border: #6b6f73; --button-radius: 2dp; --base-horizontal-padding: 5dp; - --base-vertical-padding: 7dp; + --base-vertical-padding: 5dp; --border-width: 1dp; --list-back: #232629; --separator: #383a3d; @@ -823,6 +823,56 @@ listview::header::column::arrow-down { foreground-image: poly(line, var(--icon), "1dp 7dp, 5dp 4dp"), poly(line, var(--icon), "5dp 4dp, 9dp 7dp"); } +ScrollBarMini { + scrollbar-style: no-buttons; + min-width: 4dp; + min-height: 4dp; +} + +ScrollBarMini::hback { + min-height: 4dp; + border-radius: 2dp; + background-color: transparent; +} + +ScrollBarMini::vback { + min-width: 4dp; + border-radius: 2dp; + background-color: transparent; +} + +ScrollBarMini::hslider, +ScrollBarMini::vslider { + border-width: 1dp; + border-color: var(--scrollbar-border); + transition: all 0.15s; +} + +ScrollBarMini::hbutton { + min-width: 4dp; + min-height: 4dp; + background-color: var(--scrollbar-button); + border-radius: 2dp; + border-width: 0dp; + transition: all 0.15s; +} + +ScrollBarMini::vbutton { + min-width: 4dp; + min-height: 4dp; + background-color: var(--scrollbar-button); + border-radius: 2dp; + border-width: 0dp; + transition: all 0.15s; +} + +ScrollBarMini::vslider:hover ScrollBar::vbutton, +ScrollBarMini::vbutton:hover, +ScrollBarMini::hslider:hover ScrollBar::hbutton, +ScrollBarMini::hbutton:hover { + background-color: var(--primary); +} + .appbackground { background-color: var(--back); } diff --git a/include/eepp/ui/uiscrollbar.hpp b/include/eepp/ui/uiscrollbar.hpp index 987ac5b02..74896cd80 100644 --- a/include/eepp/ui/uiscrollbar.hpp +++ b/include/eepp/ui/uiscrollbar.hpp @@ -16,7 +16,14 @@ class EE_API UIScrollBar : public UIWidget { static UIScrollBar* NewVertical(); - explicit UIScrollBar( const UIOrientation& orientation = UIOrientation::Vertical ); + static UIScrollBar* NewWithTag( const std::string& tag ); + + static UIScrollBar* NewHorizontalWithTag( const std::string& tag ); + + static UIScrollBar* NewVerticalWithTag( const std::string& tag ); + + explicit UIScrollBar( const std::string& tag = "scrollbar", + const UIOrientation& orientation = UIOrientation::Vertical ); virtual ~UIScrollBar(); diff --git a/include/eepp/ui/uitabwidget.hpp b/include/eepp/ui/uitabwidget.hpp index 59928d67e..9b645c456 100644 --- a/include/eepp/ui/uitabwidget.hpp +++ b/include/eepp/ui/uitabwidget.hpp @@ -7,6 +7,8 @@ namespace EE { namespace UI { +class UIScrollBar; + class EE_API TabEvent : public Event { public: TabEvent( Node* node, UITab* tabEvent, Uint32 tabIndex, const Uint32& eventType ) : @@ -154,6 +156,7 @@ class EE_API UITabWidget : public UIWidget { UIWidget* mNodeContainer; UIWidget* mTabBar; + UIScrollBar* mTabScroll; StyleConfig mStyleConfig; std::deque mTabs; UITab* mTabSelected; @@ -197,6 +200,10 @@ class EE_API UITabWidget : public UIWidget { void tryCloseTab( UITab* tab ); void swapTabs( UITab* left, UITab* right ); + + void updateScrollBar(); + + void updateScroll(); }; }} // namespace EE::UI diff --git a/include/eepp/ui/uitextinput.hpp b/include/eepp/ui/uitextinput.hpp index 99adf410f..b12d193e6 100644 --- a/include/eepp/ui/uitextinput.hpp +++ b/include/eepp/ui/uitextinput.hpp @@ -70,9 +70,9 @@ class EE_API UITextInput : public UITextView, public TextDocument::Client { UITextInput* setHintFont( Font* font ); - Uint32 getHintCharacterSize() const; + Uint32 getHintFontSize() const; - UITextView* setHintCharacterSize( const Uint32& characterSize ); + UITextView* setHintFontSize( const Uint32& characterSize ); const Uint32& getHintFontStyle() const; diff --git a/src/eepp/scene/node.cpp b/src/eepp/scene/node.cpp index 41763d8ff..272109847 100644 --- a/src/eepp/scene/node.cpp +++ b/src/eepp/scene/node.cpp @@ -675,7 +675,8 @@ void Node::childRemove( Node* node ) { if ( mChildLast == node ) mChildLast = mChildLast->mPrev; - node->mPrev->mNext = node->mNext; + if ( node->mPrev ) + node->mPrev->mNext = node->mNext; if ( NULL != node->mNext ) { node->mNext->mPrev = node->mPrev; diff --git a/src/eepp/ui/uiscrollbar.cpp b/src/eepp/ui/uiscrollbar.cpp index b44a0a059..7b9bc0cd0 100644 --- a/src/eepp/ui/uiscrollbar.cpp +++ b/src/eepp/ui/uiscrollbar.cpp @@ -5,19 +5,31 @@ namespace EE { namespace UI { UIScrollBar* UIScrollBar::New() { - return eeNew( UIScrollBar, ( UIOrientation::Vertical ) ); + return eeNew( UIScrollBar, () ); } UIScrollBar* UIScrollBar::NewHorizontal() { - return eeNew( UIScrollBar, ( UIOrientation::Horizontal ) ); + return eeNew( UIScrollBar, ( "scrollbar", UIOrientation::Horizontal ) ); } UIScrollBar* UIScrollBar::NewVertical() { - return eeNew( UIScrollBar, ( UIOrientation::Vertical ) ); + return eeNew( UIScrollBar, ( "scrollbar", UIOrientation::Vertical ) ); } -UIScrollBar::UIScrollBar( const UIOrientation& orientation ) : - UIWidget( "scrollbar" ), +UIScrollBar* UIScrollBar::NewWithTag( const std::string& tag ) { + return eeNew( UIScrollBar, ( tag, UIOrientation::Vertical ) ); +} + +UIScrollBar* UIScrollBar::NewHorizontalWithTag( const std::string& tag ) { + return eeNew( UIScrollBar, ( tag, UIOrientation::Horizontal ) ); +} + +UIScrollBar* UIScrollBar::NewVerticalWithTag( const std::string& tag ) { + return eeNew( UIScrollBar, ( tag, UIOrientation::Vertical ) ); +} + +UIScrollBar::UIScrollBar( const std::string& tag, const UIOrientation& orientation ) : + UIWidget( tag ), #ifdef EE_PLATFORM_TOUCH mScrollBarStyle( NoButtons ) #else @@ -29,19 +41,19 @@ UIScrollBar::UIScrollBar( const UIOrientation& orientation ) : setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed ); if ( orientation == UIOrientation::Vertical ) { - mBtnDown = UIWidget::NewWithTag( "scrollbar::btndown" ); - mBtnUp = UIWidget::NewWithTag( "scrollbar::btnup" ); + mBtnDown = UIWidget::NewWithTag( mTag + "::btndown" ); + mBtnUp = UIWidget::NewWithTag( mTag + "::btnup" ); } else { - mBtnDown = UIWidget::NewWithTag( "scrollbar::btnleft" ); - mBtnUp = UIWidget::NewWithTag( "scrollbar::btnright" ); + mBtnDown = UIWidget::NewWithTag( mTag + "::btnleft" ); + mBtnUp = UIWidget::NewWithTag( mTag + "::btnright" ); } mBtnUp->setParent( this ); mBtnUp->setSize( 8, 8 ); mBtnDown->setParent( this ); mBtnDown->setSize( 8, 8 ); - mSlider = UISlider::NewWithTag( orientation == UIOrientation::Vertical ? "scrollbar::vslider" - : "scrollbar::hslider", + mSlider = UISlider::NewWithTag( orientation == UIOrientation::Vertical ? mTag + "::vslider" + : mTag + "::hslider", orientation ); mSlider->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed ); mSlider->setOrientation( orientation ); @@ -51,11 +63,11 @@ UIScrollBar::UIScrollBar( const UIOrientation& orientation ) : mSlider->addEventListener( Event::OnValueChange, cb::Make1( this, &UIScrollBar::onValueChangeCb ) ); if ( orientation == UIOrientation::Vertical ) { - mSlider->getSliderButton()->setElementTag( "scrollbar::vbutton" ); - mSlider->getBackSlider()->setElementTag( "scrollbar::vback" ); + mSlider->getSliderButton()->setElementTag( mTag + "::vbutton" ); + mSlider->getBackSlider()->setElementTag( mTag + "::vback" ); } else { - mSlider->getSliderButton()->setElementTag( "scrollbar::hbutton" ); - mSlider->getBackSlider()->setElementTag( "scrollbar::hback" ); + mSlider->getSliderButton()->setElementTag( mTag + "::hbutton" ); + mSlider->getBackSlider()->setElementTag( mTag + "::hback" ); } applyDefaultTheme(); @@ -440,16 +452,16 @@ UIOrientation UIScrollBar::getOrientation() const { UINode* UIScrollBar::setOrientation( const UIOrientation& orientation ) { if ( mSlider->getOrientation() != orientation ) { if ( orientation == UIOrientation::Vertical ) { - mSlider->setElementTag( "scrollbar::vslider" ); + mSlider->setElementTag( mTag + "::vslider" ); mBtnDown->setElementTag( mTag + "::btndown" ); mBtnUp->setElementTag( mTag + "::btnup" ); } else { - mSlider->setElementTag( "scrollbar::hslider" ); + mSlider->setElementTag( mTag + "::hslider" ); mBtnDown->setElementTag( mTag + "::btnleft" ); mBtnUp->setElementTag( mTag + "::btnright" ); } - mSlider->setOrientation( orientation, "scrollbar" ); + mSlider->setOrientation( orientation, mTag ); applyDefaultTheme(); diff --git a/src/eepp/ui/uitabwidget.cpp b/src/eepp/ui/uitabwidget.cpp index 36cb3d68a..357eb561c 100644 --- a/src/eepp/ui/uitabwidget.cpp +++ b/src/eepp/ui/uitabwidget.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -29,7 +30,6 @@ UITabWidget::UITabWidget() : mTabBar->setPixelsSize( mSize.getWidth(), mStyleConfig.TabHeight ) ->setParent( this ) ->setPosition( 0, 0 ); - mTabBar->clipEnable(); mNodeContainer = UIWidget::NewWithTag( "tabwidget::container" ); mNodeContainer @@ -39,6 +39,12 @@ UITabWidget::UITabWidget() : ->setPosition( 0, mStyleConfig.TabHeight ); mNodeContainer->clipEnable(); + mTabScroll = UIScrollBar::NewHorizontalWithTag( "scrollbarmini" ); + mTabScroll->setParent( this ); + mTabScroll->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::WrapContent ); + mTabScroll->addEventListener( Event::OnSizeChange, [&]( const Event* ) { updateScrollBar(); } ); + mTabScroll->addEventListener( Event::OnValueChange, [&]( const Event* ) { updateScroll(); } ); + onSizeChange(); applyDefaultTheme(); @@ -101,7 +107,12 @@ void UITabWidget::setContainerSize() { } else { mTabBar->setVisible( true ); mTabBar->setEnabled( true ); - mTabBar->setPixelsSize( mSize.getWidth() - mPaddingPx.Left - mPaddingPx.Right, + Float totalTabsWidth = mTabs.empty() ? 0 + : mTabs.back()->getPixelsPosition().x + + mTabs.back()->getPixelsSize().getWidth() + + mPaddingPx.Left + mPaddingPx.Right; + Float totalSize = totalTabsWidth > mSize.getWidth() ? totalTabsWidth : mSize.getWidth(); + mTabBar->setPixelsSize( totalSize - mPaddingPx.Left - mPaddingPx.Right, PixelDensity::dpToPx( mStyleConfig.TabHeight ) ); mTabBar->setPosition( mPadding.Left, mPadding.Top ); mNodeContainer->setPosition( mPadding.Left, mPadding.Top + mStyleConfig.TabHeight ); @@ -165,13 +176,18 @@ bool UITabWidget::isDrawInvalidator() const { void UITabWidget::invalidate( Node* invalidator ) { // Only invalidate if the invalidator is actually visible in the current active tab. if ( NULL != invalidator ) { - if ( invalidator == mNodeContainer || invalidator == mTabBar || - mTabBar->inParentTreeOf( invalidator ) ) { + if ( invalidator == mTabScroll || mTabScroll->inParentTreeOf( invalidator ) ) { + if ( NULL != mNodeDrawInvalidator ) { + mNodeDrawInvalidator->invalidate( this ); + } else if ( NULL != mSceneNode ) { + mSceneNode->invalidate( this ); + } + } else if ( invalidator == mNodeContainer || invalidator == mTabBar || + mTabBar->inParentTreeOf( invalidator ) ) { mNodeDrawInvalidator->invalidate( mNodeContainer ); } else if ( invalidator->getParent() == mNodeContainer ) { - if ( invalidator->isVisible() ) { + if ( invalidator->isVisible() ) mNodeDrawInvalidator->invalidate( mNodeContainer ); - } } else { Node* container = invalidator->getParent(); while ( container->getParent() != NULL && container->getParent() != mNodeContainer ) { @@ -305,6 +321,7 @@ void UITabWidget::setTabsHeight( const Float& height ) { mStyleConfig.TabHeight = height; setContainerSize(); orderTabs(); + updateScrollBar(); } } @@ -360,6 +377,8 @@ void UITabWidget::posTabs() { x += mTabs[i]->getPixelsSize().getWidth() + mStyleConfig.TabSeparation; } + + updateScrollBar(); } void UITabWidget::zorderTabs() { @@ -508,6 +527,9 @@ void UITabWidget::removeTab( const Uint32& index, bool destroyOwnedNode, bool de orderTabs(); + updateScrollBar(); + updateScroll(); + TabEvent tabEvent( this, tab, index, Event::OnTabClosed ); sendEvent( &tabEvent ); } @@ -606,6 +628,8 @@ UITab* UITabWidget::setTabSelected( UITab* tab ) { sendCommonEvent( Event::OnTabSelected ); } + updateScroll(); + return tab; } @@ -727,11 +751,14 @@ void UITabWidget::onSizeChange() { mTabSelected->getOwnedWidget()->setSize( mNodeContainer->getSize() ); } + updateScrollBar(); + updateScroll(); + UIWidget::onSizeChange(); } void UITabWidget::onChildCountChange( Node* child, const bool& removed ) { - if ( !removed && child != mTabBar && child != mNodeContainer ) { + if ( !removed && child != mTabBar && child != mNodeContainer && child != mTabScroll ) { if ( child->isType( UI_TYPE_TAB ) ) { // This must be a tab that was dragging. if ( std::find( mTabs.begin(), mTabs.end(), child->asType() ) != mTabs.end() ) @@ -799,4 +826,29 @@ UIWidget* UITabWidget::getContainerNode() const { return mNodeContainer; } +void UITabWidget::updateScrollBar() { + mTabScroll->setPixelsSize( + { getPixelsSize().getWidth(), mTabScroll->getPixelsSize().getHeight() } ); + mTabScroll->setPixelsPosition( + { 0, mTabBar->getPixelsSize().getHeight() - mTabScroll->getPixelsSize().getHeight() } ); + + Float totalSize = mTabs.empty() ? 0 + : mTabs.back()->getPixelsPosition().x + + mTabs.back()->getPixelsSize().getWidth(); + mTabScroll->setVisible( totalSize > getPixelsSize().getWidth() ); + + if ( mTabScroll->isVisible() ) { + mTabScroll->setMaxValue( totalSize - mSize.getWidth() ); + mTabScroll->setClickStep( eefloor( mTabScroll->getMaxValue() * 0.2f ) ); + mTabScroll->setPageStep( ( totalSize - mSize.getWidth() ) * + ( mSize.getWidth() / totalSize ) ); + } +} + +void UITabWidget::updateScroll() { + if ( mTabScroll->isVisible() ) + mTabBar->setPixelsPosition( + { mPaddingPx.Left + -mTabScroll->getValue(), mTabBar->getPixelsPosition().y } ); +} + }} // namespace EE::UI diff --git a/src/eepp/ui/uitextinput.cpp b/src/eepp/ui/uitextinput.cpp index 714f846cf..1ecdf870b 100644 --- a/src/eepp/ui/uitextinput.cpp +++ b/src/eepp/ui/uitextinput.cpp @@ -36,23 +36,23 @@ UITextInput::UITextInput( const std::string& tag ) : UITheme* theme = getUISceneNode()->getUIThemeManager()->getDefaultTheme(); if ( NULL != theme && NULL != theme->getDefaultFont() ) { - mHintCache->setFont( theme->getDefaultFont() ); - } - - if ( NULL != theme ) { - mHintCache->setFontSize( theme->getDefaultFontSize() ); - } else { - mHintCache->setFontSize( getUISceneNode()->getUIThemeManager()->getDefaultFontSize() ); + setHintFont( theme->getDefaultFont() ); } if ( NULL == mHintCache->getFont() ) { if ( NULL != getUISceneNode()->getUIThemeManager()->getDefaultFont() ) { - mHintCache->setFont( getUISceneNode()->getUIThemeManager()->getDefaultFont() ); + setHintFont( getUISceneNode()->getUIThemeManager()->getDefaultFont() ); } else { Log::error( "UITextInput::UITextInput : Created a without a defined font." ); } } + if ( NULL != theme ) { + setHintFontSize( theme->getDefaultFontSize() ); + } else { + setHintFontSize( getUISceneNode()->getUIThemeManager()->getDefaultFontSize() ); + } + subscribeScheduledUpdate(); setFlags( UI_AUTO_PADDING | UI_AUTO_SIZE | UI_TEXT_SELECTION_ENABLED ); @@ -369,13 +369,13 @@ Uint32 UITextInput::onMouseLeave( const Vector2i& Pos, const Uint32& Flags ) { void UITextInput::selCurInit( const Int32& init ) { if ( mDoc.getSelection().start().column() != init && -1 != init ) { - mDoc.setSelection( {{0, init}, mDoc.getSelection().end()} ); + mDoc.setSelection( { { 0, init }, mDoc.getSelection().end() } ); } } void UITextInput::selCurEnd( const Int32& end ) { if ( mDoc.getSelection().end().column() != end && -1 != end ) { - mDoc.setSelection( {mDoc.getSelection().start(), {0, end}} ); + mDoc.setSelection( { mDoc.getSelection().start(), { 0, end } } ); } else if ( -1 == end ) { mDoc.setSelection( mDoc.getSelection().end() ); } @@ -462,7 +462,7 @@ std::string UITextInput::getPropertyString( const PropertyDefinition* propertyDe case PropertyId::HintShadowColor: return getHintShadowColor().toHexString(); case PropertyId::HintFontSize: - return String::format( "%ddp", getHintCharacterSize() ); + return String::format( "%ddp", getHintFontSize() ); case PropertyId::HintFontFamily: return NULL != getHintFont() ? getFont()->getName() : ""; case PropertyId::HintFontStyle: @@ -508,7 +508,7 @@ bool UITextInput::applyProperty( const StyleSheetProperty& attribute ) { setHintShadowColor( attribute.asColor() ); break; case PropertyId::HintFontSize: - setHintCharacterSize( attribute.asDpDimensionI() ); + setHintFontSize( attribute.asDpDimensionI() ); break; case PropertyId::HintFontFamily: setHintFont( FontManager::instance()->getByName( attribute.asString() ) ); @@ -602,14 +602,14 @@ UITextInput* UITextInput::setHintFont( Font* font ) { return this; } -Uint32 UITextInput::getHintCharacterSize() const { +Uint32 UITextInput::getHintFontSize() const { return mHintCache->getCharacterSize(); } -UITextView* UITextInput::setHintCharacterSize( const Uint32& characterSize ) { +UITextView* UITextInput::setHintFontSize( const Uint32& characterSize ) { if ( mHintCache->getCharacterSize() != characterSize ) { - mHintCache->setFontSize( characterSize ); mHintStyleConfig.CharacterSize = characterSize; + mHintCache->setFontSize( characterSize ); invalidateDraw(); } @@ -684,41 +684,41 @@ void UITextInput::registerCommands() { void UITextInput::registerKeybindings() { mKeyBindings.addKeybinds( { - {{KEY_BACKSPACE, KEYMOD_CTRL}, "delete-to-previous-word"}, - {{KEY_BACKSPACE, KEYMOD_SHIFT}, "delete-to-previous-char"}, - {{KEY_BACKSPACE, 0}, "delete-to-previous-char"}, - {{KEY_DELETE, KEYMOD_CTRL}, "delete-to-next-word"}, - {{KEY_DELETE, 0}, "delete-to-next-char"}, - {{KEY_KP_ENTER, 0}, "press-enter"}, - {{KEY_RETURN, 0}, "press-enter"}, - {{KEY_LEFT, KEYMOD_CTRL | KEYMOD_SHIFT}, "select-to-previous-word"}, - {{KEY_LEFT, KEYMOD_CTRL}, "move-to-previous-word"}, - {{KEY_LEFT, KEYMOD_SHIFT}, "select-to-previous-char"}, - {{KEY_LEFT, 0}, "move-to-previous-char"}, - {{KEY_RIGHT, KEYMOD_CTRL | KEYMOD_SHIFT}, "select-to-next-word"}, - {{KEY_RIGHT, KEYMOD_CTRL}, "move-to-next-word"}, - {{KEY_RIGHT, KEYMOD_SHIFT}, "select-to-next-char"}, - {{KEY_RIGHT, 0}, "move-to-next-char"}, - {{KEY_Z, KEYMOD_CTRL | KEYMOD_SHIFT}, "redo"}, - {{KEY_HOME, KEYMOD_CTRL | KEYMOD_SHIFT}, "select-to-start-of-doc"}, - {{KEY_HOME, KEYMOD_SHIFT}, "select-to-start-of-content"}, - {{KEY_HOME, KEYMOD_CTRL}, "move-to-start-of-doc"}, - {{KEY_HOME, 0}, "move-to-start-of-content"}, - {{KEY_END, KEYMOD_CTRL | KEYMOD_SHIFT}, "select-to-end-of-doc"}, - {{KEY_END, KEYMOD_SHIFT}, "select-to-end-of-line"}, - {{KEY_END, KEYMOD_CTRL}, "move-to-end-of-doc"}, - {{KEY_END, 0}, "move-to-end-of-line"}, - {{KEY_Y, KEYMOD_CTRL}, "redo"}, - {{KEY_Z, KEYMOD_CTRL}, "undo"}, - {{KEY_C, KEYMOD_CTRL}, "copy"}, - {{KEY_X, KEYMOD_CTRL}, "cut"}, - {{KEY_V, KEYMOD_CTRL}, "paste"}, - {{KEY_A, KEYMOD_CTRL}, "select-all"}, + { { KEY_BACKSPACE, KEYMOD_CTRL }, "delete-to-previous-word" }, + { { KEY_BACKSPACE, KEYMOD_SHIFT }, "delete-to-previous-char" }, + { { KEY_BACKSPACE, 0 }, "delete-to-previous-char" }, + { { KEY_DELETE, KEYMOD_CTRL }, "delete-to-next-word" }, + { { KEY_DELETE, 0 }, "delete-to-next-char" }, + { { KEY_KP_ENTER, 0 }, "press-enter" }, + { { KEY_RETURN, 0 }, "press-enter" }, + { { KEY_LEFT, KEYMOD_CTRL | KEYMOD_SHIFT }, "select-to-previous-word" }, + { { KEY_LEFT, KEYMOD_CTRL }, "move-to-previous-word" }, + { { KEY_LEFT, KEYMOD_SHIFT }, "select-to-previous-char" }, + { { KEY_LEFT, 0 }, "move-to-previous-char" }, + { { KEY_RIGHT, KEYMOD_CTRL | KEYMOD_SHIFT }, "select-to-next-word" }, + { { KEY_RIGHT, KEYMOD_CTRL }, "move-to-next-word" }, + { { KEY_RIGHT, KEYMOD_SHIFT }, "select-to-next-char" }, + { { KEY_RIGHT, 0 }, "move-to-next-char" }, + { { KEY_Z, KEYMOD_CTRL | KEYMOD_SHIFT }, "redo" }, + { { KEY_HOME, KEYMOD_CTRL | KEYMOD_SHIFT }, "select-to-start-of-doc" }, + { { KEY_HOME, KEYMOD_SHIFT }, "select-to-start-of-content" }, + { { KEY_HOME, KEYMOD_CTRL }, "move-to-start-of-doc" }, + { { KEY_HOME, 0 }, "move-to-start-of-content" }, + { { KEY_END, KEYMOD_CTRL | KEYMOD_SHIFT }, "select-to-end-of-doc" }, + { { KEY_END, KEYMOD_SHIFT }, "select-to-end-of-line" }, + { { KEY_END, KEYMOD_CTRL }, "move-to-end-of-doc" }, + { { KEY_END, 0 }, "move-to-end-of-line" }, + { { KEY_Y, KEYMOD_CTRL }, "redo" }, + { { KEY_Z, KEYMOD_CTRL }, "undo" }, + { { KEY_C, KEYMOD_CTRL }, "copy" }, + { { KEY_X, KEYMOD_CTRL }, "cut" }, + { { KEY_V, KEYMOD_CTRL }, "paste" }, + { { KEY_A, KEYMOD_CTRL }, "select-all" }, } ); } Uint32 UITextInput::onKeyDown( const KeyEvent& event ) { - std::string cmd = mKeyBindings.getCommandFromKeyBind( {event.getKeyCode(), event.getMod()} ); + std::string cmd = mKeyBindings.getCommandFromKeyBind( { event.getKeyCode(), event.getMod() } ); if ( !cmd.empty() ) { // Allow copy selection on locked mode if ( mAllowEditing ) { diff --git a/src/eepp/ui/uithememanager.cpp b/src/eepp/ui/uithememanager.cpp index eb5cb6f42..4b7d2f9c8 100644 --- a/src/eepp/ui/uithememanager.cpp +++ b/src/eepp/ui/uithememanager.cpp @@ -17,7 +17,7 @@ UIThemeManager::UIThemeManager() : mFadeInTime( Milliseconds( 100.f ) ), mFadeOutTime( Milliseconds( 100.f ) ), mTooltipTimeToShow( Milliseconds( 400 ) ), - mTooltipFollowMouse( true ), + mTooltipFollowMouse( false ), mCursorSize( 16, 16 ) {} UIThemeManager::~UIThemeManager() {} diff --git a/src/eepp/ui/uiwidget.cpp b/src/eepp/ui/uiwidget.cpp index 45ebff419..0aed5e2d5 100644 --- a/src/eepp/ui/uiwidget.cpp +++ b/src/eepp/ui/uiwidget.cpp @@ -295,6 +295,8 @@ Uint32 UIWidget::onMouseMove( const Vector2i& position, const Uint32& flags ) { if ( themeManager->getTooltipFollowMouse() ) { mTooltip->setPixelsPosition( getTooltipPosition() ); + } else { + mTooltip->hide(); } } } diff --git a/src/tools/codeeditor/codeeditor.cpp b/src/tools/codeeditor/codeeditor.cpp index 2ea602dde..5ab83e336 100644 --- a/src/tools/codeeditor/codeeditor.cpp +++ b/src/tools/codeeditor/codeeditor.cpp @@ -1589,11 +1589,11 @@ void App::onColorSchemeChanged( const std::string& ) { mGlobalSearchTree->updateColorScheme( mEditorSplitter->getCurrentColorScheme() ); } -void App::onDocumentLoaded( UICodeEditor* codeEditor, const std::string& path ) { - updateEditorTitle( codeEditor ); - if ( codeEditor == mEditorSplitter->getCurEditor() ) +void App::onDocumentLoaded( UICodeEditor* editor, const std::string& path ) { + updateEditorTitle( editor ); + if ( editor == mEditorSplitter->getCurEditor() ) updateCurrentFiletype(); - mEditorSplitter->removeUnusedTab( mEditorSplitter->tabWidgetFromEditor( codeEditor ) ); + mEditorSplitter->removeUnusedTab( mEditorSplitter->tabWidgetFromEditor( editor ) ); auto found = std::find( mRecentFiles.begin(), mRecentFiles.end(), path ); if ( found != mRecentFiles.end() ) mRecentFiles.erase( found ); @@ -1601,9 +1601,14 @@ void App::onDocumentLoaded( UICodeEditor* codeEditor, const std::string& path ) if ( mRecentFiles.size() > 10 ) mRecentFiles.resize( 10 ); updateRecentFiles(); - if ( mEditorSplitter->getCurEditor() == codeEditor ) { + if ( mEditorSplitter->getCurEditor() == editor ) { updateDocumentMenu(); - updateDocInfo( codeEditor->getDocument() ); + updateDocInfo( editor->getDocument() ); + } + + if ( !path.empty() ) { + UITab* tab = reinterpret_cast( editor->getData() ); + tab->setTooltipText( path ); } } diff --git a/src/tools/codeeditor/codeeditor.hpp b/src/tools/codeeditor/codeeditor.hpp index cfb378fd5..678c9d227 100644 --- a/src/tools/codeeditor/codeeditor.hpp +++ b/src/tools/codeeditor/codeeditor.hpp @@ -269,7 +269,7 @@ class App : public UICodeEditorSplitter::Client { void onColorSchemeChanged( const std::string& ); - void onDocumentLoaded( UICodeEditor* codeEditor, const std::string& path ); + void onDocumentLoaded( UICodeEditor* editor, const std::string& path ); const CodeEditorConfig& getCodeEditorConfig() const;