Rename app::Document -> Doc

This commit is contained in:
David Capello 2018-07-07 11:54:44 -03:00
parent 931c13ef58
commit 9c79ea2b77
213 changed files with 705 additions and 714 deletions

View File

@ -496,12 +496,12 @@ add_library(app-lib
console.cpp
context.cpp
context_flags.cpp
doc.cpp
doc_api.cpp
doc_range.cpp
doc_range_ops.cpp
doc_undo.cpp
docs.cpp
document.cpp
document_diff.cpp
document_exporter.cpp
extensions.cpp

View File

@ -363,19 +363,19 @@ void App::run()
// Destroy all documents in the UIContext.
const Docs& docs = m_modules->m_context.documents();
while (!docs.empty()) {
Document* doc = docs.back();
Doc* doc = docs.back();
// First we close the document. In this way we receive recent
// notifications related to the document as an app::Document. If
// we delete the document directly, we destroy the app::Document
// notifications related to the document as a app::Doc. If
// we delete the document directly, we destroy the app::Doc
// too early, and then doc::~Document() call
// DocsObserver::onRemoveDocument(). In this way, observers
// could think that they have a fully created app::Document when
// could think that they have a fully created app::Doc when
// in reality it's a doc::Document (in the middle of a
// destruction process).
//
// TODO: This problem is because we're extending doc::Document,
// in the future, we should remove app::Document.
// in the future, we should remove app::Doc.
doc->close();
delete doc;
}
@ -618,7 +618,7 @@ PixelFormat app_get_current_pixel_format()
Context* context = UIContext::instance();
ASSERT(context != NULL);
Document* document = context->activeDocument();
Doc* document = context->activeDocument();
if (document != NULL)
return document->sprite()->pixelFormat();
else

View File

@ -35,7 +35,7 @@ namespace app {
class BackupIndicator;
class Context;
class ContextBar;
class Document;
class Doc;
class Extensions;
class INotificationDelegate;
class InputChain;

View File

@ -10,7 +10,7 @@
#include "app/cli/cli_open_file.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/file/file.h"
#include "doc/frame_tag.h"
#include "doc/frame_tags.h"

View File

@ -16,11 +16,11 @@
namespace app {
class Document;
class Doc;
class FileOpROI;
struct CliOpenFile {
app::Document* document;
Doc* document;
std::string filename;
std::string filenameFormat;
std::string frameTag;

View File

@ -16,8 +16,8 @@
#include "app/commands/commands.h"
#include "app/commands/params.h"
#include "app/console.h"
#include "app/doc.h"
#include "app/doc_undo.h"
#include "app/document.h"
#include "app/document_exporter.h"
#include "app/file/file.h"
#include "app/filename_formatter.h"
@ -137,7 +137,7 @@ void CliProcessor::process(Context* ctx)
Console console;
CliOpenFile cof;
SpriteSheetType sheetType = SpriteSheetType::None;
app::Document* lastDoc = nullptr;
Doc* lastDoc = nullptr;
render::DitheringAlgorithm ditheringAlgorithm = render::DitheringAlgorithm::None;
std::string ditheringMatrix;
@ -340,7 +340,7 @@ void CliProcessor::process(Context* ctx)
// Scale all sprites
for (auto doc : ctx->documents()) {
ctx->setActiveDocument(static_cast<app::Document*>(doc));
ctx->setActiveDocument(doc);
ctx->executeCommand(command);
}
}
@ -397,7 +397,7 @@ void CliProcessor::process(Context* ctx)
}
for (auto doc : ctx->documents()) {
ctx->setActiveDocument(static_cast<app::Document*>(doc));
ctx->setActiveDocument(doc);
ctx->executeCommand(command, params);
}
}
@ -416,7 +416,7 @@ void CliProcessor::process(Context* ctx)
// Shrink all sprites if needed
for (auto doc : ctx->documents()) {
ctx->setActiveDocument(static_cast<app::Document*>(doc));
ctx->setActiveDocument(doc);
scaleWidth = (doc->width() > maxWidth ? maxWidth / doc->width() : 1.0);
scaleHeight = (doc->height() > maxHeight ? maxHeight / doc->height() : 1.0);
if (scaleWidth < 1.0 || scaleHeight < 1.0) {
@ -491,7 +491,7 @@ bool CliProcessor::openFile(Context* ctx, CliOpenFile& cof)
{
m_delegate->beforeOpenFile(cof);
app::Document* oldDoc = ctx->activeDocument();
Doc* oldDoc = ctx->activeDocument();
Command* openCommand = Commands::instance()->byId(CommandId::OpenFile());
Params params;
params.set("filename", cof.filename.c_str());
@ -499,7 +499,7 @@ bool CliProcessor::openFile(Context* ctx, CliOpenFile& cof)
params.set("oneframe", "true");
ctx->executeCommand(openCommand, params);
app::Document* doc = ctx->activeDocument();
Doc* doc = ctx->activeDocument();
// If the active document is equal to the previous one, it
// means that we couldn't open this specific document.
if (doc == oldDoc)
@ -580,7 +580,7 @@ void CliProcessor::saveFile(Context* ctx, const CliOpenFile& cof)
Command* trimCommand = Commands::instance()->byId(CommandId::AutocropSprite());
Command* undoCommand = Commands::instance()->byId(CommandId::Undo());
app::Document* doc = cof.document;
Doc* doc = cof.document;
bool clearUndo = false;
if (!cof.crop.isEmpty()) {

View File

@ -15,7 +15,7 @@
#include "app/commands/commands.h"
#include "app/commands/params.h"
#include "app/console.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/document_exporter.h"
#include "app/file/palette_file.h"
#include "app/ui_context.h"
@ -116,7 +116,7 @@ void DefaultCliDelegate::exportFiles(Context* ctx, DocumentExporter& exporter)
{
LOG("APP: Exporting sheet...\n");
base::UniquePtr<app::Document> spriteSheet(exporter.exportSheet(ctx));
base::UniquePtr<Doc> spriteSheet(exporter.exportSheet(ctx));
// Sprite sheet isn't used, we just delete it.

View File

@ -12,7 +12,7 @@
#include "app/cli/cli_open_file.h"
#include "app/context.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/document_exporter.h"
#include "app/file/file.h"
#include "base/fs.h"

View File

@ -10,8 +10,8 @@
#include "app/cmd/add_cel.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "base/serialization.h"
#include "doc/cel.h"
#include "doc/cel_data_io.h"
@ -93,7 +93,7 @@ void AddCel::addCel(Layer* layer, Cel* cel)
static_cast<LayerImage*>(layer)->addCel(cel);
layer->incrementVersion();
auto doc = static_cast<Document*>(cel->document());
Doc* doc = static_cast<Doc*>(cel->document());
DocEvent ev(doc);
ev.sprite(layer->sprite());
ev.layer(layer);
@ -103,7 +103,7 @@ void AddCel::addCel(Layer* layer, Cel* cel)
void AddCel::removeCel(Layer* layer, Cel* cel)
{
auto doc = static_cast<app::Document*>(cel->document());
Doc* doc = static_cast<Doc*>(cel->document());
DocEvent ev(doc);
ev.sprite(layer->sprite());
ev.layer(layer);

View File

@ -11,8 +11,8 @@
#include "app/cmd/add_frame.h"
#include "app/cmd/add_cel.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/cel.h"
#include "doc/layer.h"
#include "doc/primitives.h"
@ -33,7 +33,7 @@ AddFrame::AddFrame(Sprite* sprite, frame_t newFrame)
void AddFrame::onExecute()
{
Sprite* sprite = this->sprite();
app::Document* doc = static_cast<app::Document*>(sprite->document());
auto doc = static_cast<Doc*>(sprite->document());
sprite->addFrame(m_newFrame);
sprite->incrementVersion();
@ -62,7 +62,7 @@ void AddFrame::onExecute()
void AddFrame::onUndo()
{
Sprite* sprite = this->sprite();
app::Document* doc = static_cast<app::Document*>(sprite->document());
auto doc = static_cast<Doc*>(sprite->document());
if (m_addCel)
m_addCel->undo();

View File

@ -10,8 +10,8 @@
#include "app/cmd/add_frame_tag.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/frame_tag.h"
#include "doc/frame_tag_io.h"
#include "doc/sprite.h"
@ -37,7 +37,7 @@ void AddFrameTag::onExecute()
sprite->incrementVersion();
// Notify observers about the new frame.
auto doc = static_cast<Document*>(sprite->document());
Doc* doc = static_cast<Doc*>(sprite->document());
DocEvent ev(doc);
ev.sprite(sprite);
ev.frameTag(frameTag);
@ -53,7 +53,7 @@ void AddFrameTag::onUndo()
// Notify observers about the new frame.
{
auto doc = static_cast<Document*>(sprite->document());
Doc* doc = static_cast<Doc*>(sprite->document());
DocEvent ev(doc);
ev.sprite(sprite);
ev.frameTag(frameTag);
@ -78,7 +78,7 @@ void AddFrameTag::onRedo()
m_size = 0;
// Notify observers about the new frame.
Document* doc = static_cast<Document*>(sprite->document());
Doc* doc = static_cast<Doc*>(sprite->document());
DocEvent ev(doc);
ev.sprite(sprite);
ev.frameTag(frameTag);

View File

@ -10,8 +10,8 @@
#include "app/cmd/add_layer.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/layer.h"
#include "doc/layer_io.h"
#include "doc/subobjects_io.h"
@ -69,7 +69,7 @@ void AddLayer::addLayer(Layer* group, Layer* newLayer, Layer* afterThis)
group->incrementVersion();
group->sprite()->incrementVersion();
auto doc = static_cast<Document*>(group->sprite()->document());
Doc* doc = static_cast<Doc*>(group->sprite()->document());
DocEvent ev(doc);
ev.sprite(group->sprite());
ev.layer(newLayer);
@ -78,7 +78,7 @@ void AddLayer::addLayer(Layer* group, Layer* newLayer, Layer* afterThis)
void AddLayer::removeLayer(Layer* group, Layer* layer)
{
auto doc = static_cast<Document*>(group->sprite()->document());
Doc* doc = static_cast<Doc*>(group->sprite()->document());
DocEvent ev(doc);
ev.sprite(layer->sprite());
ev.layer(layer);

View File

@ -16,7 +16,7 @@
#include "app/cmd/replace_image.h"
#include "app/cmd/set_cel_opacity.h"
#include "app/cmd/set_cel_position.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/layer.h"
@ -42,7 +42,7 @@ void BackgroundFromLayer::onExecute()
{
Layer* layer = this->layer();
Sprite* sprite = layer->sprite();
app::Document* doc = static_cast<app::Document*>(sprite->document());
auto doc = static_cast<Doc*>(sprite->document());
color_t bgcolor = doc->bgColor();
// create a temporary image to draw each frame of the new

View File

@ -12,7 +12,7 @@
#include "app/cmd/clear_image.h"
#include "app/cmd/remove_cel.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/cel.h"
#include "doc/layer.h"
@ -24,7 +24,7 @@ using namespace doc;
ClearCel::ClearCel(Cel* cel)
: WithCel(cel)
{
Document* doc = static_cast<Document*>(cel->document());
Doc* doc = static_cast<Doc*>(cel->document());
if (cel->layer()->isBackground()) {
Image* image = cel->image();

View File

@ -10,7 +10,7 @@
#include "app/cmd/clear_image.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/image.h"
#include "doc/primitives.h"

View File

@ -11,7 +11,7 @@
#include "app/cmd/clear_mask.h"
#include "app/cmd/clear_cel.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/algorithm/fill_selection.h"
#include "doc/cel.h"
#include "doc/image_impl.h"
@ -27,7 +27,7 @@ using namespace doc;
ClearMask::ClearMask(Cel* cel)
: WithCel(cel)
{
Document* doc = static_cast<Document*>(cel->document());
Doc* doc = static_cast<Doc*>(cel->document());
// If the mask is empty or is not visible then we have to clear the
// entire image in the cel.
@ -86,7 +86,7 @@ void ClearMask::clear()
{
Cel* cel = this->cel();
Image* image = m_dstImage->image();
Document* doc = static_cast<Document*>(cel->document());
Doc* doc = static_cast<Doc*>(cel->document());
Mask* mask = doc->mask();
doc::algorithm::fill_selection(image, m_offset, mask, m_bgcolor);

View File

@ -10,7 +10,7 @@
#include "app/cmd/clear_rect.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/layer.h"
@ -42,7 +42,7 @@ ClearRect::ClearRect(Cel* cel, const gfx::Rect& bounds)
m_dstImage.reset(new WithImage(image));
Document* doc = static_cast<Document*>(cel->document());
Doc* doc = static_cast<Doc*>(cel->document());
m_bgcolor = doc->bgColor(cel->layer());
m_copy.reset(crop_image(image,

View File

@ -17,7 +17,7 @@
#include "app/cmd/remove_cel.h"
#include "app/cmd/set_cel_data.h"
#include "app/cmd/unlink_cel.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/util/create_cel_copy.h"
#include "doc/cel.h"
#include "doc/layer.h"
@ -129,7 +129,7 @@ void CopyCel::onFireNotifications()
ASSERT(m_srcLayer.layer());
ASSERT(m_dstLayer.layer());
static_cast<app::Document*>(m_dstLayer.layer()->sprite()->document())
static_cast<Doc*>(m_dstLayer.layer()->sprite()->document())
->notifyCelCopied(
m_srcLayer.layer(), m_srcFrame,
m_dstLayer.layer(), m_dstFrame);

View File

@ -11,27 +11,27 @@
#include "app/cmd/deselect_mask.h"
#include "app/cmd/set_mask.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/mask.h"
namespace app {
namespace cmd {
DeselectMask::DeselectMask(Document* doc)
DeselectMask::DeselectMask(Doc* doc)
: WithDocument(doc)
{
}
void DeselectMask::onExecute()
{
app::Document* doc = document();
Doc* doc = document();
m_oldMask.reset(doc->isMaskVisible() ? new Mask(*doc->mask()): nullptr);
doc->setMaskVisible(false);
}
void DeselectMask::onUndo()
{
app::Document* doc = document();
Doc* doc = document();
doc->setMask(m_oldMask);
doc->setMaskVisible(true);

View File

@ -23,7 +23,7 @@ namespace cmd {
class DeselectMask : public Cmd
, public WithDocument {
public:
DeselectMask(Document* doc);
DeselectMask(Doc* doc);
protected:
void onExecute() override;

View File

@ -11,14 +11,14 @@
#include "app/cmd/flatten_layers.h"
#include "app/cmd/add_layer.h"
#include "app/cmd/set_layer_name.h"
#include "app/cmd/configure_background.h"
#include "app/cmd/copy_rect.h"
#include "app/cmd/remove_layer.h"
#include "app/cmd/remove_layer.h"
#include "app/cmd/set_layer_flags.h"
#include "app/cmd/set_layer_name.h"
#include "app/cmd/unlink_cel.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/cel.h"
#include "doc/layer.h"
#include "doc/primitives.h"
@ -36,7 +36,7 @@ FlattenLayers::FlattenLayers(Sprite* sprite)
void FlattenLayers::onExecute()
{
Sprite* sprite = this->sprite();
app::Document* doc = static_cast<app::Document*>(sprite->document());
auto doc = static_cast<Doc*>(sprite->document());
// Create a temporary image.
ImageRef image(Image::create(sprite->pixelFormat(),

View File

@ -10,7 +10,7 @@
#include "app/cmd/flip_mask.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/algorithm/flip_image.h"
#include "doc/mask.h"
@ -19,7 +19,7 @@ namespace cmd {
using namespace doc;
FlipMask::FlipMask(Document* doc, doc::algorithm::FlipType flipType)
FlipMask::FlipMask(Doc* doc, doc::algorithm::FlipType flipType)
: WithDocument(doc)
, m_flipType(flipType)
{
@ -37,7 +37,7 @@ void FlipMask::onUndo()
void FlipMask::swap()
{
Document* document = this->document();
Doc* document = this->document();
Mask* mask = document->mask();
ASSERT(mask->bitmap());

View File

@ -19,7 +19,7 @@ namespace cmd {
class FlipMask : public Cmd
, public WithDocument {
public:
FlipMask(Document* doc, doc::algorithm::FlipType flipType);
FlipMask(Doc* doc, doc::algorithm::FlipType flipType);
protected:
void onExecute() override;

View File

@ -11,7 +11,7 @@
#include "app/cmd/flip_masked_cel.h"
#include "app/cmd/copy_rect.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/util/autocrop.h"
#include "doc/algorithm/flip_image.h"
#include "doc/cel.h"
@ -24,7 +24,7 @@ namespace cmd {
FlipMaskedCel::FlipMaskedCel(Cel* cel, doc::algorithm::FlipType flipType)
{
Document* doc = static_cast<Document*>(cel->document());
Doc* doc = static_cast<Doc*>(cel->document());
color_t bgcolor = doc->bgColor(cel->layer());
Image* image = cel->image();
Mask* mask = doc->mask();

View File

@ -19,7 +19,7 @@
#include "app/cmd/set_cel_data.h"
#include "app/cmd/set_cel_frame.h"
#include "app/cmd/unlink_cel.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/util/create_cel_copy.h"
#include "doc/cel.h"
#include "doc/layer.h"
@ -130,7 +130,7 @@ void MoveCel::onExecute()
void MoveCel::onFireNotifications()
{
CmdSequence::onFireNotifications();
static_cast<app::Document*>(m_dstLayer.layer()->sprite()->document())
static_cast<Doc*>(m_dstLayer.layer()->sprite()->document())
->notifyCelMoved(
m_srcLayer.layer(), m_srcFrame,
m_dstLayer.layer(), m_dstFrame);

View File

@ -10,8 +10,8 @@
#include "app/cmd/move_layer.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/layer.h"
#include "doc/sprite.h"
@ -92,7 +92,7 @@ void MoveLayer::onUndo()
void MoveLayer::onFireNotifications()
{
Layer* layer = m_layer.layer();
Document* doc = static_cast<Document*>(layer->sprite()->document());
Doc* doc = static_cast<Doc*>(layer->sprite()->document());
DocEvent ev(doc);
ev.sprite(layer->sprite());
ev.layer(layer);

View File

@ -11,8 +11,8 @@
#include "app/cmd/remove_frame.h"
#include "app/cmd/remove_cel.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/cels_range.h"
#include "doc/sprite.h"
@ -35,7 +35,7 @@ RemoveFrame::RemoveFrame(Sprite* sprite, frame_t frame)
void RemoveFrame::onExecute()
{
Sprite* sprite = this->sprite();
auto doc = static_cast<Document*>(sprite->document());
Doc* doc = static_cast<Doc*>(sprite->document());
if (m_firstTime) {
m_firstTime = false;
@ -64,7 +64,7 @@ void RemoveFrame::onExecute()
void RemoveFrame::onUndo()
{
Sprite* sprite = this->sprite();
Document* doc = static_cast<Document*>(sprite->document());
Doc* doc = static_cast<Doc*>(sprite->document());
if (m_frameRemoved)
sprite->addFrame(m_frame);

View File

@ -11,20 +11,20 @@
#include "app/cmd/reselect_mask.h"
#include "app/cmd/set_mask.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/mask.h"
namespace app {
namespace cmd {
ReselectMask::ReselectMask(Document* doc)
ReselectMask::ReselectMask(Doc* doc)
: WithDocument(doc)
{
}
void ReselectMask::onExecute()
{
app::Document* doc = document();
Doc* doc = document();
if (m_oldMask) {
doc->setMask(m_oldMask);
@ -36,7 +36,7 @@ void ReselectMask::onExecute()
void ReselectMask::onUndo()
{
app::Document* doc = document();
Doc* doc = document();
m_oldMask.reset(doc->isMaskVisible() ? new Mask(*doc->mask()): nullptr);

View File

@ -23,7 +23,7 @@ namespace cmd {
class ReselectMask : public Cmd
, public WithDocument {
public:
ReselectMask(Document* doc);
ReselectMask(Doc* doc);
protected:
void onExecute() override;

View File

@ -10,8 +10,8 @@
#include "app/cmd/set_cel_bounds.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/cel.h"
namespace app {
@ -41,7 +41,7 @@ void SetCelBoundsF::onUndo()
void SetCelBoundsF::onFireNotifications()
{
Cel* cel = this->cel();
Document* doc = static_cast<Document*>(cel->document());
Doc* doc = static_cast<Doc*>(cel->document());
DocEvent ev(doc);
ev.sprite(cel->sprite());
ev.cel(cel);

View File

@ -10,8 +10,8 @@
#include "app/cmd/set_cel_frame.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/cel.h"
#include "doc/layer.h"
#include "doc/sprite.h"
@ -45,7 +45,7 @@ void SetCelFrame::onUndo()
void SetCelFrame::onFireNotifications()
{
Cel* cel = this->cel();
auto doc = static_cast<Document*>(cel->sprite()->document());
Doc* doc = static_cast<Doc*>(cel->sprite()->document());
DocEvent ev(doc);
ev.sprite(cel->layer()->sprite());
ev.layer(cel->layer());

View File

@ -10,8 +10,8 @@
#include "app/cmd/set_cel_opacity.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/cel.h"
namespace app {
@ -41,7 +41,7 @@ void SetCelOpacity::onUndo()
void SetCelOpacity::onFireNotifications()
{
Cel* cel = this->cel();
Document* doc = static_cast<Document*>(cel->document());
Doc* doc = static_cast<Doc*>(cel->document());
DocEvent ev(doc);
ev.sprite(cel->sprite());
ev.cel(cel);

View File

@ -10,8 +10,8 @@
#include "app/cmd/set_cel_position.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/cel.h"
namespace app {
@ -43,7 +43,7 @@ void SetCelPosition::onUndo()
void SetCelPosition::onFireNotifications()
{
Cel* cel = this->cel();
Document* doc = static_cast<Document*>(cel->document());
Doc* doc = static_cast<Doc*>(cel->document());
DocEvent ev(doc);
ev.sprite(cel->sprite());
ev.cel(cel);

View File

@ -10,8 +10,8 @@
#include "app/cmd/set_frame_duration.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/sprite.h"
namespace app {
@ -40,7 +40,7 @@ void SetFrameDuration::onUndo()
void SetFrameDuration::onFireNotifications()
{
Sprite* sprite = this->sprite();
auto doc = static_cast<Document*>(sprite->document());
Doc* doc = static_cast<Doc*>(sprite->document());
DocEvent ev(doc);
ev.sprite(sprite);
ev.frame(m_frame);

View File

@ -10,12 +10,12 @@
#include "app/cmd/set_last_point.h"
#include "app/document.h"
#include "app/doc.h"
namespace app {
namespace cmd {
SetLastPoint::SetLastPoint(Document* doc, const gfx::Point& pos)
SetLastPoint::SetLastPoint(Doc* doc, const gfx::Point& pos)
: WithDocument(doc)
, m_oldPoint(doc->lastDrawingPoint())
, m_newPoint(pos)
@ -34,7 +34,7 @@ void SetLastPoint::onUndo()
void SetLastPoint::setLastPoint(const gfx::Point& pos)
{
Document* doc = document();
Doc* doc = document();
doc->setLastDrawingPoint(pos);
}

View File

@ -19,7 +19,7 @@ namespace cmd {
class SetLastPoint : public Cmd
, public WithDocument {
public:
SetLastPoint(Document* doc, const gfx::Point& pos);
SetLastPoint(Doc* doc, const gfx::Point& pos);
protected:
void onExecute() override;

View File

@ -10,8 +10,8 @@
#include "app/cmd/set_layer_blend_mode.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/layer.h"
#include "doc/sprite.h"
@ -40,7 +40,7 @@ void SetLayerBlendMode::onUndo()
void SetLayerBlendMode::onFireNotifications()
{
Layer* layer = this->layer();
auto doc = static_cast<Document*>(layer->sprite()->document());
Doc* doc = static_cast<Doc*>(layer->sprite()->document());
DocEvent ev(doc);
ev.sprite(layer->sprite());
ev.layer(layer);

View File

@ -10,8 +10,8 @@
#include "app/cmd/set_layer_name.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/layer.h"
#include "doc/sprite.h"
@ -40,7 +40,7 @@ void SetLayerName::onUndo()
void SetLayerName::onFireNotifications()
{
Layer* layer = this->layer();
Document* doc = static_cast<Document*>(layer->sprite()->document());
Doc* doc = static_cast<Doc*>(layer->sprite()->document());
DocEvent ev(doc);
ev.sprite(layer->sprite());
ev.layer(layer);

View File

@ -10,8 +10,8 @@
#include "app/cmd/set_layer_opacity.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/layer.h"
#include "doc/sprite.h"
@ -40,7 +40,7 @@ void SetLayerOpacity::onUndo()
void SetLayerOpacity::onFireNotifications()
{
Layer* layer = this->layer();
auto doc = static_cast<Document*>(layer->sprite()->document());
Doc* doc = static_cast<Doc*>(layer->sprite()->document());
DocEvent ev(doc);
ev.sprite(layer->sprite());
ev.layer(layer);

View File

@ -10,13 +10,13 @@
#include "app/cmd/set_mask.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/mask.h"
namespace app {
namespace cmd {
SetMask::SetMask(Document* doc, Mask* newMask)
SetMask::SetMask(Doc* doc, Mask* newMask)
: WithDocument(doc)
, m_oldMask(doc->isMaskVisible() ? new Mask(*doc->mask()): nullptr)
, m_newMask(newMask && !newMask->isEmpty() ? new Mask(*newMask): nullptr)
@ -48,7 +48,7 @@ size_t SetMask::onMemSize() const
void SetMask::setMask(Mask* mask)
{
app::Document* doc = document();
Doc* doc = document();
if (mask) {
doc->setMask(mask);

View File

@ -25,7 +25,7 @@ namespace cmd {
class SetMask : public Cmd
, public WithDocument {
public:
SetMask(Document* doc, Mask* newMask);
SetMask(Doc* doc, Mask* newMask);
// Used to change the new mask used in the onRedo()
void setNewMask(Mask* newMask);

View File

@ -10,13 +10,13 @@
#include "app/cmd/set_mask_position.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/mask.h"
namespace app {
namespace cmd {
SetMaskPosition::SetMaskPosition(Document* doc, const gfx::Point& pos)
SetMaskPosition::SetMaskPosition(Doc* doc, const gfx::Point& pos)
: WithDocument(doc)
, m_oldPosition(doc->mask()->bounds().origin())
, m_newPosition(pos)
@ -35,7 +35,7 @@ void SetMaskPosition::onUndo()
void SetMaskPosition::setMaskPosition(const gfx::Point& pos)
{
Document* doc = document();
Doc* doc = document();
doc->mask()->setOrigin(pos.x, pos.y);
doc->resetTransformation();
}

View File

@ -19,7 +19,7 @@ namespace cmd {
class SetMaskPosition : public Cmd
, public WithDocument {
public:
SetMaskPosition(Document* doc, const gfx::Point& pos);
SetMaskPosition(Doc* doc, const gfx::Point& pos);
protected:
void onExecute() override;

View File

@ -14,8 +14,8 @@
#include "app/cmd/replace_image.h"
#include "app/cmd/set_cel_opacity.h"
#include "app/cmd/set_palette.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "base/unique_ptr.h"
#include "doc/cel.h"
#include "doc/cels_range.h"
@ -148,7 +148,7 @@ void SetPixelFormat::setFormat(PixelFormat format)
sprite->incrementVersion();
// Regenerate extras
auto doc = static_cast<Document*>(sprite->document());
Doc* doc = static_cast<Doc*>(sprite->document());
doc->setExtraCel(ExtraCelRef(nullptr));
// Generate notification

View File

@ -10,9 +10,9 @@
#include "app/cmd/set_pixel_ratio.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/doc_observer.h"
#include "app/document.h"
#include "doc/sprite.h"
namespace app {
@ -44,7 +44,7 @@ void SetPixelRatio::onUndo()
void SetPixelRatio::onFireNotifications()
{
Sprite* sprite = this->sprite();
auto doc = static_cast<Document*>(sprite->document());
Doc* doc = static_cast<Doc*>(sprite->document());
DocEvent ev(doc);
ev.sprite(sprite);
doc->notify_observers<DocEvent&>(&DocObserver::onSpritePixelRatioChanged, ev);

View File

@ -10,8 +10,8 @@
#include "app/cmd/set_sprite_size.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/sprite.h"
namespace app {
@ -45,7 +45,7 @@ void SetSpriteSize::onUndo()
void SetSpriteSize::onFireNotifications()
{
Sprite* sprite = this->sprite();
auto doc = static_cast<Document*>(sprite->document());
Doc* doc = static_cast<Doc*>(sprite->document());
DocEvent ev(doc);
ev.sprite(sprite);
doc->notify_observers<DocEvent&>(&DocObserver::onSpriteSizeChanged, ev);

View File

@ -10,8 +10,8 @@
#include "app/cmd/set_total_frames.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/sprite.h"
namespace app {
@ -41,7 +41,7 @@ void SetTotalFrames::onUndo()
void SetTotalFrames::onFireNotifications()
{
Sprite* sprite = this->sprite();
auto doc = static_cast<Document*>(sprite->document());
Doc* doc = static_cast<Doc*>(sprite->document());
DocEvent ev(doc);
ev.sprite(sprite);
ev.frame(sprite->totalFrames());

View File

@ -10,8 +10,8 @@
#include "app/cmd/set_transparent_color.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "doc/sprite.h"
namespace app {
@ -41,7 +41,7 @@ void SetTransparentColor::onUndo()
void SetTransparentColor::onFireNotifications()
{
Sprite* sprite = this->sprite();
auto doc = static_cast<Document*>(sprite->document());
auto doc = static_cast<Doc*>(sprite->document());
DocEvent ev(doc);
ev.sprite(sprite);
doc->notify_observers<DocEvent&>(&DocObserver::onSpriteTransparentColorChanged, ev);

View File

@ -10,7 +10,7 @@
#include "app/cmd/shift_masked_cel.h"
#include "app/document.h"
#include "app/doc.h"
#include "doc/algorithm/shift_image.h"
#include "doc/cel.h"
#include "doc/image.h"
@ -41,7 +41,7 @@ void ShiftMaskedCel::shift(int dx, int dy)
{
Cel* cel = this->cel();
Image* image = cel->image();
Mask* mask = static_cast<Document*>(cel->document())->mask();
Mask* mask = static_cast<Doc*>(cel->document())->mask();
ASSERT(mask->bitmap());
if (!mask->bitmap())
return;

View File

@ -10,19 +10,19 @@
#include "app/cmd/with_document.h"
#include "app/document.h"
#include "app/doc.h"
namespace app {
namespace cmd {
WithDocument::WithDocument(app::Document* doc)
WithDocument::WithDocument(Doc* doc)
: m_docId(doc->id())
{
}
app::Document* WithDocument::document()
Doc* WithDocument::document()
{
return doc::get<app::Document>(m_docId);
return doc::get<Doc>(m_docId);
}
} // namespace cmd

View File

@ -11,13 +11,13 @@
#include "doc/object_id.h"
namespace app {
class Document;
class Doc;
namespace cmd {
class WithDocument {
public:
WithDocument(app::Document* doc);
app::Document* document();
WithDocument(Doc* doc);
Doc* document();
private:
doc::ObjectId m_docId;

View File

@ -10,7 +10,7 @@
#include "app/color_picker.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/pref/preferences.h"
#include "app/site.h"
#include "app/util/wrap_point.h"
@ -73,7 +73,7 @@ void ColorPicker::pickColor(const Site& site,
// Check tiled mode
if (sprite && site.document()) {
const app::Document* doc = static_cast<const app::Document*>(site.document());
auto doc = static_cast<const Doc*>(site.document());
DocumentPreferences& docPref = Preferences::instance().document(doc);
pos = wrap_pointF(docPref.tiled.mode(),

View File

@ -108,7 +108,7 @@ void AddColorCommand::onExecute(Context* ctx)
return;
ContextWriter writer(ctx, 500);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite = writer.sprite();
if (!document || !sprite) {
ASSERT(false);

View File

@ -50,7 +50,7 @@ bool BackgroundFromLayerCommand::onEnabled(Context* context)
void BackgroundFromLayerCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
{
Transaction transaction(writer.context(), "Background from Layer");

View File

@ -330,7 +330,7 @@ void CanvasSizeCommand::onExecute(Context* context)
{
ContextWriter writer(reader);
Document* document = writer.document();
Doc* document = writer.document();
Sprite* sprite = writer.sprite();
Transaction transaction(writer.context(), "Canvas Size");
DocApi api = document->getApi(transaction);

View File

@ -65,7 +65,7 @@ public:
UIContext::instance()->remove_observer(this);
}
void setCel(Document* doc, Cel* cel) {
void setCel(Doc* doc, Cel* cel) {
if (m_document) {
m_document->remove_observer(this);
m_document = nullptr;
@ -223,7 +223,7 @@ private:
// ContextObserver impl
void onActiveSiteChange(const Site& site) override {
if (isVisible())
setCel(const_cast<Document*>(site.document()),
setCel(const_cast<Doc*>(site.document()),
const_cast<Cel*>(site.cel()));
else if (m_document)
setCel(nullptr, nullptr);
@ -262,7 +262,7 @@ private:
}
Timer m_timer;
Document* m_document;
Doc* m_document;
Cel* m_cel;
DocRange m_range;
bool m_selfUpdate;

View File

@ -44,7 +44,7 @@ bool ClearCelCommand::onEnabled(Context* context)
void ClearCelCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
bool nonEditableLayers = false;
{
Transaction transaction(writer.context(), "Clear Cel");

View File

@ -61,7 +61,7 @@ bool CropSpriteCommand::onEnabled(Context* context)
void CropSpriteCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite(writer.sprite());
gfx::Rect bounds;
@ -106,7 +106,7 @@ bool AutocropSpriteCommand::onEnabled(Context* context)
void AutocropSpriteCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite(writer.sprite());
{
Transaction transaction(writer.context(), "Trim Sprite");

View File

@ -42,7 +42,7 @@ bool DeselectMaskCommand::onEnabled(Context* context)
void DeselectMaskCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
{
Transaction transaction(writer.context(), "Deselect", DoesntModifyDocument);
transaction.execute(new cmd::DeselectMask(document));

View File

@ -48,7 +48,7 @@ bool DuplicateLayerCommand::onEnabled(Context* context)
void DuplicateLayerCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document = writer.document();
Doc* document = writer.document();
{
Transaction transaction(writer.context(), "Layer Duplication");

View File

@ -49,7 +49,7 @@ bool DuplicateSpriteCommand::onEnabled(Context* context)
void DuplicateSpriteCommand::onExecute(Context* context)
{
const ContextReader reader(context);
const Document* document = reader.document();
const Doc* document = reader.document();
// Load the window widget
app::gen::DuplicateSprite window;
@ -69,7 +69,7 @@ void DuplicateSpriteCommand::onExecute(Context* context)
set_config_bool("DuplicateSprite", "Flatten", window.flatten()->isSelected());
// Make a copy of the document
Document* docCopy;
Doc* docCopy;
if (window.flatten()->isSelected())
docCopy = document->duplicate(DuplicateWithFlattenLayers);
else

View File

@ -12,7 +12,7 @@
#include "app/commands/command.h"
#include "app/commands/commands.h"
#include "app/context.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/job.h"
#include "app/ui/main_window.h"
#include "ui/alert.h"

View File

@ -12,7 +12,7 @@
#include "app/commands/command.h"
#include "app/context.h"
#include "app/context_access.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/document_exporter.h"
#include "app/file/file.h"
#include "app/file_selector.h"
@ -626,7 +626,7 @@ bool ExportSpriteSheetCommand::onEnabled(Context* context)
void ExportSpriteSheetCommand::onExecute(Context* context)
{
Site site = context->activeSite();
Document* document = static_cast<Document*>(site.document());
Doc* document = site.document();
Sprite* sprite = site.sprite();
DocumentPreferences& docPref(Preferences::instance().document(document));
bool askOverwrite = m_askOverwrite;
@ -777,7 +777,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
(!selLayers.empty() ? &selLayers: nullptr),
(!selFrames.empty() ? &selFrames: nullptr));
base::UniquePtr<Document> newDocument(exporter.exportSheet(context));
base::UniquePtr<Doc> newDocument(exporter.exportSheet(context));
if (!newDocument)
return;

View File

@ -64,7 +64,7 @@ void FillCommand::onExecute(Context* ctx)
{
ContextWriter writer(ctx);
Site site = *writer.site();
Document* doc = (app::Document*)site.document();
Doc* doc = site.document();
Sprite* sprite = site.sprite();
Layer* layer = site.layer();
Mask* mask = doc->mask();

View File

@ -64,7 +64,7 @@ bool FlipCommand::onEnabled(Context* context)
void FlipCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document = writer.document();
Doc* document = writer.document();
Sprite* sprite = writer.sprite();
{

View File

@ -239,7 +239,7 @@ protected:
private:
Context* m_context;
Editor* m_editor;
Document* m_doc;
Doc* m_doc;
Sprite* m_sprite;
const Palette* m_pal;
gfx::Point m_pos;

View File

@ -12,7 +12,7 @@
#include "app/commands/command.h"
#include "app/context.h"
#include "app/context_access.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "app/modules/editors.h"
@ -69,7 +69,7 @@ protected:
void onExecute(Context* ctx) override {
const ContextReader reader(ctx);
const Document* document = reader.document();
const Doc* document = reader.document();
const Mask* mask(document->mask());
DocumentPreferences& docPref =
Preferences::instance().document(ctx->activeDocument());

View File

@ -101,7 +101,7 @@ public:
return closer() == import();
}
Document* document() const {
Doc* document() const {
return m_document;
}
@ -120,7 +120,7 @@ protected:
}
void onSelectFile() {
Document* oldActiveDocument = m_context->activeDocument();
Doc* oldActiveDocument = m_context->activeDocument();
Command* openFile = Commands::instance()->byId(CommandId::OpenFile());
Params params;
params.set("filename", "");
@ -190,7 +190,7 @@ protected:
private:
void selectActiveDocument() {
Document* oldDocument = m_document;
Doc* oldDocument = m_document;
m_document = m_context->activeDocument();
// If the user already have selected a file, we have to destroy
@ -275,7 +275,7 @@ private:
}
Context* m_context;
Document* m_document;
Doc* m_document;
Editor* m_editor;
EditorStatePtr m_editorState;
gfx::Rect m_rect;
@ -309,7 +309,7 @@ void ImportSpriteSheetCommand::onExecute(Context* context)
if (!window.ok())
return;
Document* document = window.document();
Doc* document = window.document();
DocumentPreferences* docPref = window.docPref();
gfx::Rect frameBounds = window.frameBounds();
bool partialTiles = window.partialTilesValue();

View File

@ -62,7 +62,7 @@ void InvertMaskCommand::onExecute(Context* context)
// invert the current mask
else {
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite(writer.sprite());
// Select all the sprite area

View File

@ -50,7 +50,7 @@ bool LayerFromBackgroundCommand::onEnabled(Context* context)
void LayerFromBackgroundCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
{
Transaction transaction(writer.context(), "Layer from Background");
document->getApi(transaction).layerFromBackground(writer.layer());

View File

@ -16,8 +16,8 @@
#include "app/commands/command.h"
#include "app/console.h"
#include "app/context_access.h"
#include "app/doc.h"
#include "app/doc_event.h"
#include "app/document.h"
#include "app/modules/gui.h"
#include "app/transaction.h"
#include "app/ui/separator_in_view.h"
@ -117,7 +117,7 @@ public:
UIContext::instance()->remove_observer(this);
}
void setLayer(Document* doc, Layer* layer) {
void setLayer(Doc* doc, Layer* layer) {
if (m_layer) {
m_document->remove_observer(this);
m_layer = nullptr;
@ -271,7 +271,7 @@ private:
// ContextObserver impl
void onActiveSiteChange(const Site& site) override {
if (isVisible())
setLayer(const_cast<Document*>(static_cast<const Document*>(site.document())),
setLayer(const_cast<Doc*>(site.document()),
const_cast<Layer*>(site.layer()));
else if (m_layer)
setLayer(nullptr, nullptr);
@ -345,7 +345,7 @@ private:
}
Timer m_timer;
Document* m_document;
Doc* m_document;
Layer* m_layer;
DocRange m_range;
bool m_selfUpdate;
@ -366,7 +366,7 @@ bool LayerPropertiesCommand::onEnabled(Context* context)
void LayerPropertiesCommand::onExecute(Context* context)
{
ContextReader reader(context);
Document* doc = static_cast<Document*>(reader.document());
Doc* doc = static_cast<Doc*>(reader.document());
LayerImage* layer = static_cast<LayerImage*>(reader.layer());
if (!g_window)

View File

@ -50,7 +50,7 @@ bool LinkCelsCommand::onEnabled(Context* context)
void LinkCelsCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
bool nonEditableLayers = false;
{
auto site = context->activeSite();

View File

@ -76,7 +76,7 @@ void LoadMaskCommand::onExecute(Context* context)
{
ContextWriter writer(reader);
Document* document = writer.document();
Doc* document = writer.document();
Transaction transaction(writer.context(), "Mask Load", DoesntModifyDocument);
transaction.execute(new cmd::SetMask(document, mask));
transaction.commit();

View File

@ -43,7 +43,7 @@ bool MaskAllCommand::onEnabled(Context* context)
void MaskAllCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite(writer.sprite());
Mask newMask;

View File

@ -15,7 +15,7 @@
#include "app/commands/command.h"
#include "app/context.h"
#include "app/context_access.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/ini_file.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
@ -157,7 +157,7 @@ void MaskByColorCommand::onExecute(Context* context)
bool apply = (m_window->closer() == button_ok);
ContextWriter writer(reader);
Document* document(writer.document());
Doc* document(writer.document());
if (apply) {
Transaction transaction(writer.context(), "Mask by Color", DoesntModifyDocument);

View File

@ -52,7 +52,7 @@ bool MaskContentCommand::onEnabled(Context* context)
void MaskContentCommand::onExecute(Context* context)
{
Document* document;
Doc* document;
{
ContextWriter writer(context);
document = writer.document();

View File

@ -15,8 +15,8 @@
#include "app/cmd/unlink_cel.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/doc.h"
#include "app/doc_api.h"
#include "app/document.h"
#include "app/modules/gui.h"
#include "app/transaction.h"
#include "base/unique_ptr.h"
@ -67,7 +67,7 @@ bool MergeDownLayerCommand::onEnabled(Context* context)
void MergeDownLayerCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite(writer.sprite());
Transaction transaction(writer.context(), "Merge Down Layer", ModifyDocument);
LayerImage* src_layer = static_cast<LayerImage*>(writer.layer());

View File

@ -12,7 +12,7 @@
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/context_access.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/i18n/strings.h"
#include "app/modules/gui.h"
#include "app/pref/preferences.h"
@ -125,7 +125,7 @@ void ModifySelectionCommand::onExecute(Context* context)
// Lock sprite
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite(writer.sprite());
base::UniquePtr<Mask> mask(new Mask);

View File

@ -80,7 +80,7 @@ void MoveMaskCommand::onExecute(Context* context)
case Boundaries: {
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
{
Transaction transaction(writer.context(), "Move Selection", DoesntModifyDocument);
gfx::Point pt = document->mask()->bounds().origin();

View File

@ -13,7 +13,7 @@
#include "app/color_utils.h"
#include "app/commands/command.h"
#include "app/console.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/i18n/strings.h"
#include "app/modules/editors.h"
#include "app/modules/palettes.h"
@ -200,7 +200,7 @@ void NewFileCommand::onExecute(Context* context)
}
// Show the sprite to the user
base::UniquePtr<Document> doc(new Document(sprite));
base::UniquePtr<Doc> doc(new Doc(sprite));
sprite.release();
sprintf(buf, "Sprite-%04d", ++_sprite_counter);
doc->setFilename(buf);

View File

@ -87,7 +87,7 @@ bool NewFrameCommand::onEnabled(Context* context)
void NewFrameCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite(writer.sprite());
{
Transaction transaction(writer.context(), friendlyName());

View File

@ -108,11 +108,11 @@ private:
void NewLayerCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite(writer.sprite());
std::string name;
app::Document* pasteDoc = nullptr;
Doc* pasteDoc = nullptr;
Scoped destroyPasteDoc(
[&pasteDoc, context]{
if (pasteDoc) {
@ -129,7 +129,7 @@ void NewLayerCommand::onExecute(Context* context)
// Select a file to copy its content
if (m_fromFile) {
Document* oldActiveDocument = context->activeDocument();
Doc* oldActiveDocument = context->activeDocument();
Command* openFile = Commands::instance()->byId(CommandId::OpenFile());
Params params;
params.set("filename", "");

View File

@ -10,7 +10,7 @@
#include "app/commands/command.h"
#include "app/context.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/site.h"
#include "app/util/new_image_from_mask.h"
#include "base/fs.h"
@ -51,7 +51,7 @@ bool NewSpriteFromSelectionCommand::onEnabled(Context* context)
void NewSpriteFromSelectionCommand::onExecute(Context* context)
{
const Site site = context->activeSite();
const app::Document* doc = static_cast<const app::Document*>(site.document());
const Doc* doc = site.document();
const Sprite* sprite = site.sprite();
const Mask* mask = doc->mask();
ImageRef image(
@ -75,7 +75,7 @@ void NewSpriteFromSelectionCommand::onExecute(Context* context)
dstLayer->setFlags(site.layer()->flags()); // Copy all flags
copy_image(dstLayer->cel(frame_t(0))->image(), image.get());
base::UniquePtr<Document> dstDoc(new Document(dstSprite));
base::UniquePtr<Doc> dstDoc(new Doc(dstSprite));
dstSprite.release();
char buf[1024];
std::sprintf(buf, "%s-%dx%d-%dx%d",

View File

@ -11,7 +11,7 @@
#include "app/app.h"
#include "app/commands/command.h"
#include "app/context.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/pref/preferences.h"
namespace app {

View File

@ -14,7 +14,7 @@
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/console.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/file/file.h"
#include "app/file_selector.h"
#include "app/job.h"
@ -191,7 +191,7 @@ void OpenFileCommand::onExecute(Context* context)
if (fop->hasError() && !fop->isStop())
console.printf(fop->error().c_str());
Document* document = fop->document();
Doc* document = fop->document();
if (document) {
if (context->isUIAvailable())
App::instance()->recentFiles()->addRecentFile(fop->filename().c_str());

View File

@ -11,7 +11,7 @@
#include "app/commands/command.h"
#include "app/context.h"
#include "app/context_access.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/launcher.h"
namespace app {

View File

@ -11,7 +11,7 @@
#include "app/commands/command.h"
#include "app/context.h"
#include "app/context_access.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/launcher.h"
namespace app {

View File

@ -46,7 +46,7 @@ bool RemoveFrameCommand::onEnabled(Context* context)
void RemoveFrameCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite(writer.sprite());
{
Transaction transaction(writer.context(), "Remove Frame");

View File

@ -49,7 +49,7 @@ void RemoveLayerCommand::onExecute(Context* context)
{
std::string layerName;
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite(writer.sprite());
{
Transaction transaction(writer.context(), "Remove Layer");

View File

@ -81,7 +81,7 @@ void RemoveSliceCommand::onExecute(Context* context)
{
ContextWriter writer(reader, 500);
Document* document(writer.document());
Doc* document(writer.document());
Sprite* sprite(writer.sprite());
Transaction transaction(writer.context(), "Remove Slice");
Slice* slice = const_cast<Slice*>(foundSlice);

View File

@ -45,7 +45,7 @@ void RepeatLastExportCommand::onExecute(Context* context)
{
const ContextReader reader(context);
const Document* document(reader.document());
const Doc* document(reader.document());
DocumentPreferences& docPref =
Preferences::instance().document(document);

View File

@ -36,7 +36,7 @@ ReselectMaskCommand::ReselectMaskCommand()
bool ReselectMaskCommand::onEnabled(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
return
document && // The document does exist
!document->isMaskVisible() && // The mask is hidden
@ -47,7 +47,7 @@ bool ReselectMaskCommand::onEnabled(Context* context)
void ReselectMaskCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Document* document(writer.document());
Doc* document(writer.document());
{
Transaction transaction(writer.context(), "Reselect", DoesntModifyDocument);
transaction.execute(new cmd::ReselectMask(document));

View File

@ -47,7 +47,7 @@ void ReverseFramesCommand::onExecute(Context* context)
if (!range.enabled())
return; // Nothing to do
Document* doc = context->activeDocument();
Doc* doc = context->activeDocument();
reverse_frames(doc, range);

View File

@ -210,7 +210,7 @@ void RotateCommand::onExecute(Context* context)
site.layer()->isEditable()) {
// If we want to rotate the visible mask for the current cel,
// we can go to MovingPixelsState.
if (static_cast<app::Document*>(site.document())->isMaskVisible()) {
if (site.document()->isMaskVisible()) {
// Select marquee tool
if (tools::Tool* tool = App::instance()->toolBox()
->getToolById(tools::WellKnownTools::RectangularMarquee)) {

View File

@ -16,8 +16,8 @@
#include "app/commands/params.h"
#include "app/console.h"
#include "app/context_access.h"
#include "app/doc.h"
#include "app/doc_undo.h"
#include "app/document.h"
#include "app/file/file.h"
#include "app/file/gif_format.h"
#include "app/file/png_format.h"
@ -127,7 +127,7 @@ std::string SaveFileBaseCommand::saveAsDialog(
const bool saveInBackground,
const std::string& forbiddenFilename)
{
Document* document = context->activeDocument();
Doc* document = context->activeDocument();
std::string filename;
if (!m_filename.empty()) {
@ -167,7 +167,7 @@ std::string SaveFileBaseCommand::saveAsDialog(
void SaveFileBaseCommand::saveDocumentInBackground(
const Context* context,
app::Document* document,
Doc* document,
const std::string& filename,
const bool markAsSaved)
{
@ -244,13 +244,13 @@ SaveFileCommand::SaveFileCommand()
// [main thread]
void SaveFileCommand::onExecute(Context* context)
{
Document* document = context->activeDocument();
Doc* document = context->activeDocument();
// If the document is associated to a file in the file-system, we can
// save it directly without user interaction.
if (document->isAssociatedToFile()) {
const ContextReader reader(context);
const Document* documentReader = reader.document();
const Doc* documentReader = reader.document();
saveDocumentInBackground(
context, document,
@ -281,7 +281,7 @@ SaveFileAsCommand::SaveFileAsCommand()
void SaveFileAsCommand::onExecute(Context* context)
{
Document* document = context->activeDocument();
Doc* document = context->activeDocument();
saveAsDialog(context, "Save As",
document->filename(), true);
}
@ -295,7 +295,7 @@ protected:
void onExecute(Context* context) override;
private:
void moveToUndoState(Document* doc,
void moveToUndoState(Doc* doc,
const undo::UndoState* state);
};
@ -306,7 +306,7 @@ SaveFileCopyAsCommand::SaveFileCopyAsCommand()
void SaveFileCopyAsCommand::onExecute(Context* context)
{
Document* doc = context->activeDocument();
Doc* doc = context->activeDocument();
std::string outputFilename = m_filename;
std::string layers = kAllLayers;
std::string frames = kAllFrames;
@ -441,7 +441,7 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
}
}
void SaveFileCopyAsCommand::moveToUndoState(Document* doc,
void SaveFileCopyAsCommand::moveToUndoState(Doc* doc,
const undo::UndoState* state)
{
try {

View File

@ -14,7 +14,7 @@
#include <string>
namespace app {
class Document;
class Doc;
class SaveFileBaseCommand : public Command {
public:
@ -33,7 +33,7 @@ namespace app {
const std::string& forbiddenFilename = std::string());
void saveDocumentInBackground(
const Context* context,
app::Document* document,
Doc* document,
const std::string& filename,
const bool markAsSaved);

View File

@ -44,7 +44,7 @@ bool SaveMaskCommand::onEnabled(Context* context)
void SaveMaskCommand::onExecute(Context* context)
{
const ContextReader reader(context);
const Document* document(reader.document());
const Doc* document(reader.document());
base::paths exts = { "msk" };
base::paths selFilename;

View File

@ -11,7 +11,7 @@
#include "app/cmd/set_mask.h"
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/document.h"
#include "app/doc.h"
#include "app/i18n/strings.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
@ -72,7 +72,7 @@ void SelectTileCommand::onExecute(Context* ctx)
// Lock sprite
ContextWriter writer(ctx);
Document* doc(writer.document());
Doc* doc(writer.document());
auto& docPref = Preferences::instance().document(doc);
base::UniquePtr<Mask> mask(new Mask());

View File

@ -68,7 +68,7 @@ bool SetLoopSectionCommand::onEnabled(Context* ctx)
void SetLoopSectionCommand::onExecute(Context* ctx)
{
doc::Document* doc = ctx->activeDocument();
Doc* doc = ctx->activeDocument();
if (!doc)
return;

View File

@ -65,7 +65,7 @@ void SpritePropertiesCommand::onExecute(Context* context)
// Get sprite properties and fill frame fields
{
const ContextReader reader(context);
const Document* document(reader.document());
const Doc* document(reader.document());
const Sprite* sprite(reader.sprite());
// Update widgets values

Some files were not shown because too many files have changed in this diff Show More