Commit Graph

46 Commits

Author SHA1 Message Date
wmayer
a93fc8cc8b Sketcher: [skip ci] refactor SoDatumLabel 2022-11-24 12:38:28 +01:00
wmayer
990c7006a3 Sketcher: [skip ci] refactor SoDatumLabel 2022-11-24 11:51:26 +01:00
wmayer
b91cae4ee5 Sketch: use the focal distance to determine a correct scale factor for SoDatumLabel
This fixes #7860: Dimensions get unreadable (small) if a 2nd sketch is visible
and fixes #7082: Dimension size on perspective view scales "backwards"
2022-11-24 10:21:59 +01:00
wmayer
4b08850edb Qt6 port:
* QApplication::setFallbackSessionManagementEnabled has been removed
* QString::medRef() has been removed. Use QString::mid() again.
* QTextStream::setCodec has been removed
* Use operator QVariant of the QFont class to make code Qt5 and Qt6 compatible
* Signature of QTreeWidget::mimeData() has changed in Qt6. Remove TreeWidget::mimeData() because it doesn't change the implementation
* QLayout::setMargin() is deprecated in Qt5 and has been removed in Qt6. Use QLayout::setContentsMargins()
* QDateTime::toTime_t() is deprecated in Qt5 and has been removed in Qt6. Use QDateTime::toSecsSinceEpoch()
* QDesktopWidget is deprecated in Qt5 and has been removed in Qt6. Use QScreen
2022-11-01 16:55:40 +01:00
Uwe
0399b3f087 [Sketch] remove superfluous nullptr checks 2022-07-18 02:51:49 +02:00
Chris Hennes
589369a2cc Sketcher: PR6497 move return statement to new line 2022-03-29 13:25:06 -05:00
wmayer
51186c018e Sketcher: modernize C++11
* use nullptr
2022-03-23 19:26:15 +01:00
Abdullah Tahiri
c71a4e0c2f Sketcher: Constraint icons and fonts in 3D View
===============================================

Based on PRs #4146 #4155.

PR #4155 proposes a scaling factor to be used to scale up constraint icons and the subindex font of icons. The
scaling factor is a parameter.

PR #4146 proposes to derive the constraint icon size from the system font size via function of the dpi. The
constraint icon subindex is a factor of the constraint size.

Observations:
- PR #4146 identifies the need for a scaling factor too, but this is a hardcoded 1.25 factor.
- PR #4146 appears to mix font points and font pixels when deriving the sizes.
- PR #4155 deals exclusively with icon size and subindex font, not with constraint label

Useful concepts:
- Font point is a physical distance. There are 72 points in one inch.
- Monitors have pixels with varying pixel densities. The number of pixels in one point varies
with pixel density. Hence the need for a correction based on the dpi of the monitor.

API constraints:
- While QT's configuration can be obtained in points or pixels, coin3D sets the font size in points.

Solution:
- Continue relying on the local font setting from preferences for coin3d font, albeit by converting from pixels to points.
- Introduce a sketcher wide 3D view scaling factor, as per #4155. This factor is however used for geometry, not for fonts.
- Geometry is scaled to compensate for the scaling factor and the monitor pixel density (the scaling factor is the product
of both scaling factors).
- Derive the 3D view icon size to be 80% (hardcoded) of the 3D view font size. Having constraint icons proportional to contraint label
font size gives consistency to the interface, as constraint icons also have subindices. I do not think it is worth to provide this 80%
as a configurable parameter
- The constraint icon subindex, being a special case of font relative to the accompanying icon, is set to be the 80% of the
icon size (hardcoded). I think it is not worth to provide this as a configurable parameter.

Bonus:
- ViewProviderSketch implements an observer of parameter group and tracks view scaling factor parameter and marker size.
- On change of parameter the inventor nodes are updated and the 3D view redrawn.
- Size information is moved to edit structure for consistency with Marker size.
2021-01-07 12:11:01 +01:00
wmayer
8dbe26a95f Qt5: 'int QFontMetrics::width' is deprecated since Qt 5.11: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] 2020-06-12 17:51:33 +02:00
wmayer
b1dd1e61a7 force strict ISO C++ (-Wpedantic)
for Fem, Import, PartDesign, Robot, Sketcher, TechDraw
2019-09-18 14:18:07 +02:00
Abdullah Tahiri
62e721e8fd Sketcher: GUI PCH 2019-05-02 07:12:51 +02:00
wmayer
ba96c0773a PVS: V688 A local variable possesses the same name as one of the class members, which can result in a confusion 2019-03-13 11:58:43 +01:00
Abdullah Tahiri
174c96dca8 Sketcher: Double arrow label for Diameter Constraint 2018-07-30 00:47:20 +02:00
wmayer
ffa10bbf0c Qt5: workaround for undocking of mdi view
fix minor issues reported by clang static analyzer
2017-05-03 22:01:46 +02:00
Kunda
5aefa825b1 Typo fixes for doxygen and source comments
issue #0002914
2017-03-31 11:25:57 -03:00
Kunda
9410e751e9 source typo fixes pt4 (only on py3 merged code) 2017-03-02 13:47:21 +01:00
wmayer
05cdc342ef fixes #0002921, fixes #0002922 2017-02-24 19:54:16 +01:00
wmayer
c06b6f081f fix -Wextra in Sketcher 2016-09-22 18:34:35 +02:00
Mateusz Skowroński
c275b35d48 QString::fromAscii() is obsolete in Qt5. Replace it with fromLatin1().
This change is Qt4/Qt5 neutral.
2016-01-05 16:07:25 +01:00
wmayer
756a9c8130 + fix various warnings with gcc 2015-09-01 19:29:39 +02:00
wmayer
a6b918b276 + fix possible scaling problem of datum label 2014-11-08 15:55:47 +01:00
Abdullah Tahiri
f1035e8481 Sketcher fixes: Symmetry arrows properly scaled, fixed icon in constraint taskbar list contextual menu 2014-09-18 16:01:34 +02:00
Abdullah Tahiri
5dcd081591 Sketcher enhancement: Constraint icons visible over lines 2014-09-17 18:49:40 +02:00
Abdullah Tahiri
cea93fa33c Sketcher Bug fix: Arrows for symmetry constraint are back
The arrows were there in the code, but at a certain point, code was written to set the this->imgHeight value programatically, based on
whether it had text or not. As symmetry constraint does not have text the variable failed to initialize. Being zero, it did not pass
the ASSERT in the render function, so it was not rendered.

