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.
This commit is contained in:
David Capello 2013-12-11 19:19:27 -03:00
parent b5ea9fd7e7
commit 1f0d1be396
2 changed files with 37 additions and 30 deletions

View File

@ -43,6 +43,8 @@ using namespace gfx;
using namespace raster; using namespace raster;
using namespace filters; using namespace filters;
namespace {
class UIDocumentSettingsImpl : public IDocumentSettings { class UIDocumentSettingsImpl : public IDocumentSettings {
public: public:
UIDocumentSettingsImpl() UIDocumentSettingsImpl()
@ -140,6 +142,26 @@ private:
app::Color m_pixelGridColor; app::Color m_pixelGridColor;
}; };
class UISelectionSettingsImpl
: public ISelectionSettings
, public base::Observable<SelectionSettingsObserver> {
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 // UISettingsImpl
@ -147,7 +169,7 @@ UISettingsImpl::UISettingsImpl()
: m_currentTool(NULL) : m_currentTool(NULL)
, m_globalDocumentSettings(new UIDocumentSettingsImpl) , m_globalDocumentSettings(new UIDocumentSettingsImpl)
, m_colorSwatches(NULL) , m_colorSwatches(NULL)
, m_selectionSettings(new SelectionSettings) , m_selectionSettings(new UISelectionSettingsImpl)
{ {
m_colorSwatches = new app::ColorSwatches("Default"); m_colorSwatches = new app::ColorSwatches("Default");
for (size_t i=0; i<16; ++i) for (size_t i=0; i<16; ++i)
@ -268,6 +290,11 @@ void UISettingsImpl::removeObserver(GlobalSettingsObserver* observer) {
base::Observable<GlobalSettingsObserver>::addObserver(observer); base::Observable<GlobalSettingsObserver>::addObserver(observer);
} }
ISelectionSettings* UISettingsImpl::selection()
{
return m_selectionSettings;
}
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// IDocumentSettings implementation // IDocumentSettings implementation
@ -606,38 +633,36 @@ IToolSettings* UISettingsImpl::getToolSettings(tools::Tool* tool)
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Selection Settings // Selection Settings
SelectionSettings::SelectionSettings() : m_moveTransparentColor(app::Color::fromMask()) namespace {
UISelectionSettingsImpl::UISelectionSettingsImpl() : m_moveTransparentColor(app::Color::fromMask())
{ {
} }
SelectionSettings::~SelectionSettings() UISelectionSettingsImpl::~UISelectionSettingsImpl()
{ {
} }
ISelectionSettings* UISettingsImpl::selection() void UISelectionSettingsImpl::setMoveTransparentColor(app::Color color)
{
return m_selectionSettings;
}
void SelectionSettings::setMoveTransparentColor(app::Color color)
{ {
m_moveTransparentColor = color; m_moveTransparentColor = color;
notifyObservers(&SelectionSettingsObserver::onSetMoveTransparentColor, color); notifyObservers(&SelectionSettingsObserver::onSetMoveTransparentColor, color);
} }
app::Color SelectionSettings::getMoveTransparentColor() app::Color UISelectionSettingsImpl::getMoveTransparentColor()
{ {
return m_moveTransparentColor; return m_moveTransparentColor;
} }
void SelectionSettings::addObserver(SelectionSettingsObserver* observer) void UISelectionSettingsImpl::addObserver(SelectionSettingsObserver* observer)
{ {
base::Observable<SelectionSettingsObserver>::addObserver(observer); base::Observable<SelectionSettingsObserver>::addObserver(observer);
} }
void SelectionSettings::removeObserver(SelectionSettingsObserver* observer) void UISelectionSettingsImpl::removeObserver(SelectionSettingsObserver* observer)
{ {
base::Observable<SelectionSettingsObserver>::removeObserver(observer); base::Observable<SelectionSettingsObserver>::removeObserver(observer);
} }
} // anonymous namespace
} // namespace app } // namespace app

View File

@ -73,24 +73,6 @@ namespace app {
ISelectionSettings* m_selectionSettings; ISelectionSettings* m_selectionSettings;
}; };
class SelectionSettings
: public ISelectionSettings
, public base::Observable<SelectionSettingsObserver> {
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 } // namespace app
#endif #endif