Merge branch 'dev' of git@github.com:aseprite/aseprite.git into dev

This commit is contained in:
David Capello 2014-04-28 22:03:25 -03:00
commit a21febf6e8
7 changed files with 32 additions and 12 deletions

View File

@ -64,7 +64,8 @@ public:
}
void onScrollChanged(Editor* editor) OVERRIDE {
App::instance()->getMainWindow()->getMiniEditor()->updateUsingEditor(this);
if (current_editor == this)
App::instance()->getMainWindow()->getMiniEditor()->updateUsingEditor(this);
}
void onStateChanged(Editor* editor) OVERRIDE {

View File

@ -324,9 +324,6 @@ void Editor::setEditorScroll(int x, int y, int use_refresh_region)
if (thick)
editor_draw_cursor(m_cursor_screen_x, m_cursor_screen_y);
// Notify observers
m_observers.notifyScrollChanged(this);
}
void Editor::updateEditor()
@ -869,9 +866,6 @@ void Editor::centerInSpritePoint(int x, int y)
showDrawingCursor();
invalidate();
// Notify observers
m_observers.notifyScrollChanged(this);
}
void Editor::updateStatusBar()
@ -1164,9 +1158,6 @@ void Editor::setZoomAndCenterInMouse(int zoom, int mouse_x, int mouse_y, ZoomBeh
updateEditor();
setEditorScroll(x, y, use_refresh_region);
// Notify observers
m_observers.notifyScrollChanged(this);
}
showDrawingCursor();
}
@ -1225,6 +1216,11 @@ void Editor::pasteImage(const Image* image, int x, int y)
setState(EditorStatePtr(new MovingPixelsState(this, NULL, pixelsMovement, NoHandle)));
}
void Editor::notifyScrollChanged()
{
m_observers.notifyScrollChanged(this);
}
void Editor::onSetTiledMode(filters::TiledMode mode)
{
invalidate();

View File

@ -169,6 +169,10 @@ namespace app {
void pasteImage(const Image* image, int x, int y);
// Used by EditorView to notify changes in the view's scroll
// position.
void notifyScrollChanged();
// in cursor.cpp
static int get_raw_cursor_color();

View File

@ -63,8 +63,7 @@ EditorView::~EditorView()
void EditorView::onPaint(PaintEvent& ev)
{
Graphics* g = ev.getGraphics();
Widget* viewport = getViewport();
Widget* child = UI_FIRST_WIDGET(viewport->getChildren());
Widget* child = attachedWidget();
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
bool selected = false;
@ -96,6 +95,16 @@ void EditorView::onResize(ResizeEvent& ev)
updateView();
}
void EditorView::onScrollChange()
{
View::onScrollChange();
Editor* editor = static_cast<Editor*>(attachedWidget());
ASSERT(editor != NULL);
if (editor)
editor->notifyScrollChanged();
}
void EditorView::onSetShowSpriteEditorScrollbars(bool state)
{
setupScrollbars();

View File

@ -39,6 +39,7 @@ namespace app {
protected:
void onPaint(ui::PaintEvent& ev) OVERRIDE;
void onResize(ui::ResizeEvent& ev) OVERRIDE;
void onScrollChange() OVERRIDE;
// GlobalSettingsObserver impl
void onSetShowSpriteEditorScrollbars(bool state) OVERRIDE;

View File

@ -188,6 +188,8 @@ void View::setViewScroll(const Point& pt)
m_scrollbar_v.setPos(newScroll.y);
m_viewport.layout();
onScrollChange();
}
void View::updateView()
@ -273,4 +275,9 @@ void View::onPaint(PaintEvent& ev)
getTheme()->paintView(ev);
}
void View::onScrollChange()
{
// Do nothing
}
} // namespace ui

View File

@ -59,6 +59,8 @@ protected:
void onPreferredSize(PreferredSizeEvent& ev) OVERRIDE;
void onPaint(PaintEvent& ev) OVERRIDE;
virtual void onScrollChange();
private:
bool m_hasBars;
Viewport m_viewport;