Feature/sketcher constraint symbol size (#23366)

* Sketcher: Initial wiring up of independent contraint symbol size.

* Sketcher: Align constraint symbol size controls with other preferences

- Refactored the Sketcher preferences UI to place the "Constraint symbol size" checkbox and spinbox in separate grid columns, matching the layout of other settings.
- Ensured the spinbox aligns visually with other value fields for a more consistent and professional appearance.
- Preserved the enable/disable behavior of the spinbox based on the checkbox state.

* Update constraint size label

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* style: simplify constraint icon size logic and remove stray blank line

* Sketcher: optional constraint symbol size defaults to font size preference (per PR comment)

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
George Peden
2025-09-02 20:58:56 -07:00
committed by GitHub
parent 04e085cba3
commit eef738b312
3 changed files with 96 additions and 18 deletions

View File

@@ -373,6 +373,8 @@ void EditModeCoinManager::ParameterObserver::updateElementSizeParameters(
Client.defaultApplicationFontSizePixels(); // returns height in pixels, not points
int sketcherfontSize = hGrp->GetInt("EditSketcherFontSize", defaultFontSizePixels);
int constraintSymbolSizePref = hGrp->GetInt("ConstraintSymbolSize", defaultFontSizePixels);
bool useConstraintSymbolSize = hGrp->GetBool("UseConstraintSymbolSize", false);
double dpi = Client.getApplicationLogicalDPIX();
double devicePixelRatio = Client.getDevicePixelRatio();
@@ -385,11 +387,15 @@ void EditModeCoinManager::ParameterObserver::updateElementSizeParameters(
// internally. Coin, at least our coin at this time, takes pixels, not points.
Client.drawingParameters.coinFontSize =
std::lround(sketcherfontSize * devicePixelRatio); // in pixels
Client.drawingParameters.labelFontSize =
std::lround(sketcherfontSize * devicePixelRatio * 72.0f
/ dpi); // in points, as SoDatumLabel uses points
Client.drawingParameters.constraintIconSize = std::lround(0.8 * sketcherfontSize);
std::lround(sketcherfontSize * devicePixelRatio); // in pixels (Coin uses pixels)
Client.drawingParameters.labelFontSize = std::lround(
sketcherfontSize * devicePixelRatio * 72.0f / dpi); // in points (SoDatumLabel uses points)
// Constraint icon size: legacy derives 0.8 * font (when override disabled); if override
// enabled we use the stored absolute pixel size (defaulting to full font size initially).
int symbolSizeToUse =
useConstraintSymbolSize ? constraintSymbolSizePref : std::lround(0.8 * sketcherfontSize);
Client.drawingParameters.constraintIconSize = std::lround(symbolSizeToUse * devicePixelRatio);
auto supportedsizes = Gui::Inventor::MarkerBitmaps::getSupportedSizes("CIRCLE_LINE");
auto scaledMarkerSize = std::lround(markerSize * devicePixelRatio);