Adress review
This commit is contained in:
@@ -1,3 +1,27 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2026 Théo Veilleux-Trinh <theo.veilleux.trinh@proton.me>*
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* 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. *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef APP_TRANSACTIONDEFS_H_
|
||||
#define APP_TRANSACTIONDEFS_H_
|
||||
|
||||
@@ -1524,11 +1524,14 @@ void Application::unsetEditDocument(Gui::Document* pcDocument)
|
||||
}
|
||||
void Application::unsetEditDocumentIf(const std::function<bool(Gui::Document*)>& eval)
|
||||
{
|
||||
for (auto editDoc : d->editDocuments) {
|
||||
if (eval(editDoc)) {
|
||||
unsetEditDocument(editDoc);
|
||||
std::erase_if(d->editDocuments, [&](Gui::Document* doc) {
|
||||
if (eval(doc)) {
|
||||
doc->_resetEdit();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
updateActions();
|
||||
}
|
||||
Gui::MDIView* Application::editViewOfNode(SoNode* node) const
|
||||
{
|
||||
|
||||
+2
-1
@@ -735,7 +735,8 @@ void Command::resetTransactionID()
|
||||
}
|
||||
bool Command::hasPendingCommand()
|
||||
{
|
||||
return App::GetApplication().getActiveDocument()->getBookedTransactionID() != 0;
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
return doc && doc->getBookedTransactionID() != App::NullTransaction;
|
||||
}
|
||||
|
||||
bool Command::_blockCmd = false;
|
||||
|
||||
+2
-12
@@ -286,7 +286,8 @@ struct DocumentP
|
||||
{
|
||||
_editingObject = sobj;
|
||||
_editMode = ModNum;
|
||||
_editViewProvider = svp; // Helps the viewprovider find the correct in editDocument
|
||||
_editViewProvider = svp; // Used to resolve start editing (find the document in edit from
|
||||
// within the viewprovider)
|
||||
_editViewProvider = svp->startEditing(ModNum);
|
||||
if (!_editViewProvider) {
|
||||
_editViewProviderParent = nullptr;
|
||||
@@ -1080,17 +1081,6 @@ void Document::slotDeletedObject(const App::DocumentObject& Obj)
|
||||
});
|
||||
}
|
||||
|
||||
if (d->_editViewProvider == viewProvider || d->_editViewProviderParent == viewProvider) {
|
||||
_resetEdit();
|
||||
}
|
||||
else if (Application::Instance->editDocument()) {
|
||||
auto editDoc = Application::Instance->editDocument();
|
||||
if (editDoc->d->_editViewProvider == viewProvider
|
||||
|| editDoc->d->_editViewProviderParent == viewProvider) {
|
||||
Application::Instance->setEditDocument(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
handleChildren3D(viewProvider, true);
|
||||
|
||||
if (viewProvider && viewProvider->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) {
|
||||
|
||||
@@ -62,34 +62,6 @@ using namespace Gui;
|
||||
using namespace std;
|
||||
namespace sp = std::placeholders;
|
||||
|
||||
// TODO-theo-vt remove!
|
||||
SelectionGateFilterExternal::SelectionGateFilterExternal(const char* docName, const char* objName)
|
||||
{
|
||||
if (docName) {
|
||||
DocName = docName;
|
||||
if (objName) {
|
||||
ObjName = objName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SelectionGateFilterExternal::allow(App::Document* doc, App::DocumentObject* obj, const char*)
|
||||
{
|
||||
if (!doc || !obj) {
|
||||
return true;
|
||||
}
|
||||
if (!DocName.empty() && doc->getName() != DocName) {
|
||||
notAllowedReason = "Cannot select external object";
|
||||
}
|
||||
else if (!ObjName.empty() && ObjName == obj->getNameInDocument()) {
|
||||
notAllowedReason = "Cannot select self";
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SelectionObserver::SelectionObserver(bool attach, ResolveMode resolve)
|
||||
@@ -1871,6 +1843,9 @@ void SelectionSingleton::setVisible(VisibleState vis, const char* pDocName)
|
||||
void SelectionSingleton::setSelection(const char* pDocName, const std::vector<App::DocumentObject*>& sel)
|
||||
{
|
||||
auto context = getSelectionContext(pDocName);
|
||||
if (!context.info) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!context.info->pickedList.empty()) {
|
||||
context.info->pickedList.clear();
|
||||
|
||||
@@ -287,20 +287,6 @@ public:
|
||||
std::string notAllowedReason;
|
||||
};
|
||||
|
||||
/** SelectionGateFilterExternal
|
||||
* The selection gate disallows any external object
|
||||
*/
|
||||
class GuiExport SelectionGateFilterExternal: public SelectionGate
|
||||
{
|
||||
public:
|
||||
explicit SelectionGateFilterExternal(const char* docName, const char* objName = nullptr);
|
||||
bool allow(App::Document*, App::DocumentObject*, const char*) override;
|
||||
|
||||
private:
|
||||
std::string DocName;
|
||||
std::string ObjName;
|
||||
};
|
||||
|
||||
/** The Selection class
|
||||
* The selection singleton keeps track of the selection state of
|
||||
* the whole application. It gets messages from all entities which can
|
||||
|
||||
Reference in New Issue
Block a user