From 3ada08af90dab4440247ba4b3190b669e6b42b73 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 24 Sep 2015 16:07:17 +0200 Subject: [PATCH] store lock state and pass it on to edit mode --- apps/opencs/view/render/editmode.cpp | 5 +++++ apps/opencs/view/render/editmode.hpp | 3 +++ apps/opencs/view/world/scenesubview.cpp | 13 +++++++++++-- apps/opencs/view/world/scenesubview.hpp | 3 +++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/apps/opencs/view/render/editmode.cpp b/apps/opencs/view/render/editmode.cpp index bf96fea3a..c3aad3f7a 100644 --- a/apps/opencs/view/render/editmode.cpp +++ b/apps/opencs/view/render/editmode.cpp @@ -21,3 +21,8 @@ void CSVRender::EditMode::updateUserSetting (const QString& name, const QStringL { } + +void CSVRender::EditMode::setEditLock (bool locked) +{ + +} diff --git a/apps/opencs/view/render/editmode.hpp b/apps/opencs/view/render/editmode.hpp index 381a6abcb..1212cd285 100644 --- a/apps/opencs/view/render/editmode.hpp +++ b/apps/opencs/view/render/editmode.hpp @@ -25,6 +25,9 @@ namespace CSVRender /// Default-implementation: Do nothing. virtual void updateUserSetting (const QString& name, const QStringList& value); + + /// Default-implementation: Ignored. + virtual void setEditLock (bool locked); }; } diff --git a/apps/opencs/view/world/scenesubview.cpp b/apps/opencs/view/world/scenesubview.cpp index f0b18dd86..967909969 100644 --- a/apps/opencs/view/world/scenesubview.cpp +++ b/apps/opencs/view/world/scenesubview.cpp @@ -28,7 +28,7 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) : SubView (id), mScene(NULL), mLayout(new QHBoxLayout), mDocument(document), mToolbar(NULL), - mEditMode (0) + mEditMode (0), mLocked (false) { QVBoxLayout *layout = new QVBoxLayout; @@ -131,7 +131,8 @@ CSVWidget::SceneToolbar* CSVWorld::SceneSubView::makeToolbar (CSVRender::Worldsp void CSVWorld::SceneSubView::setEditLock (bool locked) { - + mLocked = locked; + dynamic_cast (*mEditMode->getCurrent()).setEditLock (locked); } void CSVWorld::SceneSubView::setStatusBar (bool show) @@ -258,4 +259,12 @@ void CSVWorld::SceneSubView::replaceToolbarAndWorldspace (CSVRender::WorldspaceW mScene->selectDefaultNavigationMode(); setFocusProxy (mScene); + + connect (mEditMode, SIGNAL (modeChanged (const std::string&)), + this, SLOT (editModeChanged (const std::string&))); +} + +void CSVWorld::SceneSubView::editModeChanged (const std::string& id) +{ + dynamic_cast (*mEditMode->getCurrent()).setEditLock (mLocked); } diff --git a/apps/opencs/view/world/scenesubview.hpp b/apps/opencs/view/world/scenesubview.hpp index 29aca5ab6..f59fee37f 100644 --- a/apps/opencs/view/world/scenesubview.hpp +++ b/apps/opencs/view/world/scenesubview.hpp @@ -47,6 +47,7 @@ namespace CSVWorld CSVWidget::SceneToolbar* mToolbar; std::string mTitle; CSVWidget::SceneToolMode *mEditMode; + bool mLocked; public: @@ -85,6 +86,8 @@ namespace CSVWorld void cellSelectionChanged (const CSMWorld::UniversalId& id); void handleDrop(const std::vector& data); + + void editModeChanged (const std::string& id); }; }