mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Merge branch '1.0'
Conflicts: src/app/document.cpp
This commit is contained in:
commit
aefdf2fd4b
@ -1,5 +1,5 @@
|
||||
/* Aseprite
|
||||
* Copyright (C) 2001-2013 David Capello
|
||||
* Copyright (C) 2001-2014 David Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -30,6 +30,7 @@
|
||||
#include "app/settings/settings.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace app {
|
||||
|
||||
|
@ -34,9 +34,9 @@
|
||||
#include "base/mutex.h"
|
||||
#include "base/scoped_lock.h"
|
||||
#include "base/unique_ptr.h"
|
||||
#include "doc/cel.h"
|
||||
#include "doc/document_event.h"
|
||||
#include "doc/document_observer.h"
|
||||
#include "doc/cel.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/mask.h"
|
||||
#include "doc/palette.h"
|
||||
@ -139,6 +139,12 @@ void Document::notifyCelCopied(Layer* fromLayer, FrameNumber fromFrame, Layer* t
|
||||
notifyObservers<doc::DocumentEvent&>(&doc::DocumentObserver::onCelCopied, ev);
|
||||
}
|
||||
|
||||
void Document::notifySelectionChanged()
|
||||
{
|
||||
doc::DocumentEvent ev(this);
|
||||
notifyObservers<doc::DocumentEvent&>(&doc::DocumentObserver::onSelectionChanged, ev);
|
||||
}
|
||||
|
||||
bool Document::isModified() const
|
||||
{
|
||||
return !m_undo->isSavedState();
|
||||
@ -210,6 +216,9 @@ void Document::generateMaskBoundaries(Mask* mask)
|
||||
m_bound.seg[c].y2 += mask->bounds().y;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO move this to the exact place where selection is modified.
|
||||
notifySelectionChanged();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -93,6 +93,7 @@ namespace app {
|
||||
void notifyLayerMergedDown(Layer* srcLayer, Layer* targetLayer);
|
||||
void notifyCelMoved(Layer* fromLayer, FrameNumber fromFrame, Layer* toLayer, FrameNumber toFrame);
|
||||
void notifyCelCopied(Layer* fromLayer, FrameNumber fromFrame, Layer* toLayer, FrameNumber toFrame);
|
||||
void notifySelectionChanged();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// File related properties
|
||||
|
@ -203,8 +203,8 @@ DocumentExporter::DocumentExporter()
|
||||
, m_textureWidth(0)
|
||||
, m_textureHeight(0)
|
||||
, m_texturePack(false)
|
||||
, m_scaleMode(DefaultScaleMode)
|
||||
, m_scale(1.0)
|
||||
, m_scaleMode(DefaultScaleMode)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -966,7 +966,8 @@ Rect Editor::getVisibleSpriteBounds()
|
||||
screenToEditor(vp.x, vp.y, &x1, &y1);
|
||||
screenToEditor(vp.x+vp.w-1, vp.y+vp.h-1, &x2, &y2);
|
||||
|
||||
return Rect(x1, y1, x2-x1+1, y2-y1+1);
|
||||
return Rect(0, 0, m_sprite->width(), m_sprite->height())
|
||||
.createIntersect(Rect(x1, y1, x2-x1+1, y2-y1+1));
|
||||
}
|
||||
|
||||
// Changes the scroll to see the given point as the center of the editor.
|
||||
@ -1361,10 +1362,6 @@ void Editor::pasteImage(const Image* image, int x, int y)
|
||||
|
||||
// Check bounds where the image will be pasted.
|
||||
{
|
||||
// First we limit the image inside the sprite's bounds.
|
||||
x = MID(0, x, sprite->width() - image->width());
|
||||
y = MID(0, y, sprite->height() - image->height());
|
||||
|
||||
// Then we check if the image will be visible by the user.
|
||||
Rect visibleBounds = getVisibleSpriteBounds();
|
||||
x = MID(visibleBounds.x-image->width(), x, visibleBounds.x+visibleBounds.w-1);
|
||||
@ -1381,6 +1378,10 @@ void Editor::pasteImage(const Image* image, int x, int y)
|
||||
x = visibleBounds.x + visibleBounds.w/2 - image->width()/2;
|
||||
y = visibleBounds.y + visibleBounds.h/2 - image->height()/2;
|
||||
}
|
||||
|
||||
// We limit the image inside the sprite's bounds.
|
||||
x = MID(0, x, sprite->width() - image->width());
|
||||
y = MID(0, y, sprite->height() - image->height());
|
||||
}
|
||||
|
||||
PixelsMovementPtr pixelsMovement(
|
||||
|
@ -967,6 +967,14 @@ void Timeline::onRemoveFrame(doc::DocumentEvent& ev)
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void Timeline::onSelectionChanged(doc::DocumentEvent& ev)
|
||||
{
|
||||
m_range.disableRange();
|
||||
|
||||
clearClipboardRange();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void Timeline::onAfterFrameChanged(Editor* editor)
|
||||
{
|
||||
setFrame(editor->frame());
|
||||
|
@ -108,6 +108,7 @@ namespace app {
|
||||
void onAfterRemoveLayer(doc::DocumentEvent& ev) override;
|
||||
void onAddFrame(doc::DocumentEvent& ev) override;
|
||||
void onRemoveFrame(doc::DocumentEvent& ev) override;
|
||||
void onSelectionChanged(doc::DocumentEvent& ev) override;
|
||||
|
||||
// app::Context slots.
|
||||
void onAfterCommandExecution(Command* command);
|
||||
|
@ -55,6 +55,9 @@ namespace doc {
|
||||
// When the number of total frames available is modified.
|
||||
virtual void onTotalFramesChanged(DocumentEvent& ev) { }
|
||||
|
||||
// The selection has changed.
|
||||
virtual void onSelectionChanged(DocumentEvent& ev) { }
|
||||
|
||||
// Called to destroy the observable. (Here you could call "delete this".)
|
||||
virtual void dispose() { }
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user