Commit Graph

420 Commits

Author SHA1 Message Date
longrackslabs
dbf44cf425 Fix ConstrainSymmetric hint for point→edge→point workflow
Change 'pick symmetry point' to 'pick point' when the workflow is
point → symmetry line → point, since the final selection is a
regular point, not a special 'symmetry point'.
2025-09-30 08:47:43 -05:00
George Peden
603f84fbae Add MODE_HINT to dimension tool
- Add MODE_HINT constant to DrawSketchHandlerDimension class
- Shows 'switch mode' hint for M key in dimension tool
- Addresses reviewer feedback for missing M key hint
2025-09-30 08:47:43 -05:00
George Peden
c6e7976af5 Fix ConstrainSymmetric two points + symmetry point workflow
- Fix hint text to say 'pick symmetry line or symmetry point' for two points + symmetry point workflow
- Add missing sequence {SelVertexOrRoot, SelVertexOrRoot, SelVertexOrRoot} to allowedSelSequences
- Add case 8 to handle two points + symmetry point constraint creation
- Fix duplicate constraint creation by adding return statement in case 8
- Add getSelection().clearSelection() for consistency

Fixes reviewer comment #2 from PR #22282
2025-09-30 08:47:43 -05:00
George Peden
03ea7fd4c6 Fix Sketcher Dimension hints - add context-aware hints based on selection
- Add PICK_POINT_OR_EDGE constant to DrawSketchHandlerDimension class
- Implement nuanced hints for Dimension tool based on selected geometry:
  - Empty selection: 'pick point or edge'
  - Single point/line/circle: 'pick second point or edge'
  - Multiple selections: 'pick second point or edge'
- Remove stray character causing build error
- Addresses feedback on issue #22282 for comprehensive Sketcher hints coverage
2025-09-30 08:47:43 -05:00
George Peden
800afc5dfa Improve context-aware hints for Sketcher constraints
- ConstrainDistanceX/Y: Fix hints to show 'pick second point' instead of 'pick second point or edge' when first selection is a point
- ConstrainPerpendicular: Add context-aware hints for edge+point+edge workflow
- ConstrainTangent: Add context-aware hints for edge+point+edge workflow
- ConstrainSymmetric: Fix hints to show 'pick edge or second point' instead of 'pick edge or first point' when first selection is a point
- ConstrainSymmetric: Fix hints to show 'pick symmetry line' instead of 'pick symmetry line or point' for point+point+edge workflow

All changes are hint improvements only - no functionality changes to existing workflows.
2025-09-30 08:47:43 -05:00
George Peden
6730a5bc74 Refactor: Replace all literal hint strings with constants
- Added class-level static constexpr constants for all hint strings
- Replaced all QObject::tr("%1 pick...") with constants in both DrawSketchHandlerGenConstraint and DrawSketchHandlerDimension classes
- Eliminates string duplication and improves maintainability
- Addresses Copilot's PR feedback on string refactoring
2025-09-30 08:47:43 -05:00
George Peden
7ecb97a11e Refactor hint strings to use constants
- Add class-level constants for all hint texts
- Replace all hardcoded strings in static table and context-aware hints
- Eliminate duplication and improve maintainability
- Addresses Copilot PR review feedback on code duplication

All hint strings are now defined once and reused consistently.
2025-09-30 08:47:43 -05:00
George Peden
018ed43fac Add context-aware hints for remaining constraint tools
- Add context-aware hints for ConstrainPerpendicular
- Add context-aware hints for ConstrainTangent
- Add context-aware hints for ConstrainSymmetric
- All hints now remember user selections to provide appropriate guidance
- Covers all workflows mentioned in issue #22282 feedback
- Completes comprehensive coverage of missing constraint hints
2025-09-30 08:47:43 -05:00
George Peden
700afdb07f Add context-aware hints for ConstrainAngle tool
- Add special case for Sketcher_ConstrainAngle in getToolHints()
- Hints now remember what user has selected to provide appropriate guidance
- Step 0: 'pick edge or first point' (covers all workflows)
- Step 1: Context-aware based on first selection:
  - If point first: 'pick first edge' (point+edge+edge workflow)
  - If line first: 'pick second line or point' (line+line or edge+point+edge)
