Commit Graph

2281 Commits

Author SHA1 Message Date
Pieter Hijma
951afad93a Doc: Move Extension documentation to a topic
This commit constitutes an almost verbatim move from the documentation
of Extension and ExtensionContainer to its own topic in core-app.dox.
2025-05-20 13:39:26 +02:00
Pieter Hijma
aeef2298b2 Doc: Reorder topics 2025-05-20 13:39:26 +02:00
hlorus
900afce86f Measure: Add MeasureElementType::Surface 2025-05-20 12:01:14 +02:00
Joao Matos
e5dad52fdf App: Invoke signalBeforeRecompute() on the GUI thread
Historically, `App::Document::recompute()` ran entirely on the **main**
(GUI) thread and directly emitted `signalBeforeRecompute()`.

* Add-ons like **Assembly3** and others depend on that signal for
setup/teardown hooks before any recompute work begins.

* After offloading `recompute()` into a background worker thread to keep
the UI responsive, calling `signalBeforeRecompute()` directly from the
worker would break thread-affinity rules and silently break
compatibility with those add-ons.

**Solution**

1. **Introduce a generic hook** (`PreRecomputeHook`) in
**App::Document**:

* A `std::function<void()>` that, if set, is invoked at the very
start of `recompute()`.

* Core code stays Qt-free—only knows to call a callback if one
exists.

2. **Wire up the hook in `Gui::Document`**:

* In the GUI wrapper’s constructor, install a hook that calls
`callSignalBeforeRecompute()`.

* `callSignalBeforeRecompute()` uses `QMetaObject::invokeMethod(...,
Qt::BlockingQueuedConnection)` to enqueue `signalBeforeRecompute()` on
the GUI thread and **block** the worker until it completes.

    * If already on the GUI thread, it simply calls the signal directly.

3. **Maintain add-on compatibility**:

* From the add-on’s perspective nothing changes—they still receive
`signalBeforeRecompute()` on the main thread before any recompute work.

* Internally, the recompute body now runs on a worker thread,
improving UI responsiveness without breaking existing hooks.

**Result**

* **Recompute** remains fully backward-compatible for add-ons like
Assembly3.

* **UI thread** still handles all GUI-related signaling.

