Commit Graph

511 Commits

Author SHA1 Message Date
Markus Reitböck
05a706697b Material: 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-22 23:17:39 +02:00
Chris Hennes
929bd5090b App: Sanitize all paths for null characters (#23821)
* App: Sanitize all paths for null characters

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

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

* Apply suggestions from code review

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kacper Donat <kadet1090@gmail.com>
2025-09-18 17:37:33 +00:00
sliptonic
79640fd18a Merge pull request #23885 from chennes/pythonInterfaceToApplicationDirectories
App: Add Python interface to ApplicationDirectories
2025-09-17 18:11:41 -05:00
Chris Hennes
8f128f21f9 Tests: Update to match new behavior 2025-09-17 17:02:35 -05:00
Markus Reitböck
6ef07bb358 Gui: 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-14 09:47:03 +02:00
Markus Reitböck
d05e2a0431 App: 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-14 09:47:02 +02:00
Markus Reitböck
f0eca551b3 Base: 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-14 09:47:01 +02:00
Markus Reitböck
749ac36615 do not use precompiled header for setting global compiler definitions and to disable compiler warnings
only 4 of these warnings are still relevant, CMake shall be used to disable them

Compiler definitions:

  NOMINMAX:
    * is already globally defined in SetGlobalCompilerAndLinkerSettings.cmake

  WIN32_LEAN_AND_MEAN:
    * use CMake target_compile_options on relevant targets

Warnings that still occur:

  C4251, C4273, C4275: all related to dllimport / export
    * use CMake target_compile_options on relevant targets

  C4661: no suitable definition provied for explicit template instantiation request
    * triggered in Mesh because of Vector3D in Base - not all functions are defined in header
    * use CMake target_compile_options on relevant targets

Warnings that are Currently not triggered (fix code if they appear again):

  C4005: macro redefinition

  C4244: argument conversion, possible loss of data

  C4267: conversion from size_t to type, possible loss of data

  C4305: truncation from type1 to type2
    * only occurrence disabled in Reader.cpp

  C4522: multiple assignment operator specified

  C5208: unnamed class in typedef name

Obsolete Compiler warnings:

  C4181: not mentioned in Microsoft docs anymore

  C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
    * throw(optional_type_list)  deprecated in C++17

  C4482: nonstandard extension used: enum 'enumeration' used in qualified name
    * not generated for compilers that support C++11

  C4503: 'identifier': decorated name length exceeded, name was truncated
    * obsolete since Visual Studio 2017

  C4786: not mentioned in Microsoft docs anymore
2025-09-11 20:21:04 -05:00
Chris Hennes
1f05f5eda4 Merge pull request #23351 from 3x380V/fileinfo
Core: Modernize Fileinfo
2025-09-07 21:28:11 -05:00
Chris Hennes
325730dd9c Merge pull request #23384 from 3x380V/units
Base: Units update
2025-09-07 20:22:54 -05:00
Weston Schmidt
140c9febc4 Add test causing crash and fix map sorting function. (#22889)
* Add test causing crash and fix map sorting function.

When opening a model from FreeCAD 0.7, the model would crash when I
changed some of the parameters.  This turned out to be due to the
ElementNameComparator::operator() not correctly sorting the items going
into the map, which caused the map to be invalid.

This change adds a test that represented the exact names causing the
crash as well as a fix for the problem.  Names are now sorted:

1. Empty names first
2. Identifier based names second.
3. Hex based names last.

Identifiers are sorted lexicographically for the name portion and
numerically for the number portion, smallest to largest.

Hex based names are sorted by the value of the hex number, smallest to
largest.

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

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

* Fix lint issues.

* Add another test form to the mix.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-09-05 14:07:02 -05:00
Ladislav Michl
88f76f3605 Base: UnitsSchema: use basic imperial conversion constants
Use well defined basic constants for conversion of imperial units.
This makes code hopefully easily readable and verificable.
2025-09-05 17:31:55 +02:00
Ladislav Michl
1cd47c2dd4 Base: add back Imperial for Civil Engineering unit conversions
Fixes: 1155f0d752 ("Base: simplify UnitsSchemas management")
2025-09-05 17:31:54 +02:00
Ladislav Michl
01b547912f Base: QuantityFormat: avoid storing formatting defaults
User defined precision and fractional inch are stored on QuantityFormat
construction making changes persistent to object life time.
Change that so until not explicitely overriden, user defined values
are always returned.

Co-authored-by: Matthias Danner <28687794+matthiasdanner@users.noreply.github.com>
2025-09-05 17:31:54 +02:00
Chris Hennes
8221ab77d7 Merge pull request #23503 from maxwxyz/issue-22123
Fix STEP import with bad string behavior
2025-08-31 23:23:25 -05:00
Chris Hennes
c26e3e9756 Base: Allow all valid Python 3 identifier characters
Note: Does not check for keywords, only character classes (not a change from the original code).
2025-08-31 21:39:49 +02:00
wmayer
ee2d35cad8 Test: Add test cases for Persistence::validateXMLString 2025-08-31 14:38:25 +02:00
Chris Hennes
102d0a9ac8 App: refactor to use unique_ptr
Also address other reviewer comments.
2025-08-27 11:51:22 -05:00
Chris Hennes
7ed4a9b731 App: Add directory versioning for data and config
At the application level, support the existence of subdirectories inside
the original config and data paths for a specific version of the
software. For a new installation, create them, but for an existing
installation use the most recent available version, even if it's not the
current one (and even if it's not versioned at all). Any migration must
be done at the GUI level due to the amount of data that is potentially
being copied during that process.
2025-08-27 11:51:22 -05:00
PaddleStroke
a346c266e7 PartDesign: Extrude 2 sides (#21794)
* PartDesign: extrude 2 sides

* Part: OpCodes XOR

* PartDesign: Remove deprecated generatePrism functions

* PartDesign: Extrude : Update Sides combobox strings

* Change "Sides" to "Mode"

* Use OpCodes::Extrude instead of Prism.
2025-08-25 17:17:23 +00:00
wmayer
8747607820 Tests: Add test case for ReaderOBJ 2025-08-25 18:13:59 +02:00
wmayer
a6cf8ba983 Tests: Add unit tests for FileInfo 2025-08-22 15:20:25 +02:00
Chris Hennes
d8168d33f3 App: Remove use of dangerous localtime() function 2025-08-18 17:44:34 +02:00
Kacper Donat
2f1d96bf44 Gui: Add ParameterDefinition to Style Parameters
This adds a way to define parameters within code, that allows developers
to easily encapsulate the parameters and their default values.
2025-08-12 22:04:23 +02:00
Kacper Donat
0cce9c1261 Gui: Make StyleParameterManager::resolve return optional result
This changes the resolve method of style parameter manager to return
optional intead of definitive result. In reality tokens may not be
defioned correctly and optionals provide a good way to nicely handle
defaults.
2025-08-12 22:04:23 +02:00
Kacper Donat
322ed2c7bc Gui: Rename StyleParameters::Length to StyleParameters::Numeric
This change gives a better name to the parameter type that is used to
store numeric values. Before it was called length, but it can store
other quantities as well so the name is no longer fitting.
2025-08-12 21:25:41 +02:00
Kacper Donat
cf55183ece Gui: StyleParameters - use Base::Color instead of QColor
If possible we should prefer using our own classess instead of ones
coming from frameworks. This changes Style Parameters to use Base::Color
class instead of QColor. Calculations are still done using QColor but
the data is always exposed as Base::Color.
2025-08-12 21:25:41 +02:00
Chris Hennes
91b3581a78 Merge pull request #22788 from pieterhijma/fix-func-expr-simplify
Core: Fix expression function simplify
2025-08-12 11:07:44 -05:00
Pieter Hijma
0acc2d1ed5 Core: Add test for a prop rename with expression 2025-08-08 17:09:49 +02:00
Frank David Martínez M
1b3851c502 [Core] Add Boolean Functions to expressions (AND, OR, NOT) (#22506)
* [Core] Add Boolean Functions to expressions (AND, OR, BOOL, NOT)

* [Core] Add `if` function to expressions to overcome ternary operator limitations

* [Core] Update expressions grammar to recognize relational operations as arguments

* [Core] The `if` function has been removed as no consensus was reached regarding its convenience or necessity. Its inclusion was considered potentially confusing or redundant.

* [Core] Make boolean cast based on Confusion threshold.
2025-08-05 03:50:13 +00:00
Chris Hennes
26c6aa934d Tests: Add tests for timestamp-based backups 2025-08-04 17:51:15 +02:00
Pieter Hijma
c86907d243 Core: Add tests for expression simplify and eval 2025-08-04 16:51:11 +02:00
Chris Hennes
d54ff81870 Tests: Save/restore Materials user prefs 2025-07-23 19:26:20 -05:00
Chris Hennes
25f1d28468 Tests: Ensure tests use a fixture that inits app 2025-07-23 19:26:14 -05:00
tomate44
4614e6b4f6 Part: Feature Offset2D fix #22563 2025-07-22 20:40:51 -05:00
Benjamin Nauck
7150ae1dc9 Sketcher: Add tests for ensuring accessing works for both old and new api 2025-07-21 18:03:14 +02:00
Chris Hennes
538b6e042c Merge pull request #22227 from kadet1090/refactor-tool-hints
Sketcher: Refactor Tool Hints
2025-07-20 12:05:15 -05:00
Chris Hennes
b97bdb7383 Tests: Add tests for 'Standard' backup policy (#22566)
* Tests: Add tests for 'Standard' backup policy

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-07-20 00:34:07 +02:00
Kacper Donat
33ec6e671e Gui: Add standardized HintsTable for InputHints
Input hints in various DrawSketchHandler were implemented independently
using declarative mechanism with searching over lookup table. This
results in a lot of duplicated code, this commit will create generic
mechanisms that can be used to replace them.
2025-07-19 10:05:08 +02:00
Benjamin Nauck
566fe8371a Merge pull request #21995 from chennes/moveBackupPolicy
Extract BackupPolicy class into its own file to facilitate automated testing
2025-07-12 17:58:14 +02:00
FEA-eng
45be617bf3 Part: Enable solid creation by default for Loft and Sweep (#22098)
* Part: Update PartFeatures.cpp

* Part: Update DlgRevolution.ui

* Part: Update TaskLoft.ui

* Part: Update TaskSweep.ui

* Part: Update PartFeatures.cpp

* Update src/Mod/Part/Gui/DlgRevolution.ui

---------

Co-authored-by: Max Wilfinger <6246609+maxwxyz@users.noreply.github.com>
2025-07-07 17:46:19 +02:00
Kacper Donat
a32594faea Gui: Add ThemeTokenManager class to contain theme parameters
This class aims to implement Design Token idea into FreeCAD themes. It
allows themes to use generic variables with generic values so we could
use one qss theme and change the style based on values from preference
packs.
2025-07-07 00:07:31 +02:00
Pieter Hijma
5c9761d676 Core: Fix property rename test 2025-07-02 15:36:56 -05:00
Chris Hennes
6b4b1a1a95 Merge pull request #21975 from pieterhijma/transaction-rename-property
Core: Add redo/undo to property rename
2025-06-30 10:36:26 -05:00
Pieter Hijma
b19fc992fb Core: Add tests for undo/redo property rename 2025-06-16 17:58:33 +02:00
wmayer
74a22df884 Base: Simplify Base::Matrix4D
As discussed in https://forum.freecad.org/viewtopic.php?t=65959 reduce code duplications
2025-06-16 10:05:43 +02:00
Chris Hennes
5388c32f10 Tests: Refactor tests with better names, etc.
The basic tests now run on Windows correctly without needing to manually
copy any files -- the executables are output in the same location as the
necessary DLLs. However, tests that require *.pyd files (all code in the
Mod subdirectory, basically) still do not work on Windows as the test
executables cannot find those files. This is a work in progress.
2025-06-15 17:31:19 -05:00
Chris Hennes
ee571ef6e7 Tests: Add test framework for BackupPolicy 2025-06-15 10:34:09 -05:00
bofdahof
847e2f5c85 Base: Units: refactor
Refactor Units making it constexpr, immutable, with repetition reduced.
Separate data from code.

Constexpr constructed units allow constructing predefined Quantities
from predefined unit types.
2025-06-03 09:31:38 +02:00
Ladislav Michl
f8d2789a43 Base: Units: introduce unit one
Dimensionless quantities have all exponents equal to zero.
Such quantities are simply numbers. The associated unit is
the unit one, symbol 1, although this is rarely explicitly
written.

See chapter 2.3.3 Dimensions of quantities, The International
System of Units, 9th edition.
2025-06-03 09:31:38 +02:00