Rename DocumentView -> DocView

This commit is contained in:
David Capello 2018-07-14 23:24:49 -03:00
parent b8317805f8
commit b3c89cd110
27 changed files with 125 additions and 125 deletions

View File

@ -321,7 +321,7 @@ if(ENABLE_UI)
ui/configure_timeline_popup.cpp ui/configure_timeline_popup.cpp
ui/context_bar.cpp ui/context_bar.cpp
ui/dithering_selector.cpp ui/dithering_selector.cpp
ui/document_view.cpp ui/doc_view.cpp
ui/drop_down_button.cpp ui/drop_down_button.cpp
ui/editor/brush_preview.cpp ui/editor/brush_preview.cpp
ui/editor/drawing_state.cpp ui/editor/drawing_state.cpp

View File

@ -40,7 +40,7 @@
#include "app/tools/tool_box.h" #include "app/tools/tool_box.h"
#include "app/ui/backup_indicator.h" #include "app/ui/backup_indicator.h"
#include "app/ui/color_bar.h" #include "app/ui/color_bar.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/ui/editor/editor.h" #include "app/ui/editor/editor.h"
#include "app/ui/editor/editor_view.h" #include "app/ui/editor/editor_view.h"
#include "app/ui/input_chain.h" #include "app/ui/input_chain.h"
@ -563,7 +563,7 @@ void App::updateDisplayTitleBar()
std::string defaultTitle = PACKAGE " v" VERSION; std::string defaultTitle = PACKAGE " v" VERSION;
std::string title; std::string title;
DocumentView* docView = UIContext::instance()->activeView(); DocView* docView = UIContext::instance()->activeView();
if (docView) { if (docView) {
// Prepend the document's filename. // Prepend the document's filename.
title += docView->document()->name(); title += docView->document()->name();

View File

@ -13,7 +13,7 @@
#include "app/commands/commands.h" #include "app/commands/commands.h"
#include "app/context_access.h" #include "app/context_access.h"
#include "app/modules/editors.h" #include "app/modules/editors.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/ui/status_bar.h" #include "app/ui/status_bar.h"
#include "app/ui/workspace.h" #include "app/ui/workspace.h"
#include "app/ui_context.h" #include "app/ui_context.h"
@ -69,9 +69,9 @@ protected:
Workspace* workspace = App::instance()->workspace(); Workspace* workspace = App::instance()->workspace();
// Collect all document views // Collect all document views
DocumentViews docViews; DocViews docViews;
for (auto view : *workspace) { for (auto view : *workspace) {
DocumentView* docView = dynamic_cast<DocumentView*>(view); DocView* docView = dynamic_cast<DocView*>(view);
if (docView) if (docView)
docViews.push_back(docView); docViews.push_back(docView);
} }

View File

@ -20,7 +20,7 @@
#include "app/modules/gui.h" #include "app/modules/gui.h"
#include "app/pref/preferences.h" #include "app/pref/preferences.h"
#include "app/transaction.h" #include "app/transaction.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/ui/editor/editor.h" #include "app/ui/editor/editor.h"
#include "app/ui_context.h" #include "app/ui_context.h"
#include "base/convert_to.h" #include "base/convert_to.h"

View File

@ -18,7 +18,7 @@
#include "app/i18n/strings.h" #include "app/i18n/strings.h"
#include "app/modules/gui.h" #include "app/modules/gui.h"
#include "app/transaction.h" #include "app/transaction.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/ui/editor/editor.h" #include "app/ui/editor/editor.h"
#include "app/ui/main_window.h" #include "app/ui/main_window.h"
#include "app/ui/status_bar.h" #include "app/ui/status_bar.h"
@ -171,7 +171,7 @@ void NewFrameCommand::onExecute(Context* context)
// TODO should we use DocObserver? // TODO should we use DocObserver?
if (UIContext::instance() == context) { if (UIContext::instance() == context) {
if (DocumentView* view = UIContext::instance()->activeView()) if (DocView* view = UIContext::instance()->activeView())
view->editor()->setFrame(writer.frame()+1); view->editor()->setFrame(writer.frame()+1);
} }
} }

View File