* **Worker thread** performs the actual heavy lifting, unblocked only
once the GUI is primed and all pre-recompute signals have been
delivered.
2025-05-19 18:30:56 +02:00
xtemp09
712de69f73 Add Navigation Style/Orbit Style/Rotation Mode to About info
Closes #17431
2025-05-19 17:45:00 +02:00
jffmichi
8331a41902 App: Fix exported object dynamic property type identifier (#21415)
Fixes: 9d6f1ad37c ("App: Align Document to best practices")

Co-authored-by: jffmichi <>
2025-05-18 01:38:04 +02:00
Luz Paz
ee4fa234c9 Fix various typos
Missed by the codespell CI not being functional for a period of time.
2025-05-15 10:59:48 -05:00
3x380V
fc2a2cedbe App: Align Document to best practices (#21059)
* use static cast

* join declaration and definition

* don't hide previous declaration

* initialize in declaration

* redundant else

* reserved identifier

* endl

* implicit conversion

* narrowing

* always false

* replace define with constexpr

* return and continue

* avoid copy

* multiple declarations in line

* use auto

* member initialize

* uninitialized

* range based loop

* move to inner scope

* redundant

* const, mainly

* function parameter descriptions

* misc

---------

Co-authored-by: bofdahof <172177156+bofdahof@users.noreply.github.com>
2025-05-14 09:36:42 +02:00
Chris Hennes
952485dcbb Merge pull request #19907 from benj5378/getAttribute
Base: make getAttribute template
2025-05-12 10:39:55 -05:00
Benjamin Bræstrup Sayoc
2b6e73c29d Everywhere: clean up getAttribute conversions 2025-05-09 15:54:57 +02:00
Benjamin Bræstrup Sayoc
2b1aec0041 Base: make getAttribute template 2025-05-09 15:54:57 +02:00
Pieter Hijma
ca6fe75f43 Doc: Fix small doc warnings in ExtensionContainer 2025-05-08 17:52:33 -05:00
Pieter Hijma
fe4c79a046 Doc: Improve App::Extension documentation 2025-05-08 17:52:33 -05:00
Pieter Hijma
3ddcc10f12 Doc: Improve App::ExtensionContainer documentation 2025-05-08 08:28:51 -05:00
Chris Hennes
d691d5261e Merge pull request #21184 from pieterhijma/doc-object-identifier
Doc: Improve App::ObjectIdentifier documentation
2025-05-07 16:22:49 -05:00
Pieter Hijma
4c21636359 Doc: Fix warnings App::Property
PR #21155 introduced some warnings that are fixed in this PR.
2025-05-07 15:15:08 +02:00
Pieter Hijma
9cbea91d60 Doc: Improve App::ObjectIdentifier docs 2025-05-07 13:34:25 +02:00
Pieter Hijma
f438c0ed04 Doc: Move doc comments ObjectIdentifier
Move the doc comments from the cpp file to the header file.
2025-05-07 10:26:28 +02:00
PaddleStroke
90190f8d13 Core: restoreContent not restoring expressions (#21152) 2025-05-06 12:02:35 -05:00
Pieter Hijma
39dcd21233 Doc: Improve App::Property documentation 2025-05-06 12:00:52 -05:00
bofdahof
ba2c2ca5ad Console: rename PascalCase named methods to camelCase 2025-05-06 17:50:21 +02:00
Ladislav Michl
9683cf1e4f Base: rename Exception's PascalCase methods to camelCase 2025-05-05 23:50:01 +02:00
Chris Hennes
f55063855a Merge pull request #20540 from 3x380V/cleanup-schemas-management
Simplify UnitsSchemas management
2025-05-05 10:43:27 -05:00
Benjamin Nauck
ecc2571d12 App: use contains() instead of count() 2025-05-03 22:22:10 +02:00
Benjamin Nauck
ea6ea1ee9c App: Use contains instead of std::find 2025-05-03 22:22:10 +02:00
Benjamin Nauck
02d095f6e2 App: use contains() instead of count() where possible 2025-05-03 22:19:51 +02:00
Pieter Hijma
ecb61310c1 Doc: Improve PropertyContainer documentation 2025-04-29 22:50:14 -05:00
João Neves
05f0c606d5 Core: Fixed a bug where an empty document disappears (#20554)
* Core: Fixed a bug where an empty document disappears

Created a flag named autoCreated to distinguish an autoCreated
document created in the startup from a manually document.
Implemented a setter and a getter for this new flag.
Added a codition that verifies if a document is autoCreated
when opening another document to close it in the correct case.
Implemented unit tests for theses cases. Fixes #19868.

Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt>

* Tests: Fix failing auto-created document tests

Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt>

* Tests: moved created tests to the existing Document test framework.

Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt>

---------

Signed-off-by: João Neves <joao.antonio.neves@tecnico.ulisboa.pt>
2025-04-28 10:46:52 -05:00
Luz Paz
ac9b65aa65 Misc: Fix various typos
Found via codespell
2025-04-27 19:32:19 -05:00
bofdahof
353acbb27b Base: simplify UnitsSchemas management
Fixes: Maintaining schemas is difficult and error-prone

- Facilitate easy schemas add, remove, change, etc.
- Remove 14 files containing approx 2,190 lines of if/else code and data
- Place data in one file (UnitsSchemasData.h) using a normalized structure (including special functions)
- Isolate and simplify data operations (code)
- Remove schemas enum to keep data independent of code
- Separate responsibilities: Specifications, data, schemas, schema
- Add schema data 'isDefault'
- Add schema data name
- Prefer algorithms to raw loops
- Add schemas unit tests
- Tweak quantity unit tests
2025-04-27 00:45:54 +02:00
Kacper Donat
ad3420e126 App: Use freecad_cast whenever possible 2025-04-26 14:23:25 +02:00
Kacper Donat
ccb42d0a0f App: Fix inheritance information for PropertyEnumeration
For some reason PropertyEnumeration in our type information system was
said to be inherited from App::PropertyInteger, wich is not the case.
This commit fixes that mistake.
2025-04-25 11:12:11 +02:00
Florian Foinant-Willig
73708391fb Add locked keyword to Document::addProperty 2025-04-24 16:03:34 +02:00
Monty Montgomery
eb58ba5657 Fix to sanity checking of ElementMap::restore()
An operator precedence error in new sanity checking code within
ElementMap::restore() causes <X>.Shape.Map.txt files with more than
2 element maps to be rejected as invalid.  This silently corrupts
projects upon loading, potentially unrecoverably.

The preexisting code comment is still appropriate if ironic.
2025-04-23 17:19:32 -05:00
Florian Foinant-Willig
d6958ea1e6 Add locked keyword argument to DocumentObject::addProperty 2025-04-22 23:52:17 +02:00
Pieter Hijma
05364b9eb4 [Doc] Process comments from review
Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
2025-04-22 13:42:50 +02:00
Pieter Hijma
519b78d775 [Doc] Improve documentation PropertyContainer 2025-04-22 13:42:50 +02:00
Pieter Hijma
8956c56235 [Doc] Add documentation top-level namespace App 2025-04-22 13:42:50 +02:00
FilippoR
e165d808f7 App: cmake: add missing Coin_INCLUDE_DIR after #20487 (#20863) 2025-04-21 15:01:03 -03:00
Chris Hennes
f1ef2159ee Merge pull request #20835 from oursland/python-binding-generator-const
python: Make const methods declared const in C++.
2025-04-21 10:58:21 -05:00
Jackson Oursland
8d679b70f0 App: Use the legacy macOS version functionality for About FreeCAD dialog (#20858) 2025-04-18 06:41:18 +02:00
bofdahof
09d08593ed Remove unused code: verbosity 2025-04-17 08:38:38 +02:00
Jacob Oursland
5c251e73ac python: apply const method annotations to impls. 2025-04-16 20:32:04 -07:00
Alex Tran
353085d7e3 App: Running FreeCAD in verbose mode information to reflect Gui -> Help -> About Dialog info (#20487) 2025-04-16 08:29:07 +02:00
Benjamin Nauck
f22f3705db Use Base::toDegrees() instead of manually converting 2025-04-15 07:16:39 +02:00
Benjamin Nauck
21fbf8e539 Use Base::toRadians() instead of manually converting 2025-04-15 07:16:36 +02:00
Bas Ruigrok
7b46ac4cd6 Use longest edge in face for horizontal/vertical alignment (#20374)
* App: Add second direction to getCameraAlignmentDirection()

* Part: Find longest face edge for horizontal/vertical alignment

* Gui: Use longest face edge for horizontal/vertical alignment

* App: Improve horizontal/vertical alignment for Datums and LCS
2025-04-14 11:20:49 -05:00
Kacper Donat
77e40b9747 Base: Use explicit pointer syntax for freecad_cast (#20694)
* Base: Use explicit pointer syntax for freecad_cast

This aligns our custom cast with other casts

* All: Use explicit pointer syntax for freecad_cast
2025-04-11 14:11:33 +00:00
Ladislav Michl
3f025585dc App: Expression: rename lexer and parser files
Rename files according 7d233dc ("Gui: Rename generated lexer files
to match core naming pattern"). Note that C space errors (space
before tabs, spaces on blank lines, etc.) still need to be fixed
manually after regenerating lexer file.
2025-04-08 11:10:50 +02:00
PaddleStroke
2f479e3c95 PartDesign: Fix use of App::Planes to create sketches (#20453) 2025-04-07 17:34:13 +02:00