- Step 2: Context-aware based on selection history:
  - Point+edge+edge: 'pick second edge'
  - Edge+point+edge: 'pick second edge'
- Fixes part of issue #22282 - missing angle constraint hints
2025-09-30 08:47:43 -05:00
George Peden
27af7fda04 Add missing hints for ConstrainRadiam tool
- Add hints entry for Sketcher_ConstrainRadiam in hints array
- ConstrainRadiam now shows 'pick circle or arc' hint like other radius/diameter tools
- Fixes part of issue #22282 - missing radius constraint hints
2025-09-30 08:47:43 -05:00
Chris Hennes
43fd9e2b55 GUI: Fix some translatable text (#24289) 2025-09-28 10:47:16 +02:00
Markus Reitböck
45c02f7978 Sketcher: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
 should be considered an optimization, not a requirement. In particular, do not explicitly include a
 precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
 generated precompile header on the compiler command line instead. This is more portable across
 the major compilers and is likely to be easier to maintain. It will also avoid warnings being
 generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-23 00:51:00 +02:00
Max Wilfinger
ab5e9e0ded Fix source string mistakes reported on Crowdin (#23157)
* Fix source string mistakes reported on Crowdin

* Update src/Mod/Draft/Resources/ui/TaskPanel_CircularArray.ui

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>

* Update src/Mod/Draft/Resources/ui/TaskPanel_CircularArray.ui

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>

* Update src/Mod/Draft/draftfunctions/upgrade.py

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>

* Update src/Mod/Draft/draftfunctions/upgrade.py

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>

* Update src/Mod/Draft/draftguitools/gui_downgrade.py

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>

* Update src/Mod/Draft/Resources/ui/TaskPanel_SetStyle.ui

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>

---------

Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
2025-08-24 20:51:32 -05:00
captain0xff
b39e097fea Sketcher: fix cropping of some icons on hidpi screens 2025-08-18 01:02:13 +02:00
matthiasdanner
57f251d742 Sketcher: Display arc angle and length constraints beyond center point (#22651)
* Allow arc segment length and angle constraints to go past the center point

* fix angle helper lines

* fix linter warning

* fix arc length calculation

---------

Co-authored-by: Matthias Danner <28687794+matthiasdanner@users.noreply.github.com>
2025-07-25 13:57:21 +02:00
PaddleStroke
64c8ec77f8 Sketcher: Dimension: Offset the label when moving mouse (#22387)
* Sketcher: Dimension: Offset the label when moving mouse

* Sketcher: Create dedicated enum for offset boolean

This improves readability because the intent must be stated explicitly.

---------

Co-authored-by: Kacper Donat <kadet1090@gmail.com>
2025-07-20 19:47:21 +02:00
Max Wilfinger
36659f0176 Sketcher: Update UI strings for consistency (#22167)
* Sketcher: Update UI strings for consistency

* Update src/Mod/Sketcher/App/Sketch.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Update src/Mod/Sketcher/Gui/Command.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Update src/Mod/Sketcher/App/SketchObject.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Update src/Mod/Sketcher/Gui/Command.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Update src/Mod/Sketcher/Gui/Command.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Update src/Mod/Sketcher/Gui/Command.cpp

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>

* Apply suggestions from code review

* Apply suggestions from code review

---------

Co-authored-by: Ryan K <114723629+ryankembrey@users.noreply.github.com>
2025-06-30 22:51:46 +00:00
George Peden
2c1d23e4e5 Sketcher: Add contextual input hints to constraint commands (InputHints Phase 2) (#21751)
* Sketcher: Extend InputHints infrastructure to constraint tools

- Implement DrawSketchHandler::getToolHints() for constraint workflows
- Add centralized hint table mapping constraint commands to step-specific InputHints
- Integrate hint lookup in DrawSketchHandlerGenConstraint and dimension handler
- Provide step-by-step user guidance for:
  - Coincident, PointOnObject, Distance (X/Y)
  - Horizontal, Vertical, HorVer, Lock, Block
  - Equal, Symmetric, Radius, Diameter, Angle
  - Tangent, Perpendicular, Parallel

This continues the InputHints work started for drawing tools by enabling consistent, contextual guidance for constraint creation, including multi-step workflows like tangent-via-point.

* Call updateHint() after selection reset to re-arm the first-step prompt
when the tool stays active after apply.

* Add comments to hints table structure

* Sketcher: Update constraint hint text to use "pick" instead of "Select"

Change constraint hint text from "Select" to "pick" to maintain consistency
with existing FreeCAD UI style. This affects the DrawSketchHandlerGenConstraint
hint system for various constraint operations including coincident, distance,
horizontal/vertical, block, lock, symmetry, tangent, perpendicular, parallel,
and distance constraints.

The hints now follow the pattern:
- "%1 pick first point or edge"
- "%1 pick second point or edge"
- "%1 pick line or two points"
etc.

This provides consistent terminology throughout the sketcher constraint
creation workflow.

* - Remove redundant 'first' from initial selection hints
- Improve consistency in hint text formatting per Developer Guidelines
- Add consistent spacing in comment sections"

* Per PR feedback for DrawSketchHandlerDimension hints:
* Change 'Click to' to "pick"
* Simplify hint wording
* Combine redundant else
* Use direct return pattern instead of building hints list

* Update lookupConstraintHints() to use C++20 std:ranges::find_if form per PR review feedback

* Sketcher: Refine constraint hints per PR feedback

- Use consistent 'point or edge' phrasing in Distance and DistanceX/Y tools
- Reword Horizontal/Vertical step 0 to avoid misleading 'two points'
- Generalize Tangent and Perpendicular hints to 'edge' with optional point
- Simplify legacy Distance to 'point or edge'

* Add dynamic hint handling for PointOnObject constraint
- Implemented contextual hints in getToolHints() to generate an appropriate step 2 hint based on step 1 selection type
- Preserved static lookupConstraintHints() for all other tools

* Sketcher: Convert constraint hint table to C++20 designated initializer syntax

- Refactored static constraint hint table to follow Sketcher hint development guidelines
- Uses C++20 designated initializers for clarity and maintainability
- No changes to hint logic or behavior; content is identical to previous version
2025-06-23 21:24:33 +02:00
Florian Foinant-Willig
b749db373d Sketcher: Fix circle-line negative distance 2025-06-23 10:56:45 -05:00
matthiasdanner
b9b57f8c02 Sketcher: 3 Point Symmetry fixed if root is selected first (and simplify and fix the selection logic) (#21612) 2025-06-22 19:54:39 -05:00
Benjamin Nauck
21fbf8e539 Use Base::toRadians() instead of manually converting 2025-04-15 07:16:36 +02:00
captain0xff
887cbd0e1a remove some code setting pixel density ratio for pixmaps
update
2025-04-03 19:55:27 +05:30
Benjamin Nauck
1cff040fbc Sketcher: Add #include <limits> where used 2025-03-31 23:52:38 +02:00
Benjamin Nauck
3279a1dd8f Sketcher: Use std::numeric_limits and std::numbers instead of defines 2025-03-29 13:32:39 +01:00
Benjamin Nauck
9c173d2b35 Sketcher: Use constant for Type::BadType instead Type::badType() 2025-02-24 08:30:18 +01:00
Kacper Donat
cc2efa90f8 Base: Add isNullOrEmpty string helper
This adds isNullOrEmpty string helper that cheks if string is... well
null or empty. It is done to improve readability of the code and better
express intent.
2025-02-21 15:04:43 +01:00
Benjamin Bræstrup Sayoc
aa43ce8cc0 Sketcher: Use QStringLiteral 2025-02-10 18:32:45 +01:00
tritao
551c2e48fb Gui: Reorganize the selection files into a top Selection folder. 2025-02-03 17:56:57 +01:00
Benjamin Nauck
6f535f19fb Prefer to use BaseClass's isDerivedFrom<T> over non template or Base::Type's
Regex based changes, manually verified
2025-01-27 16:08:18 +01:00
tritao
4c93a14fea Gui: Reorganize the dialog files into a top Dialogs folder. 2025-01-24 16:28:02 -06:00
Benjamin Nauck
74f3aee9a7 Add template based SelectionSingleton::countObjectsOfType
Also convert code to use this new method
2025-01-13 18:55:15 +01:00
Chris Hennes
7a0fc120d1 Merge pull request #18273 from Ondsel-Development/sk_group_drag
Sketcher: Group dragging
2024-12-09 12:29:49 -05:00
Kacper Donat
954b729b56 Gui: Use getObject<T>() helpers in classes
This commit is generated using regex based find and replace:

```
s/[\w:]+_cast\s*<([^>]+)\*>\s*\(\s*getObject\(\s*\)\)/getObject<$1>/
s/[\w:]+_cast\s*<([^>]+)\*>\s*\(\s*([^)]*)\s*->\s*getObject\(\s*\)\)/$2->getObject<$1>()/
```

To regenerate if needed.
2024-12-06 18:29:39 +01:00
PaddleStroke
17e6aa9629 Sketcher: Rename movePoint to moveGeometries. 2024-12-06 16:45:47 +01:00
PaddleStroke
6cf06383c6 Sketcher: Dimension: Handle case of vertical/horizontal lines 2024-10-28 17:29:40 +01:00
Benjamin Bræstrup Sayoc
35d5259c31 [Sketcher] If origin selected: don't do distance to origin
In auto constrainer. Fixes #12684
2024-10-07 09:02:43 -05:00
PaddleStroke
4f93df136b Sketcher: CommandConstraints: Make sure points are created as constructions in few functions. 2024-09-03 18:28:54 +02:00
Ajinkya Dahale
d03464b7d6 [Sketcher] Fix endpoint-to-endpoint/edge tangency substitution
Only substitute if the point(s) involved are `start`/`end`. Centers do
not make sense here.
2024-08-25 07:33:59 +05:30
PaddleStroke
fad0f93838 Sketcher: Dimension: Fix right click/esc so that it dismiss the dimension before exiting the tool. 2024-07-15 18:26:03 +02:00
Max Wilfinger
8ff5a1f688 Fix source string typos mentioned on Crowdin (#15261) 2024-07-08 17:18:31 -05:00
wmayer
de547956d5 Sketch: Fix compiler warnings 2024-07-08 19:27:39 +02:00
Chris Hennes
8c028b8b22 Merge pull request #14979 from Ondsel-Development/sk_ovp_switching
Sketcher: Dimension: Fix 2 bugs.
2024-07-08 11:26:39 -05:00
ppphp
12e8fb1695 fix unique ptr usage in sketch (#15008)
* fix unique ptr usage in sketch

* [pre-commit.ci] auto fixes from pre-commit.com hooks
2024-07-08 10:53:49 -05:00
PaddleStroke
be05df89fa Sketcher: Dimension: Prevent the use of Undo from crashing. 2024-07-02 15:48:47 +02:00
PaddleStroke
ef3b0216dc Sketcher: Dimension: Fix constraint switching. Refactor a little bit by adding finishDimensionCreation to reduce code copies. 2024-07-02 09:49:47 +02:00
wmayer
127f935711 Fix several compiler warnings
* -Wmaybe-uninitialized
* -Wunused-parameter
* -Wunused-variable
* -Wnonnull
* -Wstringop-truncation
* -Wstringop-overflow
2024-06-19 21:14:23 -05:00
wmayer
f89a0cec28 Sketcher: Fix accessibility of some group commands
The affected commands are:
* Sketcher_CompLine
* Sketcher_CompCreateArc
* Sketcher_CompCreateConic
* Sketcher_CompCreateFillets
* Sketcher_CompCurveEdition
* Sketcher_CompSlot
* Sketcher_CompHorVer
* Sketcher_CompToggleConstraints
2024-05-23 10:14:46 +02:00
PaddleStroke
4ecd54275b Sketcher: Dimension : little fixes 2024-05-06 18:40:46 +02:00
Max Wilfinger
06174f4693 Sketcher / UI: Update Sketcher Toolbars (#13763)
* Update Sketcher toolbar UIs.
Group all create tools for arcs, conics.
Group toggle driving/active constraints.
Update arrangement of icons.

* Change default to unified coincidence tool.
2024-05-06 18:05:56 +02:00
PaddleStroke
4442fa709e Sketcher: Dimension tool : add arc length 2024-05-06 17:50:17 +02:00