Merge branch 'master' into master
This commit is contained in:
@@ -108,10 +108,13 @@ void DlgSettingsNavigation::saveSettings()
|
||||
hCustom->SetFloat("Q2", q2);
|
||||
hCustom->SetFloat("Q3", q3);
|
||||
}
|
||||
|
||||
hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/NaviCube");
|
||||
hGrp->SetASCII("FontString", ui->naviCubeFontName->currentText().toLatin1());
|
||||
if (ui->naviCubeFontName->currentIndex()) {
|
||||
hGrp->SetASCII("FontString", ui->naviCubeFontName->currentText().toLatin1());
|
||||
} else {
|
||||
hGrp->RemoveASCII("FontString");
|
||||
}
|
||||
}
|
||||
|
||||
void DlgSettingsNavigation::loadSettings()
|
||||
@@ -171,9 +174,6 @@ void DlgSettingsNavigation::loadSettings()
|
||||
this, &DlgSettingsNavigation::onMouseButtonClicked);
|
||||
|
||||
// fill up font styles
|
||||
hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/NaviCube");
|
||||
std::string defaultSansserifFont = NaviCubeSettings::getDefaultSansserifFont().toStdString();
|
||||
|
||||
// we purposely allow all available fonts on the system
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
@@ -182,12 +182,12 @@ void DlgSettingsNavigation::loadSettings()
|
||||
QStringList familyNames = QFontDatabase::families(QFontDatabase::Any);
|
||||
#endif
|
||||
ui->naviCubeFontName->addItems(familyNames);
|
||||
|
||||
|
||||
hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/NaviCube");
|
||||
int indexFamilyNames = familyNames.indexOf(
|
||||
QString::fromStdString(hGrp->GetASCII("FontString", defaultSansserifFont.c_str())));
|
||||
if (indexFamilyNames < 0)
|
||||
indexFamilyNames = 0;
|
||||
ui->naviCubeFontName->setCurrentIndex(indexFamilyNames);
|
||||
QString::fromStdString(hGrp->GetASCII("FontString")));
|
||||
ui->naviCubeFontName->setCurrentIndex(indexFamilyNames + 1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -157,6 +157,11 @@
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>NaviCube</cstring>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
@@ -204,8 +209,7 @@
|
||||
<item row="3" column="1">
|
||||
<widget class="Gui::PrefColorButton" name="naviCubeBaseColor">
|
||||
<property name="toolTip">
|
||||
<string>color for all elements
|
||||
around the cube</string>
|
||||
<string>Base color for all elements</string>
|
||||
</property>
|
||||
<property name="color">
|
||||
<color alpha="128">
|
||||
|
||||
@@ -446,16 +446,6 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
|
||||
// accept drops on the window, get handled in dropEvent, dragEnterEvent
|
||||
setAcceptDrops(true);
|
||||
|
||||
// setup font substitutions for NaviCube
|
||||
// Helvetica usually gives good enough results on mac & linux
|
||||
// in rare cases Helvetica matches a bad font on linux
|
||||
// Nimbus Sans Narrow and Open Sans Condensed added as fallback
|
||||
// Bahnschrift is a condensed font available on windows versions since 2017
|
||||
// Arial added as fallback for older version
|
||||
auto substitutions = QStringLiteral("Bahnschrift,Helvetica,Nimbus Sans Narrow,Open Sans Condensed,Arial,Sans");
|
||||
auto family = QStringLiteral("FreeCAD NaviCube");
|
||||
QFont::insertSubstitutions(family, substitutions.split(QLatin1Char(',')));
|
||||
|
||||
statusBar()->showMessage(tr("Ready"), 2001);
|
||||
}
|
||||
|
||||
|
||||
@@ -401,12 +401,10 @@ int imageVerticalBalance(QImage p, int sizeHint) {
|
||||
|
||||
void NaviCubeImplementation::createCubeFaceTextures() {
|
||||
int texSize = 192; // Works well for the max cube size 1024
|
||||
// find font sizes
|
||||
QFont font;
|
||||
if (!m_TextFont.empty()) {
|
||||
QString fontString = QString::fromStdString(m_TextFont);
|
||||
font.fromString(fontString);
|
||||
}
|
||||
if (m_TextFont.empty()) font.fromString(QStringLiteral("Arial"));
|
||||
else font.fromString(QString::fromStdString(m_TextFont));
|
||||
font.setStyleHint(QFont::SansSerif);
|
||||
if (m_FontWeight > 0) {
|
||||
font.setWeight(convertWeights(m_FontWeight));
|
||||
}
|
||||
@@ -454,9 +452,10 @@ void NaviCubeImplementation::createCubeFaceTextures() {
|
||||
delete m_LabelTextures[pickId].texture;
|
||||
}
|
||||
m_LabelTextures[pickId].texture = new QOpenGLTexture(image.mirrored());
|
||||
m_LabelTextures[pickId].texture->generateMipMaps();
|
||||
m_LabelTextures[pickId].texture->setMaximumAnisotropy(4.0);
|
||||
m_LabelTextures[pickId].texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
|
||||
m_LabelTextures[pickId].texture->setMagnificationFilter(QOpenGLTexture::Linear);
|
||||
m_LabelTextures[pickId].texture->generateMipMaps();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -442,7 +442,6 @@ NaviCubeSettings::NaviCubeSettings(ParameterGrp::handle hGrp,
|
||||
[this](ParameterGrp*, ParameterGrp::ParamType, const char *Name, const char *) {
|
||||
parameterChanged(Name);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
NaviCubeSettings::~NaviCubeSettings()
|
||||
@@ -450,16 +449,6 @@ NaviCubeSettings::~NaviCubeSettings()
|
||||
connectParameterChanged.disconnect();
|
||||
}
|
||||
|
||||
QString NaviCubeSettings::getDefaultSansserifFont()
|
||||
{
|
||||
// "FreeCAD NaviCube" family susbtitutions are set in MainWindow::MainWindow
|
||||
QFont font(QStringLiteral("FreeCAD NaviCube"));
|
||||
font.setStyleHint(QFont::SansSerif);
|
||||
// QFontInfo is required to get the actually matched font family
|
||||
return QFontInfo(font).family();
|
||||
// return QStringLiteral("FreeCAD NaviCube");
|
||||
}
|
||||
|
||||
void NaviCubeSettings::applySettings()
|
||||
{
|
||||
parameterChanged("BaseColor");
|
||||
@@ -506,9 +495,7 @@ void NaviCubeSettings::parameterChanged(const char* Name)
|
||||
nc->setFontZoom(hGrp->GetFloat("FontZoom", 0.3));
|
||||
}
|
||||
else if (strcmp(Name, "FontString") == 0) {
|
||||
std::string font =
|
||||
hGrp->GetASCII("FontString", getDefaultSansserifFont().toStdString().c_str());
|
||||
nc->setFont(font);
|
||||
nc->setFont(hGrp->GetASCII("FontString"));
|
||||
}
|
||||
else if (strcmp(Name, "FontWeight") == 0) {
|
||||
nc->setFontWeight(hGrp->GetInt("FontWeight", 0));
|
||||
|
||||
@@ -60,7 +60,6 @@ public:
|
||||
~NaviCubeSettings();
|
||||
|
||||
void applySettings();
|
||||
static QString getDefaultSansserifFont();
|
||||
private:
|
||||
void parameterChanged(ParameterGrp::MessageType pName);
|
||||
ParameterGrp::handle hGrp;
|
||||
|
||||
@@ -1115,12 +1115,12 @@ public:
|
||||
|
||||
void languageChange()
|
||||
{
|
||||
gridAutoSpacing->setText(tr("Grid Auto Spacing"));
|
||||
gridAutoSpacing->setText(tr("Grid auto spacing"));
|
||||
gridAutoSpacing->setToolTip(tr("Resize grid automatically depending on zoom."));
|
||||
gridAutoSpacing->setStatusTip(gridAutoSpacing->toolTip());
|
||||
|
||||
sizeLabel->setText(tr("Spacing"));
|
||||
gridSizeBox->setToolTip(tr("Distance between two subsequent grid lines"));
|
||||
gridSizeBox->setToolTip(tr("Distance between two subsequent grid lines."));
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -1217,7 +1217,7 @@ CmdSketcherGrid::CmdSketcherGrid()
|
||||
sGroup = "Sketcher";
|
||||
sMenuText = QT_TR_NOOP("Toggle grid");
|
||||
sToolTipText =
|
||||
QT_TR_NOOP("Toggle the grid in the sketch. In the menu you can change grid settings");
|
||||
QT_TR_NOOP("Toggle the grid in the sketch. In the menu you can change grid settings.");
|
||||
sWhatsThis = "Sketcher_Grid";
|
||||
sStatusTip = sToolTipText;
|
||||
eType = 0;
|
||||
@@ -1371,7 +1371,7 @@ public:
|
||||
angleLabel->setText(tr("Snap angle"));
|
||||
snapAngle->setToolTip(
|
||||
tr("Angular step for tools that use 'Snap at Angle' (line for instance). Hold CTRL to "
|
||||
"enable 'Snap at Angle'. The angle start from the East axis (horizontal right)"));
|
||||
"enable 'Snap at Angle'. The angle starts from the positive X axis of the sketch."));
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -1474,7 +1474,7 @@ CmdSketcherSnap::CmdSketcherSnap()
|
||||
sMenuText = QT_TR_NOOP("Toggle snap");
|
||||
sToolTipText =
|
||||
QT_TR_NOOP("Toggle all snap functionality. In the menu you can toggle 'Snap to grid' and "
|
||||
"'Snap to objects' individually, and change further snap settings");
|
||||
"'Snap to objects' individually, and change further snap settings.");
|
||||
sWhatsThis = "Sketcher_Snap";
|
||||
sStatusTip = sToolTipText;
|
||||
eType = 0;
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace
|
||||
{
|
||||
inline const QStringList editModeToolbarNames()
|
||||
{
|
||||
return QStringList {QString::fromLatin1("Sketcher Edit Mode"),
|
||||
return QStringList {QString::fromLatin1("Sketcher edit mode"),
|
||||
QString::fromLatin1("Sketcher geometries"),
|
||||
QString::fromLatin1("Sketcher constraints"),
|
||||
QString::fromLatin1("Sketcher tools"),
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
using namespace TechDraw;
|
||||
|
||||
const double Preferences::DefaultFontSizeInMM = 5.0;
|
||||
const double Preferences::DefaultArrowSize = 3.5;
|
||||
|
||||
//! Returns the TechDraw preference group
|
||||
Base::Reference<ParameterGrp> Preferences::getPreferenceGroup(const char* Name)
|
||||
@@ -70,6 +71,11 @@ double Preferences::dimFontSizeMM()
|
||||
return getPreferenceGroup("Dimensions")->GetFloat("FontSize", DefaultFontSizeInMM);
|
||||
}
|
||||
|
||||
double Preferences::dimArrowSize()
|
||||
{
|
||||
return getPreferenceGroup("Dimensions")->GetFloat("ArrowSize", DefaultArrowSize);
|
||||
}
|
||||
|
||||
App::Color Preferences::normalColor()
|
||||
{
|
||||
App::Color fcColor;
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
static QString labelFontQString();
|
||||
static double labelFontSizeMM();
|
||||
static double dimFontSizeMM();
|
||||
static double dimArrowSize();
|
||||
|
||||
static App::Color normalColor();
|
||||
static App::Color selectColor();
|
||||
@@ -74,6 +75,7 @@ public:
|
||||
static std::string lineGroupFile();
|
||||
|
||||
static const double DefaultFontSizeInMM;
|
||||
static const double DefaultArrowSize;
|
||||
|
||||
static std::string formatSpec();
|
||||
static int altDecimals();
|
||||
|
||||
@@ -74,10 +74,11 @@ void DlgPrefsTechDrawDimensionsImp::loadSettings()
|
||||
//Quantity widgets do not use preset value since they are based on
|
||||
//QAbstractSpinBox
|
||||
double fontDefault = Preferences::dimFontSizeMM();
|
||||
double arrowDefault = Preferences::dimArrowSize();
|
||||
ui->plsb_FontSize->setValue(fontDefault);
|
||||
// double arrowDefault = 5.0;
|
||||
// plsb_ArrowSize->setValue(arrowDefault);
|
||||
ui->plsb_ArrowSize->setValue(fontDefault);
|
||||
ui->plsb_ArrowSize->setValue(arrowDefault);
|
||||
|
||||
ui->pcbStandardAndStyle->onRestore();
|
||||
ui->cbGlobalDecimals->onRestore();
|
||||
|
||||
@@ -145,7 +145,7 @@ int PreferencesGui::dimArrowStyle()
|
||||
|
||||
double PreferencesGui::dimArrowSize()
|
||||
{
|
||||
return Preferences::getPreferenceGroup("Dimensions")->GetFloat("ArrowSize", Preferences::dimFontSizeMM());
|
||||
return Preferences::getPreferenceGroup("Dimensions")->GetFloat("ArrowSize", Preferences::dimArrowSize());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1267,7 +1267,9 @@ void QGIViewDimension::drawArrows(int count, const Base::Vector2d positions[], d
|
||||
}
|
||||
|
||||
arrow->setStyle(QGIArrow::getPrefArrowStyle());
|
||||
arrow->setSize(QGIArrow::getPrefArrowSize());
|
||||
auto vp = static_cast<ViewProviderDimension*>(getViewProvider(getViewObject()));
|
||||
auto arrowSize = vp->Arrowsize.getValue();
|
||||
arrow->setSize(arrowSize);
|
||||
arrow->setFlipped(flipped);
|
||||
|
||||
if (QGIArrow::getPrefArrowStyle() != 7) {// if not "None"
|
||||
@@ -2624,7 +2626,13 @@ double QGIViewDimension::getDefaultArrowTailLength() const
|
||||
{
|
||||
// Arrow length shall be equal to font height and both ISO and ASME seem
|
||||
// to have arrow tail twice the arrow length, so let's make it twice arrow size
|
||||
return QGIArrow::getPrefArrowSize() * 2.0;
|
||||
auto arrowSize = PreferencesGui::dimArrowSize();
|
||||
auto vp = static_cast<ViewProviderDimension*>(getViewProvider(getViewObject()));
|
||||
if (vp) {
|
||||
arrowSize = vp->Arrowsize.getValue();
|
||||
|
||||
}
|
||||
return arrowSize * 2.0;
|
||||
}
|
||||
|
||||
double QGIViewDimension::getDefaultIsoDimensionLineSpacing() const
|
||||
|
||||
@@ -70,6 +70,9 @@ ViewProviderDimension::ViewProviderDimension()
|
||||
ADD_PROPERTY_TYPE(Fontsize, (Preferences::dimFontSizeMM()),
|
||||
group, (App::PropertyType)(App::Prop_None),
|
||||
"Dimension text size in units");
|
||||
ADD_PROPERTY_TYPE(Arrowsize, (Preferences::dimArrowSize()),
|
||||
group, (App::PropertyType)(App::Prop_None),
|
||||
"Arrow size in units");
|
||||
ADD_PROPERTY_TYPE(LineWidth, (prefWeight()), group, (App::PropertyType)(App::Prop_None),
|
||||
"Dimension line width");
|
||||
ADD_PROPERTY_TYPE(Color, (prefColor()), group, App::Prop_None, "Color of the dimension");
|
||||
@@ -195,6 +198,7 @@ void ViewProviderDimension::onChanged(const App::Property* p)
|
||||
{
|
||||
if ((p == &Font) ||
|
||||
(p == &Fontsize) ||
|
||||
(p == &Arrowsize) ||
|
||||
(p == &LineWidth) ||
|
||||
(p == &StandardAndStyle) ||
|
||||
(p == &RenderingExtent) ||
|
||||
@@ -240,6 +244,11 @@ double ViewProviderDimension::prefFontSize() const
|
||||
return Preferences::dimFontSizeMM();
|
||||
}
|
||||
|
||||
double ViewProviderDimension::prefArrowSize() const
|
||||
{
|
||||
return Preferences::dimArrowSize();
|
||||
}
|
||||
|
||||
double ViewProviderDimension::prefWeight() const
|
||||
{
|
||||
return TechDraw::LineGroup::getDefaultWidth("Thin");
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
|
||||
App::PropertyFont Font;
|
||||
App::PropertyLength Fontsize;
|
||||
App::PropertyLength Arrowsize;
|
||||
App::PropertyLength LineWidth;
|
||||
App::PropertyColor Color;
|
||||
|
||||
@@ -81,6 +82,7 @@ public:
|
||||
App::Color prefColor() const;
|
||||
std::string prefFont() const;
|
||||
double prefFontSize() const;
|
||||
double prefArrowSize() const;
|
||||
double prefWeight() const;
|
||||
int prefStandardAndStyle() const;
|
||||
bool canDelete(App::DocumentObject* obj) const override;
|
||||
|
||||
@@ -7,16 +7,16 @@ namespace ZVALUE {
|
||||
//border/label const int border = 0;
|
||||
const int FACE = 10;
|
||||
const int HATCH = 30;
|
||||
const int HIDEDGE = 40;
|
||||
const int SECTIONFACE = 45;
|
||||
const int SECTIONHATCH = 46;
|
||||
const int EDGE = 50;
|
||||
const int VERTEX = 60;
|
||||
const int SECTIONFACE = 40;
|
||||
const int SECTIONHATCH = 41;
|
||||
const int HIGHLIGHT = 50;
|
||||
const int HIDEDGE = 60;
|
||||
const int EDGE = 70;
|
||||
const int VERTEX = 80;
|
||||
const int SECTIONLINE = 90;
|
||||
const int MATTING = 100;
|
||||
const int DIMENSION = 110;
|
||||
const int LABEL = 120;
|
||||
const int SECTIONLINE = 80; //TODO: change to "DECORATION"? section lines, symmetry lines, etc?
|
||||
const int HIGHLIGHT = 80;
|
||||
const int MATTING = 100;
|
||||
const int TRACKER = 125;
|
||||
const int LOCK = 200;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ endif()
|
||||
add_executable(Tests_run)
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(src)
|
||||
target_include_directories(Tests_run PUBLIC ${Python3_INCLUDE_DIRS})
|
||||
target_include_directories(Tests_run PUBLIC ${Python3_INCLUDE_DIRS} ${XercesC_INCLUDE_DIRS})
|
||||
target_link_libraries(Tests_run gtest_main ${Google_Tests_LIBS} FreeCADApp)
|
||||
|
||||
add_executable(Sketcher_tests_run)
|
||||
|
||||
Reference in New Issue
Block a user