Skip to content

Commit

Permalink
Merge branch 'master' into tledit_units
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfalck committed Dec 23, 2016
2 parents c84e766 + 21f430d commit 1d2c392
Show file tree
Hide file tree
Showing 149 changed files with 10,281 additions and 99,015 deletions.
2 changes: 1 addition & 1 deletion src/3rdParty/salomesmesh/src/SMESHDS/SMESHDS_SubMesh.cpp
Expand Up @@ -121,7 +121,7 @@ bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDele
}
if (!IsComplexSubmesh())
{
if ( ME->getshapeId() != myIndex ) // elem not in a pool can loose it's data already
if ( ME->getshapeId() != myIndex ) // elem not in a pool can lose its data already
{
if ( isElemDeleted )
for ( size_t i = 0; i < myElements.size(); ++i )
Expand Down
2 changes: 1 addition & 1 deletion src/App/PropertyFile.cpp
Expand Up @@ -182,7 +182,7 @@ void PropertyFileIncluded::setValue(const char* sFile, const char* sName)
// directory:
// When a file is read-only it is supposed to be assigned to a
// PropertyFileIncluded instance. In this case we must copy the
// file because otherwise the above instance looses its data.
// file because otherwise the above instance loses its data.
// If the file is writable it is supposed to be of free use and
// it can be simply renamed.

Expand Down
4 changes: 3 additions & 1 deletion src/Base/Unit.cpp
Expand Up @@ -485,7 +485,8 @@ QString Unit::getTypeString(void) const
if(*this == Unit::ThermalExpansionCoefficient ) return QString::fromLatin1("ThermalExpansionCoefficient"); else
if(*this == Unit::SpecificHeat ) return QString::fromLatin1("SpecificHeat"); else
if(*this == Unit::ThermalTransferCoefficient ) return QString::fromLatin1("ThermalTransferCoefficient"); else

if(*this == Unit::HeatFlux ) return QString::fromLatin1("HeatFlux"); else

return QString();

}
Expand Down Expand Up @@ -517,3 +518,4 @@ Unit Unit::ThermalConductivity (1,1,-3,0,-1);
Unit Unit::ThermalExpansionCoefficient (0,0,0,0,-1);
Unit Unit::SpecificHeat (2,0,-2,0,-1);
Unit Unit::ThermalTransferCoefficient (0,1,-3,0,-1);
Unit Unit::HeatFlux (0,1,-3,0,0);
1 change: 1 addition & 0 deletions src/Base/Unit.h
Expand Up @@ -120,6 +120,7 @@ class BaseExport Unit
static Unit ThermalExpansionCoefficient;
static Unit SpecificHeat;
static Unit ThermalTransferCoefficient;
static Unit HeatFlux;

//@}
protected:
Expand Down
8 changes: 8 additions & 0 deletions src/Base/UnitsSchemaCentimeters.cpp
Expand Up @@ -54,6 +54,14 @@ QString UnitsSchemaCentimeters::schemaTranslate(const Base::Quantity& quant, dou
unitString = QString::fromLatin1("m^3");
factor = 1000000000.0;
}
else if (unit == Unit::Power) {
unitString = QString::fromLatin1("W");
factor = 1000000;
}
else if (unit == Unit::HeatFlux) {
unitString = QString::fromLatin1("W/m^2");
factor = 1.0;
}
else {
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();
Expand Down
8 changes: 8 additions & 0 deletions src/Base/UnitsSchemaInternal.cpp
Expand Up @@ -155,6 +155,14 @@ QString UnitsSchemaInternal::schemaTranslate(const Quantity &quant, double &fact
factor = 0.001;
}
}
else if (unit == Unit::Power) {
unitString = QString::fromLatin1("W");
factor = 1000000;
}
else if (unit == Unit::HeatFlux) {
unitString = QString::fromLatin1("W/m^2");
factor = 1.0;
}
else {
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();
Expand Down
8 changes: 8 additions & 0 deletions src/Base/UnitsSchemaMKS.cpp
Expand Up @@ -156,6 +156,14 @@ QString UnitsSchemaMKS::schemaTranslate(const Quantity &quant, double &factor, Q
unitString = QString::fromLatin1("W/m^2/K");
factor = 1.0;
}
else if (unit == Unit::Power) {
unitString = QString::fromLatin1("W");
factor = 1000000;
}
else if (unit == Unit::HeatFlux) {
unitString = QString::fromLatin1("W/m^2");
factor = 1.0;
}
else {
// default action for all cases without special treatment:
unitString = quant.getUnit().getString();
Expand Down
42 changes: 42 additions & 0 deletions src/Gui/CommandView.cpp
Expand Up @@ -906,6 +906,47 @@ bool StdCmdHideSelection::isActive(void)
return (Gui::Selection().size() != 0);
}

//===========================================================================
// Std_SelectVisibleObjects
//===========================================================================
DEF_STD_CMD_A(StdCmdSelectVisibleObjects)

StdCmdSelectVisibleObjects::StdCmdSelectVisibleObjects()
: Command("Std_SelectVisibleObjects")
{
sGroup = QT_TR_NOOP("Standard-View");
sMenuText = QT_TR_NOOP("Select visible objects");
sToolTipText = QT_TR_NOOP("Select visible objects in the active document");
sStatusTip = QT_TR_NOOP("Select visible objects in the active document");
sWhatsThis = "Std_SelectVisibleObjects";
eType = Alter3DView;
}

void StdCmdSelectVisibleObjects::activated(int iMsg)
{
Q_UNUSED(iMsg);
// go through active document
Gui::Document* doc = Application::Instance->activeDocument();
App::Document* app = doc->getDocument();
const std::vector<App::DocumentObject*> obj = app->getObjectsOfType
(App::DocumentObject::getClassTypeId());

std::vector<App::DocumentObject*> visible;
visible.reserve(obj.size());
for (std::vector<App::DocumentObject*>::const_iterator it=obj.begin();it!=obj.end();++it) {
if (doc->isShow((*it)->getNameInDocument()))
visible.push_back(*it);
}

SelectionSingleton& rSel = Selection();
rSel.setSelection(app->getName(), visible);
}

bool StdCmdSelectVisibleObjects::isActive(void)
{
return App::GetApplication().getActiveDocument();
}

//===========================================================================
// Std_ToggleObjects
//===========================================================================
Expand Down Expand Up @@ -2649,6 +2690,7 @@ void CreateViewStdCommands(void)
rcCmdMgr.addCommand(new StdCmdToggleSelectability());
rcCmdMgr.addCommand(new StdCmdShowSelection());
rcCmdMgr.addCommand(new StdCmdHideSelection());
rcCmdMgr.addCommand(new StdCmdSelectVisibleObjects());
rcCmdMgr.addCommand(new StdCmdToggleObjects());
rcCmdMgr.addCommand(new StdCmdShowObjects());
rcCmdMgr.addCommand(new StdCmdHideObjects());
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/DlgUnitsCalculatorImp.cpp
Expand Up @@ -71,7 +71,7 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl )
<< Base::Unit::AmountOfSubstance << Base::Unit::LuminoseIntensity << Base::Unit::Stress
<< Base::Unit::Pressure << Base::Unit::Force << Base::Unit::Work << Base::Unit::Power
<< Base::Unit::ThermalConductivity << Base::Unit::ThermalExpansionCoefficient
<< Base::Unit::SpecificHeat << Base::Unit::ThermalTransferCoefficient;
<< Base::Unit::SpecificHeat << Base::Unit::ThermalTransferCoefficient <<Base::Unit::HeatFlux;
for (QList<Base::Unit>::iterator it = units.begin(); it != units.end(); ++it) {
ui->unitsBox->addItem(it->getTypeString());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/MDIView.cpp
Expand Up @@ -178,7 +178,7 @@ void MDIView::closeEvent(QCloseEvent *e)
}

// Note: When using QMdiArea we must not use removeWindow()
// because otherwise the QMdiSubWindow will loose its parent
// because otherwise the QMdiSubWindow will lose its parent
// and thus the notification in QMdiSubWindow::closeEvent of
// other mdi windows to get maximized if this window
// is maximized will fail.
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/MainWindow.cpp
Expand Up @@ -783,7 +783,7 @@ void MainWindow::removeWindow(Gui::MDIView* view)

QWidget* parent = view->parentWidget();
// The call of 'd->mdiArea->removeSubWindow(parent)' causes the QMdiSubWindow
// to loose its parent and thus the notification in QMdiSubWindow::closeEvent
// to lose its parent and thus the notification in QMdiSubWindow::closeEvent
// of other mdi windows to get maximized if this window is maximized will fail.
// However, we must let it here otherwise deleting MDI child views directly can
// cause other problems.
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/ProgressBar.h
Expand Up @@ -175,7 +175,7 @@ protected Q_SLOTS:
void resetObserveEventFilter();
/** Gets the events under control */
void enterControlEvents();
/** Looses the control over incoming events*/
/** Loses the control over incoming events*/
void leaveControlEvents();
//@}
ProgressBarPrivate* d;
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/Selection.cpp
Expand Up @@ -382,7 +382,7 @@ std::vector<SelectionObject> SelectionSingleton::getSelectionEx(const char* pDoc
}
}