This includes Werner's fix for improver cast of a SoRayPickAction to SoGLRenderAction:
SbVec2s vp_size = static_cast<SoGLRenderAction*>(action)->getViewportRegion().getWindowSize();
to
SbVec2s vp_size = SoViewportRegionElement::get(state).getWindowSize();

At least sometimes tt is a SoRayPickAction because:

When you move with the mouse over the sketcher (when in edit mode) you enter the method ViewProviderSketch::mouseMove.
Inside there the method getPointOnRay is called to get a picked point underneath the cursor. Inside the latter method
an instance of SoRayPickAction is created to traverse the scene graph. After a long cascade of function calls you
finally enter SoDatumLabel::generatePrimitives(SoAction*).
2014-09-17 18:48:54 +02:00
wmayer
839eced7a9 + fix more compiler warnings 2014-08-27 13:26:44 +02:00
wmayer
d431f52a2d + fix issues with angle constraints 2014-05-17 18:27:56 +02:00
Stefan Tröger
468069266c fix sketcher arrow size and make them independend from window size 2014-05-14 22:43:31 +02:00
Stefan Tröger
31771d5314 fix inverted sketcher font-size issue and make font size undependend of window size 2014-05-13 18:20:38 +02:00
wmayer
8ad5d0416b fixes #0001191: Cannot manipulate length if moved away from between the 'red lines' 2014-01-14 11:48:34 +01:00
wmayer
3fe720f3bc + Replace math.h with cmath 2014-01-05 11:25:40 +01:00
jriegel
16c6fe2470 Add unti support to Sketcher 2013-12-15 22:47:47 +01:00
wmayer
00d46af3e1 0001246: Constraint datum dimension label shown as gray box vice number in transparent background. 2013-10-21 10:05:23 +02:00
wmayer
434400f8a0 0000971: Tracing over a background image in Sketcher: image is overwritten by first dimensional constraint text 2013-10-13 18:35:27 +02:00
wmayer
c64d0594b6 Apply fix from mrlukeparry for datum labels 2013-05-27 11:25:50 +02:00
Yorik van Havre
acb2d38da5 Sketcher: small fix to allow to use SoDatumLabel in python 2013-03-04 15:56:17 -03:00
wmayer
ec1de40d99 0000721: massive memory leak when dragging an unconstrained model 2012-11-15 00:24:40 +01:00
wmayer
3b3aaa5bcd Fix some memory leaks 2012-11-14 17:12:42 +01:00
unknown
c2c5b137f2 Fix possible crash in various view providers, fix formatting of Coin debug output, fix warning and compiler errors with Coin2 in SoDatumLabel 2012-07-18 10:40:36 +02:00
mrlukeparry
5513942b55 Sketcher: fix incorrect datum text flip for non xy-plane sketches 2012-07-17 23:15:58 +02:00
mrlukeparry
4486bd0a1c Sketcher: improve symmetric constraint visual 2012-07-17 12:40:22 +02:00
mrlukeparry
7b05576aa2 Sketcher, 0000466: improve visualization of constraints 2012-07-15 13:23:59 +02:00
mrlukeparry
4fcffabf15 Remove un-necessary GL command that seemed to cause rendering artifacts.
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5372 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-12-31 20:01:24 +00:00
logari81
3d9c7771f8 + fix indentation, untabify and strip trailing spaces
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5054 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-22 11:57:49 +00:00
mrlukeparry
87dd7826c7 Improved Datum Visuals.
DepthTest works correctly.
Datum label selection colour works correctly. 
Made labels slightly smaller to prevent stretch

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5052 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-22 08:50:30 +00:00
logari81
b252fe7e1f + improve coding style and fix typos
+ fix positioning of symmetry constraint icon


git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5002 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-10 21:41:30 +00:00
wmayer
120ca87015 + unify DLL export defines to namespace names
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-10 13:44:52 +00:00