Fix bug switching current fg color (X key) and updating Editor's brush preview.

This commit is contained in:
David Capello 2011-07-28 20:02:07 -03:00
parent 2b95ba58d2
commit 2835d642a0
2 changed files with 19 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#include "app.h"
#include "app/color.h"
#include "app/color_utils.h"
#include "base/bind.h"
#include "commands/commands.h"
#include "commands/params.h"
#include "document_wrappers.h"
@ -139,6 +140,9 @@ Editor::Editor()
m_currentToolChangeSlot =
App::instance()->CurrentToolChange.connect(&Editor::onCurrentToolChange, this);
m_fgColorChangeSlot =
app_get_colorbar()->FgColorChange.connect(Bind<void>(&Editor::onFgColorChange, this));
}
Editor::~Editor()
@ -149,6 +153,10 @@ Editor::~Editor()
// Remove this editor as listener of CurrentToolChange signal.
App::instance()->CurrentToolChange.disconnect(m_currentToolChangeSlot);
delete m_currentToolChangeSlot;
// Remove this editor as listener of FgColorChange
app_get_colorbar()->FgColorChange.disconnect(m_fgColorChangeSlot);
delete m_fgColorChangeSlot;
}
int editor_type()
@ -992,6 +1000,14 @@ void Editor::onCurrentToolChange()
m_state->onCurrentToolChange(this);
}
void Editor::onFgColorChange()
{
if (m_cursor_thick) {
hideDrawingCursor();
showDrawingCursor();
}
}
/**
* Returns size for the editor viewport
*/

View File

@ -164,6 +164,7 @@ public:
protected:
bool onProcessMessage(Message* msg) OVERRIDE;
void onCurrentToolChange();
void onFgColorChange();
// Returns true if this editor should change the preferred document
// settings.
@ -220,6 +221,8 @@ private:
// signals).
Slot0<void>* m_currentToolChangeSlot;
Slot1<void, const Color&>* m_fgColorChangeSlot;
EditorListeners m_listeners;
};