From dda7ddb6f8628b30632833ef2f486b8678aa4351 Mon Sep 17 00:00:00 2001 From: Marek Kochanowicz Date: Thu, 23 Jan 2014 16:00:44 +0100 Subject: [PATCH] Disable not needed referencable creator widget when in cloning mode. --- apps/opencs/view/world/creator.hpp | 2 ++ apps/opencs/view/world/genericcreator.cpp | 6 +++++- apps/opencs/view/world/genericcreator.hpp | 4 +++- apps/opencs/view/world/referenceablecreator.cpp | 8 +++++++- apps/opencs/view/world/referenceablecreator.hpp | 1 + apps/opencs/view/world/tablebottombox.cpp | 2 ++ 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/apps/opencs/view/world/creator.hpp b/apps/opencs/view/world/creator.hpp index 5eaf3e1781..5174232bc2 100644 --- a/apps/opencs/view/world/creator.hpp +++ b/apps/opencs/view/world/creator.hpp @@ -28,6 +28,8 @@ namespace CSVWorld virtual void cloneMode(const std::string& originid, const CSMWorld::UniversalId::Type type, const CSMWorld::UniversalId::ArgumentType argumentType) = 0; virtual void setEditLock (bool locked) = 0; + + virtual void toggleWidgets(bool active = true) = 0; signals: diff --git a/apps/opencs/view/world/genericcreator.cpp b/apps/opencs/view/world/genericcreator.cpp index ab387393b2..2a93f0e0f9 100644 --- a/apps/opencs/view/world/genericcreator.cpp +++ b/apps/opencs/view/world/genericcreator.cpp @@ -157,4 +157,8 @@ void CSVWorld::GenericCreator::cloneMode(const std::string& originid, mClonedId = originid; mClonedType = type; mArgumentType = argumentType; -} \ No newline at end of file +} + +void CSVWorld::GenericCreator::toggleWidgets(bool active) +{ +} diff --git a/apps/opencs/view/world/genericcreator.hpp b/apps/opencs/view/world/genericcreator.hpp index 867595bb55..e4813594b2 100644 --- a/apps/opencs/view/world/genericcreator.hpp +++ b/apps/opencs/view/world/genericcreator.hpp @@ -48,7 +48,7 @@ namespace CSVWorld virtual std::string getId() const; virtual void configureCreateCommand (CSMWorld::CreateCommand& command) const; - + CSMWorld::Data& getData() const; const CSMWorld::UniversalId& getCollectionId() const; @@ -61,6 +61,8 @@ namespace CSVWorld virtual void setEditLock (bool locked); virtual void reset(); + + virtual void toggleWidgets (bool active = true); virtual void cloneMode(const std::string& originid, const CSMWorld::UniversalId::Type type, diff --git a/apps/opencs/view/world/referenceablecreator.cpp b/apps/opencs/view/world/referenceablecreator.cpp index 718fe9ca7c..7a5fca8538 100644 --- a/apps/opencs/view/world/referenceablecreator.cpp +++ b/apps/opencs/view/world/referenceablecreator.cpp @@ -40,4 +40,10 @@ void CSVWorld::ReferenceableCreator::reset() { mType->setCurrentIndex (0); GenericCreator::reset(); -} \ No newline at end of file +} + +void CSVWorld::ReferenceableCreator::toggleWidgets(bool active) +{ + CSVWorld::GenericCreator::toggleWidgets(active); + mType->setEnabled(active); +} diff --git a/apps/opencs/view/world/referenceablecreator.hpp b/apps/opencs/view/world/referenceablecreator.hpp index 06e0e582be..88545575e3 100644 --- a/apps/opencs/view/world/referenceablecreator.hpp +++ b/apps/opencs/view/world/referenceablecreator.hpp @@ -23,6 +23,7 @@ namespace CSVWorld const CSMWorld::UniversalId& id); virtual void reset(); + virtual void toggleWidgets(bool active = true); }; } diff --git a/apps/opencs/view/world/tablebottombox.cpp b/apps/opencs/view/world/tablebottombox.cpp index 60a206d0c2..ef20cf1d47 100644 --- a/apps/opencs/view/world/tablebottombox.cpp +++ b/apps/opencs/view/world/tablebottombox.cpp @@ -153,6 +153,7 @@ void CSVWorld::TableBottomBox::tableSizeChanged (int size, int deleted, int modi void CSVWorld::TableBottomBox::createRequest() { mCreator->reset(); + mCreator->toggleWidgets(true); mLayout->setCurrentWidget (mCreator); setVisible (true); mCreating = true; @@ -163,6 +164,7 @@ void CSVWorld::TableBottomBox::cloneRequest(const std::string& id, const CSMWorld::UniversalId::ArgumentType argumnetType) { mCreator->reset(); + mCreator->toggleWidgets(false); mCreator->cloneMode(id, type, argumnetType); mLayout->setCurrentWidget(mCreator); setVisible (true);