Skip to content

fix: resolve text truncation in MixedFilamentDialog across multiple DPIs#348

Open
PILIPALA030 wants to merge 4 commits into
Snapmaker:feature_mix_filament_smfrom
PILIPALA030:fix/text-truncation-multi-dpi
Open

fix: resolve text truncation in MixedFilamentDialog across multiple DPIs#348
PILIPALA030 wants to merge 4 commits into
Snapmaker:feature_mix_filament_smfrom
PILIPALA030:fix/text-truncation-multi-dpi

Conversation

@PILIPALA030
Copy link
Copy Markdown

Description

Summary

  • Fixed text truncation in MixedFilamentDialog that caused labels to be
    clipped at different display resolutions (2K, 3072x1920)
  • "Filament Selection" title now renders fully at all DPIs
  • Warning/error banners properly wrap to available width

Root Cause

Three interacting issues:

  1. The title shared a horizontal row with three buttons; at high DPI
    the total width exceeded the card's FromDIP(325) constraint
  2. Error/warning text used hardcoded Wrap(FromDIP(360)) which exceeded
    the actual available width of ~334 DIP
  3. wxStaticText::Wrap does not re-wrap on DPI change or window resize

Changes

  • MixedFilamentDialog.cpp:
    Title moved to independent row with wxEXPAND; error/warning text
    switched from wxStaticText to Label with LB_AUTO_WRAP; 7 explicit
    Wrap(FromDIP(360)) calls removed; added 8 DIP spacer between title
    and button row
  • Label.cpp:
    Added width > 0 guard in SetLabel to prevent wrapping to zero-width
    before sizer layout completes

Test Plan

  • Verify "Filament Selection" displays fully at 2K (2560x1440)
  • Verify "Filament Selection" displays fully at 3072x1920
  • Verify long warning text wraps correctly at both resolutions
  • Drag dialog between 2K and 3K monitors — text re-wraps correctly

- Move "Filament Selection" title to its own row so it no longer competes with buttons for horizontal space at high DPI

- Replace wxStaticText with Label + LB_AUTO_WRAP for error/warning banners, wrapping to actual allocated width instead of hardcoded FromDIP(360) which exceeded available space by 12+ DIP

- Add width > 0 guard in Label::SetLabel to prevent one-char-per-line flicker when SetLabel is called before sizer layout
…m' into fix/text-truncation-multi-dpi

# Conflicts:
#	src/slic3r/GUI/MixedFilamentDialog.cpp
…update header types

- Label constructor: add width > 0 guard before Wrap() to match SetLabel fix
- on_dpi_changed: restore Fit() (removed accidentally), dropped only the
  redundant Layout() which DPIAware::rescale() already calls
- MixedFilamentDialog.hpp: declare m_error_text/m_warning_text as Label*
  with forward declaration instead of wxStaticText*
…i_changed

- Label::SetLabel: when GetSize().x is 0 and LB_AUTO_WRAP is set,
  fall through to wxStaticText::SetLabel instead of silently skipping
  the display update
- MixedFilamentDialog::on_dpi_changed: restore Layout() call removed
  earlier, keeping consistency with all other DPIDialog subclasses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant