Merge branch 'refs/heads/master' into jriegel/develop-fem
Conflicts: src/Gui/View3DInventor.cpp same fix, but master was better
This commit is contained in:
@@ -1385,6 +1385,10 @@ namespace boost { namespace filesystem {
|
||||
|
||||
pair<string, string> customSyntax(const string& s)
|
||||
{
|
||||
#if defined(FC_OS_MACOSX)
|
||||
if (s.find("-psn_") == 0)
|
||||
return make_pair(string("psn"), s.substr(5));
|
||||
#endif
|
||||
if (s.find("-display") == 0)
|
||||
return make_pair(string("display"), string("null"));
|
||||
else if (s.find("-style") == 0)
|
||||
@@ -1493,6 +1497,9 @@ void Application::ParseOptions(int ac, char ** av)
|
||||
("visual", boost::program_options::value< string >(), "set the X-Window to color scema")
|
||||
("ncols", boost::program_options::value< int >(), "set the X-Window to color scema")
|
||||
("cmap", "set the X-Window to color scema")
|
||||
#if defined(FC_OS_MACOSX)
|
||||
("psn", boost::program_options::value< string >(), "process serial number")
|
||||
#endif
|
||||
;
|
||||
|
||||
// Ignored options, will be savely ignored. Mostly uses by underlaying libs.
|
||||
|
||||
@@ -229,8 +229,8 @@ bool Document::undo(void)
|
||||
if (d->iUndoMode) {
|
||||
if (d->activeUndoTransaction)
|
||||
commitTransaction();
|
||||
else
|
||||
assert(mUndoTransactions.size()!=0);
|
||||
else if (mUndoTransactions.empty())
|
||||
return false;
|
||||
|
||||
// redo
|
||||
d->activeUndoTransaction = new Transaction();
|
||||
@@ -313,12 +313,21 @@ void Document::openTransaction(const char* name)
|
||||
}
|
||||
}
|
||||
|
||||
void Document::_checkTransaction(void)
|
||||
void Document::_checkTransaction(DocumentObject* pcObject)
|
||||
{
|
||||
// if the undo is active but no transaction open, open one!
|
||||
if (d->iUndoMode) {
|
||||
if (!d->activeUndoTransaction)
|
||||
openTransaction();
|
||||
if (!d->activeUndoTransaction) {
|
||||
// When the object is going to be deleted we have to check if it has already been added to
|
||||
// the undo transactions
|
||||
std::list<Transaction*>::iterator it;
|
||||
for (it = mUndoTransactions.begin(); it != mUndoTransactions.end(); ++it) {
|
||||
if ((*it)->hasObject(pcObject)) {
|
||||
openTransaction();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1440,14 +1449,14 @@ void Document::_addObject(DocumentObject* pcObject, const char* pObjectName)
|
||||
/// Remove an object out of the document
|
||||
void Document::remObject(const char* sName)
|
||||
{
|
||||
_checkTransaction();
|
||||
|
||||
std::map<std::string,DocumentObject*>::iterator pos = d->objectMap.find(sName);
|
||||
|
||||
// name not found?
|
||||
if (pos == d->objectMap.end())
|
||||
return;
|
||||
|
||||
_checkTransaction(pos->second);
|
||||
|
||||
if (d->activeObject == pos->second)
|
||||
d->activeObject = 0;
|
||||
|
||||
@@ -1499,7 +1508,7 @@ void Document::remObject(const char* sName)
|
||||
/// Remove an object out of the document (internal)
|
||||
void Document::_remObject(DocumentObject* pcObject)
|
||||
{
|
||||
_checkTransaction();
|
||||
_checkTransaction(pcObject);
|
||||
|
||||
std::map<std::string,DocumentObject*>::iterator pos = d->objectMap.find(pcObject->getNameInDocument());
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ protected:
|
||||
DocumentObject* _copyObject(DocumentObject* obj, std::map<DocumentObject*,
|
||||
DocumentObject*>&, bool recursive=false, bool keepdigitsatend=false);
|
||||
/// checks if a valid transaction is open
|
||||
void _checkTransaction(void);
|
||||
void _checkTransaction(DocumentObject* pcObject);
|
||||
void breakDependency(DocumentObject* pcObject, bool clear);
|
||||
std::vector<App::DocumentObject*> readObjects(Base::XMLReader& reader);
|
||||
void writeObjects(const std::vector<App::DocumentObject*>&, Base::Writer &writer) const;
|
||||
|
||||
@@ -102,6 +102,12 @@ int Transaction::getPos(void) const
|
||||
return iPos;
|
||||
}
|
||||
|
||||
bool Transaction::hasObject(DocumentObject *Obj) const
|
||||
{
|
||||
std::map<const DocumentObject*,TransactionObject*>::const_iterator it;
|
||||
it = _Objects.find(Obj);
|
||||
return (it != _Objects.end());
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// separator for other implemetation aspects
|
||||
|
||||
@@ -93,6 +93,8 @@ public:
|
||||
|
||||
/// get the position in the transaction history
|
||||
int getPos(void) const;
|
||||
/// check if this object is used in a transaction
|
||||
bool hasObject(DocumentObject *Obj) const;
|
||||
|
||||
friend class Document;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user