mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-10 01:13:49 +00:00
Rename Documents -> Docs
This commit is contained in:
parent
ee5842cde3
commit
432094f432
@ -498,12 +498,12 @@ add_library(app-lib
|
||||
context_flags.cpp
|
||||
doc_api.cpp
|
||||
doc_undo.cpp
|
||||
docs.cpp
|
||||
document.cpp
|
||||
document_diff.cpp
|
||||
document_exporter.cpp
|
||||
document_range.cpp
|
||||
document_range_ops.cpp
|
||||
documents.cpp
|
||||
extensions.cpp
|
||||
extra_cel.cpp
|
||||
file/file.cpp
|
||||
|
@ -361,7 +361,7 @@ void App::run()
|
||||
#endif // ENABLE_SCRIPTING
|
||||
|
||||
// Destroy all documents in the UIContext.
|
||||
const Documents& docs = m_modules->m_context.documents();
|
||||
const Docs& docs = m_modules->m_context.documents();
|
||||
while (!docs.empty()) {
|
||||
Document* doc = docs.back();
|
||||
|
||||
@ -369,7 +369,7 @@ void App::run()
|
||||
// notifications related to the document as an app::Document. If
|
||||
// we delete the document directly, we destroy the app::Document
|
||||
// too early, and then doc::~Document() call
|
||||
// DocumentsObserver::onRemoveDocument(). In this way, observers
|
||||
// DocsObserver::onRemoveDocument(). In this way, observers
|
||||
// could think that they have a fully created app::Document when
|
||||
// in reality it's a doc::Document (in the middle of a
|
||||
// destruction process).
|
||||
|
@ -15,9 +15,9 @@
|
||||
#include "app/context_observer.h"
|
||||
#include "app/doc_undo.h"
|
||||
#include "app/doc_undo_observer.h"
|
||||
#include "app/docs_observer.h"
|
||||
#include "app/document.h"
|
||||
#include "app/document_access.h"
|
||||
#include "app/documents_observer.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "app/modules/palettes.h"
|
||||
#include "app/site.h"
|
||||
@ -33,7 +33,7 @@ namespace app {
|
||||
|
||||
class UndoHistoryWindow : public app::gen::UndoHistory,
|
||||
public ContextObserver,
|
||||
public DocumentsObserver,
|
||||
public DocsObserver,
|
||||
public DocUndoObserver {
|
||||
public:
|
||||
class Item : public ui::ListItem {
|
||||
@ -126,7 +126,7 @@ private:
|
||||
attachDocument(const_cast<Document*>(site.document()));
|
||||
}
|
||||
|
||||
// DocumentsObserver
|
||||
// DocsObserver
|
||||
void onRemoveDocument(Document* doc) override {
|
||||
if (m_document && m_document == doc)
|
||||
detachDocument();
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context_flags.h"
|
||||
#include "app/context_observer.h"
|
||||
#include "app/documents.h"
|
||||
#include "app/documents_observer.h"
|
||||
#include "app/docs.h"
|
||||
#include "app/docs_observer.h"
|
||||
#include "base/disable_copying.h"
|
||||
#include "base/exception.h"
|
||||
#include "obs/observable.h"
|
||||
@ -52,13 +52,13 @@ namespace app {
|
||||
};
|
||||
|
||||
class Context : public obs::observable<ContextObserver>,
|
||||
public DocumentsObserver {
|
||||
public DocsObserver {
|
||||
public:
|
||||
Context();
|
||||
virtual ~Context();
|
||||
|
||||
const Documents& documents() const { return m_docs; }
|
||||
Documents& documents() { return m_docs; }
|
||||
const Docs& documents() const { return m_docs; }
|
||||
Docs& documents() { return m_docs; }
|
||||
|
||||
virtual bool isUIAvailable() const { return false; }
|
||||
virtual bool isRecordingMacro() const { return false; }
|
||||
@ -87,7 +87,7 @@ namespace app {
|
||||
obs::signal<void (CommandExecutionEvent&)> AfterCommandExecution;
|
||||
|
||||
protected:
|
||||
// DocumentsObserver impl
|
||||
// DocsObserver impl
|
||||
void onCreateDocument(CreateDocumentArgs* args) override;
|
||||
void onAddDocument(Document* doc) override;
|
||||
void onRemoveDocument(Document* doc) override;
|
||||
@ -98,7 +98,7 @@ namespace app {
|
||||
Document* lastSelectedDoc() { return m_lastSelectedDoc; }
|
||||
|
||||
private:
|
||||
Documents m_docs;
|
||||
Docs m_docs;
|
||||
ContextFlags m_flags; // Last updated flags.
|
||||
Document* m_lastSelectedDoc;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "app/context_observer.h"
|
||||
#include "app/doc_observer.h"
|
||||
#include "app/documents_observer.h"
|
||||
#include "app/docs_observer.h"
|
||||
#include "base/mutex.h"
|
||||
#include "base/thread.h"
|
||||
|
||||
@ -23,7 +23,7 @@ namespace crash {
|
||||
class Session;
|
||||
|
||||
class BackupObserver : public ContextObserver
|
||||
, public DocumentsObserver
|
||||
, public DocsObserver
|
||||
, public DocObserver {
|
||||
public:
|
||||
BackupObserver(Session* session, Context* ctx);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/documents.h"
|
||||
#include "app/docs.h"
|
||||
|
||||
#include "app/document.h"
|
||||
#include "base/fs.h"
|
||||
@ -19,23 +19,23 @@
|
||||
|
||||
namespace app {
|
||||
|
||||
Documents::Documents(Context* ctx)
|
||||
Docs::Docs(Context* ctx)
|
||||
: m_ctx(ctx)
|
||||
{
|
||||
ASSERT(ctx != NULL);
|
||||
}
|
||||
|
||||
Documents::~Documents()
|
||||
Docs::~Docs()
|
||||
{
|
||||
deleteAll();
|
||||
}
|
||||
|
||||
Document* Documents::add(int width, int height, ColorMode mode, int ncolors)
|
||||
Document* Docs::add(int width, int height, ColorMode mode, int ncolors)
|
||||
{
|
||||
// Ask to observers to create the document (maybe a doc::Document or
|
||||
// a derived class).
|
||||
CreateDocumentArgs args;
|
||||
notify_observers(&DocumentsObserver::onCreateDocument, &args);
|
||||
notify_observers(&DocsObserver::onCreateDocument, &args);
|
||||
if (!args.document())
|
||||
args.setDocument(new Document(nullptr));
|
||||
|
||||
@ -47,7 +47,7 @@ Document* Documents::add(int width, int height, ColorMode mode, int ncolors)
|
||||
return doc.release();
|
||||
}
|
||||
|
||||
Document* Documents::add(Document* doc)
|
||||
Document* Docs::add(Document* doc)
|
||||
{
|
||||
ASSERT(doc != NULL);
|
||||
ASSERT(doc->id() != doc::NullId);
|
||||
@ -60,11 +60,11 @@ Document* Documents::add(Document* doc)
|
||||
|
||||
m_docs.insert(begin(), doc);
|
||||
|
||||
notify_observers(&DocumentsObserver::onAddDocument, doc);
|
||||
notify_observers(&DocsObserver::onAddDocument, doc);
|
||||
return doc;
|
||||
}
|
||||
|
||||
void Documents::remove(Document* doc)
|
||||
void Docs::remove(Document* doc)
|
||||
{
|
||||
iterator it = std::find(begin(), end(), doc);
|
||||
if (it == end()) // Already removed.
|
||||
@ -72,12 +72,12 @@ void Documents::remove(Document* doc)
|
||||
|
||||
m_docs.erase(it);
|
||||
|
||||
notify_observers(&DocumentsObserver::onRemoveDocument, doc);
|
||||
notify_observers(&DocsObserver::onRemoveDocument, doc);
|
||||
|
||||
doc->setContext(NULL);
|
||||
}
|
||||
|
||||
void Documents::move(Document* doc, int index)
|
||||
void Docs::move(Document* doc, int index)
|
||||
{
|
||||
iterator it = std::find(begin(), end(), doc);
|
||||
ASSERT(it != end());
|
||||
@ -87,7 +87,7 @@ void Documents::move(Document* doc, int index)
|
||||
m_docs.insert(begin()+index, doc);
|
||||
}
|
||||
|
||||
Document* Documents::getById(ObjectId id) const
|
||||
Document* Docs::getById(ObjectId id) const
|
||||
{
|
||||
for (const auto& doc : *this) {
|
||||
if (doc->id() == id)
|
||||
@ -96,7 +96,7 @@ Document* Documents::getById(ObjectId id) const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Document* Documents::getByName(const std::string& name) const
|
||||
Document* Docs::getByName(const std::string& name) const
|
||||
{
|
||||
for (const auto& doc : *this) {
|
||||
if (doc->name() == name)
|
||||
@ -105,7 +105,7 @@ Document* Documents::getByName(const std::string& name) const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Document* Documents::getByFileName(const std::string& filename) const
|
||||
Document* Docs::getByFileName(const std::string& filename) const
|
||||
{
|
||||
std::string fn = base::normalize_path(filename);
|
||||
for (const auto& doc : *this) {
|
||||
@ -115,7 +115,7 @@ Document* Documents::getByFileName(const std::string& filename) const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Documents::deleteAll()
|
||||
void Docs::deleteAll()
|
||||
{
|
||||
while (!empty()) {
|
||||
ASSERT(m_ctx == back()->context());
|
@ -4,11 +4,11 @@
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifndef APP_DOCUMENTS_H_INCLUDED
|
||||
#define APP_DOCUMENTS_H_INCLUDED
|
||||
#ifndef APP_DOCS_H_INCLUDED
|
||||
#define APP_DOCS_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "app/documents_observer.h"
|
||||
#include "app/docs_observer.h"
|
||||
#include "base/disable_copying.h"
|
||||
#include "doc/color_mode.h"
|
||||
#include "doc/object_id.h"
|
||||
@ -21,13 +21,13 @@ namespace app {
|
||||
class Context;
|
||||
class Document;
|
||||
|
||||
class Documents : public obs::observable<DocumentsObserver> {
|
||||
class Docs : public obs::observable<DocsObserver> {
|
||||
public:
|
||||
typedef std::vector<Document*>::iterator iterator;
|
||||
typedef std::vector<Document*>::const_iterator const_iterator;
|
||||
|
||||
Documents(Context* ctx);
|
||||
~Documents();
|
||||
Docs(Context* ctx);
|
||||
~Docs();
|
||||
|
||||
iterator begin() { return m_docs.begin(); }
|
||||
iterator end() { return m_docs.end(); }
|
||||
@ -68,7 +68,7 @@ namespace app {
|
||||
Context* m_ctx;
|
||||
std::vector<Document*> m_docs;
|
||||
|
||||
DISABLE_COPYING(Documents);
|
||||
DISABLE_COPYING(Docs);
|
||||
};
|
||||
|
||||
} // namespace app
|
@ -4,8 +4,8 @@
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifndef APP_DOCUMENTS_OBSERVER_H_INCLUDED
|
||||
#define APP_DOCUMENTS_OBSERVER_H_INCLUDED
|
||||
#ifndef APP_DOCS_OBSERVER_H_INCLUDED
|
||||
#define APP_DOCS_OBSERVER_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
namespace app {
|
||||
@ -20,9 +20,9 @@ namespace app {
|
||||
Document* m_doc;
|
||||
};
|
||||
|
||||
class DocumentsObserver {
|
||||
class DocsObserver {
|
||||
public:
|
||||
virtual ~DocumentsObserver() { }
|
||||
virtual ~DocsObserver() { }
|
||||
virtual void onCreateDocument(CreateDocumentArgs* args) { }
|
||||
virtual void onAddDocument(Document* doc) { }
|
||||
virtual void onRemoveDocument(Document* doc) { }
|
@ -10,8 +10,8 @@
|
||||
|
||||
#include "app/color.h"
|
||||
#include "app/commands/filters/cels_target.h"
|
||||
#include "app/docs_observer.h"
|
||||
#include "app/document_exporter.h"
|
||||
#include "app/documents_observer.h"
|
||||
#include "app/pref/option.h"
|
||||
#include "app/sprite_sheet_type.h"
|
||||
#include "app/tools/freehand_algorithm.h"
|
||||
@ -45,7 +45,7 @@ namespace app {
|
||||
typedef app::gen::DocPref DocumentPreferences;
|
||||
|
||||
class Preferences : public app::gen::GlobalPref,
|
||||
public app::DocumentsObserver {
|
||||
public app::DocsObserver {
|
||||
public:
|
||||
static Preferences& instance();
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "app/color.h"
|
||||
#include "app/context_observer.h"
|
||||
#include "app/doc_observer.h"
|
||||
#include "app/documents_observer.h"
|
||||
#include "app/docs_observer.h"
|
||||
#include "app/ui/button_set.h"
|
||||
#include "app/ui/color_button.h"
|
||||
#include "app/ui/input_chain_element.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "app/color.h"
|
||||
#include "app/context_observer.h"
|
||||
#include "app/doc_observer.h"
|
||||
#include "app/documents_observer.h"
|
||||
#include "app/docs_observer.h"
|
||||
#include "app/tools/active_tool_observer.h"
|
||||
#include "base/time.h"
|
||||
#include "ui/base.h"
|
||||
@ -43,7 +43,7 @@ namespace app {
|
||||
|
||||
class StatusBar : public ui::HBox
|
||||
, public ContextObserver
|
||||
, public DocumentsObserver
|
||||
, public DocsObserver
|
||||
, public DocObserver
|
||||
, public tools::ActiveToolObserver {
|
||||
static StatusBar* m_instance;
|
||||
|
@ -9,8 +9,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "app/doc_observer.h"
|
||||
#include "app/docs_observer.h"
|
||||
#include "app/document_range.h"
|
||||
#include "app/documents_observer.h"
|
||||
#include "app/loop_tag.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/ui/editor/editor_observer.h"
|
||||
@ -56,7 +56,7 @@ namespace app {
|
||||
class Timeline : public ui::Widget,
|
||||
public ui::ScrollableViewDelegate,
|
||||
public ContextObserver,
|
||||
public DocumentsObserver,
|
||||
public DocsObserver,
|
||||
public DocObserver,
|
||||
public EditorObserver,
|
||||
public InputChainElement,
|
||||
@ -153,7 +153,7 @@ namespace app {
|
||||
// ContextObserver impl
|
||||
void onActiveSiteChange(const Site& site) override;
|
||||
|
||||
// DocumentsObserver impl.
|
||||
// DocsObserver impl.
|
||||
void onRemoveDocument(Document* document) override;
|
||||
|
||||
// EditorObserver impl.
|
||||
|
@ -9,7 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "app/context.h"
|
||||
#include "app/documents_observer.h"
|
||||
#include "app/docs_observer.h"
|
||||
|
||||
namespace app {
|
||||
class DocumentView;
|
||||
|
@ -43,7 +43,7 @@ namespace app {
|
||||
|
||||
namespace {
|
||||
|
||||
class ClipboardRange : public DocumentsObserver {
|
||||
class ClipboardRange : public DocsObserver {
|
||||
public:
|
||||
ClipboardRange() : m_doc(nullptr) {
|
||||
}
|
||||
@ -76,7 +76,7 @@ namespace {
|
||||
Document* document() const { return m_doc; }
|
||||
DocumentRange range() const { return m_range; }
|
||||
|
||||
// DocumentsObserver impl
|
||||
// DocsObserver impl
|
||||
void onRemoveDocument(Document* doc) override {
|
||||
if (doc == m_doc)
|
||||
invalidate();
|
||||
|
Loading…
x
Reference in New Issue
Block a user