From fcded81a7f145cd12d1584dd06a022bec5b08c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Wed, 30 Sep 2026 10:24:06 -0300 Subject: [PATCH] More pixel density errors fixed. --- src/eepp/ui/tools/uidiffview.cpp | 43 +++++++++++++------ src/eepp/ui/tools/uifontpickerdialog.cpp | 4 +- src/eepp/ui/tools/uiimageviewer.cpp | 2 +- src/eepp/ui/tools/uimergeview.cpp | 2 +- src/eepp/ui/uicodeeditor.cpp | 12 +++--- src/eepp/ui/uiconsole.cpp | 2 +- src/eepp/ui/uimessagebox.cpp | 6 +-- src/eepp/ui/uirichtext.cpp | 2 +- src/eepp/ui/uitextedit.cpp | 2 +- src/eepp/ui/uitextinput.cpp | 2 +- src/eepp/ui/uitextspan.cpp | 2 +- src/eepp/ui/uitextview.cpp | 2 +- src/eepp/ui/uitooltip.cpp | 2 +- src/eepp/ui/uiwidget.cpp | 20 ++++----- src/eepp/ui/uiwidgettable.cpp | 6 +-- src/tools/ecode/ecode.cpp | 2 +- .../ecode/plugins/aiassistant/chatui.cpp | 4 +- 17 files changed, 68 insertions(+), 47 deletions(-) diff --git a/src/eepp/ui/tools/uidiffview.cpp b/src/eepp/ui/tools/uidiffview.cpp index 4e12b4577..2959b4578 100644 --- a/src/eepp/ui/tools/uidiffview.cpp +++ b/src/eepp/ui/tools/uidiffview.cpp @@ -389,8 +389,9 @@ class UIDiffEditorPlugin : public UICodeEditorPlugin { void onRegister( UICodeEditor* editor ) override { Float glyphWidth = editor->getGlyphWidth(); - Float totalChars = mView->getViewMode() == UIDiffView::ViewMode::Unified ? 10 : 5; - mGutterWidth = PixelDensity::dpToPx( glyphWidth * totalChars ); + Float totalChars = + editor == mView->getEditor() ? mLineNumberDigits * 2 + 1 : mLineNumberDigits; + mGutterWidth = glyphWidth * totalChars; mPluginTopSpace = PixelDensity::dpToPxI( 20 ); editor->registerGutterSpace( this, mGutterWidth, 0 ); @@ -425,6 +426,13 @@ class UIDiffEditorPlugin : public UICodeEditorPlugin { onRegister( editor ); } + void setLineNumberDigits( UICodeEditor* editor, int digits ) { + if ( mLineNumberDigits == digits ) + return; + mLineNumberDigits = digits; + registerUpdate( editor ); + } + void drawTop( UICodeEditor* editor, const Vector2f& screenStart, const Sizef& size, const Float& /*fontSize*/ ) override { Float width = editor->getTopAreaWidth(); @@ -602,34 +610,37 @@ class UIDiffEditorPlugin : public UICodeEditorPlugin { const auto& lines = mView->getDiffLines(); const auto& line = lines[viewLines[index]]; - static constexpr auto bufSize = 16; + static constexpr auto bufSize = 64; String::StringBaseType buf[bufSize] = {}; if ( mView->getViewMode() == UIDiffView::ViewMode::Unified ) { switch ( line.type ) { case UIDiffView::DiffLineType::Added: - String::formatBuffer( buf, bufSize, "%5s %5lld", "", - (long long)line.newLineNum ); + String::formatBuffer( buf, bufSize, "%*s %*lld", mLineNumberDigits, "", + mLineNumberDigits, (long long)line.newLineNum ); break; case UIDiffView::DiffLineType::Removed: - String::formatBuffer( buf, bufSize, "%5lld %5s", (long long)line.oldLineNum, - "" ); + String::formatBuffer( buf, bufSize, "%*lld %*s", mLineNumberDigits, + (long long)line.oldLineNum, mLineNumberDigits, "" ); break; case UIDiffView::DiffLineType::Header: - String::formatBuffer( buf, bufSize, "%5lld %5lld", (long long)line.oldLineNum, + String::formatBuffer( buf, bufSize, "%*lld %*lld", mLineNumberDigits, + (long long)line.oldLineNum, mLineNumberDigits, (long long)line.newLineNum ); break; case UIDiffView::DiffLineType::Common: - String::formatBuffer( buf, bufSize, "%5lld %5s", (long long)line.oldLineNum, - "" ); + String::formatBuffer( buf, bufSize, "%*lld %*s", mLineNumberDigits, + (long long)line.oldLineNum, mLineNumberDigits, "" ); break; } } else { if ( editor == mView->getLeftEditor() ) { if ( line.oldLineNum > 0 ) - String::formatBuffer( buf, bufSize, "%5lld", (long long)line.oldLineNum ); + String::formatBuffer( buf, bufSize, "%*lld", mLineNumberDigits, + (long long)line.oldLineNum ); } else { if ( line.newLineNum > 0 ) - String::formatBuffer( buf, bufSize, "%5lld", (long long)line.newLineNum ); + String::formatBuffer( buf, bufSize, "%*lld", mLineNumberDigits, + (long long)line.newLineNum ); } } @@ -653,6 +664,7 @@ class UIDiffEditorPlugin : public UICodeEditorPlugin { protected: UIDiffView* mView; + int mLineNumberDigits{ 5 }; Float mGutterWidth{ 0 }; Float mPluginTopSpace{ 0 }; Float mHeaderIconWidth{ 0 }; @@ -1052,8 +1064,10 @@ void UIDiffView::updateEditorsText() { String leftText; String rightText; mViewLines.clear(); + Int64 largestLineNum = 99999; for ( size_t i = 0; i < mLines.size(); ++i ) { + largestLineNum = std::max( { largestLineNum, mLines[i].oldLineNum, mLines[i].newLineNum } ); if ( mCollapsed ) continue; bool showLine = mShowCompleteView; @@ -1102,6 +1116,11 @@ void UIDiffView::updateEditorsText() { mLeftEditor->getDocument().setSyntaxDefinition( mSyntaxDef ); mRightEditor->getDocument().setSyntaxDefinition( mSyntaxDef ); } + + const int lineNumberDigits = Math::countDigits( largestLineNum ); + mPlugin->setLineNumberDigits( mEditor, lineNumberDigits ); + mLeftPlugin->setLineNumberDigits( mLeftEditor, lineNumberDigits ); + mRightPlugin->setLineNumberDigits( mRightEditor, lineNumberDigits ); } bool UIDiffView::loadImageDiffFromPaths( const std::string& oldFilePath, diff --git a/src/eepp/ui/tools/uifontpickerdialog.cpp b/src/eepp/ui/tools/uifontpickerdialog.cpp index 1681eac6d..73101577d 100644 --- a/src/eepp/ui/tools/uifontpickerdialog.cpp +++ b/src/eepp/ui/tools/uifontpickerdialog.cpp @@ -265,8 +265,8 @@ UIFontPickerDialog::UIFontPickerDialog( Uint32 flags ) : UIWindow(), mFlags( fla setTitle( i18n( "font_picker_select_font", "Select Font" ) ); const Sizef sceneSize( getUISceneNode()->getSize() ); - const Sizef maxSize( eemax( 320.f, sceneSize.getWidth() - PixelDensity::dpToPx( 32 ) ), - eemax( 320.f, sceneSize.getHeight() - PixelDensity::dpToPx( 32 ) ) ); + const Sizef maxSize( eemax( 320.f, sceneSize.getWidth() - 32.f ), + eemax( 320.f, sceneSize.getHeight() - 32.f ) ); setMinWindowSize( Sizef( eemin( 720.f, maxSize.getWidth() ), eemin( 440.f, maxSize.getHeight() ) ) ); setSizeWithDecoration( diff --git a/src/eepp/ui/tools/uiimageviewer.cpp b/src/eepp/ui/tools/uiimageviewer.cpp index 2350231ee..634551428 100644 --- a/src/eepp/ui/tools/uiimageviewer.cpp +++ b/src/eepp/ui/tools/uiimageviewer.cpp @@ -78,7 +78,7 @@ UIImageViewer::UIImageViewer() : UIWidget( "imageviewer" ) { mLoader->setVisible( false ); mLoader->setEnabled( false ); mLoader->setSize( { 64, 64 } ); - mLoader->setOutlineThickness( PixelDensity::dpToPx( 6 ) ); + mLoader->setOutlineThickness( 6 ); mTextView = UITextView::New(); mTextView->setParent( this ); mTextView->setEnabled( false ); diff --git a/src/eepp/ui/tools/uimergeview.cpp b/src/eepp/ui/tools/uimergeview.cpp index 27da532f6..853f3d3e1 100644 --- a/src/eepp/ui/tools/uimergeview.cpp +++ b/src/eepp/ui/tools/uimergeview.cpp @@ -227,7 +227,7 @@ UIPushButton* UIMergeView::addToolbarAction( const std::string& command, const S if ( auto* toolbarIcon = getUISceneNode()->findIcon( icon ) ) button->setIcon( toolbarIcon->createDrawable( PixelDensity::dpToPxI( 12 ) ) ); button->setClass( "mergeview_toolbar_button" ); - button->setLayoutMarginRight( PixelDensity::dpToPx( 4 ) ); + button->setLayoutMarginRight( 4 ); const auto keybind = getKeyBindings().getCommandKeybindString( command ); button->setTooltipText( keybind.empty() ? text : text + " (" + keybind + ")" ); button->onClick( [this, command]( const Event* ) { execute( command ); } ); diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp index f8c227328..2263ff383 100644 --- a/src/eepp/ui/uicodeeditor.cpp +++ b/src/eepp/ui/uicodeeditor.cpp @@ -929,15 +929,17 @@ void UICodeEditor::setMouseWheelScroll( const Float& mouseWheelScroll ) { } void UICodeEditor::setLineNumberPaddingLeft( const Float& dpLeft ) { - if ( dpLeft != mLineNumberPaddingLeft ) { - mLineNumberPaddingLeft = dpLeft; + Float pxLeft = PixelDensity::dpToPx( dpLeft ); + if ( pxLeft != mLineNumberPaddingLeft ) { + mLineNumberPaddingLeft = pxLeft; invalidateDraw(); } } void UICodeEditor::setLineNumberPaddingRight( const Float& dpRight ) { - if ( dpRight != mLineNumberPaddingRight ) { - mLineNumberPaddingRight = dpRight; + Float pxRight = PixelDensity::dpToPx( dpRight ); + if ( pxRight != mLineNumberPaddingRight ) { + mLineNumberPaddingRight = pxRight; invalidateDraw(); } } @@ -3272,7 +3274,7 @@ std::string UICodeEditor::getPropertyString( const PropertyDefinition* propertyD case PropertyId::FontWeight: return Text::fontWeightToString( mFontStyleConfig.Weight ); case PropertyId::TextStrokeWidth: - return String::fromFloat( PixelDensity::dpToPx( getOutlineThickness() ), "px" ); + return String::fromFloat( getOutlineThickness(), "px" ); case PropertyId::TextStrokeColor: return getOutlineColor().toHexString(); case PropertyId::TextSelection: diff --git a/src/eepp/ui/uiconsole.cpp b/src/eepp/ui/uiconsole.cpp index f89e6ada0..211ba5865 100644 --- a/src/eepp/ui/uiconsole.cpp +++ b/src/eepp/ui/uiconsole.cpp @@ -281,7 +281,7 @@ std::string UIConsole::getPropertyString( const PropertyDefinition* propertyDef, case PropertyId::FontWeight: return Text::fontWeightToString( getFontStyleConfig().Weight ); case PropertyId::TextStrokeWidth: - return String::fromFloat( PixelDensity::dpToPx( getFontOutlineThickness() ), "px" ); + return String::fromFloat( getFontOutlineThickness(), "px" ); case PropertyId::TextStrokeColor: return getFontOutlineColor().toHexString(); default: diff --git a/src/eepp/ui/uimessagebox.cpp b/src/eepp/ui/uimessagebox.cpp index 733d63e82..d7c740442 100644 --- a/src/eepp/ui/uimessagebox.cpp +++ b/src/eepp/ui/uimessagebox.cpp @@ -64,7 +64,7 @@ UIMessageBox::UIMessageBox( const Type& type, const String& message, const Uint3 mTextEdit = UITextEdit::New(); mTextEdit->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed ) ->setLayoutMargin( Rectf( 0, 4, 0, 4 ) ) - ->setSize( PixelDensity::dpToPx( Vector2f{ 400, 100 } ) ) + ->setSize( Vector2f{ 400, 100 } ) ->setParent( vlay ); mTextEdit->getDocument().setCommand( "complete-edit", [this] { sendCommonEvent( Event::OnConfirm ); } ); @@ -74,14 +74,14 @@ UIMessageBox::UIMessageBox( const Type& type, const String& message, const Uint3 mDropDownList = UIDropDownList::New(); mDropDownList->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::WrapContent ) ->setLayoutMargin( Rectf( 0, 4, 0, 4 ) ) - ->setSize( PixelDensity::dpToPx( Vector2f{ 200, 18 } ) ) + ->setSize( Vector2f{ 200, 18 } ) ->setParent( vlay ); mDropDownList->setPopUpToRoot( true ); } else if ( mMsgBoxType == COMBOBOX ) { mComboBox = UIComboBox::New(); mComboBox->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::WrapContent ) ->setLayoutMargin( Rectf( 0, 4, 0, 4 ) ) - ->setSize( PixelDensity::dpToPx( Vector2f{ 200, 18 } ) ) + ->setSize( Vector2f{ 200, 18 } ) ->setParent( vlay ); mComboBox->getDropDownList()->setPopUpToRoot( true ); mComboBox->getDropDownList()->getDocument().setCommand( diff --git a/src/eepp/ui/uirichtext.cpp b/src/eepp/ui/uirichtext.cpp index 378794d56..5caac79d6 100644 --- a/src/eepp/ui/uirichtext.cpp +++ b/src/eepp/ui/uirichtext.cpp @@ -681,7 +681,7 @@ std::string UIRichText::getPropertyString( const PropertyDefinition* propertyDef return String::fromFloat( getFontShadowOffset().x ) + " " + String::fromFloat( getFontShadowOffset().y ); case PropertyId::TextStrokeWidth: - return String::fromFloat( PixelDensity::dpToPx( getOutlineThickness() ), "px" ); + return String::fromFloat( getOutlineThickness(), "px" ); case PropertyId::TextStrokeColor: return getOutlineColor().toHexString(); case PropertyId::SelectionColor: diff --git a/src/eepp/ui/uitextedit.cpp b/src/eepp/ui/uitextedit.cpp index dd1b97c41..060fc23d2 100644 --- a/src/eepp/ui/uitextedit.cpp +++ b/src/eepp/ui/uitextedit.cpp @@ -301,7 +301,7 @@ std::string UITextEdit::getPropertyString( const PropertyDefinition* propertyDef case PropertyId::HintFontStyle: return Text::styleFlagToString( getHintFontStyle() ); case PropertyId::HintStrokeWidth: - return String::fromFloat( PixelDensity::dpToPx( getHintOutlineThickness() ), "px" ); + return String::fromFloat( getHintOutlineThickness(), "px" ); case PropertyId::HintStrokeColor: return getHintOutlineColor().toHexString(); case PropertyId::HintDisplay: diff --git a/src/eepp/ui/uitextinput.cpp b/src/eepp/ui/uitextinput.cpp index fc10fca8a..7c8a50117 100644 --- a/src/eepp/ui/uitextinput.cpp +++ b/src/eepp/ui/uitextinput.cpp @@ -602,7 +602,7 @@ std::string UITextInput::getPropertyString( const PropertyDefinition* propertyDe case PropertyId::HintFontStyle: return Text::styleFlagToString( getHintFontStyle() ); case PropertyId::HintStrokeWidth: - return String::fromFloat( PixelDensity::dpToPx( getHintOutlineThickness() ), "px" ); + return String::fromFloat( getHintOutlineThickness(), "px" ); case PropertyId::HintStrokeColor: return getHintOutlineColor().toHexString(); case PropertyId::HintDisplay: diff --git a/src/eepp/ui/uitextspan.cpp b/src/eepp/ui/uitextspan.cpp index d0a81bfdb..ff78d8276 100644 --- a/src/eepp/ui/uitextspan.cpp +++ b/src/eepp/ui/uitextspan.cpp @@ -226,7 +226,7 @@ std::string UITextSpan::getPropertyString( const PropertyDefinition* propertyDef return String::fromFloat( getFontShadowOffset().x ) + " " + String::fromFloat( getFontShadowOffset().y ); case PropertyId::TextStrokeWidth: - return String::fromFloat( PixelDensity::dpToPx( getOutlineThickness() ), "px" ); + return String::fromFloat( getOutlineThickness(), "px" ); case PropertyId::TextStrokeColor: return getOutlineColor().toHexString(); case PropertyId::TextDecoration: diff --git a/src/eepp/ui/uitextview.cpp b/src/eepp/ui/uitextview.cpp index d8adbb366..26b643115 100644 --- a/src/eepp/ui/uitextview.cpp +++ b/src/eepp/ui/uitextview.cpp @@ -917,7 +917,7 @@ std::string UITextView::getPropertyString( const PropertyDefinition* propertyDef case PropertyId::FontWeight: return Text::fontWeightToString( mFontStyleConfig.Weight ); case PropertyId::TextStrokeWidth: - return String::fromFloat( PixelDensity::dpToPx( getOutlineThickness() ), "px" ); + return String::fromFloat( getOutlineThickness(), "px" ); case PropertyId::TextStrokeColor: return getOutlineColor().toHexString(); case PropertyId::Wordwrap: diff --git a/src/eepp/ui/uitooltip.cpp b/src/eepp/ui/uitooltip.cpp index 6fe58f14d..e9c69d6f3 100644 --- a/src/eepp/ui/uitooltip.cpp +++ b/src/eepp/ui/uitooltip.cpp @@ -513,7 +513,7 @@ std::string UITooltip::getPropertyString( const PropertyDefinition* propertyDef, case PropertyId::FontWeight: return Text::fontWeightToString( mStyleConfig.Weight ); case PropertyId::TextStrokeWidth: - return String::fromFloat( PixelDensity::dpToPx( getOutlineThickness() ), "px" ); + return String::fromFloat( getOutlineThickness(), "px" ); case PropertyId::TextStrokeColor: return getOutlineColor().toHexString(); case PropertyId::Wordwrap: diff --git a/src/eepp/ui/uiwidget.cpp b/src/eepp/ui/uiwidget.cpp index c966096cd..ac02de969 100644 --- a/src/eepp/ui/uiwidget.cpp +++ b/src/eepp/ui/uiwidget.cpp @@ -255,7 +255,7 @@ UIWidget* UIWidget::updateLayoutMarginAuto() { } UIWidget* UIWidget::setLayoutPixelsMargin( const Rectf& margin ) { - if ( mLayoutMargin != margin ) { + if ( mLayoutMarginPx != margin ) { mLayoutMarginPx = margin; mLayoutMargin = PixelDensity::pxToDp( mLayoutMarginPx ).ceil(); onMarginChange(); @@ -267,7 +267,7 @@ UIWidget* UIWidget::setLayoutPixelsMargin( const Rectf& margin ) { } UIWidget* UIWidget::setLayoutPixelsMarginLeft( const Float& marginLeft ) { - if ( mLayoutMargin.Left != marginLeft ) { + if ( mLayoutMarginPx.Left != marginLeft ) { mLayoutMarginPx.Left = marginLeft; mLayoutMargin.Left = eeceil( PixelDensity::pxToDp( mLayoutMarginPx.Left ) ); onMarginChange(); @@ -279,7 +279,7 @@ UIWidget* UIWidget::setLayoutPixelsMarginLeft( const Float& marginLeft ) { } UIWidget* UIWidget::setLayoutPixelsMarginRight( const Float& marginRight ) { - if ( mLayoutMargin.Right != marginRight ) { + if ( mLayoutMarginPx.Right != marginRight ) { mLayoutMarginPx.Right = marginRight; mLayoutMargin.Right = eeceil( PixelDensity::pxToDp( mLayoutMarginPx.Right ) ); onMarginChange(); @@ -291,7 +291,7 @@ UIWidget* UIWidget::setLayoutPixelsMarginRight( const Float& marginRight ) { } UIWidget* UIWidget::setLayoutPixelsMarginTop( const Float& marginTop ) { - if ( mLayoutMargin.Top != marginTop ) { + if ( mLayoutMarginPx.Top != marginTop ) { mLayoutMarginPx.Top = marginTop; mLayoutMargin.Top = eeceil( PixelDensity::pxToDp( mLayoutMarginPx.Top ) ); onMarginChange(); @@ -303,7 +303,7 @@ UIWidget* UIWidget::setLayoutPixelsMarginTop( const Float& marginTop ) { } UIWidget* UIWidget::setLayoutPixelsMarginBottom( const Float& marginBottom ) { - if ( mLayoutMargin.Bottom != marginBottom ) { + if ( mLayoutMarginPx.Bottom != marginBottom ) { mLayoutMarginPx.Bottom = marginBottom; mLayoutMargin.Bottom = eeceil( PixelDensity::pxToDp( mLayoutMarginPx.Bottom ) ); onMarginChange(); @@ -1009,7 +1009,7 @@ UIWidget* UIWidget::setPaddingBottom( const Float& paddingBottom ) { } UIWidget* UIWidget::setPaddingPixels( const Rectf& padding ) { - if ( padding != mPadding ) { + if ( padding != mPaddingPx ) { mPaddingPx = padding; mPadding = PixelDensity::pxToDp( mPaddingPx ).ceil(); onAutoSize(); @@ -1021,7 +1021,7 @@ UIWidget* UIWidget::setPaddingPixels( const Rectf& padding ) { } UIWidget* UIWidget::setPaddingPixelsLeft( const Float& paddingLeft ) { - if ( paddingLeft != mPadding.Left ) { + if ( paddingLeft != mPaddingPx.Left ) { mPaddingPx.Left = paddingLeft; mPadding.Left = eeceil( PixelDensity::pxToDp( mPaddingPx.Left ) ); onAutoSize(); @@ -1033,7 +1033,7 @@ UIWidget* UIWidget::setPaddingPixelsLeft( const Float& paddingLeft ) { } UIWidget* UIWidget::setPaddingPixelsRight( const Float& paddingRight ) { - if ( paddingRight != mPadding.Right ) { + if ( paddingRight != mPaddingPx.Right ) { mPaddingPx.Right = paddingRight; mPadding.Right = eeceil( PixelDensity::pxToDp( mPaddingPx.Right ) ); onAutoSize(); @@ -1045,7 +1045,7 @@ UIWidget* UIWidget::setPaddingPixelsRight( const Float& paddingRight ) { } UIWidget* UIWidget::setPaddingPixelsTop( const Float& paddingTop ) { - if ( paddingTop != mPadding.Top ) { + if ( paddingTop != mPaddingPx.Top ) { mPaddingPx.Top = paddingTop; mPadding.Top = eeceil( PixelDensity::pxToDp( mPaddingPx.Top ) ); onAutoSize(); @@ -1057,7 +1057,7 @@ UIWidget* UIWidget::setPaddingPixelsTop( const Float& paddingTop ) { } UIWidget* UIWidget::setPaddingPixelsBottom( const Float& paddingBottom ) { - if ( paddingBottom != mPadding.Bottom ) { + if ( paddingBottom != mPaddingPx.Bottom ) { mPaddingPx.Bottom = paddingBottom; mPadding.Bottom = eeceil( PixelDensity::pxToDp( mPaddingPx.Bottom ) ); onAutoSize(); diff --git a/src/eepp/ui/uiwidgettable.cpp b/src/eepp/ui/uiwidgettable.cpp index 7bb9b8f13..30e4c10d6 100644 --- a/src/eepp/ui/uiwidgettable.cpp +++ b/src/eepp/ui/uiwidgettable.cpp @@ -122,7 +122,7 @@ void UIWidgetTable::setTheme( UITheme* Theme ) { void UIWidgetTable::autoPadding() { if ( mFlags & UI_AUTO_PADDING ) { - mContainerPadding = PixelDensity::dpToPx( makePadding() ); + mContainerPadding = makePadding(); } } @@ -134,7 +134,7 @@ void UIWidgetTable::onSizeChange() { } void UIWidgetTable::containerResize() { - Rectf padding = mContainerPadding + mPaddingPx; + Rectf padding = mContainerPadding + mPadding; mContainer->setPosition( padding.Left, padding.Top ); @@ -627,7 +627,7 @@ UIWidgetTable* UIWidgetTable::setSmoothScroll( bool smoothScroll ) { } Rectf UIWidgetTable::getContainerPadding() const { - return PixelDensity::pxToDp( mContainerPadding + mPaddingPx ); + return mContainerPadding + mPadding; } void UIWidgetTable::onPaddingChange() { diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index b098683d4..6ec8f9bbb 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -2602,7 +2602,7 @@ void App::createDocManyLangsAlert( UICodeEditor* editor ) { UIPushButton* btn = UIPushButton::New(); btn->setParent( flow ); btn->setText( lang->getLanguageName() ); - btn->setLayoutMarginRight( PixelDensity::dpToPx( 8 ) ); + btn->setLayoutMarginRight( 8 ); btn->onClick( [this, editor, lang, docAlert, ext]( auto ) { editor->setSyntaxDefinition( *lang ); editor->disableReportSizeChangeToChildren(); diff --git a/src/tools/ecode/plugins/aiassistant/chatui.cpp b/src/tools/ecode/plugins/aiassistant/chatui.cpp index 5231fcd9b..158452ad7 100644 --- a/src/tools/ecode/plugins/aiassistant/chatui.cpp +++ b/src/tools/ecode/plugins/aiassistant/chatui.cpp @@ -2097,7 +2097,7 @@ void LLMChatUI::doAgentRequest() { auto* thinking = editor->findByClass( "thinking" ); auto thinkingID = String::hash( String::format( "thinking-%p", thinking ) ); thinking->setVisible( true ); - thinking->setPosition( { PixelDensity::dpToPx( 8 ), PixelDensity::dpToPx( 3 ) } ); + thinking->setPosition( { 8, 3 } ); thinking->setInterval( [thinking] { thinking->rotate( 360 / 32 ); }, Seconds( 0.125 ), thinkingID ); @@ -2127,7 +2127,7 @@ void LLMChatUI::doAgentRequest() { auto* thinking = editor->findByClass( "thinking" ); auto thinkingID = String::hash( String::format( "thinking-%p", thinking ) ); thinking->setVisible( true ); - thinking->setPosition( { PixelDensity::dpToPx( 8 ), PixelDensity::dpToPx( 3 ) } ); + thinking->setPosition( { 8, 3 } ); thinking->setInterval( [thinking] { thinking->rotate( 360 / 32 ); }, Seconds( 0.125 ), thinkingID );