@ -13,7 +13,7 @@
#include "app/commands/params.h" #include "app/commands/params.h"
#include "app/i18n/strings.h" #include "app/i18n/strings.h"
#include "app/pref/preferences.h" #include "app/pref/preferences.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/ui/editor/editor.h" #include "app/ui/editor/editor.h"
#include "app/ui_context.h" #include "app/ui_context.h"
#include "fmt/format.h" #include "fmt/format.h"
@ -74,7 +74,7 @@ gfx::Point MoveThing::getDelta(Context* context) const
{ {
gfx::Point delta(0, 0); gfx::Point delta(0, 0);
DocumentView* view = static_cast<UIContext*>(context)->activeView(); DocView* view = static_cast<UIContext*>(context)->activeView();
if (!view) if (!view)
return delta; return delta;

View File

@ -23,7 +23,7 @@
namespace app { namespace app {
class Command; class Command;
class Doc; class Doc;
class DocumentView; class DocView;
class CommandPreconditionException : public base::Exception { class CommandPreconditionException : public base::Exception {
public: public:
@ -79,7 +79,7 @@ namespace app {
void executeCommand(const char* commandName); void executeCommand(const char* commandName);
virtual void executeCommand(Command* command, const Params& params = Params()); virtual void executeCommand(Command* command, const Params& params = Params());
virtual DocumentView* getFirstDocumentView(Doc* document) const { virtual DocView* getFirstDocView(Doc* document) const {
return nullptr; return nullptr;
} }

View File

@ -340,11 +340,11 @@ bool CustomizedGuiManager::onProcessMessage(Message* msg)
// If the document is already open, select it. // If the document is already open, select it.
Doc* doc = ctx->documents().getByFileName(fn); Doc* doc = ctx->documents().getByFileName(fn);
if (doc) { if (doc) {
DocumentView* docView = ctx->getFirstDocumentView(doc); DocView* docView = ctx->getFirstDocView(doc);
if (docView) if (docView)
ctx->setActiveView(docView); ctx->setActiveView(docView);
else { else {
ASSERT(false); // Must be some DocumentView available ASSERT(false); // Must be some DocView available
} }
} }
// Load the file // Load the file

View File

@ -20,7 +20,7 @@
#include "app/script/sprite_wrap.h" #include "app/script/sprite_wrap.h"
#include "app/site.h" #include "app/site.h"
#include "app/transaction.h" #include "app/transaction.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "doc/mask.h" #include "doc/mask.h"
#include "doc/palette.h" #include "doc/palette.h"
#include "doc/sprite.h" #include "doc/sprite.h"

View File

@ -18,14 +18,14 @@
#include "app/script/image_wrap.h" #include "app/script/image_wrap.h"
#include "app/site.h" #include "app/site.h"
#include "app/transaction.h" #include "app/transaction.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "doc/sprite.h" #include "doc/sprite.h"
namespace app { namespace app {
SpriteWrap::SpriteWrap(Doc* doc) SpriteWrap::SpriteWrap(Doc* doc)
: m_doc(doc) : m_doc(doc)
, m_view(App::instance()->context()->getFirstDocumentView(m_doc)) , m_view(App::instance()->context()->getFirstDocView(m_doc))
, m_transaction(nullptr) , m_transaction(nullptr)
{ {
} }
@ -79,7 +79,7 @@ doc::Sprite* SpriteWrap::sprite()
ImageWrap* SpriteWrap::activeImage() ImageWrap* SpriteWrap::activeImage()
{ {
if (!m_view) { if (!m_view) {
m_view = App::instance()->context()->getFirstDocumentView(m_doc); m_view = App::instance()->context()->getFirstDocView(m_doc);
if (!m_view) if (!m_view)
return nullptr; return nullptr;
} }

View File

@ -19,7 +19,7 @@ namespace doc {
namespace app { namespace app {
class Doc; class Doc;
class DocumentView; class DocView;
class ImageWrap; class ImageWrap;
class Transaction; class Transaction;
@ -42,7 +42,7 @@ namespace app {
private: private:
Doc* m_doc; Doc* m_doc;
app::DocumentView* m_view; app::DocView* m_view;
app::Transaction* m_transaction; app::Transaction* m_transaction;
Images m_images; Images m_images;

View File

@ -8,7 +8,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/app.h" #include "app/app.h"
#include "app/app_menus.h" #include "app/app_menus.h"
@ -57,7 +57,7 @@ class AppEditor : public Editor,
public EditorCustomizationDelegate { public EditorCustomizationDelegate {
public: public:
AppEditor(Doc* document, AppEditor(Doc* document,
DocumentViewPreviewDelegate* previewDelegate) DocViewPreviewDelegate* previewDelegate)
: Editor(document) : Editor(document)
, m_previewDelegate(previewDelegate) { , m_previewDelegate(previewDelegate) {
add_observer(this); add_observer(this);
@ -150,7 +150,7 @@ protected:
} }
private: private:
DocumentViewPreviewDelegate* m_previewDelegate; DocViewPreviewDelegate* m_previewDelegate;
}; };
class PreviewEditor : public Editor, class PreviewEditor : public Editor,
@ -188,8 +188,8 @@ public:
} }
}; };
DocumentView::DocumentView(Doc* document, Type type, DocView::DocView(Doc* document, Type type,
DocumentViewPreviewDelegate* previewDelegate) DocViewPreviewDelegate* previewDelegate)
: Box(VERTICAL) : Box(VERTICAL)
, m_type(type) , m_type(type)
, m_document(document) , m_document(document)
@ -205,45 +205,45 @@ DocumentView::DocumentView(Doc* document, Type type,
m_view->attachToView(m_editor); m_view->attachToView(m_editor);
m_view->setExpansive(true); m_view->setExpansive(true);
m_editor->setDocumentView(this); m_editor->setDocView(this);
m_document->add_observer(this); m_document->add_observer(this);
} }
DocumentView::~DocumentView() DocView::~DocView()
{ {
m_document->remove_observer(this); m_document->remove_observer(this);
delete m_editor; delete m_editor;
} }
void DocumentView::getSite(Site* site) const void DocView::getSite(Site* site) const
{ {
m_editor->getSite(site); m_editor->getSite(site);
} }
std::string DocumentView::getTabText() std::string DocView::getTabText()
{ {
return m_document->name(); return m_document->name();
} }
TabIcon DocumentView::getTabIcon() TabIcon DocView::getTabIcon()
{ {
return TabIcon::NONE; return TabIcon::NONE;
} }
WorkspaceView* DocumentView::cloneWorkspaceView() WorkspaceView* DocView::cloneWorkspaceView()
{ {
return new DocumentView(m_document, Normal, m_previewDelegate); return new DocView(m_document, Normal, m_previewDelegate);
} }
void DocumentView::onWorkspaceViewSelected() void DocView::onWorkspaceViewSelected()
{ {
// Do nothing // Do nothing
} }
void DocumentView::onClonedFrom(WorkspaceView* from) void DocView::onClonedFrom(WorkspaceView* from)
{ {
Editor* newEditor = this->editor(); Editor* newEditor = this->editor();
Editor* srcEditor = static_cast<DocumentView*>(from)->editor(); Editor* srcEditor = static_cast<DocView*>(from)->editor();
newEditor->setLayer(srcEditor->layer()); newEditor->setLayer(srcEditor->layer());
newEditor->setFrame(srcEditor->frame()); newEditor->setFrame(srcEditor->frame());
@ -253,14 +253,14 @@ void DocumentView::onClonedFrom(WorkspaceView* from)
->setViewScroll(View::getView(srcEditor)->viewScroll()); ->setViewScroll(View::getView(srcEditor)->viewScroll());
} }
bool DocumentView::onCloseView(Workspace* workspace, bool quitting) bool DocView::onCloseView(Workspace* workspace, bool quitting)
{ {
if (m_editor->isMovingPixels()) if (m_editor->isMovingPixels())
m_editor->dropMovingPixels(); m_editor->dropMovingPixels();
// If there is another view for this document, just close the view. // If there is another view for this document, just close the view.
for (auto view : *workspace) { for (auto view : *workspace) {
DocumentView* docView = dynamic_cast<DocumentView*>(view); DocView* docView = dynamic_cast<DocView*>(view);
if (docView && docView != this && if (docView && docView != this &&
docView->document() == document()) { docView->document() == document()) {
workspace->removeView(this); workspace->removeView(this);
@ -338,7 +338,7 @@ bool DocumentView::onCloseView(Workspace* workspace, bool quitting)
} }
} }
void DocumentView::onTabPopup(Workspace* workspace) void DocView::onTabPopup(Workspace* workspace)
{ {
Menu* menu = AppMenus::instance()->getDocumentTabPopupMenu(); Menu* menu = AppMenus::instance()->getDocumentTabPopupMenu();
if (!menu) if (!menu)
@ -351,7 +351,7 @@ void DocumentView::onTabPopup(Workspace* workspace)
menu->showPopup(ui::get_mouse_position()); menu->showPopup(ui::get_mouse_position());
} }
bool DocumentView::onProcessMessage(Message* msg) bool DocView::onProcessMessage(Message* msg)
{ {
switch (msg->type()) { switch (msg->type()) {
case kFocusEnterMessage: case kFocusEnterMessage:
@ -361,25 +361,25 @@ bool DocumentView::onProcessMessage(Message* msg)
return Box::onProcessMessage(msg); return Box::onProcessMessage(msg);
} }
void DocumentView::onGeneralUpdate(DocEvent& ev) void DocView::onGeneralUpdate(DocEvent& ev)
{ {
if (m_editor->isVisible()) if (m_editor->isVisible())
m_editor->updateEditor(); m_editor->updateEditor();
} }
void DocumentView::onSpritePixelsModified(DocEvent& ev) void DocView::onSpritePixelsModified(DocEvent& ev)
{ {
if (m_editor->isVisible() && if (m_editor->isVisible() &&
m_editor->frame() == ev.frame()) m_editor->frame() == ev.frame())
m_editor->drawSpriteClipped(ev.region()); m_editor->drawSpriteClipped(ev.region());
} }
void DocumentView::onLayerMergedDown(DocEvent& ev) void DocView::onLayerMergedDown(DocEvent& ev)
{ {
m_editor->setLayer(ev.targetLayer()); m_editor->setLayer(ev.targetLayer());
} }
void DocumentView::onAddLayer(DocEvent& ev) void DocView::onAddLayer(DocEvent& ev)
{ {
if (current_editor == m_editor) { if (current_editor == m_editor) {
ASSERT(ev.layer() != NULL); ASSERT(ev.layer() != NULL);
@ -387,7 +387,7 @@ void DocumentView::onAddLayer(DocEvent& ev)
} }
} }
void DocumentView::onBeforeRemoveLayer(DocEvent& ev) void DocView::onBeforeRemoveLayer(DocEvent& ev)
{ {
Sprite* sprite = ev.sprite(); Sprite* sprite = ev.sprite();
Layer* layer = ev.layer(); Layer* layer = ev.layer();
@ -410,7 +410,7 @@ void DocumentView::onBeforeRemoveLayer(DocEvent& ev)
} }
} }
void DocumentView::onAddFrame(DocEvent& ev) void DocView::onAddFrame(DocEvent& ev)
{ {
if (current_editor == m_editor) if (current_editor == m_editor)
m_editor->setFrame(ev.frame()); m_editor->setFrame(ev.frame());
@ -418,7 +418,7 @@ void DocumentView::onAddFrame(DocEvent& ev)
m_editor->setFrame(m_editor->frame()+1); m_editor->setFrame(m_editor->frame()+1);
} }
void DocumentView::onRemoveFrame(DocEvent& ev) void DocView::onRemoveFrame(DocEvent& ev)
{ {
// Adjust current frame of all editors that are in a frame more // Adjust current frame of all editors that are in a frame more
// advanced that the removed one. // advanced that the removed one.
@ -433,35 +433,35 @@ void DocumentView::onRemoveFrame(DocEvent& ev)
} }
} }
void DocumentView::onAddCel(DocEvent& ev) void DocView::onAddCel(DocEvent& ev)
{ {
UIContext::instance()->notifyActiveSiteChanged(); UIContext::instance()->notifyActiveSiteChanged();
} }
void DocumentView::onRemoveCel(DocEvent& ev) void DocView::onRemoveCel(DocEvent& ev)
{ {
UIContext::instance()->notifyActiveSiteChanged(); UIContext::instance()->notifyActiveSiteChanged();
} }
void DocumentView::onTotalFramesChanged(DocEvent& ev) void DocView::onTotalFramesChanged(DocEvent& ev)
{ {
if (m_editor->frame() >= m_editor->sprite()->totalFrames()) { if (m_editor->frame() >= m_editor->sprite()->totalFrames()) {
m_editor->setFrame(m_editor->sprite()->lastFrame()); m_editor->setFrame(m_editor->sprite()->lastFrame());
} }
} }
void DocumentView::onLayerRestacked(DocEvent& ev) void DocView::onLayerRestacked(DocEvent& ev)
{ {
m_editor->invalidate(); m_editor->invalidate();
} }
void DocumentView::onNewInputPriority(InputChainElement* element, void DocView::onNewInputPriority(InputChainElement* element,
const ui::Message* msg) const ui::Message* msg)
{ {
// Do nothing // Do nothing
} }
bool DocumentView::onCanCut(Context* ctx) bool DocView::onCanCut(Context* ctx)
{ {
if (ctx->checkFlags(ContextFlags::ActiveDocumentIsWritable | if (ctx->checkFlags(ContextFlags::ActiveDocumentIsWritable |
ContextFlags::ActiveLayerIsVisible | ContextFlags::ActiveLayerIsVisible |
@ -476,7 +476,7 @@ bool DocumentView::onCanCut(Context* ctx)
return false; return false;
} }
bool DocumentView::onCanCopy(Context* ctx) bool DocView::onCanCopy(Context* ctx)
{ {
if (ctx->checkFlags(ContextFlags::ActiveDocumentIsWritable | if (ctx->checkFlags(ContextFlags::ActiveDocumentIsWritable |
ContextFlags::ActiveLayerIsVisible | ContextFlags::ActiveLayerIsVisible |
@ -490,7 +490,7 @@ bool DocumentView::onCanCopy(Context* ctx)
return false; return false;
} }
bool DocumentView::onCanPaste(Context* ctx) bool DocView::onCanPaste(Context* ctx)
{ {
return return
(clipboard::get_current_format() == clipboard::ClipboardImage (clipboard::get_current_format() == clipboard::ClipboardImage
@ -501,7 +501,7 @@ bool DocumentView::onCanPaste(Context* ctx)
&& !ctx->checkFlags(ContextFlags::ActiveLayerIsReference)); && !ctx->checkFlags(ContextFlags::ActiveLayerIsReference));
} }
bool DocumentView::onCanClear(Context* ctx) bool DocView::onCanClear(Context* ctx)
{ {
if (ctx->checkFlags(ContextFlags::ActiveDocumentIsWritable | if (ctx->checkFlags(ContextFlags::ActiveDocumentIsWritable |
ContextFlags::ActiveLayerIsVisible | ContextFlags::ActiveLayerIsVisible |
@ -517,14 +517,14 @@ bool DocumentView::onCanClear(Context* ctx)
return false; return false;
} }
bool DocumentView::onCut(Context* ctx) bool DocView::onCut(Context* ctx)
{ {
ContextWriter writer(ctx); ContextWriter writer(ctx);
clipboard::cut(writer); clipboard::cut(writer);
return true; return true;
} }
bool DocumentView::onCopy(Context* ctx) bool DocView::onCopy(Context* ctx)
{ {
const ContextReader reader(ctx); const ContextReader reader(ctx);
if (reader.site()->document() && if (reader.site()->document() &&
@ -537,7 +537,7 @@ bool DocumentView::onCopy(Context* ctx)
return false; return false;
} }
bool DocumentView::onPaste(Context* ctx) bool DocView::onPaste(Context* ctx)
{ {
if (clipboard::get_current_format() == clipboard::ClipboardImage) { if (clipboard::get_current_format() == clipboard::ClipboardImage) {
clipboard::paste(); clipboard::paste();
@ -547,7 +547,7 @@ bool DocumentView::onPaste(Context* ctx)
return false; return false;
} }
bool DocumentView::onClear(Context* ctx) bool DocView::onClear(Context* ctx)
{ {
ContextWriter writer(ctx); ContextWriter writer(ctx);
Doc* document = writer.document(); Doc* document = writer.document();
@ -579,7 +579,7 @@ bool DocumentView::onClear(Context* ctx)
return true; return true;
} }
void DocumentView::onCancel(Context* ctx) void DocView::onCancel(Context* ctx)
{ {
// Deselect mask // Deselect mask
if (ctx->checkFlags(ContextFlags::ActiveDocumentIsWritable | if (ctx->checkFlags(ContextFlags::ActiveDocumentIsWritable |

View File

@ -4,8 +4,8 @@
// This program is distributed under the terms of // This program is distributed under the terms of
// the End-User License Agreement for Aseprite. // the End-User License Agreement for Aseprite.
#ifndef APP_UI_DOCUMENT_VIEW_H_INCLUDED #ifndef APP_UI_DOC_VIEW_H_INCLUDED
#define APP_UI_DOCUMENT_VIEW_H_INCLUDED #define APP_UI_DOC_VIEW_H_INCLUDED
#pragma once #pragma once
#include "app/doc_observer.h" #include "app/doc_observer.h"
@ -23,28 +23,28 @@ namespace app {
class Editor; class Editor;
class Site; class Site;
class DocumentViewPreviewDelegate { class DocViewPreviewDelegate {
public: public:
virtual ~DocumentViewPreviewDelegate() { } virtual ~DocViewPreviewDelegate() { }
virtual void onScrollOtherEditor(Editor* editor) = 0; virtual void onScrollOtherEditor(Editor* editor) = 0;
virtual void onDisposeOtherEditor(Editor* editor) = 0; virtual void onDisposeOtherEditor(Editor* editor) = 0;
virtual void onPreviewOtherEditor(Editor* editor) = 0; virtual void onPreviewOtherEditor(Editor* editor) = 0;
}; };
class DocumentView : public ui::Box, class DocView : public ui::Box,
public TabView, public TabView,
public app::DocObserver, public app::DocObserver,
public WorkspaceView, public WorkspaceView,
public app::InputChainElement { public app::InputChainElement {
public: public:
enum Type { enum Type {
Normal, Normal,
Preview Preview
}; };
DocumentView(Doc* document, Type type, DocView(Doc* document, Type type,
DocumentViewPreviewDelegate* previewDelegate); DocViewPreviewDelegate* previewDelegate);
~DocumentView(); ~DocView();
Doc* document() const { return m_document; } Doc* document() const { return m_document; }
Editor* editor() { return m_editor; } Editor* editor() { return m_editor; }
@ -100,7 +100,7 @@ namespace app {
Type m_type; Type m_type;
Doc* m_document; Doc* m_document;
ui::View* m_view; ui::View* m_view;
DocumentViewPreviewDelegate* m_previewDelegate; DocViewPreviewDelegate* m_previewDelegate;
Editor* m_editor; Editor* m_editor;
}; };

View File

@ -49,7 +49,7 @@ namespace ui {
namespace app { namespace app {
class Context; class Context;
class DocumentView; class DocView;
class EditorCustomizationDelegate; class EditorCustomizationDelegate;
class EditorRender; class EditorRender;
class PixelsMovement; class PixelsMovement;
@ -102,8 +102,8 @@ namespace app {
bool isActive() const; bool isActive() const;
DocumentView* getDocumentView() { return m_docView; } DocView* getDocView() { return m_docView; }
void setDocumentView(DocumentView* docView) { m_docView = docView; } void setDocView(DocView* docView) { m_docView = docView; }
// Returns the current state. // Returns the current state.
EditorStatePtr getState() { return m_state; } EditorStatePtr getState() { return m_state; }
@ -384,7 +384,7 @@ namespace app {
// TODO This field shouldn't be here. It should be removed when // TODO This field shouldn't be here. It should be removed when
// editors.cpp are finally replaced with a fully funtional Workspace // editors.cpp are finally replaced with a fully funtional Workspace
// widget. // widget.
DocumentView* m_docView; DocView* m_docView;
gfx::Point m_oldPos; gfx::Point m_oldPos;

View File

@ -237,7 +237,7 @@ bool MovingPixelsState::onMouseDown(Editor* editor, MouseMessage* msg)
// with a couple of Editors, in one is moving pixels and the other // with a couple of Editors, in one is moving pixels and the other
// one not. // one not.
UIContext* ctx = UIContext::instance(); UIContext* ctx = UIContext::instance();
ctx->setActiveView(editor->getDocumentView()); ctx->setActiveView(editor->getDocView());
ContextBar* contextBar = App::instance()->contextBar(); ContextBar* contextBar = App::instance()->contextBar();
contextBar->updateForMovingPixels(); contextBar->updateForMovingPixels();

View File

@ -29,7 +29,7 @@ bool NavigateState::onMouseDown(Editor* editor, MouseMessage* msg)
// UIContext* context = UIContext::instance(); // UIContext* context = UIContext::instance();
// // When an editor is clicked the current view is changed. // // When an editor is clicked the current view is changed.
// context->setActiveView(editor->getDocumentView()); // context->setActiveView(editor->getDocView());
// Start scroll loop // Start scroll loop
EditorStatePtr newState(new ScrollingState()); EditorStatePtr newState(new ScrollingState());

View File

@ -110,7 +110,7 @@ bool PlayState::onMouseDown(Editor* editor, MouseMessage* msg)
// When an editor is clicked the current view is changed. // When an editor is clicked the current view is changed.
UIContext* context = UIContext::instance(); UIContext* context = UIContext::instance();
context->setActiveView(editor->getDocumentView()); context->setActiveView(editor->getDocView());
// A click with right-button stops the animation // A click with right-button stops the animation
if (msg->buttons() == kButtonRight) { if (msg->buttons() == kButtonRight) {

View File

@ -24,7 +24,7 @@
#include "app/tools/pick_ink.h" #include "app/tools/pick_ink.h"
#include "app/tools/tool.h" #include "app/tools/tool.h"
#include "app/ui/app_menuitem.h" #include "app/ui/app_menuitem.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/ui/editor/drawing_state.h" #include "app/ui/editor/drawing_state.h"
#include "app/ui/editor/editor.h" #include "app/ui/editor/editor.h"
#include "app/ui/editor/editor_customization_delegate.h" #include "app/ui/editor/editor_customization_delegate.h"
@ -136,7 +136,7 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
Layer* layer = site.layer(); Layer* layer = site.layer();
// When an editor is clicked the current view is changed. // When an editor is clicked the current view is changed.
context->setActiveView(editor->getDocumentView()); context->setActiveView(editor->getDocView());
// Start scroll loop // Start scroll loop
if (editor->checkForScroll(msg) || if (editor->checkForScroll(msg) ||
@ -684,7 +684,7 @@ void StandbyState::startFlipTransformation(Editor* editor, doc::algorithm::FlipT
void StandbyState::transformSelection(Editor* editor, MouseMessage* msg, HandleType handle) void StandbyState::transformSelection(Editor* editor, MouseMessage* msg, HandleType handle)
{ {
Doc* document = editor->document(); Doc* document = editor->document();
for (auto docView : UIContext::instance()->getAllDocumentViews(document)) { for (auto docView : UIContext::instance()->getAllDocViews(document)) {
if (docView->editor()->isMovingPixels()) { if (docView->editor()->isMovingPixels()) {
// TODO Transfer moving pixels state to this editor // TODO Transfer moving pixels state to this editor
docView->editor()->dropMovingPixels(); docView->editor()->dropMovingPixels();

View File

@ -21,7 +21,7 @@ namespace app {
// The chain of objects (in order) that want to receive // The chain of objects (in order) that want to receive
// input/commands from the user (e.g. ColorBar, Timeline, and // input/commands from the user (e.g. ColorBar, Timeline, and
// Workspace/DocumentView). When each of these elements receive the // Workspace/DocView). When each of these elements receive the
// user focus, they call InputChain::prioritize(). // user focus, they call InputChain::prioritize().
class InputChain { class InputChain {
public: public:

View File

@ -21,7 +21,7 @@
#include "app/ui/browser_view.h" #include "app/ui/browser_view.h"
#include "app/ui/color_bar.h" #include "app/ui/color_bar.h"
#include "app/ui/context_bar.h" #include "app/ui/context_bar.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/ui/editor/editor.h" #include "app/ui/editor/editor.h"
#include "app/ui/editor/editor_view.h" #include "app/ui/editor/editor_view.h"
#include "app/ui/home_view.h" #include "app/ui/home_view.h"
@ -198,9 +198,9 @@ MainWindow::~MainWindow()
m_menuBar->setMenu(NULL); m_menuBar->setMenu(NULL);
} }
DocumentView* MainWindow::getDocView() DocView* MainWindow::getDocView()
{ {
return dynamic_cast<DocumentView*>(m_workspace->activeView()); return dynamic_cast<DocView*>(m_workspace->activeView());
} }
HomeView* MainWindow::getHomeView() HomeView* MainWindow::getHomeView()
@ -367,7 +367,7 @@ void MainWindow::onResize(ui::ResizeEvent& ev)
// inform to the UIContext that the current view has changed. // inform to the UIContext that the current view has changed.
void MainWindow::onActiveViewChange() void MainWindow::onActiveViewChange()
{ {
if (DocumentView* docView = getDocView()) if (DocView* docView = getDocView())
UIContext::instance()->setActiveView(docView); UIContext::instance()->setActiveView(docView);
else else
UIContext::instance()->setActiveView(nullptr); UIContext::instance()->setActiveView(nullptr);
@ -377,7 +377,7 @@ void MainWindow::onActiveViewChange()
bool MainWindow::isTabModified(Tabs* tabs, TabView* tabView) bool MainWindow::isTabModified(Tabs* tabs, TabView* tabView)
{ {
if (DocumentView* docView = dynamic_cast<DocumentView*>(tabView)) { if (DocView* docView = dynamic_cast<DocView*>(tabView)) {
Doc* document = docView->document(); Doc* document = docView->document();
return document->isModified(); return document->isModified();
} }
@ -465,7 +465,7 @@ void MainWindow::onTabsContainerDoubleClicked(Tabs* tabs)
void MainWindow::onMouseOverTab(Tabs* tabs, TabView* tabView) void MainWindow::onMouseOverTab(Tabs* tabs, TabView* tabView)
{ {
// Note: tabView can be NULL // Note: tabView can be NULL
if (DocumentView* docView = dynamic_cast<DocumentView*>(tabView)) { if (DocView* docView = dynamic_cast<DocView*>(tabView)) {
Doc* document = docView->document(); Doc* document = docView->document();
std::string name; std::string name;

View File

@ -27,7 +27,7 @@ namespace app {
class ColorBar; class ColorBar;
class ContextBar; class ContextBar;
class DevConsoleView; class DevConsoleView;
class DocumentView; class DocView;
class HomeView; class HomeView;
class INotificationDelegate; class INotificationDelegate;
class MainMenuBar; class MainMenuBar;
@ -102,7 +102,7 @@ namespace app {
void onActiveViewChange(); void onActiveViewChange();
private: private:
DocumentView* getDocView(); DocView* getDocView();
HomeView* getHomeView(); HomeView* getHomeView();
void configureWorkspaceLayout(); void configureWorkspaceLayout();

View File

@ -16,7 +16,7 @@
#include "app/modules/palettes.h" #include "app/modules/palettes.h"
#include "app/res/palette_resource.h" #include "app/res/palette_resource.h"
#include "app/res/palettes_loader_delegate.h" #include "app/res/palettes_loader_delegate.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/ui/editor/editor.h" #include "app/ui/editor/editor.h"
#include "app/ui/icon_button.h" #include "app/ui/icon_button.h"
#include "app/ui/skin/skin_theme.h" #include "app/ui/skin/skin_theme.h"

View File

@ -273,7 +273,7 @@ void PreviewEditorWindow::onWindowResize()
{ {
Window::onWindowResize(); Window::onWindowResize();
DocumentView* view = UIContext::instance()->activeView(); DocView* view = UIContext::instance()->activeView();
if (view) if (view)
updateUsingEditor(view->editor()); updateUsingEditor(view->editor());
} }
@ -360,7 +360,7 @@ void PreviewEditorWindow::updateUsingEditor(Editor* editor)
if (!miniEditor || miniEditor->document() != document) { if (!miniEditor || miniEditor->document() != document) {
destroyDocView(); destroyDocView();
m_docView = new DocumentView(document, DocumentView::Preview, this); m_docView = new DocView(document, DocView::Preview, this);
addChild(m_docView); addChild(m_docView);
miniEditor = m_docView->editor(); miniEditor = m_docView->editor();

View File

@ -8,7 +8,7 @@
#define APP_UI_PREVIEW_EDITOR_H_INCLUDED #define APP_UI_PREVIEW_EDITOR_H_INCLUDED
#pragma once #pragma once
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/ui/editor/editor_observer.h" #include "app/ui/editor/editor_observer.h"
#include "doc/frame.h" #include "doc/frame.h"
#include "app/pref/preferences.h" #include "app/pref/preferences.h"
@ -20,7 +20,7 @@ namespace app {
class PreviewEditorWindow : public ui::Window class PreviewEditorWindow : public ui::Window
, public EditorObserver , public EditorObserver
, public DocumentViewPreviewDelegate { , public DocViewPreviewDelegate {
public: public:
PreviewEditorWindow(); PreviewEditorWindow();
~PreviewEditorWindow(); ~PreviewEditorWindow();
@ -37,7 +37,7 @@ namespace app {
void onScrollChanged(Editor* editor) override; void onScrollChanged(Editor* editor) override;
void onZoomChanged(Editor* editor) override; void onZoomChanged(Editor* editor) override;
// DocumentViewPreviewDelegate impl // DocViewPreviewDelegate impl
void onScrollOtherEditor(Editor* editor) override; void onScrollOtherEditor(Editor* editor) override;
void onDisposeOtherEditor(Editor* editor) override; void onDisposeOtherEditor(Editor* editor) override;
void onPreviewOtherEditor(Editor* editor) override; void onPreviewOtherEditor(Editor* editor) override;
@ -60,7 +60,7 @@ namespace app {
void saveScrollPref(); void saveScrollPref();
bool m_isEnabled; bool m_isEnabled;
DocumentView* m_docView; DocView* m_docView;
MiniCenterButton* m_centerButton; MiniCenterButton* m_centerButton;
MiniPlayButton* m_playButton; MiniPlayButton* m_playButton;
doc::frame_t m_refFrame; doc::frame_t m_refFrame;

View File

@ -31,7 +31,7 @@
#include "app/transaction.h" #include "app/transaction.h"
#include "app/ui/app_menuitem.h" #include "app/ui/app_menuitem.h"
#include "app/ui/configure_timeline_popup.h" #include "app/ui/configure_timeline_popup.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/ui/editor/editor.h" #include "app/ui/editor/editor.h"
#include "app/ui/input_chain.h" #include "app/ui/input_chain.h"
#include "app/ui/skin/skin_theme.h" #include "app/ui/skin/skin_theme.h"
@ -337,7 +337,7 @@ void Timeline::updateUsingEditor(Editor* editor)
m_tagFocusBand = m_editor->tagFocusBand(); m_tagFocusBand = m_editor->tagFocusBand();
Site site; Site site;
DocumentView* view = m_editor->getDocumentView(); DocView* view = m_editor->getDocView();
view->getSite(&site); view->getSite(&site);
site.document()->add_observer(this); site.document()->add_observer(this);

View File

@ -14,7 +14,7 @@
#include "app/pref/preferences.h" #include "app/pref/preferences.h"
#include "app/site.h" #include "app/site.h"
#include "app/ui/color_bar.h" #include "app/ui/color_bar.h"
#include "app/ui/document_view.h" #include "app/ui/doc_view.h"
#include "app/ui/editor/editor.h" #include "app/ui/editor/editor.h"
#include "app/ui/input_chain.h" #include "app/ui/input_chain.h"
#include "app/ui/main_window.h" #include "app/ui/main_window.h"
@ -58,7 +58,7 @@ bool UIContext::isUIAvailable() const
return App::instance()->isGui(); return App::instance()->isGui();
} }
DocumentView* UIContext::activeView() const DocView* UIContext::activeView() const
{ {
if (!isUIAvailable()) if (!isUIAvailable())
return nullptr; return nullptr;
@ -68,13 +68,13 @@ DocumentView* UIContext::activeView() const
return nullptr; return nullptr;
WorkspaceView* view = workspace->activeView(); WorkspaceView* view = workspace->activeView();
if (DocumentView* docView = dynamic_cast<DocumentView*>(view)) if (DocView* docView = dynamic_cast<DocView*>(view))
return docView; return docView;
else else
return nullptr; return nullptr;
} }
void UIContext::setActiveView(DocumentView* docView) void UIContext::setActiveView(DocView* docView)
{ {
MainWindow* mainWin = App::instance()->mainWindow(); MainWindow* mainWin = App::instance()->mainWindow();
@ -125,7 +125,7 @@ void UIContext::onSetActiveDocument(Doc* document)
bool notify = (lastSelectedDoc() != document); bool notify = (lastSelectedDoc() != document);
app::Context::onSetActiveDocument(document); app::Context::onSetActiveDocument(document);
DocumentView* docView = getFirstDocumentView(document); DocView* docView = getFirstDocView(document);
if (docView) { // The view can be null if we are in --batch mode if (docView) { // The view can be null if we are in --batch mode
setActiveView(docView); setActiveView(docView);
notify = false; notify = false;
@ -135,14 +135,14 @@ void UIContext::onSetActiveDocument(Doc* document)
notifyActiveSiteChanged(); notifyActiveSiteChanged();
} }
DocumentView* UIContext::getFirstDocumentView(Doc* document) const DocView* UIContext::getFirstDocView(Doc* document) const
{ {
Workspace* workspace = App::instance()->workspace(); Workspace* workspace = App::instance()->workspace();
if (!workspace) // Workspace (main window) can be null if we are in --batch mode if (!workspace) // Workspace (main window) can be null if we are in --batch mode
return nullptr; return nullptr;
for (WorkspaceView* view : *workspace) { for (WorkspaceView* view : *workspace) {
if (DocumentView* docView = dynamic_cast<DocumentView*>(view)) { if (DocView* docView = dynamic_cast<DocView*>(view)) {
if (docView->document() == document) { if (docView->document() == document) {
return docView; return docView;
} }
@ -152,13 +152,13 @@ DocumentView* UIContext::getFirstDocumentView(Doc* document) const
return nullptr; return nullptr;
} }
DocumentViews UIContext::getAllDocumentViews(Doc* document) const DocViews UIContext::getAllDocViews(Doc* document) const
{ {
Workspace* workspace = App::instance()->workspace(); Workspace* workspace = App::instance()->workspace();
DocumentViews docViews; DocViews docViews;
for (WorkspaceView* view : *workspace) { for (WorkspaceView* view : *workspace) {
if (DocumentView* docView = dynamic_cast<DocumentView*>(view)) { if (DocView* docView = dynamic_cast<DocView*>(view)) {
if (docView->document() == document) { if (docView->document() == document) {
docViews.push_back(docView); docViews.push_back(docView);
} }
@ -170,7 +170,7 @@ DocumentViews UIContext::getAllDocumentViews(Doc* document) const
Editor* UIContext::activeEditor() Editor* UIContext::activeEditor()
{ {
DocumentView* view = activeView(); DocView* view = activeView();
if (view) if (view)
return view->editor(); return view->editor();
else else
@ -186,9 +186,9 @@ void UIContext::onAddDocument(Doc* doc)
return; return;
// Add a new view for this document // Add a new view for this document
DocumentView* view = new DocumentView( DocView* view = new DocView(
lastSelectedDoc(), lastSelectedDoc(),
DocumentView::Normal, DocView::Normal,
App::instance()->mainWindow()->getPreviewEditor()); App::instance()->mainWindow()->getPreviewEditor());
// Add a tab with the new view for the document // Add a tab with the new view for the document
@ -206,7 +206,7 @@ void UIContext::onRemoveDocument(Doc* doc)
if (isUIAvailable()) { if (isUIAvailable()) {
Workspace* workspace = App::instance()->workspace(); Workspace* workspace = App::instance()->workspace();
for (DocumentView* docView : getAllDocumentViews(doc)) { for (DocView* docView : getAllDocViews(doc)) {
workspace->removeView(docView); workspace->removeView(docView);
delete docView; delete docView;
} }
@ -215,7 +215,7 @@ void UIContext::onRemoveDocument(Doc* doc)
void UIContext::onGetActiveSite(Site* site) const void UIContext::onGetActiveSite(Site* site) const
{ {
DocumentView* view = activeView(); DocView* view = activeView();
if (view) { if (view) {
view->getSite(site); view->getSite(site);

View File

@ -12,10 +12,10 @@
#include "app/docs_observer.h" #include "app/docs_observer.h"
namespace app { namespace app {
class DocumentView; class DocView;
class Editor; class Editor;
typedef std::vector<DocumentView*> DocumentViews; typedef std::vector<DocView*> DocViews;
class UIContext : public app::Context { class UIContext : public app::Context {
public: public:
@ -26,11 +26,11 @@ namespace app {
bool isUIAvailable() const override; bool isUIAvailable() const override;
DocumentView* activeView() const; DocView* activeView() const;
void setActiveView(DocumentView* documentView); void setActiveView(DocView* documentView);
DocumentView* getFirstDocumentView(Doc* document) const override; DocView* getFirstDocView(Doc* document) const override;
DocumentViews getAllDocumentViews(Doc* document) const; DocViews getAllDocViews(Doc* document) const;
// Returns the current editor. It can be null. // Returns the current editor. It can be null.
Editor* activeEditor(); Editor* activeEditor();
@ -46,7 +46,7 @@ namespace app {
void onSetActiveDocument(Doc* doc) override; void onSetActiveDocument(Doc* doc) override;
private: private:
DocumentView* m_lastSelectedView; DocView* m_lastSelectedView;
static UIContext* m_instance; static UIContext* m_instance;
}; };