1
// SPDX-License-Identifier: LGPL-2.1-or-later
3
/***************************************************************************
4
* Copyright (c) 2019 Manuel Apeltauer, direkt cnc-systeme GmbH *
5
* Copyright (c) 2024 Werner Mayer <wmayer[at]users.sourceforge.net> *
7
* This file is part of FreeCAD. *
9
* FreeCAD is free software: you can redistribute it and/or modify it *
10
* under the terms of the GNU Lesser General Public License as *
11
* published by the Free Software Foundation, either version 2.1 of the *
12
* License, or (at your option) any later version. *
14
* FreeCAD is distributed in the hope that it will be useful, but *
15
* WITHOUT ANY WARRANTY; without even the implied warranty of *
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
17
* Lesser General Public License for more details. *
19
* You should have received a copy of the GNU Lesser General Public *
20
* License along with FreeCAD. If not, see *
21
* <https://www.gnu.org/licenses/>. *
23
**************************************************************************/
25
#include "PreCompiled.h"
31
#include "ViewProviderProjectOnSurface.h"
32
#include "DlgProjectionOnSurface.h"
33
#include <Gui/Control.h>
36
using namespace PartGui;
38
PROPERTY_SOURCE(PartGui::ViewProviderProjectOnSurface, PartGui::ViewProviderPart)
41
ViewProviderProjectOnSurface::ViewProviderProjectOnSurface()
43
const unsigned int color = 0x8ae23400;
44
LineColor.setValue(color);
45
ShapeAppearance.setDiffuseColor(color);
46
PointColor.setValue(color);
47
Transparency.setValue(0);
50
ViewProviderProjectOnSurface::~ViewProviderProjectOnSurface() = default;
52
void ViewProviderProjectOnSurface::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
54
QAction* act = menu->addAction(QObject::tr("Edit projection"), receiver, member);
55
act->setData(QVariant((int)ViewProvider::Default));
57
ViewProviderPart::setupContextMenu(menu, receiver, member);
60
bool ViewProviderProjectOnSurface::setEdit(int ModNum)
62
if (ModNum == ViewProvider::Default) {
63
if (Gui::Control().activeDialog()) {
67
if (auto feature = dynamic_cast<Part::ProjectOnSurface*>(getObject())) {
68
Gui::Control().showDialog(new TaskProjectOnSurface(feature));
75
return ViewProviderPart::setEdit(ModNum);
78
void ViewProviderProjectOnSurface::unsetEdit(int ModNum)
80
if (ModNum == ViewProvider::Default) {
81
Gui::Control().closeDialog();
84
ViewProviderPart::unsetEdit(ModNum);