// The map looses the order thus we have to go again through the list and pick up the SelectionObject from the map
// The map loses the order thus we have to go again through the list and pick up the SelectionObject from the map
for (std::list<_SelObj>::const_iterator It = _SelList.begin();It != _SelList.end();++It) {
std::map<App::DocumentObject*,SelectionObject>::iterator Jt = SortMap.find(It->pObject);
if (Jt != SortMap.end()) {
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/TextEdit.cpp
Expand Up @@ -156,7 +156,7 @@ void TextEdit::complete()

/**
* Creates the listbox containing all possibilities for the completion.
* The listbox is closed when ESC is pressed, the text edit field looses focus or a
* The listbox is closed when ESC is pressed, the text edit field loses focus or a
* mouse button was pressed.
*/
void TextEdit::createListBox()
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/View3DInventor.cpp
Expand Up @@ -974,7 +974,7 @@ void View3DInventor::setCurrentViewMode(ViewMode newmode)
// be avoided because when two or more windows are either in 'TopLevel' or 'Fullscreen'
// mode only the last window gets all key event even if it is not the active one.
//
// It is important to set the focus proxy to get all key events otherwise we would loose
// It is important to set the focus proxy to get all key events otherwise we would lose
// control after redirecting the first key event to the GL widget.
if (oldmode == Child) {
// To make a global shortcut working from this window we need to add
Expand Down
33 changes: 24 additions & 9 deletions src/Gui/ViewProvider.cpp
Expand Up @@ -265,7 +265,21 @@ SbMatrix ViewProvider::convert(const Base::Matrix4D &rcMatrix) const

void ViewProvider::addDisplayMaskMode(SoNode *node, const char* type)
{
node->setName(type);
if (type) {
std::string name = type;
for (std::string::iterator it = name.begin(); it != name.end(); ++it) {
if (it == name.begin()) {
if (!SbName::isBaseNameStartChar(*it))
*it = '_';
}
else {
if (!SbName::isBaseNameChar(*it))
*it = '_';
}
}
node->setName(name.c_str());
}

_sDisplayMaskModes[type] = pcModeSwitch->getNumChildren();
pcModeSwitch->addChild(node);
}
Expand Down Expand Up @@ -397,9 +411,8 @@ void ViewProvider::setModeSwitch()
{
if (viewOverrideMode == -1)
pcModeSwitch->whichChild = _iActualMode;
else
if (viewOverrideMode < pcModeSwitch->getNumChildren())
pcModeSwitch->whichChild = viewOverrideMode;
else if (viewOverrideMode < pcModeSwitch->getNumChildren())
pcModeSwitch->whichChild = viewOverrideMode;
}

void ViewProvider::setDefaultMode(int val)
Expand Down Expand Up @@ -533,7 +546,7 @@ bool ViewProvider::mouseButtonPressed(int button, bool pressed,
(void)cursorPos;
(void)viewer;
return false;
}
}

bool ViewProvider::onDelete(const vector< string >& subNames) {
bool del = true;
Expand All @@ -547,19 +560,21 @@ bool ViewProvider::onDelete(const vector< string >& subNames) {
bool ViewProvider::canDragObject(App::DocumentObject* obj) const {

auto vector = getExtensionsDerivedFromType<Gui::ViewProviderExtension>();
for(Gui::ViewProviderExtension* ext : vector)
for(Gui::ViewProviderExtension* ext : vector) {
if(ext->extensionCanDragObject(obj))
return true;
}

return false;
}

bool ViewProvider::canDragObjects() const {

auto vector = getExtensionsDerivedFromType<Gui::ViewProviderExtension>();
for(Gui::ViewProviderExtension* ext : vector)
for(Gui::ViewProviderExtension* ext : vector) {
if(ext->extensionCanDragObjects())
return true;
}

return false;
}
Expand All @@ -574,7 +589,7 @@ void ViewProvider::dragObject(App::DocumentObject* obj) {
}
}

throw Base::Exception("ViewProvider::dragObject: no extension for draging given object available.");
throw Base::Exception("ViewProvider::dragObject: no extension for dragging given object available.");
}


Expand Down Expand Up @@ -615,7 +630,7 @@ void ViewProvider::dropObject(App::DocumentObject* obj) {
}
}

throw Base::Exception("ViewProvider::dropObject: no extension for droping given object available.");
throw Base::Exception("ViewProvider::dropObject: no extension for dropping given object available.");
}

