diff --git a/apps/opencs/view/world/genericcreator.cpp b/apps/opencs/view/world/genericcreator.cpp index 099fdd09c..7beaf9c67 100644 --- a/apps/opencs/view/world/genericcreator.cpp +++ b/apps/opencs/view/world/genericcreator.cpp @@ -50,7 +50,7 @@ std::string CSVWorld::GenericCreator::getId() const void CSVWorld::GenericCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const {} -void CSVWorld::GenericCreator::pushCommand (std::auto_ptr command, +void CSVWorld::GenericCreator::pushCommand (std::auto_ptr command, const std::string& id) { mUndoStack.push (command.release()); @@ -184,7 +184,7 @@ void CSVWorld::GenericCreator::create() { std::string id = getId(); - std::auto_ptr command; + std::auto_ptr command; if (mCloneMode) { @@ -196,9 +196,9 @@ void CSVWorld::GenericCreator::create() command.reset (new CSMWorld::CreateCommand ( dynamic_cast (*mData.getTableModel (mListId)), id)); - configureCreateCommand (dynamic_cast (*command)); } + configureCreateCommand (*command); pushCommand (command, id); emit done(); diff --git a/apps/opencs/view/world/genericcreator.hpp b/apps/opencs/view/world/genericcreator.hpp index a9ef87749..8d9e32966 100644 --- a/apps/opencs/view/world/genericcreator.hpp +++ b/apps/opencs/view/world/genericcreator.hpp @@ -13,7 +13,6 @@ class QLineEdit; class QHBoxLayout; class QComboBox; class QLabel; -class QUndoCommand; namespace CSMWorld { @@ -59,10 +58,12 @@ namespace CSVWorld virtual std::string getId() const; - /// \note This function is not called in case of a clone operation. + /// Allow subclasses to add additional data to \a command. virtual void configureCreateCommand (CSMWorld::CreateCommand& command) const; - virtual void pushCommand (std::auto_ptr command, + /// Allow subclasses to wrap the create command together with additional commands + /// into a macro. + virtual void pushCommand (std::auto_ptr command, const std::string& id); CSMWorld::Data& getData() const; diff --git a/apps/opencs/view/world/referencecreator.cpp b/apps/opencs/view/world/referencecreator.cpp index 561ac87da..5eec9df6d 100644 --- a/apps/opencs/view/world/referencecreator.cpp +++ b/apps/opencs/view/world/referencecreator.cpp @@ -31,7 +31,7 @@ void CSVWorld::ReferenceCreator::configureCreateCommand (CSMWorld::CreateCommand command.addValue (refNumColumn, getRefNumCount()); } -void CSVWorld::ReferenceCreator::pushCommand (std::auto_ptr command, +void CSVWorld::ReferenceCreator::pushCommand (std::auto_ptr command, const std::string& id) { // get the old count @@ -98,11 +98,6 @@ std::string CSVWorld::ReferenceCreator::getErrors() const // record is internal and requires neither user input nor verification. std::string errors; - if (mCloneMode) - { - return errors; - } - std::string cell = mCell->text().toUtf8().constData(); if (cell.empty()) @@ -128,12 +123,6 @@ void CSVWorld::ReferenceCreator::cellChanged() update(); } -void CSVWorld::ReferenceCreator::toggleWidgets(bool active) -{ - CSVWorld::GenericCreator::toggleWidgets(active); - mCell->setEnabled(active); -} - void CSVWorld::ReferenceCreator::cloneMode(const std::string& originId, const CSMWorld::UniversalId::Type type) { diff --git a/apps/opencs/view/world/referencecreator.hpp b/apps/opencs/view/world/referencecreator.hpp index c463469e4..002a62d87 100644 --- a/apps/opencs/view/world/referencecreator.hpp +++ b/apps/opencs/view/world/referencecreator.hpp @@ -20,10 +20,9 @@ namespace CSVWorld virtual void configureCreateCommand (CSMWorld::CreateCommand& command) const; - virtual void pushCommand (std::auto_ptr command, + virtual void pushCommand (std::auto_ptr command, const std::string& id); - /// Return next available RefNum for the cell the creator is currently operating on int getRefNumCount() const; public: @@ -35,7 +34,6 @@ namespace CSVWorld const CSMWorld::UniversalId::Type type); virtual void reset(); - virtual void toggleWidgets(bool active = true); virtual std::string getErrors() const; ///< Return formatted error descriptions for the current state of the creator. if an empty