mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-02 11:59:58 +00:00
Rename DocumentApi -> DocApi
This commit is contained in:
parent
ac7e48d92d
commit
ee5842cde3
@ -496,9 +496,9 @@ add_library(app-lib
|
||||
console.cpp
|
||||
context.cpp
|
||||
context_flags.cpp
|
||||
doc_api.cpp
|
||||
doc_undo.cpp
|
||||
document.cpp
|
||||
document_api.cpp
|
||||
document_diff.cpp
|
||||
document_exporter.cpp
|
||||
document_range.cpp
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
@ -333,7 +333,7 @@ void CanvasSizeCommand::onExecute(Context* context)
|
||||
Document* document = writer.document();
|
||||
Sprite* sprite = writer.sprite();
|
||||
Transaction transaction(writer.context(), "Canvas Size");
|
||||
DocumentApi api = document->getApi(transaction);
|
||||
DocApi api = document->getApi(transaction);
|
||||
|
||||
api.cropSprite(sprite,
|
||||
gfx::Rect(x1, y1,
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "app/console.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc_event.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/document_range.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/color_bar.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "app/console.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc_undo.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
@ -53,7 +53,7 @@ void DuplicateLayerCommand::onExecute(Context* context)
|
||||
{
|
||||
Transaction transaction(writer.context(), "Layer Duplication");
|
||||
LayerImage* sourceLayer = static_cast<LayerImage*>(writer.layer());
|
||||
DocumentApi api = document->getApi(transaction);
|
||||
DocApi api = document->getApi(transaction);
|
||||
api.duplicateLayerAfter(sourceLayer,
|
||||
sourceLayer->parent(),
|
||||
sourceLayer);
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "app/cmd/trim_cel.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/document_range.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
@ -69,7 +69,7 @@ void FlipCommand::onExecute(Context* context)
|
||||
|
||||
{
|
||||
Transaction transaction(writer.context(), friendlyName());
|
||||
DocumentApi api = document->getApi(transaction);
|
||||
DocApi api = document->getApi(transaction);
|
||||
|
||||
Timeline* timeline = App::instance()->timeline();
|
||||
LockTimelineRange lockRange(timeline);
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/transaction.h"
|
||||
#include "base/convert_to.h"
|
||||
@ -129,7 +129,7 @@ void FramePropertiesCommand::onExecute(Context* context)
|
||||
|
||||
ContextWriter writer(reader);
|
||||
Transaction transaction(writer.context(), "Frame Duration");
|
||||
DocumentApi api = writer.document()->getApi(transaction);
|
||||
DocApi api = writer.document()->getApi(transaction);
|
||||
|
||||
for (frame_t frame : selFrames)
|
||||
api.setFrameDuration(writer.sprite(), frame, newMsecs);
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "app/context.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
@ -386,7 +386,7 @@ void ImportSpriteSheetCommand::onExecute(Context* context)
|
||||
// operations in a undo-transaction.
|
||||
ContextWriter writer(context);
|
||||
Transaction transaction(writer.context(), "Import Sprite Sheet", ModifyDocument);
|
||||
DocumentApi api = document->getApi(transaction);
|
||||
DocApi api = document->getApi(transaction);
|
||||
|
||||
// Add the layer in the sprite.
|
||||
LayerImage* resultLayer = api.newLayer(sprite->root(), "Sprite Sheet");
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
#include "doc/layer.h"
|
||||
|
@ -15,8 +15,8 @@
|
||||
#include "app/cmd/unlink_cel.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/document.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
#include "base/unique_ptr.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "app/commands/params.h"
|
||||
#include "app/console.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
@ -91,7 +91,7 @@ void NewFrameCommand::onExecute(Context* context)
|
||||
Sprite* sprite(writer.sprite());
|
||||
{
|
||||
Transaction transaction(writer.context(), friendlyName());
|
||||
DocumentApi api = document->getApi(transaction);
|
||||
DocApi api = document->getApi(transaction);
|
||||
|
||||
switch (m_content) {
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "app/commands/commands.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/find_widget.h"
|
||||
#include "app/load_widget.h"
|
||||
#include "app/modules/gui.h"
|
||||
@ -180,7 +180,7 @@ void NewLayerCommand::onExecute(Context* context)
|
||||
Transaction transaction(
|
||||
writer.context(),
|
||||
std::string("New ") + layerPrefix());
|
||||
DocumentApi api = document->getApi(transaction);
|
||||
DocApi api = document->getApi(transaction);
|
||||
bool afterBackground = false;
|
||||
|
||||
switch (m_type) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
#include "doc/sprite.h"
|
||||
@ -50,7 +50,7 @@ void RemoveFrameCommand::onExecute(Context* context)
|
||||
Sprite* sprite(writer.sprite());
|
||||
{
|
||||
Transaction transaction(writer.context(), "Remove Frame");
|
||||
DocumentApi api = document->getApi(transaction);
|
||||
DocApi api = document->getApi(transaction);
|
||||
const Site* site = writer.site();
|
||||
if (site->inTimeline() &&
|
||||
!site->selectedFrames().empty()) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
@ -53,7 +53,7 @@ void RemoveLayerCommand::onExecute(Context* context)
|
||||
Sprite* sprite(writer.sprite());
|
||||
{
|
||||
Transaction transaction(writer.context(), "Remove Layer");
|
||||
DocumentApi api = document->getApi(transaction);
|
||||
DocApi api = document->getApi(transaction);
|
||||
|
||||
const Site* site = writer.site();
|
||||
if (site->inTimeline() &&
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "app/cmd/set_slice_key.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/transaction.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "app/commands/cmd_rotate.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/document_range.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/modules/editors.h"
|
||||
@ -79,7 +79,7 @@ protected:
|
||||
|
||||
// [working thread]
|
||||
void onJob() override {
|
||||
DocumentApi api = document()->getApi(transaction());
|
||||
DocApi api = document()->getApi(transaction());
|
||||
|
||||
// 1) Rotate cel positions
|
||||
for (Cel* cel : m_cels) {
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "app/commands/cmd_set_palette.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/file_selector.h"
|
||||
#include "app/ini_file.h"
|
||||
#include "app/modules/palettes.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "app/color.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/color_button.h"
|
||||
@ -137,7 +137,7 @@ void SpritePropertiesCommand::onExecute(Context* context)
|
||||
if (index != sprite->transparentColor() ||
|
||||
pixelRatio != sprite->pixelRatio()) {
|
||||
Transaction transaction(writer.context(), "Change Sprite Properties");
|
||||
DocumentApi api = writer.document()->getApi(transaction);
|
||||
DocApi api = writer.document()->getApi(transaction);
|
||||
|
||||
if (index != sprite->transparentColor())
|
||||
api.setSpriteTransparentColor(sprite, index);
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "app/commands/cmd_sprite_size.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/ini_file.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/modules/palettes.h"
|
||||
@ -73,7 +73,7 @@ protected:
|
||||
|
||||
// [working thread]
|
||||
void onJob() override {
|
||||
DocumentApi api = writer().document()->getApi(transaction());
|
||||
DocApi api = writer().document()->getApi(transaction());
|
||||
|
||||
int cels_count = 0;
|
||||
for (Cel* cel : sprite()->uniqueCels()) { // TODO add size() member function to CelsRange
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
|
||||
#include "app/cmd/add_cel.h"
|
||||
#include "app/cmd/add_frame.h"
|
||||
@ -63,23 +63,23 @@
|
||||
|
||||
namespace app {
|
||||
|
||||
DocumentApi::DocumentApi(Document* document, Transaction& transaction)
|
||||
DocApi::DocApi(Document* document, Transaction& transaction)
|
||||
: m_document(document)
|
||||
, m_transaction(transaction)
|
||||
{
|
||||
}
|
||||
|
||||
void DocumentApi::setSpriteSize(Sprite* sprite, int w, int h)
|
||||
void DocApi::setSpriteSize(Sprite* sprite, int w, int h)
|
||||
{
|
||||
m_transaction.execute(new cmd::SetSpriteSize(sprite, w, h));
|
||||
}
|
||||
|
||||
void DocumentApi::setSpriteTransparentColor(Sprite* sprite, color_t maskColor)
|
||||
void DocApi::setSpriteTransparentColor(Sprite* sprite, color_t maskColor)
|
||||
{
|
||||
m_transaction.execute(new cmd::SetTransparentColor(sprite, maskColor));
|
||||
}
|
||||
|
||||
void DocumentApi::cropSprite(Sprite* sprite, const gfx::Rect& bounds)
|
||||
void DocApi::cropSprite(Sprite* sprite, const gfx::Rect& bounds)
|
||||
{
|
||||
setSpriteSize(sprite, bounds.w, bounds.h);
|
||||
|
||||
@ -157,7 +157,7 @@ void DocumentApi::cropSprite(Sprite* sprite, const gfx::Rect& bounds)
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentApi::trimSprite(Sprite* sprite)
|
||||
void DocApi::trimSprite(Sprite* sprite)
|
||||
{
|
||||
gfx::Rect bounds;
|
||||
|
||||
@ -181,14 +181,14 @@ void DocumentApi::trimSprite(Sprite* sprite)
|
||||
cropSprite(sprite, bounds);
|
||||
}
|
||||
|
||||
void DocumentApi::addFrame(Sprite* sprite, frame_t newFrame)
|
||||
void DocApi::addFrame(Sprite* sprite, frame_t newFrame)
|
||||
{
|
||||
copyFrame(sprite, newFrame-1, newFrame,
|
||||
kDropBeforeFrame,
|
||||
kDefaultTagsAdjustment);
|
||||
}
|
||||
|
||||
void DocumentApi::addEmptyFrame(Sprite* sprite, frame_t newFrame)
|
||||
void DocApi::addEmptyFrame(Sprite* sprite, frame_t newFrame)
|
||||
{
|
||||
m_transaction.execute(new cmd::AddFrame(sprite, newFrame));
|
||||
adjustFrameTags(sprite, newFrame, +1,
|
||||
@ -196,13 +196,13 @@ void DocumentApi::addEmptyFrame(Sprite* sprite, frame_t newFrame)
|
||||
kDefaultTagsAdjustment);
|
||||
}
|
||||
|
||||
void DocumentApi::addEmptyFramesTo(Sprite* sprite, frame_t newFrame)
|
||||
void DocApi::addEmptyFramesTo(Sprite* sprite, frame_t newFrame)
|
||||
{
|
||||
while (sprite->totalFrames() <= newFrame)
|
||||
addEmptyFrame(sprite, sprite->totalFrames());
|
||||
}
|
||||
|
||||
void DocumentApi::copyFrame(Sprite* sprite,
|
||||
void DocApi::copyFrame(Sprite* sprite,
|
||||
const frame_t fromFrame,
|
||||
const frame_t newFrame,
|
||||
const DropFramePlace dropFramePlace,
|
||||
@ -220,7 +220,7 @@ void DocumentApi::copyFrame(Sprite* sprite,
|
||||
tagsHandling);
|
||||
}
|
||||
|
||||
void DocumentApi::removeFrame(Sprite* sprite, frame_t frame)
|
||||
void DocApi::removeFrame(Sprite* sprite, frame_t frame)
|
||||
{
|
||||
ASSERT(frame >= 0);
|
||||
m_transaction.execute(new cmd::RemoveFrame(sprite, frame));
|
||||
@ -229,18 +229,18 @@ void DocumentApi::removeFrame(Sprite* sprite, frame_t frame)
|
||||
kDefaultTagsAdjustment);
|
||||
}
|
||||
|
||||
void DocumentApi::setTotalFrames(Sprite* sprite, frame_t frames)
|
||||
void DocApi::setTotalFrames(Sprite* sprite, frame_t frames)
|
||||
{
|
||||
ASSERT(frames >= 1);
|
||||
m_transaction.execute(new cmd::SetTotalFrames(sprite, frames));
|
||||
}
|
||||
|
||||
void DocumentApi::setFrameDuration(Sprite* sprite, frame_t frame, int msecs)
|
||||
void DocApi::setFrameDuration(Sprite* sprite, frame_t frame, int msecs)
|
||||
{
|
||||
m_transaction.execute(new cmd::SetFrameDuration(sprite, frame, msecs));
|
||||
}
|
||||
|
||||
void DocumentApi::setFrameRangeDuration(Sprite* sprite, frame_t from, frame_t to, int msecs)
|
||||
void DocApi::setFrameRangeDuration(Sprite* sprite, frame_t from, frame_t to, int msecs)
|
||||
{
|
||||
ASSERT(from >= frame_t(0));
|
||||
ASSERT(from < to);
|
||||
@ -250,7 +250,7 @@ void DocumentApi::setFrameRangeDuration(Sprite* sprite, frame_t from, frame_t to
|
||||
m_transaction.execute(new cmd::SetFrameDuration(sprite, fr, msecs));
|
||||
}
|
||||
|
||||
void DocumentApi::moveFrame(Sprite* sprite,
|
||||
void DocApi::moveFrame(Sprite* sprite,
|
||||
const frame_t frame,
|
||||
frame_t targetFrame,
|
||||
const DropFramePlace dropFramePlace,
|
||||
@ -293,7 +293,7 @@ void DocumentApi::moveFrame(Sprite* sprite,
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentApi::moveFrameLayer(Layer* layer, frame_t frame, frame_t beforeFrame)
|
||||
void DocApi::moveFrameLayer(Layer* layer, frame_t frame, frame_t beforeFrame)
|
||||
{
|
||||
ASSERT(layer);
|
||||
|
||||
@ -349,7 +349,7 @@ void DocumentApi::moveFrameLayer(Layer* layer, frame_t frame, frame_t beforeFram
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentApi::addCel(LayerImage* layer, Cel* cel)
|
||||
void DocApi::addCel(LayerImage* layer, Cel* cel)
|
||||
{
|
||||
ASSERT(layer);
|
||||
ASSERT(cel);
|
||||
@ -357,7 +357,7 @@ void DocumentApi::addCel(LayerImage* layer, Cel* cel)
|
||||
m_transaction.execute(new cmd::AddCel(layer, cel));
|
||||
}
|
||||
|
||||
void DocumentApi::setCelFramePosition(Cel* cel, frame_t frame)
|
||||
void DocApi::setCelFramePosition(Cel* cel, frame_t frame)
|
||||
{
|
||||
ASSERT(cel);
|
||||
ASSERT(frame >= 0);
|
||||
@ -365,14 +365,14 @@ void DocumentApi::setCelFramePosition(Cel* cel, frame_t frame)
|
||||
m_transaction.execute(new cmd::SetCelFrame(cel, frame));
|
||||
}
|
||||
|
||||
void DocumentApi::setCelPosition(Sprite* sprite, Cel* cel, int x, int y)
|
||||
void DocApi::setCelPosition(Sprite* sprite, Cel* cel, int x, int y)
|
||||
{
|
||||
ASSERT(cel);
|
||||
|
||||
m_transaction.execute(new cmd::SetCelPosition(cel, x, y));
|
||||
}
|
||||
|
||||
void DocumentApi::setCelOpacity(Sprite* sprite, Cel* cel, int newOpacity)
|
||||
void DocApi::setCelOpacity(Sprite* sprite, Cel* cel, int newOpacity)
|
||||
{
|
||||
ASSERT(cel);
|
||||
ASSERT(sprite->supportAlpha());
|
||||
@ -380,19 +380,19 @@ void DocumentApi::setCelOpacity(Sprite* sprite, Cel* cel, int newOpacity)
|
||||
m_transaction.execute(new cmd::SetCelOpacity(cel, newOpacity));
|
||||
}
|
||||
|
||||
void DocumentApi::clearCel(LayerImage* layer, frame_t frame)
|
||||
void DocApi::clearCel(LayerImage* layer, frame_t frame)
|
||||
{
|
||||
if (Cel* cel = layer->cel(frame))
|
||||
clearCel(cel);
|
||||
}
|
||||
|
||||
void DocumentApi::clearCel(Cel* cel)
|
||||
void DocApi::clearCel(Cel* cel)
|
||||
{
|
||||
ASSERT(cel);
|
||||
m_transaction.execute(new cmd::ClearCel(cel));
|
||||
}
|
||||
|
||||
void DocumentApi::moveCel(
|
||||
void DocApi::moveCel(
|
||||
LayerImage* srcLayer, frame_t srcFrame,
|
||||
LayerImage* dstLayer, frame_t dstFrame)
|
||||
{
|
||||
@ -402,7 +402,7 @@ void DocumentApi::moveCel(
|
||||
dstLayer, dstFrame, dstLayer->isContinuous()));
|
||||
}
|
||||
|
||||
void DocumentApi::copyCel(
|
||||
void DocApi::copyCel(
|
||||
LayerImage* srcLayer, frame_t srcFrame,
|
||||
LayerImage* dstLayer, frame_t dstFrame)
|
||||
{
|
||||
@ -411,7 +411,7 @@ void DocumentApi::copyCel(
|
||||
dstLayer, dstFrame, dstLayer->isContinuous());
|
||||
}
|
||||
|
||||
void DocumentApi::copyCel(
|
||||
void DocApi::copyCel(
|
||||
LayerImage* srcLayer, frame_t srcFrame,
|
||||
LayerImage* dstLayer, frame_t dstFrame, bool continuous)
|
||||
{
|
||||
@ -426,7 +426,7 @@ void DocumentApi::copyCel(
|
||||
dstLayer, dstFrame, continuous));
|
||||
}
|
||||
|
||||
void DocumentApi::swapCel(
|
||||
void DocApi::swapCel(
|
||||
LayerImage* layer, frame_t frame1, frame_t frame2)
|
||||
{
|
||||
ASSERT(frame1 != frame2);
|
||||
@ -444,7 +444,7 @@ void DocumentApi::swapCel(
|
||||
if (cel2) setCelFramePosition(cel2, frame1);
|
||||
}
|
||||
|
||||
LayerImage* DocumentApi::newLayer(LayerGroup* parent, const std::string& name)
|
||||
LayerImage* DocApi::newLayer(LayerGroup* parent, const std::string& name)
|
||||
{
|
||||
LayerImage* layer = new LayerImage(parent->sprite());
|
||||
layer->setName(name);
|
||||
@ -453,7 +453,7 @@ LayerImage* DocumentApi::newLayer(LayerGroup* parent, const std::string& name)
|
||||
return layer;
|
||||
}
|
||||
|
||||
LayerGroup* DocumentApi::newGroup(LayerGroup* parent, const std::string& name)
|
||||
LayerGroup* DocApi::newGroup(LayerGroup* parent, const std::string& name)
|
||||
{
|
||||
LayerGroup* layer = new LayerGroup(parent->sprite());
|
||||
layer->setName(name);
|
||||
@ -462,19 +462,19 @@ LayerGroup* DocumentApi::newGroup(LayerGroup* parent, const std::string& name)
|
||||
return layer;
|
||||
}
|
||||
|
||||
void DocumentApi::addLayer(LayerGroup* parent, Layer* newLayer, Layer* afterThis)
|
||||
void DocApi::addLayer(LayerGroup* parent, Layer* newLayer, Layer* afterThis)
|
||||
{
|
||||
m_transaction.execute(new cmd::AddLayer(parent, newLayer, afterThis));
|
||||
}
|
||||
|
||||
void DocumentApi::removeLayer(Layer* layer)
|
||||
void DocApi::removeLayer(Layer* layer)
|
||||
{
|
||||
ASSERT(layer);
|
||||
|
||||
m_transaction.execute(new cmd::RemoveLayer(layer));
|
||||
}
|
||||
|
||||
void DocumentApi::restackLayerAfter(Layer* layer, LayerGroup* parent, Layer* afterThis)
|
||||
void DocApi::restackLayerAfter(Layer* layer, LayerGroup* parent, Layer* afterThis)
|
||||
{
|
||||
ASSERT(parent);
|
||||
|
||||
@ -484,7 +484,7 @@ void DocumentApi::restackLayerAfter(Layer* layer, LayerGroup* parent, Layer* aft
|
||||
m_transaction.execute(new cmd::MoveLayer(layer, parent, afterThis));
|
||||
}
|
||||
|
||||
void DocumentApi::restackLayerBefore(Layer* layer, LayerGroup* parent, Layer* beforeThis)
|
||||
void DocApi::restackLayerBefore(Layer* layer, LayerGroup* parent, Layer* beforeThis)
|
||||
{
|
||||
ASSERT(parent);
|
||||
|
||||
@ -500,17 +500,17 @@ void DocumentApi::restackLayerBefore(Layer* layer, LayerGroup* parent, Layer* be
|
||||
restackLayerAfter(layer, parent, afterThis);
|
||||
}
|
||||
|
||||
void DocumentApi::backgroundFromLayer(Layer* layer)
|
||||
void DocApi::backgroundFromLayer(Layer* layer)
|
||||
{
|
||||
m_transaction.execute(new cmd::BackgroundFromLayer(layer));
|
||||
}
|
||||
|
||||
void DocumentApi::layerFromBackground(Layer* layer)
|
||||
void DocApi::layerFromBackground(Layer* layer)
|
||||
{
|
||||
m_transaction.execute(new cmd::LayerFromBackground(layer));
|
||||
}
|
||||
|
||||
Layer* DocumentApi::duplicateLayerAfter(Layer* sourceLayer, LayerGroup* parent, Layer* afterLayer)
|
||||
Layer* DocApi::duplicateLayerAfter(Layer* sourceLayer, LayerGroup* parent, Layer* afterLayer)
|
||||
{
|
||||
ASSERT(parent);
|
||||
base::UniquePtr<Layer> newLayerPtr;
|
||||
@ -532,7 +532,7 @@ Layer* DocumentApi::duplicateLayerAfter(Layer* sourceLayer, LayerGroup* parent,
|
||||
return newLayerPtr.release();
|
||||
}
|
||||
|
||||
Layer* DocumentApi::duplicateLayerBefore(Layer* sourceLayer, LayerGroup* parent, Layer* beforeLayer)
|
||||
Layer* DocApi::duplicateLayerBefore(Layer* sourceLayer, LayerGroup* parent, Layer* beforeLayer)
|
||||
{
|
||||
ASSERT(parent);
|
||||
Layer* afterThis = (beforeLayer ? beforeLayer->getPreviousBrowsable(): nullptr);
|
||||
@ -542,7 +542,7 @@ Layer* DocumentApi::duplicateLayerBefore(Layer* sourceLayer, LayerGroup* parent,
|
||||
return newLayer;
|
||||
}
|
||||
|
||||
Cel* DocumentApi::addCel(LayerImage* layer, frame_t frameNumber, const ImageRef& image)
|
||||
Cel* DocApi::addCel(LayerImage* layer, frame_t frameNumber, const ImageRef& image)
|
||||
{
|
||||
ASSERT(layer->cel(frameNumber) == NULL);
|
||||
|
||||
@ -552,7 +552,7 @@ Cel* DocumentApi::addCel(LayerImage* layer, frame_t frameNumber, const ImageRef&
|
||||
return cel.release();
|
||||
}
|
||||
|
||||
void DocumentApi::replaceImage(Sprite* sprite, const ImageRef& oldImage, const ImageRef& newImage)
|
||||
void DocApi::replaceImage(Sprite* sprite, const ImageRef& oldImage, const ImageRef& newImage)
|
||||
{
|
||||
ASSERT(oldImage);
|
||||
ASSERT(newImage);
|
||||
@ -562,13 +562,13 @@ void DocumentApi::replaceImage(Sprite* sprite, const ImageRef& oldImage, const I
|
||||
sprite, oldImage, newImage));
|
||||
}
|
||||
|
||||
void DocumentApi::flipImage(Image* image, const gfx::Rect& bounds,
|
||||
void DocApi::flipImage(Image* image, const gfx::Rect& bounds,
|
||||
doc::algorithm::FlipType flipType)
|
||||
{
|
||||
m_transaction.execute(new cmd::FlipImage(image, bounds, flipType));
|
||||
}
|
||||
|
||||
void DocumentApi::copyToCurrentMask(Mask* mask)
|
||||
void DocApi::copyToCurrentMask(Mask* mask)
|
||||
{
|
||||
ASSERT(m_document->mask());
|
||||
ASSERT(mask);
|
||||
@ -576,14 +576,14 @@ void DocumentApi::copyToCurrentMask(Mask* mask)
|
||||
m_transaction.execute(new cmd::SetMask(m_document, mask));
|
||||
}
|
||||
|
||||
void DocumentApi::setMaskPosition(int x, int y)
|
||||
void DocApi::setMaskPosition(int x, int y)
|
||||
{
|
||||
ASSERT(m_document->mask());
|
||||
|
||||
m_transaction.execute(new cmd::SetMaskPosition(m_document, gfx::Point(x, y)));
|
||||
}
|
||||
|
||||
void DocumentApi::setPalette(Sprite* sprite, frame_t frame, const Palette* newPalette)
|
||||
void DocApi::setPalette(Sprite* sprite, frame_t frame, const Palette* newPalette)
|
||||
{
|
||||
Palette* currentSpritePalette = sprite->palette(frame); // Sprite current pal
|
||||
int from, to;
|
||||
@ -598,7 +598,7 @@ void DocumentApi::setPalette(Sprite* sprite, frame_t frame, const Palette* newPa
|
||||
}
|
||||
}
|
||||
|
||||
void DocumentApi::adjustFrameTags(Sprite* sprite,
|
||||
void DocApi::adjustFrameTags(Sprite* sprite,
|
||||
const frame_t frame,
|
||||
const frame_t delta,
|
||||
const DropFramePlace dropFramePlace,
|
@ -4,8 +4,8 @@
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifndef APP_DOCUMENT_API_H_INCLUDED
|
||||
#define APP_DOCUMENT_API_H_INCLUDED
|
||||
#ifndef APP_DOC_API_H_INCLUDED
|
||||
#define APP_DOC_API_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "app/drop_frame_place.h"
|
||||
@ -37,9 +37,9 @@ namespace app {
|
||||
// directly to the transaction.
|
||||
//
|
||||
// TODO refactor this class in several Cmd, don't make it bigger
|
||||
class DocumentApi {
|
||||
class DocApi {
|
||||
public:
|
||||
DocumentApi(Document* document, Transaction& transaction);
|
||||
DocApi(Document* document, Transaction& transaction);
|
||||
|
||||
// Sprite API
|
||||
void setSpriteSize(Sprite* sprite, int w, int h);
|
@ -18,7 +18,7 @@
|
||||
#include "app/doc_event.h"
|
||||
#include "app/doc_observer.h"
|
||||
#include "app/doc_undo.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/file/format_options.h"
|
||||
#include "app/flatten.h"
|
||||
#include "app/pref/preferences.h"
|
||||
@ -76,9 +76,9 @@ void Document::setContext(Context* ctx)
|
||||
onContextChanged();
|
||||
}
|
||||
|
||||
DocumentApi Document::getApi(Transaction& transaction)
|
||||
DocApi Document::getApi(Transaction& transaction)
|
||||
{
|
||||
return DocumentApi(this, transaction);
|
||||
return DocApi(this, transaction);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -42,7 +42,7 @@ namespace gfx {
|
||||
namespace app {
|
||||
|
||||
class Context;
|
||||
class DocumentApi;
|
||||
class DocApi;
|
||||
class DocUndo;
|
||||
class Transaction;
|
||||
|
||||
@ -71,7 +71,7 @@ namespace app {
|
||||
void setContext(Context* ctx);
|
||||
|
||||
// Returns a high-level API: observable and undoable methods.
|
||||
DocumentApi getApi(Transaction& transaction);
|
||||
DocApi getApi(Transaction& transaction);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Main properties
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "app/context.h"
|
||||
#include "app/document.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/test_context.h"
|
||||
#include "app/transaction.h"
|
||||
#include "base/unique_ptr.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/document_range.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
@ -33,7 +33,7 @@ namespace app {
|
||||
enum Op { Move, Copy };
|
||||
|
||||
static void move_or_copy_cels(
|
||||
DocumentApi& api, Op op,
|
||||
DocApi& api, Op op,
|
||||
const LayerList& srcLayers,
|
||||
const LayerList& dstLayers,
|
||||
const SelectedFrames& srcFrames,
|
||||
@ -76,7 +76,7 @@ static void move_or_copy_cels(
|
||||
}
|
||||
|
||||
static DocumentRange move_or_copy_frames(
|
||||
DocumentApi& api, Op op,
|
||||
DocApi& api, Op op,
|
||||
Sprite* sprite,
|
||||
const DocumentRange& srcRange,
|
||||
frame_t dstFrame,
|
||||
@ -332,11 +332,11 @@ static DocumentRange drop_range_op(
|
||||
const ContextReader reader(context);
|
||||
ContextWriter writer(reader, 500);
|
||||
Transaction transaction(writer.context(), undoLabel, ModifyDocument);
|
||||
DocumentApi api = doc->getApi(transaction);
|
||||
DocApi api = doc->getApi(transaction);
|
||||
|
||||
// TODO Try to add the range with just one call to DocumentApi
|
||||
// TODO Try to add the range with just one call to DocApi
|
||||
// methods, to avoid generating a lot of cmd::SetCelFrame (see
|
||||
// DocumentApi::setCelFramePosition() function).
|
||||
// DocApi::setCelFramePosition() function).
|
||||
|
||||
switch (from.type()) {
|
||||
|
||||
@ -489,7 +489,7 @@ void reverse_frames(Document* doc, const DocumentRange& range)
|
||||
const ContextReader reader(context);
|
||||
ContextWriter writer(reader, 500);
|
||||
Transaction transaction(writer.context(), "Reverse Frames");
|
||||
DocumentApi api = doc->getApi(transaction);
|
||||
DocApi api = doc->getApi(transaction);
|
||||
Sprite* sprite = doc->sprite();
|
||||
LayerList layers;
|
||||
frame_t frameBegin, frameEnd;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "app/context.h"
|
||||
#include "app/doc_undo.h"
|
||||
#include "app/document.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/document_range.h"
|
||||
#include "app/document_range_ops.h"
|
||||
#include "app/test_context.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context.h"
|
||||
#include "app/document.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/file/palette_file.h"
|
||||
#include "app/script/app_scripting.h"
|
||||
#include "app/script/sprite_wrap.h"
|
||||
@ -60,7 +60,7 @@ void Sprite_resize(script::ContextHandle handle)
|
||||
wrap->commitImages();
|
||||
|
||||
Document* doc = wrap->document();
|
||||
DocumentApi api(doc, wrap->transaction());
|
||||
DocApi api(doc, wrap->transaction());
|
||||
api.setSpriteSize(doc->sprite(), size.w, size.h);
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ void Sprite_crop(script::ContextHandle handle)
|
||||
}
|
||||
|
||||
if (!bounds.isEmpty()) {
|
||||
DocumentApi api(doc, wrap->transaction());
|
||||
DocApi api(doc, wrap->transaction());
|
||||
api.cropSprite(doc->sprite(), bounds);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "app/cmd/set_sprite_size.h"
|
||||
#include "app/context.h"
|
||||
#include "app/document.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/script/image_wrap.h"
|
||||
#include "app/site.h"
|
||||
#include "app/transaction.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "app/console.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/doc_undo.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/ini_file.h"
|
||||
#include "app/modules/editors.h"
|
||||
@ -648,7 +648,7 @@ void ColorBar::setTransparentIndex(int index)
|
||||
int(sprite->transparentColor()) != index) {
|
||||
// TODO merge this code with SpritePropertiesCommand
|
||||
Transaction transaction(writer.context(), "Set Transparent Color");
|
||||
DocumentApi api = writer.document()->getApi(transaction);
|
||||
DocApi api = writer.document()->getApi(transaction);
|
||||
api.setSpriteTransparentColor(sprite, index);
|
||||
transaction.commit();
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "app/app.h"
|
||||
#include "app/cmd/set_cel_bounds.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/document_range.h"
|
||||
#include "app/transaction.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
@ -149,7 +149,7 @@ bool MovingCelState::onMouseUp(Editor* editor, MouseMessage* msg)
|
||||
{
|
||||
ContextWriter writer(m_reader, 1000);
|
||||
Transaction transaction(writer.context(), "Cel Movement", ModifyDocument);
|
||||
DocumentApi api = document->getApi(transaction);
|
||||
DocApi api = document->getApi(transaction);
|
||||
gfx::Point intOffset = intCelOffset();
|
||||
|
||||
// And now we move the cel (or all selected range) to the new position.
|
||||
@ -178,7 +178,7 @@ bool MovingCelState::onMouseUp(Editor* editor, MouseMessage* msg)
|
||||
// m_celOffset=(0.5,0.5)) will not move the final
|
||||
// position of the mask (so the ref layer is moved and
|
||||
// the mask isn't).
|
||||
|
||||
|
||||
api.setMaskPosition(document->mask()->bounds().x + intOffset.x,
|
||||
document->mask()->bounds().y + intOffset.y);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "app/cmd/trim_cel.h"
|
||||
#include "app/console.h"
|
||||
#include "app/document.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/site.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "app/doc_event.h"
|
||||
#include "app/doc_undo.h"
|
||||
#include "app/document.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/document_range_ops.h"
|
||||
#include "app/loop_tag.h"
|
||||
#include "app/modules/editors.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "app/console.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/document.h"
|
||||
#include "app/document_api.h"
|
||||
#include "app/doc_api.h"
|
||||
#include "app/document_range.h"
|
||||
#include "app/document_range_ops.h"
|
||||
#include "app/modules/editors.h"
|
||||
@ -407,7 +407,7 @@ void paste()
|
||||
}
|
||||
|
||||
Transaction transaction(UIContext::instance(), "Paste Cels");
|
||||
DocumentApi api = dstDoc->getApi(transaction);
|
||||
DocApi api = dstDoc->getApi(transaction);
|
||||
|
||||
// Add extra frames if needed
|
||||
while (dstFrameFirst+srcRange.frames() > dstSpr->totalFrames())
|
||||
@ -499,7 +499,7 @@ void paste()
|
||||
}
|
||||
|
||||
Transaction transaction(UIContext::instance(), "Paste Frames");
|
||||
DocumentApi api = dstDoc->getApi(transaction);
|
||||
DocApi api = dstDoc->getApi(transaction);
|
||||
|
||||
auto srcLayers = srcSpr->allBrowsableLayers();
|
||||
auto dstLayers = dstSpr->allBrowsableLayers();
|
||||
@ -542,7 +542,7 @@ void paste()
|
||||
throw std::runtime_error("You cannot copy layers of document with different color modes");
|
||||
|
||||
Transaction transaction(UIContext::instance(), "Paste Layers");
|
||||
DocumentApi api = dstDoc->getApi(transaction);
|
||||
DocApi api = dstDoc->getApi(transaction);
|
||||
|
||||
// Remove children if their parent is selected so we only
|
||||
// copy the parent.
|
||||
|
Loading…
Reference in New Issue
Block a user