From 1f0d1be3966d997c5d6dedcb3e8fb9ae1d525dc6 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 11 Dec 2013 19:19:27 -0300 Subject: [PATCH] Rename app::SelectionSettings to app::UISelectionSettingsImpl The class UISelectionSettingsImpl is the implementation of ISelectionSettingsImpl so it doesn't need to be available from ui_settings_impl.h. Also we can use anonymous namespaces to put classes that are used only inside ui_settings_impl.cpp. --- src/app/settings/ui_settings_impl.cpp | 49 ++++++++++++++++++++------- src/app/settings/ui_settings_impl.h | 18 ---------- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/app/settings/ui_settings_impl.cpp b/src/app/settings/ui_settings_impl.cpp index 1c731154e..fac6ccbc2 100644 --- a/src/app/settings/ui_settings_impl.cpp +++ b/src/app/settings/ui_settings_impl.cpp @@ -43,6 +43,8 @@ using namespace gfx; using namespace raster; using namespace filters; +namespace { + class UIDocumentSettingsImpl : public IDocumentSettings { public: UIDocumentSettingsImpl() @@ -140,6 +142,26 @@ private: app::Color m_pixelGridColor; }; +class UISelectionSettingsImpl + : public ISelectionSettings + , public base::Observable { +public: + UISelectionSettingsImpl(); + ~UISelectionSettingsImpl(); + + void setMoveTransparentColor(app::Color color); + + app::Color getMoveTransparentColor(); + + void addObserver(SelectionSettingsObserver* observer); + void removeObserver(SelectionSettingsObserver* observer); + +private: + app::Color m_moveTransparentColor; +}; + +} // anonymous namespace + ////////////////////////////////////////////////////////////////////// // UISettingsImpl @@ -147,7 +169,7 @@ UISettingsImpl::UISettingsImpl() : m_currentTool(NULL) , m_globalDocumentSettings(new UIDocumentSettingsImpl) , m_colorSwatches(NULL) - , m_selectionSettings(new SelectionSettings) + , m_selectionSettings(new UISelectionSettingsImpl) { m_colorSwatches = new app::ColorSwatches("Default"); for (size_t i=0; i<16; ++i) @@ -268,6 +290,11 @@ void UISettingsImpl::removeObserver(GlobalSettingsObserver* observer) { base::Observable::addObserver(observer); } +ISelectionSettings* UISettingsImpl::selection() +{ + return m_selectionSettings; +} + ////////////////////////////////////////////////////////////////////// // IDocumentSettings implementation @@ -606,38 +633,36 @@ IToolSettings* UISettingsImpl::getToolSettings(tools::Tool* tool) ////////////////////////////////////////////////////////////////////// // Selection Settings -SelectionSettings::SelectionSettings() : m_moveTransparentColor(app::Color::fromMask()) +namespace { + +UISelectionSettingsImpl::UISelectionSettingsImpl() : m_moveTransparentColor(app::Color::fromMask()) { } -SelectionSettings::~SelectionSettings() +UISelectionSettingsImpl::~UISelectionSettingsImpl() { } -ISelectionSettings* UISettingsImpl::selection() -{ - return m_selectionSettings; -} - -void SelectionSettings::setMoveTransparentColor(app::Color color) +void UISelectionSettingsImpl::setMoveTransparentColor(app::Color color) { m_moveTransparentColor = color; notifyObservers(&SelectionSettingsObserver::onSetMoveTransparentColor, color); } -app::Color SelectionSettings::getMoveTransparentColor() +app::Color UISelectionSettingsImpl::getMoveTransparentColor() { return m_moveTransparentColor; } -void SelectionSettings::addObserver(SelectionSettingsObserver* observer) +void UISelectionSettingsImpl::addObserver(SelectionSettingsObserver* observer) { base::Observable::addObserver(observer); } -void SelectionSettings::removeObserver(SelectionSettingsObserver* observer) +void UISelectionSettingsImpl::removeObserver(SelectionSettingsObserver* observer) { base::Observable::removeObserver(observer); } +} // anonymous namespace } // namespace app diff --git a/src/app/settings/ui_settings_impl.h b/src/app/settings/ui_settings_impl.h index 241c2dcc9..f1904b548 100644 --- a/src/app/settings/ui_settings_impl.h +++ b/src/app/settings/ui_settings_impl.h @@ -73,24 +73,6 @@ namespace app { ISelectionSettings* m_selectionSettings; }; - class SelectionSettings - : public ISelectionSettings - , public base::Observable { - public: - SelectionSettings(); - ~SelectionSettings(); - - void setMoveTransparentColor(app::Color color); - - app::Color getMoveTransparentColor(); - - void addObserver(SelectionSettingsObserver* observer); - void removeObserver(SelectionSettingsObserver* observer); - - private: - app::Color m_moveTransparentColor; - }; - } // namespace app #endif