void ViewProvider::Restore(Base::XMLReader& reader) {
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/ViewProvider.h
Expand Up @@ -255,7 +255,7 @@ class GuiExport ViewProvider : public App::TransactionalObject
protected:
/// is called by the document when the provider goes in edit mode
virtual bool setEdit(int ModNum);
/// is called when you loose the edit mode
/// is called when you lose the edit mode
virtual void unsetEdit(int ModNum);
/// return the edit mode or -1 if nothing is being edited
int getEditingMode() const;
Expand Down
14 changes: 8 additions & 6 deletions src/Gui/ViewProviderGroupExtension.cpp
Expand Up @@ -46,7 +46,6 @@ EXTENSION_PROPERTY_SOURCE(Gui::ViewProviderGroupExtension, Gui::ViewProviderExte
ViewProviderGroupExtension::ViewProviderGroupExtension() : visible(false)
{
initExtension(ViewProviderGroupExtension::getExtensionClassTypeId());

}

ViewProviderGroupExtension::~ViewProviderGroupExtension()
Expand Down Expand Up @@ -77,7 +76,9 @@ bool ViewProviderGroupExtension::extensionCanDropObjects() const {

bool ViewProviderGroupExtension::extensionCanDropObject(App::DocumentObject* obj) const {

Base::Console().Message("Check ViewProviderGroupExtension");
#ifdef FC_DEBUG
Base::Console().Log("Check ViewProviderGroupExtension");
#endif

auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>();

Expand All @@ -86,12 +87,13 @@ bool ViewProviderGroupExtension::extensionCanDropObject(App::DocumentObject* obj
return false;

//group into group?
if (obj->hasExtension(App::GroupExtension::getExtensionClassTypeId()))
if (group->isChildOf(obj->getExtensionByType<App::GroupExtension>()))
return false;
if (obj->hasExtension(App::GroupExtension::getExtensionClassTypeId())) {
if (group->isChildOf(obj->getExtensionByType<App::GroupExtension>()))
return false;
}

//We need to find the correct App extension to ask if this is a supported type, there should only be one
if(group->allowObject(obj))
if (group->allowObject(obj))
return true;

return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/ViewProviderPythonFeature.h
Expand Up @@ -387,7 +387,7 @@ class ViewProviderPythonFeatureT : public ViewProviderT
if (!ok) ok = ViewProviderT::setEdit(ModNum);
return ok;
}
/// is called when you loose the edit mode
/// is called when you lose the edit mode
virtual void unsetEdit(int ModNum)
{
bool ok = imp->unsetEdit(ModNum);
Expand Down
1 change: 1 addition & 0 deletions src/Gui/Workbench.cpp
Expand Up @@ -531,6 +531,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
MenuItem* visu = new MenuItem;
visu->setCommand("Visibility");
*visu << "Std_ToggleVisibility" << "Std_ShowSelection" << "Std_HideSelection"
<< "Std_SelectVisibleObjects"
<< "Separator" << "Std_ToggleObjects" << "Std_ShowObjects" << "Std_HideObjects"
<< "Separator" << "Std_ToggleSelectability"
<< "Separator" << "View_Measure_Toggle_All" << "View_Measure_Clear_All";
Expand Down

0 comments on commit 1d2c392

Please sign in to comment.