Material: Material handling enhancements
Rework of the material handling system. This first part concntrates on a rework of the material cards. Rather than use a fixed list of possible properties, properties can be defined separately in their own files and mixed to provide a complete list of possible properties. Properties can be inherited. The cards then provide values for the properties. These can also be inherited allowing for small changes in cards as required. The new property definitions are more extensive than previously. 2 and 3 dimensional arrays of properties can be defined. Values are obtained by calling an API instead of reading from a dictionary. For compatibility, a Python dictionary of values can be obtained similar to how it was done previously, but this is considered a deprecated API and won't support the newer advanced features. The editor is completely reworked. It will be able to edit older format material cards, but can only save them in the new format. For testing during the development phase, a system preference can specifiy wether the old or new material editors are to be used. This option will be removed before release.
This commit is contained in:
@@ -1,25 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
* as published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* for detail see the LICENCE text file. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* FreeCAD is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with FreeCAD; if not, write to the Free Software *
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
* USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
@@ -34,6 +32,7 @@
|
||||
#include <Gui/WidgetFactory.h>
|
||||
|
||||
#include "DlgSettingsMaterial.h"
|
||||
#include "Workbench.h"
|
||||
|
||||
// use a different name to CreateCommand()
|
||||
void CreateMaterialCommands();
|
||||
@@ -54,7 +53,7 @@ public:
|
||||
Module()
|
||||
: Py::ExtensionModule<Module>("MatGui")
|
||||
{
|
||||
initialize("This module is the MatGui module.");// register with Python
|
||||
initialize("This module is the MatGui module."); // register with Python
|
||||
}
|
||||
|
||||
~Module() override
|
||||
@@ -68,7 +67,7 @@ PyObject* initModule()
|
||||
return Base::Interpreter().addModule(new Module);
|
||||
}
|
||||
|
||||
}// namespace MatGui
|
||||
} // namespace MatGui
|
||||
|
||||
PyMOD_INIT_FUNC(MatGui)
|
||||
{
|
||||
@@ -90,6 +89,8 @@ PyMOD_INIT_FUNC(MatGui)
|
||||
|
||||
Base::Console().Log("Loading GUI of Material module... done\n");
|
||||
|
||||
MatGui::Workbench ::init();
|
||||
|
||||
// instantiating the commands
|
||||
CreateMaterialCommands();
|
||||
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
@@ -56,7 +55,8 @@ Array2D::Array2D(const QString& propertyName, Materials::Material* material, QWi
|
||||
_property = nullptr;
|
||||
}
|
||||
if (_property) {
|
||||
_value = static_cast<Materials::Material2DArray*>(_property->getMaterialValue());
|
||||
_value =
|
||||
std::static_pointer_cast<Materials::Material2DArray>(_property->getMaterialValue());
|
||||
}
|
||||
else {
|
||||
_value = nullptr;
|
||||
@@ -76,7 +76,7 @@ void Array2D::setupDefault()
|
||||
}
|
||||
|
||||
try {
|
||||
Materials::MaterialProperty& column1 = _property->getColumn(0);
|
||||
const Materials::MaterialProperty& column1 = _property->getColumn(0);
|
||||
QString label = QString::fromStdString("Default ") + column1.getName();
|
||||
ui->labelDefault->setText(label);
|
||||
if (column1.getPropertyType() == QString::fromStdString("Quantity")) {
|
||||
@@ -118,7 +118,7 @@ void Array2D::setColumnDelegates(QTableView* table)
|
||||
{
|
||||
int length = _property->columns();
|
||||
for (int i = 0; i < length; i++) {
|
||||
Materials::MaterialProperty& column = _property->getColumn(i);
|
||||
const Materials::MaterialProperty& column = _property->getColumn(i);
|
||||
table->setItemDelegateForColumn(
|
||||
i,
|
||||
new ArrayDelegate(column.getType(), column.getUnits(), this));
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MATGUI_ARRAY2D_H
|
||||
#define MATGUI_ARRAY2D_H
|
||||
@@ -53,8 +52,8 @@ public:
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_Array2D> ui;
|
||||
Materials::MaterialProperty* _property;
|
||||
Materials::Material2DArray* _value;
|
||||
const Materials::MaterialProperty* _property;
|
||||
std::shared_ptr<Materials::Material2DArray> _value;
|
||||
|
||||
void setupDefault();
|
||||
void setHeaders(QStandardItemModel* model);
|
||||
@@ -63,6 +62,6 @@ private:
|
||||
void setupArray();
|
||||
};
|
||||
|
||||
}// namespace MatGui
|
||||
} // namespace MatGui
|
||||
|
||||
#endif// MATGUI_ARRAY2D_H
|
||||
#endif // MATGUI_ARRAY2D_H
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
@@ -55,7 +54,8 @@ Array3D::Array3D(const QString& propertyName, Materials::Material* material, QWi
|
||||
_property = nullptr;
|
||||
}
|
||||
if (_property) {
|
||||
_value = static_cast<Materials::Material3DArray*>(_property->getMaterialValue());
|
||||
_value =
|
||||
std::static_pointer_cast<Materials::Material3DArray>(_property->getMaterialValue());
|
||||
}
|
||||
else {
|
||||
_value = nullptr;
|
||||
@@ -95,7 +95,7 @@ void Array3D::setupDefault()
|
||||
}
|
||||
|
||||
try {
|
||||
Materials::MaterialProperty& column1 = _property->getColumn(0);
|
||||
auto& column1 = _property->getColumn(0);
|
||||
QString label = QString::fromStdString("Default ") + column1.getName();
|
||||
ui->labelDefault->setText(label);
|
||||
if (column1.getPropertyType() == QString::fromStdString("Quantity")) {
|
||||
@@ -122,7 +122,7 @@ void Array3D::defaultValueChanged(const Base::Quantity& value)
|
||||
|
||||
void Array3D::setDepthColumnDelegate(QTableView* table)
|
||||
{
|
||||
Materials::MaterialProperty& column = _property->getColumn(0);
|
||||
auto& column = _property->getColumn(0);
|
||||
table->setItemDelegateForColumn(0,
|
||||
new ArrayDelegate(column.getType(), column.getUnits(), this));
|
||||
}
|
||||
@@ -159,7 +159,7 @@ void Array3D::setColumnDelegates(QTableView* table)
|
||||
{
|
||||
int length = _property->columns();
|
||||
for (int i = 0; i < length; i++) {
|
||||
Materials::MaterialProperty& column = _property->getColumn(i);
|
||||
auto& column = _property->getColumn(i);
|
||||
table->setItemDelegateForColumn(
|
||||
i,
|
||||
new ArrayDelegate(column.getType(), column.getUnits(), this));
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MATGUI_ARRAY3D_H
|
||||
#define MATGUI_ARRAY3D_H
|
||||
@@ -50,8 +49,8 @@ public:
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_Array3D> ui;
|
||||
Materials::MaterialProperty* _property;
|
||||
Materials::Material3DArray* _value;
|
||||
const Materials::MaterialProperty* _property;
|
||||
std::shared_ptr<Materials::Material3DArray> _value;
|
||||
|
||||
void setupDefault();
|
||||
void setDepthColumnWidth(QTableView* table);
|
||||
@@ -62,6 +61,6 @@ private:
|
||||
void setupArray();
|
||||
};
|
||||
|
||||
}// namespace MatGui
|
||||
} // namespace MatGui
|
||||
|
||||
#endif// MATGUI_ARRAY3D_H
|
||||
#endif // MATGUI_ARRAY3D_H
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MATGUI_ArrayDelegate_H
|
||||
#define MATGUI_ArrayDelegate_H
|
||||
@@ -70,6 +69,6 @@ private:
|
||||
QWidget* createWidget(QWidget* parent, const QVariant& item) const;
|
||||
};
|
||||
|
||||
}// namespace MatGui
|
||||
} // namespace MatGui
|
||||
|
||||
#endif// MATGUI_ArrayDelegate_H
|
||||
#endif // MATGUI_ArrayDelegate_H
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
@@ -47,8 +46,8 @@ AbstractArrayModel::AbstractArrayModel(QObject* parent)
|
||||
//===
|
||||
|
||||
|
||||
Array2DModel::Array2DModel(Materials::MaterialProperty* property,
|
||||
Materials::Material2DArray* value,
|
||||
Array2DModel::Array2DModel(const Materials::MaterialProperty* property,
|
||||
std::shared_ptr<Materials::Material2DArray> value,
|
||||
QObject* parent)
|
||||
: AbstractArrayModel(parent)
|
||||
, _property(property)
|
||||
@@ -58,10 +57,10 @@ Array2DModel::Array2DModel(Materials::MaterialProperty* property,
|
||||
int Array2DModel::rowCount(const QModelIndex& parent) const
|
||||
{
|
||||
if (parent.isValid()) {
|
||||
return 0;// No children
|
||||
return 0; // No children
|
||||
}
|
||||
|
||||
return _value->rows() + 1;// Will always have 1 empty row
|
||||
return _value->rows() + 1; // Will always have 1 empty row
|
||||
}
|
||||
|
||||
bool Array2DModel::newRow(const QModelIndex& index) const
|
||||
@@ -105,7 +104,7 @@ QVariant Array2DModel::headerData(int section, Qt::Orientation orientation, int
|
||||
{
|
||||
if (role == Qt::DisplayRole) {
|
||||
if (orientation == Qt::Horizontal) {
|
||||
Materials::MaterialProperty& column = _property->getColumn(section);
|
||||
const Materials::MaterialProperty& column = _property->getColumn(section);
|
||||
return QVariant(column.getName());
|
||||
}
|
||||
else if (orientation == Qt::Vertical) {
|
||||
@@ -188,8 +187,8 @@ bool Array2DModel::removeColumns(int column, int count, const QModelIndex& paren
|
||||
|
||||
//===
|
||||
|
||||
Array3DDepthModel::Array3DDepthModel(Materials::MaterialProperty* property,
|
||||
Materials::Material3DArray* value,
|
||||
Array3DDepthModel::Array3DDepthModel(const Materials::MaterialProperty* property,
|
||||
std::shared_ptr<Materials::Material3DArray> value,
|
||||
QObject* parent)
|
||||
: AbstractArrayModel(parent)
|
||||
, _property(property)
|
||||
@@ -199,10 +198,10 @@ Array3DDepthModel::Array3DDepthModel(Materials::MaterialProperty* property,
|
||||
int Array3DDepthModel::rowCount(const QModelIndex& parent) const
|
||||
{
|
||||
if (parent.isValid()) {
|
||||
return 0;// No children
|
||||
return 0; // No children
|
||||
}
|
||||
|
||||
return _value->depth() + 1;// Will always have 1 empty row
|
||||
return _value->depth() + 1; // Will always have 1 empty row
|
||||
}
|
||||
|
||||
bool Array3DDepthModel::newRow(const QModelIndex& index) const
|
||||
@@ -239,7 +238,7 @@ QVariant Array3DDepthModel::headerData(int section, Qt::Orientation orientation,
|
||||
{
|
||||
if (role == Qt::DisplayRole) {
|
||||
if (orientation == Qt::Horizontal) {
|
||||
Materials::MaterialProperty& column = _property->getColumn(section);
|
||||
const Materials::MaterialProperty& column = _property->getColumn(section);
|
||||
return QVariant(column.getName());
|
||||
}
|
||||
else if (orientation == Qt::Vertical) {
|
||||
@@ -322,8 +321,8 @@ bool Array3DDepthModel::removeColumns(int column, int count, const QModelIndex&
|
||||
|
||||
//===
|
||||
|
||||
Array3DModel::Array3DModel(Materials::MaterialProperty* property,
|
||||
Materials::Material3DArray* value,
|
||||
Array3DModel::Array3DModel(const Materials::MaterialProperty* property,
|
||||
std::shared_ptr<Materials::Material3DArray> value,
|
||||
QObject* parent)
|
||||
: AbstractArrayModel(parent)
|
||||
, _property(property)
|
||||
@@ -333,10 +332,10 @@ Array3DModel::Array3DModel(Materials::MaterialProperty* property,
|
||||
int Array3DModel::rowCount(const QModelIndex& parent) const
|
||||
{
|
||||
if (parent.isValid()) {
|
||||
return 0;// No children
|
||||
return 0; // No children
|
||||
}
|
||||
|
||||
return _value->depth() + 1;// Will always have 1 empty row
|
||||
return _value->depth() + 1; // Will always have 1 empty row
|
||||
}
|
||||
|
||||
int Array3DModel::columnCount(const QModelIndex& parent) const
|
||||
@@ -384,7 +383,7 @@ QVariant Array3DModel::headerData(int section, Qt::Orientation orientation, int
|
||||
{
|
||||
if (role == Qt::DisplayRole) {
|
||||
if (orientation == Qt::Horizontal) {
|
||||
Materials::MaterialProperty& column = _property->getColumn(section + 1);
|
||||
const Materials::MaterialProperty& column = _property->getColumn(section + 1);
|
||||
return QVariant(column.getName());
|
||||
}
|
||||
else if (orientation == Qt::Vertical) {
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MATGUI_ARRAYMODEL_H
|
||||
#define MATGUI_ARRAYMODEL_H
|
||||
@@ -46,8 +45,8 @@ public:
|
||||
class Array2DModel: public AbstractArrayModel
|
||||
{
|
||||
public:
|
||||
explicit Array2DModel(Materials::MaterialProperty* property = nullptr,
|
||||
Materials::Material2DArray* value = nullptr,
|
||||
explicit Array2DModel(const Materials::MaterialProperty* property = nullptr,
|
||||
std::shared_ptr<Materials::Material2DArray> value = nullptr,
|
||||
QObject* parent = nullptr);
|
||||
~Array2DModel() override = default;
|
||||
|
||||
@@ -68,15 +67,15 @@ public:
|
||||
bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override;
|
||||
|
||||
private:
|
||||
Materials::MaterialProperty* _property;
|
||||
Materials::Material2DArray* _value;
|
||||
const Materials::MaterialProperty* _property;
|
||||
std::shared_ptr<Materials::Material2DArray> _value;
|
||||
};
|
||||
|
||||
class Array3DDepthModel: public AbstractArrayModel
|
||||
{
|
||||
public:
|
||||
explicit Array3DDepthModel(Materials::MaterialProperty* property = nullptr,
|
||||
Materials::Material3DArray* value = nullptr,
|
||||
explicit Array3DDepthModel(const Materials::MaterialProperty* property = nullptr,
|
||||
std::shared_ptr<Materials::Material3DArray> value = nullptr,
|
||||
QObject* parent = nullptr);
|
||||
~Array3DDepthModel() override = default;
|
||||
|
||||
@@ -101,15 +100,15 @@ public:
|
||||
bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override;
|
||||
|
||||
private:
|
||||
Materials::MaterialProperty* _property;
|
||||
Materials::Material3DArray* _value;
|
||||
const Materials::MaterialProperty* _property;
|
||||
std::shared_ptr<Materials::Material3DArray> _value;
|
||||
};
|
||||
|
||||
class Array3DModel: public AbstractArrayModel
|
||||
{
|
||||
public:
|
||||
explicit Array3DModel(Materials::MaterialProperty* property = nullptr,
|
||||
Materials::Material3DArray* value = nullptr,
|
||||
explicit Array3DModel(const Materials::MaterialProperty* property = nullptr,
|
||||
std::shared_ptr<Materials::Material3DArray> value = nullptr,
|
||||
QObject* parent = nullptr);
|
||||
~Array3DModel() override = default;
|
||||
|
||||
@@ -130,10 +129,10 @@ public:
|
||||
bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override;
|
||||
|
||||
private:
|
||||
Materials::MaterialProperty* _property;
|
||||
Materials::Material3DArray* _value;
|
||||
const Materials::MaterialProperty* _property;
|
||||
std::shared_ptr<Materials::Material3DArray> _value;
|
||||
};
|
||||
|
||||
}// namespace MatGui
|
||||
} // namespace MatGui
|
||||
|
||||
#endif// MATGUI_ARRAYMODEL_H
|
||||
#endif // MATGUI_ARRAYMODEL_H
|
||||
|
||||
@@ -30,7 +30,7 @@ list(APPEND MatGui_LIBS
|
||||
${QtConcurrent_LIBRARIES}
|
||||
)
|
||||
|
||||
set (Material_TR_QRC ${CMAKE_CURRENT_BINARY_DIR}/Resources/Material_translation.qrc)
|
||||
set(Material_TR_QRC ${CMAKE_CURRENT_BINARY_DIR}/Resources/Material_translation.qrc)
|
||||
qt_find_and_add_translation(QM_SRCS "Resources/translations/*_*.ts"
|
||||
${CMAKE_CURRENT_BINARY_DIR}/Resources/translations)
|
||||
qt_create_resource_file(${Material_TR_QRC} ${QM_SRCS})
|
||||
@@ -76,6 +76,8 @@ SET(MatGui_SRCS
|
||||
ModelSelect.ui
|
||||
PreCompiled.cpp
|
||||
PreCompiled.h
|
||||
Workbench.cpp
|
||||
Workbench.h
|
||||
)
|
||||
|
||||
if(FREECAD_USE_PCH)
|
||||
@@ -96,7 +98,6 @@ SET(MatGuiIcon_SVG
|
||||
add_library(MatGui SHARED ${MatGui_SRCS} ${MatGuiIcon_SVG})
|
||||
target_link_libraries(MatGui ${MatGui_LIBS})
|
||||
|
||||
|
||||
SET_BIN_DIR(MatGui MatGui /Mod/Material)
|
||||
SET_PYTHON_PREFIX_SUFFIX(MatGui)
|
||||
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2018 FreeCAD Developers *
|
||||
* Author: Bernd Hahnebach <bernd@bimstatik.ch> *
|
||||
* Based on src/Mod/Fem/Gui/DlgSettingsFemElmerImp.cpp *
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
/**************************************************************************
|
||||
* Copyright (c) 2018 FreeCAD Developers *
|
||||
* Author: Bernd Hahnebach <bernd@bimstatik.ch> *
|
||||
* Based on src/Mod/Fem/Gui/DlgSettingsFemElmer.h *
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MATGUI_DLGSETTINGSMATERIAL_H
|
||||
#define MATGUI_DLGSETTINGSMATERIAL_H
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
@@ -112,7 +111,7 @@ bool MaterialDelegate::editorEvent(QEvent* event,
|
||||
|
||||
void MaterialDelegate::showColorModal(QStandardItem* item)
|
||||
{
|
||||
QColor currentColor;// = d->col;
|
||||
QColor currentColor; // = d->col;
|
||||
currentColor.setRgba(parseColor(item->text()));
|
||||
QColorDialog* dlg = new QColorDialog(currentColor);
|
||||
|
||||
@@ -275,7 +274,7 @@ QSize MaterialDelegate::sizeHint(const QStyleOptionViewItem& option, const QMode
|
||||
|
||||
std::string type = propertyType.toStdString();
|
||||
if (type == "Color") {
|
||||
return QSize(75, 23);// Standard QPushButton size
|
||||
return QSize(75, 23); // Standard QPushButton size
|
||||
}
|
||||
else if (type == "2DArray" || type == "3DArray") {
|
||||
return QSize(23, 23);
|
||||
@@ -421,7 +420,7 @@ QWidget* MaterialDelegate::createWidget(QWidget* parent,
|
||||
Gui::InputField* input = new Gui::InputField();
|
||||
input->setMinimum(std::numeric_limits<double>::min());
|
||||
input->setMaximum(std::numeric_limits<double>::max());
|
||||
input->setUnitText(propertyUnits);// TODO: Ensure this exists
|
||||
input->setUnitText(propertyUnits); // TODO: Ensure this exists
|
||||
input->setPrecision(6);
|
||||
input->setQuantityString(propertyValue);
|
||||
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MATGUI_MATERIALDELEGATE_H
|
||||
#define MATGUI_MATERIALDELEGATE_H
|
||||
@@ -46,7 +45,7 @@ class MaterialDelegate: public QStyledItemDelegate
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MaterialDelegate(QObject* parent = nullptr);
|
||||
virtual ~MaterialDelegate() = default;
|
||||
~MaterialDelegate() override = default;
|
||||
|
||||
QWidget* createEditor(QWidget* parent,
|
||||
const QStyleOptionViewItem&,
|
||||
@@ -82,6 +81,6 @@ private:
|
||||
void showArray3DModal(const QString& propertyName, QStandardItem* item);
|
||||
};
|
||||
|
||||
}// namespace MatGui
|
||||
} // namespace MatGui
|
||||
|
||||
#endif// MATGUI_MATERIALDELEGATE_H
|
||||
#endif // MATGUI_MATERIALDELEGATE_H
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
@@ -56,7 +55,7 @@ MaterialSave::MaterialSave(Materials::Material* material, QWidget* parent)
|
||||
else {
|
||||
ui->editFilename->setText(QString::fromStdString("NewMaterial.FCMat"));
|
||||
}
|
||||
_filename = QString(ui->editFilename->text());// No filename by default
|
||||
_filename = QString(ui->editFilename->text()); // No filename by default
|
||||
|
||||
connect(ui->standardButtons->button(QDialogButtonBox::Ok),
|
||||
&QPushButton::clicked,
|
||||
@@ -97,7 +96,7 @@ void MaterialSave::onOk(bool checked)
|
||||
Base::Console().Log("name '%s'\n", _filename.toStdString().c_str());
|
||||
if (name != _material->getName()) {
|
||||
_material->setName(name);
|
||||
_material->setEditStateAlter();// ? Does a name change count?
|
||||
_material->setEditStateAlter(); // ? Does a name change count?
|
||||
}
|
||||
|
||||
auto variant = ui->comboLibrary->currentData();
|
||||
@@ -132,8 +131,8 @@ void MaterialSave::reject()
|
||||
|
||||
void MaterialSave::setLibraries()
|
||||
{
|
||||
std::list<Materials::MaterialLibrary*>* libraries = _manager.getMaterialLibraries();
|
||||
for (Materials::MaterialLibrary* library : *libraries) {
|
||||
auto libraries = _manager.getMaterialLibraries();
|
||||
for (auto library : *libraries) {
|
||||
if (!library->isReadOnly()) {
|
||||
QVariant libraryVariant;
|
||||
libraryVariant.setValue(*library);
|
||||
@@ -162,10 +161,11 @@ void MaterialSave::addExpanded(QTreeView* tree, QStandardItemModel* parent, QSta
|
||||
tree->setExpanded(child->index(), true);
|
||||
}
|
||||
|
||||
void MaterialSave::addMaterials(QStandardItem& parent,
|
||||
const std::map<QString, Materials::MaterialTreeNode*>* modelTree,
|
||||
const QIcon& folderIcon,
|
||||
const QIcon& icon)
|
||||
void MaterialSave::addMaterials(
|
||||
QStandardItem& parent,
|
||||
const std::shared_ptr<std::map<QString, Materials::MaterialTreeNode*>> modelTree,
|
||||
const QIcon& folderIcon,
|
||||
const QIcon& icon)
|
||||
{
|
||||
auto tree = ui->treeMaterials;
|
||||
for (auto& mat : *modelTree) {
|
||||
@@ -188,7 +188,7 @@ void MaterialSave::addMaterials(QStandardItem& parent,
|
||||
auto node = new QStandardItem(folderIcon, mat.first);
|
||||
addExpanded(tree, &parent, node);
|
||||
// node->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled);
|
||||
const std::map<QString, Materials::MaterialTreeNode*>* treeMap = nodePtr->getFolder();
|
||||
auto treeMap = nodePtr->getFolder();
|
||||
addMaterials(*node, treeMap, folderIcon, icon);
|
||||
}
|
||||
}
|
||||
@@ -212,8 +212,7 @@ void MaterialSave::showSelectedTree()
|
||||
lib->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled);
|
||||
addExpanded(tree, model, lib);
|
||||
|
||||
std::map<QString, Materials::MaterialTreeNode*>* modelTree =
|
||||
_manager.getMaterialTree(library);
|
||||
auto modelTree = _manager.getMaterialTree(library);
|
||||
addMaterials(*lib, modelTree, folderIcon, icon);
|
||||
}
|
||||
else {
|
||||
@@ -241,7 +240,7 @@ void MaterialSave::onSelectModel(const QItemSelection& selected, const QItemSele
|
||||
// Q_UNUSED(selected);
|
||||
Q_UNUSED(deselected);
|
||||
|
||||
_filename = QString(ui->editFilename->text());// No filename by default
|
||||
_filename = QString(ui->editFilename->text()); // No filename by default
|
||||
QStandardItemModel* model = static_cast<QStandardItemModel*>(ui->treeMaterials->model());
|
||||
QModelIndexList indexes = selected.indexes();
|
||||
if (indexes.count() == 0) {
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MATGUI_MATERIALSAVE_H
|
||||
#define MATGUI_MATERIALSAVE_H
|
||||
@@ -49,10 +48,11 @@ public:
|
||||
void createModelTree();
|
||||
void addExpanded(QTreeView* tree, QStandardItem* parent, QStandardItem* child);
|
||||
void addExpanded(QTreeView* tree, QStandardItemModel* parent, QStandardItem* child);
|
||||
void addMaterials(QStandardItem& parent,
|
||||
const std::map<QString, Materials::MaterialTreeNode*>* modelTree,
|
||||
const QIcon& folderIcon,
|
||||
const QIcon& icon);
|
||||
void
|
||||
addMaterials(QStandardItem& parent,
|
||||
const std::shared_ptr<std::map<QString, Materials::MaterialTreeNode*>> modelTree,
|
||||
const QIcon& folderIcon,
|
||||
const QIcon& icon);
|
||||
void showSelectedTree();
|
||||
|
||||
void onSelectModel(const QItemSelection& selected, const QItemSelection& deselected);
|
||||
@@ -76,6 +76,6 @@ private:
|
||||
QString getPath(const QStandardItem* item) const;
|
||||
};
|
||||
|
||||
}// namespace MatGui
|
||||
} // namespace MatGui
|
||||
|
||||
#endif// MATGUI_MATERIALSAVE_H
|
||||
#endif // MATGUI_MATERIALSAVE_H
|
||||
|
||||
0
src/Mod/Material/Gui/MaterialTreeView.h
Normal file
0
src/Mod/Material/Gui/MaterialTreeView.h
Normal file
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
@@ -378,10 +377,11 @@ void MaterialsEditor::reject()
|
||||
// auto pixmap = icon.pixmap();
|
||||
// }
|
||||
|
||||
void MaterialsEditor::addMaterials(QStandardItem& parent,
|
||||
const std::map<QString, Materials::MaterialTreeNode*>* modelTree,
|
||||
const QIcon& folderIcon,
|
||||
const QIcon& icon)
|
||||
void MaterialsEditor::addMaterials(
|
||||
QStandardItem& parent,
|
||||
const std::shared_ptr<std::map<QString, Materials::MaterialTreeNode*>> modelTree,
|
||||
const QIcon& folderIcon,
|
||||
const QIcon& icon)
|
||||
{
|
||||
auto tree = ui->treeMaterials;
|
||||
for (auto& mat : *modelTree) {
|
||||
@@ -404,7 +404,7 @@ void MaterialsEditor::addMaterials(QStandardItem& parent,
|
||||
auto node = new QStandardItem(folderIcon, mat.first);
|
||||
addExpanded(tree, &parent, node);
|
||||
node->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled);
|
||||
const std::map<QString, Materials::MaterialTreeNode*>* treeMap = nodePtr->getFolder();
|
||||
auto treeMap = nodePtr->getFolder();
|
||||
addMaterials(*node, treeMap, folderIcon, icon);
|
||||
}
|
||||
}
|
||||
@@ -549,8 +549,7 @@ void MaterialsEditor::fillMaterialTree()
|
||||
QIcon icon(library->getIconPath());
|
||||
QIcon folderIcon(QString::fromStdString(":/icons/folder.svg"));
|
||||
|
||||
std::map<QString, Materials::MaterialTreeNode*>* modelTree =
|
||||
_materialManager.getMaterialTree(*library);
|
||||
auto modelTree = _materialManager.getMaterialTree(*library);
|
||||
addMaterials(*lib, modelTree, folderIcon, icon);
|
||||
}
|
||||
}
|
||||
@@ -650,16 +649,16 @@ QString MaterialsEditor::getColorHash(const QString& colorString, int colorRange
|
||||
std::stringstream stream(colorString.toStdString());
|
||||
|
||||
char c;
|
||||
stream >> c;// read "("
|
||||
stream >> c; // read "("
|
||||
double red;
|
||||
stream >> red;
|
||||
stream >> c;// ","
|
||||
stream >> c; // ","
|
||||
double green;
|
||||
stream >> green;
|
||||
stream >> c;// ","
|
||||
stream >> c; // ","
|
||||
double blue;
|
||||
stream >> blue;
|
||||
stream >> c;// ","
|
||||
stream >> c; // ","
|
||||
double alpha = 1.0;
|
||||
if (c == ',') {
|
||||
stream >> alpha;
|
||||
@@ -888,7 +887,7 @@ int MaterialsEditor::confirmSave(QWidget* parent)
|
||||
}
|
||||
|
||||
int res = QMessageBox::Cancel;
|
||||
box.adjustSize();// Silence warnings from Qt on Windows
|
||||
box.adjustSize(); // Silence warnings from Qt on Windows
|
||||
switch (box.exec()) {
|
||||
case QMessageBox::Save:
|
||||
saveMaterial();
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MATGUI_MATERIALSEDITOR_H
|
||||
#define MATGUI_MATERIALSEDITOR_H
|
||||
@@ -116,16 +115,17 @@ private:
|
||||
void createMaterialTree();
|
||||
void fillMaterialTree();
|
||||
void refreshMaterialTree();
|
||||
void addMaterials(QStandardItem& parent,
|
||||
const std::map<QString, Materials::MaterialTreeNode*>* modelTree,
|
||||
const QIcon& folderIcon,
|
||||
const QIcon& icon);
|
||||
void
|
||||
addMaterials(QStandardItem& parent,
|
||||
const std::shared_ptr<std::map<QString, Materials::MaterialTreeNode*>> modelTree,
|
||||
const QIcon& folderIcon,
|
||||
const QIcon& icon);
|
||||
bool isMaterial(const fs::path& p) const
|
||||
{
|
||||
return Materials::MaterialManager::isMaterial(p);
|
||||
}
|
||||
};
|
||||
|
||||
}// namespace MatGui
|
||||
} // namespace MatGui
|
||||
|
||||
#endif// MATGUI_MATERIALSEDITOR_H
|
||||
#endif // MATGUI_MATERIALSEDITOR_H
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
@@ -233,9 +232,10 @@ void ModelSelect::addExpanded(QTreeView* tree, QStandardItemModel* parent, QStan
|
||||
tree->setExpanded(child->index(), true);
|
||||
}
|
||||
|
||||
void ModelSelect::addModels(QStandardItem& parent,
|
||||
const std::map<QString, Materials::ModelTreeNode*>* modelTree,
|
||||
const QIcon& icon)
|
||||
void ModelSelect::addModels(
|
||||
QStandardItem& parent,
|
||||
const std::shared_ptr<std::map<QString, Materials::ModelTreeNode*>> modelTree,
|
||||
const QIcon& icon)
|
||||
{
|
||||
auto tree = ui->treeModels;
|
||||
for (auto& mod : *modelTree) {
|
||||
@@ -255,7 +255,7 @@ void ModelSelect::addModels(QStandardItem& parent,
|
||||
auto node = new QStandardItem(mod.first);
|
||||
addExpanded(tree, &parent, node);
|
||||
node->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled);
|
||||
const std::map<QString, Materials::ModelTreeNode*>* treeMap = nodePtr->getFolder();
|
||||
auto treeMap = nodePtr->getFolder();
|
||||
addModels(*node, treeMap, icon);
|
||||
}
|
||||
}
|
||||
@@ -343,16 +343,13 @@ void ModelSelect::fillTree()
|
||||
addExpanded(tree, model, lib);
|
||||
addRecents(lib);
|
||||
|
||||
std::list<Materials::ModelLibrary*>* libraries = getModelManager().getModelLibraries();
|
||||
for (Materials::ModelLibrary* library : *libraries) {
|
||||
auto libraries = getModelManager().getModelLibraries();
|
||||
for (auto library : *libraries) {
|
||||
lib = new QStandardItem(library->getName());
|
||||
lib->setFlags(Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled);
|
||||
addExpanded(tree, model, lib);
|
||||
|
||||
// auto path = library->getDirectoryPath();
|
||||
std::map<QString, Materials::ModelTreeNode*>* modelTree =
|
||||
getModelManager().getModelTree(*library, _filter);
|
||||
// delete modelTree;
|
||||
auto modelTree = getModelManager().getModelTree(*library, _filter);
|
||||
addModels(*lib, modelTree, QIcon(library->getIconPath()));
|
||||
}
|
||||
}
|
||||
@@ -450,7 +447,7 @@ void ModelSelect::updateMaterialModel(const QString& uuid)
|
||||
updateModelProperties(model);
|
||||
}
|
||||
|
||||
void ModelSelect::clearMaterialModel(void)
|
||||
void ModelSelect::clearMaterialModel()
|
||||
{
|
||||
// Update the general information
|
||||
ui->editName->setText(QString::fromStdString(""));
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MATGUI_MODELSELECT_H
|
||||
#define MATGUI_MODELSELECT_H
|
||||
@@ -78,10 +77,10 @@ private:
|
||||
void addRecents(QStandardItem* parent);
|
||||
void addFavorites(QStandardItem* parent);
|
||||
void addModels(QStandardItem& parent,
|
||||
const std::map<QString, Materials::ModelTreeNode*>* modelTree,
|
||||
const std::shared_ptr<std::map<QString, Materials::ModelTreeNode*>> modelTree,
|
||||
const QIcon& icon);
|
||||
void updateMaterialModel(const QString& uuid);
|
||||
void clearMaterialModel(void);
|
||||
void clearMaterialModel();
|
||||
void createModelTree();
|
||||
void refreshModelTree();
|
||||
void fillTree();
|
||||
@@ -104,6 +103,6 @@ private:
|
||||
int _recentMax;
|
||||
};
|
||||
|
||||
}// namespace MatGui
|
||||
} // namespace MatGui
|
||||
|
||||
#endif// MATGUI_MODELSELECT_H
|
||||
#endif // MATGUI_MODELSELECT_H
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
@@ -1,37 +1,34 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef MATGUI_PRECOMPILED_H
|
||||
#define MATGUI_PRECOMPILED_H
|
||||
|
||||
#include <FCConfig.h>
|
||||
|
||||
#include <Mod/Material/MaterialGlobal.h>
|
||||
|
||||
// point at which warnings of overly long specifiers disabled (needed for VC6)
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4251)
|
||||
#pragma warning(disable : 4503)
|
||||
#pragma warning(disable : 4786)// specifier longer then 255 chars
|
||||
#pragma warning(disable : 4786) // specifier longer then 255 chars
|
||||
#pragma warning(disable : 4273)
|
||||
#endif
|
||||
|
||||
@@ -72,6 +69,6 @@
|
||||
// # include <Gui/InventorAll.h>
|
||||
// #endif
|
||||
|
||||
#endif//_PreComp_
|
||||
#endif //_PreComp_
|
||||
|
||||
#endif// MATGUI_PRECOMPILED_H
|
||||
#endif // MATGUI_PRECOMPILED_H
|
||||
|
||||
34
src/Mod/Material/Gui/Workbench.cpp
Normal file
34
src/Mod/Material/Gui/Workbench.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include "Workbench.h"
|
||||
|
||||
using namespace MatGui;
|
||||
|
||||
/// @namespace MatGui @class Workbench
|
||||
TYPESYSTEM_SOURCE(MatGui::Workbench, Gui::StdWorkbench)
|
||||
|
||||
Workbench::Workbench() = default;
|
||||
|
||||
Workbench::~Workbench() = default;
|
||||
47
src/Mod/Material/Gui/Workbench.h
Normal file
47
src/Mod/Material/Gui/Workbench.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 David Carter <dcarter@david.carter.ca> *
|
||||
* *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#ifndef MATGUI_WORKBENCH_H
|
||||
#define MATGUI_WORKBENCH_H
|
||||
|
||||
#include <Gui/Workbench.h>
|
||||
#include <Mod/Material/MaterialGlobal.h>
|
||||
|
||||
namespace MatGui
|
||||
{
|
||||
|
||||
/**
|
||||
* @author David Carter
|
||||
*/
|
||||
class MatGuiExport Workbench: public Gui::StdWorkbench
|
||||
{
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
|
||||
public:
|
||||
Workbench();
|
||||
~Workbench() override;
|
||||
};
|
||||
|
||||
} // namespace MatGui
|
||||
|
||||
|
||||
#endif // MATGUI_WORKBENCH_H
|
||||
Reference in New Issue
Block a user