Commit Graph

418 Commits

Author SHA1 Message Date
xtemp09
65fe3b8558 Add Navigation Style/Orbit Style/Rotation Mode to About info
Closes #17431
2025-05-19 17:45:00 +02:00
bofdahof
998f4e4d45 Console: rename PascalCase named methods to camelCase 2025-05-06 17:50:21 +02:00
Ladislav Michl
c293d74566 Base: rename Exception's PascalCase methods to camelCase 2025-05-05 23:50:01 +02:00
Chris Hennes
9b1467cef3 Merge pull request #20540 from 3x380V/cleanup-schemas-management
Simplify UnitsSchemas management
2025-05-05 10:43:27 -05:00
Benjamin Nauck
65ee1339de App: use contains() instead of count() where possible 2025-05-03 22:19:51 +02:00
bofdahof
1155f0d752 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
Jackson Oursland
6be09c29f6 App: Use the legacy macOS version functionality for About FreeCAD dialog (#20858) 2025-04-18 06:41:18 +02:00
bofdahof
3e24dc6d8c Remove unused code: verbosity 2025-04-17 08:38:38 +02:00
Alex Tran
989a06ea63 App: Running FreeCAD in verbose mode information to reflect Gui -> Help -> About Dialog info (#20487) 2025-04-16 08:29:07 +02:00
bofdahof
7013f913b6 App: remove redundant qualifier from Application class 2025-04-07 11:09:04 +02:00
bofdahof
6b5030f391 App: constify variables in Application class 2025-04-07 11:09:04 +02:00
Kacper Donat
f5199145a4 Merge pull request #20379 from chennes/baseEliminatePy_GetPath
Replace it with a piece of code that replicates the functionality. Also eliminate the round-trip through char * that this function was using (the final variable is stored as a std::string anyway).
2025-03-29 18:13:08 +01:00
marioalexis
406a834a6d Base: Add volume charge density unit 2025-03-27 21:13:21 +01:00
Chris Hennes
f0fc6ccde1 Base: Remove deprecated Py_GetPath call
Replace it with a piece of code that replicates the functionality. Also eliminate the round-trip through char * that this function was using (the final variable is stored as a std::string anyway).
2025-03-22 18:59:05 -05:00
Thomas Gimpel
dbfc0b47b6 App: reverted commit 8ff4b1b and improved comments in order to fix the MacOS build (#20068) 2025-03-17 20:23:01 +01:00
bofdahof
2d3f0d714d cleanup commented lines 2025-03-08 13:37:46 +10:00
bofdahof
ae9eec20a6 remove using namespace Base::FileInfo 2025-03-08 13:37:46 +10:00
bofdahof
65619fae39 remove using namespace boost::program_options 2025-03-08 13:20:32 +10:00
bofdahof
00173ebe02 remove using namespace std 2025-03-08 13:18:06 +10:00
bofdahof
f66561b23a remove using namespace boost 2025-03-08 13:14:35 +10:00
bofdahof
00ce73dc45 remove using namespace Base 2025-03-08 13:13:38 +10:00
Chris Hennes
a028d8d299 Merge pull request #20058 from tritao/fix-app-document-main-doc-load
App: Fix regression for document creation requests coming from the main document.
2025-03-07 23:28:27 +00:00
Joao Matos
668b0acc00 App: Fix regression when creating new document coming from the main document. 2025-03-07 20:54:16 +00:00
Joao Matos
9bcdd2d44c Rename DocumentCreateFlags to DocumentInitFlags. 2025-03-07 20:54:16 +00:00
Chris Hennes
750d8c6a96 App: Cleanup parameter names in Application.*
* Unify names in header and cpp files
* Make names consistent across methods with similar uses
* Fix spacing

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
2025-03-07 08:47:49 -06:00
Chris Hennes
b090e27dcf App: Switch to isNullOrEmpty() 2025-03-03 19:24:15 -06:00
Chris Hennes
66e1710956 App: Minor formatting from review
Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
2025-03-03 19:21:05 -06:00
bofdahof
091f73f09f Calling static via instance 2025-03-03 19:21:04 -06:00
bofdahof
035d789ffa Narrowing conversion 2025-03-03 19:21:04 -06:00
bofdahof
3ddf2fe67b Don't use endl 2025-03-03 19:21:04 -06:00
bofdahof
4811be9881 Reserve vector size 2025-03-03 19:21:04 -06:00
bofdahof
8ff4b1b018 Redundant c_str() 2025-03-03 19:21:04 -06:00
bofdahof
31825c28aa Else after return 2025-03-03 19:21:04 -06:00
bofdahof
4bfe65b48c Declaration hides previous 2025-03-03 19:21:04 -06:00
bofdahof
ee849b6349 C++ style cast instead of C 2025-03-03 19:21:04 -06:00
bofdahof
78696bdaee Join declaration and assignment 2025-03-03 19:21:04 -06:00
bofdahof
2ab03306ca Use auto 2025-03-03 19:21:04 -06:00
bofdahof
c3eee2dc99 Simplify expression 2025-03-03 19:21:04 -06:00
bofdahof
819faf71ed DRY 2025-03-03 19:20:59 -06:00
Chris Hennes
6512dc69e9 Merge pull request #19761 from chennes/coverityFixesFeb2025
Base: Coverity fixes from February 2025 run (round 1)
2025-03-02 16:15:17 -06:00
Kevin Martin
41f09db9e1 Address performance of existing unique-name generation (Part 2) (#18676)
As described in Issue 16849, the existing Tools::getUniqueName method
requires calling code to form a vector of existing names to be avoided.

This leads to poor performance both in the O(n) cost of building such a
vector and also getUniqueName's O(n) algorithm for actually generating
the unique name (where 'n' is the number of pre-existing names).

This has  particularly noticeable cost in documents with large numbers
of DocumentObjects because generating both Names and Labels for each new
object incurs this cost. During an operation such as importing this
results in an O(n^2) time spent generating names.

The other major cost is in the saving of the temporary backup file,
which uses name generation for the "files" embedded in the Zip file.
Documents can easily need several such "files" for each object in the
document.

This update includes the following changes to use the newly-added
UniqueNameManager as a replacement for the old Tools::getUniqueName
method and deletes the latter to remove any temptation to use it as
its usage model breeds inefficiency:

Eliminate Tools::getUniqueName, its local functions, and its unit tests.

Make DocumentObject naming use the new UniqueNameManager class.

Make DocumentObject Label naming use the new UniqueNameManager class.
This needs to monitor DocumentObject Labels for changes since this
property is not read-only. The special handling for the Label
property, which includes optionally forcing uniqueness and updating
links in referencing objects, has been mostly moved from
PropertyString to DocumentObject.

Add Document::containsObject(DocumentObject*) for a definitive
test of an object being in a Document. This is needed because
DocumentObjects can be in a sort of limbo (e.g. when they are in the
Undo/Redo lists) where they have a parent linkage to the Document but
should not participate in Label collision checks.

Rename Document.getStandardObjectName to getStandardObjectLabel
to better represent what it does.

Use new UniqueNameManager for Writer internal filenames within the zip
file.

Eliminate unneeded Reader::FileNames collection. The file names
already exist in the FileList collection elements. The only existing
use for the FileNames collection was to determine if there were any
files at all, and with FileList and FileNames being parallel
vectors, they both had the same length so FileList could be used
for this test..

Use UniqueNameManager for document names and labels. This uses ad hoc
UniqueNameManager objects created on the spot on the assumption that
document creation is relatively rare and there are few documents, so
although the cost is O(n), n itself is small.

Use an ad hoc UniqueNameManager to name new DymanicProperty entries.
This is only done if a property of the proposed name already exists,
since such a check is more-or-less O(log(n)), almost never finds a
collision, and avoids the O(n) building of the UniqueNameManager.
If there is a collision an ad-hoc UniqueNameManager is built
and discarded after use.
The property management classes have a bit of a mess of methods
including several to populate various collection types with all
existing properties. Rather than introducing yet another such
collection-specific method to fill a UniqueNameManager, a
visitProperties method was added which calls a passed function for
each property. The existing code (e.g. getPropertyMap) would be
simpler if they all used this but the cost of calling a lambda
for each property must be considered. It would clarify the semantics
of these methods, which have a bit of variance in which properties
populate the passed collection, e.g. when there are duplicate names..
Ideally the PropertyContainer class would keep a central directory of
all properties ("static", Dynamic, and exposed by ExtensionContainer and
other derivations) and a permanent UniqueNameManager. However the
Property management is a bit of a mess making such a change a project
unto itself.
2025-02-24 10:23:53 -06:00
Kacper Donat
7a067ed464 Update src/App/Application.cpp
Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
2025-02-21 15:04:43 +01:00
Kacper Donat
12a69fe296 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
Chris Hennes
9c097eba60 App: Small fixes caught by Coverity scan 2025-02-20 22:00:40 -06:00
Benjamin Bræstrup Sayoc
546d973337 App: Use QStringLiteral 2025-02-10 18:34:58 +01:00
tritao
e94d1cf872 Base: Remove Boost-based filesystem and switch to standard <filesystem> 2025-02-10 10:48:54 -06:00
Chris Hennes
d2194bbeda App: Add utility method to get app name with version included 2025-02-03 12:05:16 -05:00
tritao
123569823e App: Provide temporary document creation flag to Python App.loadDocument. 2025-02-03 18:01:18 +01:00
Chris Hennes
d38b6fc3c5 Merge pull request #19011 from marioalexis84/fem-electromagnetic_boundary_condtion 2025-01-27 15:15:59 -06:00
Jonas Bähr
9ffa56765c Main: Avoid Popups in Console Mode
When in console mode, some messages from CLI interaction still resulted
in popup dialogs, e.g. the response from `--help` or `--version`. This
is becasue those information are communicated via exceptions and those
exceptions prevented the console mode from being properly set.
By using a scope guard the console mode flag is now evaluated in all
cases. The code to display those messages got refactored into dedicated
methods which now also take care of console mode.
2025-01-27 17:47:16 +01:00