mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 06:32:42 +00:00
Minor refactor: rename DocumentView::getEditor/Document() -> editor/document()
This commit is contained in:
parent
3400cdba8b
commit
c49ec61fa0
@ -749,7 +749,7 @@ void App::updateDisplayTitleBar()
|
||||
DocumentView* docView = UIContext::instance()->activeView();
|
||||
if (docView) {
|
||||
// Prepend the document's filename.
|
||||
title += docView->getDocument()->name();
|
||||
title += docView->document()->name();
|
||||
title += " - ";
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -168,7 +168,7 @@ void NewFrameCommand::onExecute(Context* context)
|
||||
// TODO should we use DocumentObserver?
|
||||
if (UIContext::instance() == context) {
|
||||
if (DocumentView* view = UIContext::instance()->activeView())
|
||||
view->getEditor()->setFrame(writer.frame()+1);
|
||||
view->editor()->setFrame(writer.frame()+1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -207,8 +207,8 @@ void DocumentView::onWorkspaceViewSelected()
|
||||
|
||||
void DocumentView::onClonedFrom(WorkspaceView* from)
|
||||
{
|
||||
Editor* newEditor = getEditor();
|
||||
Editor* srcEditor = static_cast<DocumentView*>(from)->getEditor();
|
||||
Editor* newEditor = this->editor();
|
||||
Editor* srcEditor = static_cast<DocumentView*>(from)->editor();
|
||||
|
||||
newEditor->setLayer(srcEditor->layer());
|
||||
newEditor->setFrame(srcEditor->frame());
|
||||
@ -227,7 +227,7 @@ bool DocumentView::onCloseView(Workspace* workspace)
|
||||
for (auto view : *workspace) {
|
||||
DocumentView* docView = dynamic_cast<DocumentView*>(view);
|
||||
if (docView && docView != this &&
|
||||
docView->getDocument() == getDocument()) {
|
||||
docView->document() == document()) {
|
||||
workspace->removeView(this);
|
||||
delete this;
|
||||
return true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -50,9 +50,9 @@ namespace app {
|
||||
DocumentViewPreviewDelegate* previewDelegate);
|
||||
~DocumentView();
|
||||
|
||||
Document* getDocument() const { return m_document; }
|
||||
Document* document() const { return m_document; }
|
||||
Editor* editor() { return m_editor; }
|
||||
void getSite(doc::Site* site) const;
|
||||
Editor* getEditor() { return m_editor; }
|
||||
|
||||
bool isPreview() { return m_type == Preview; }
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -464,9 +464,9 @@ void StandbyState::transformSelection(Editor* editor, MouseMessage* msg, HandleT
|
||||
Document* document = editor->document();
|
||||
|
||||
for (auto docView : UIContext::instance()->getAllDocumentViews(document)) {
|
||||
if (docView->getEditor()->isMovingPixels()) {
|
||||
if (docView->editor()->isMovingPixels()) {
|
||||
// TODO Transfer moving pixels state to this editor
|
||||
docView->getEditor()->dropMovingPixels();
|
||||
docView->editor()->dropMovingPixels();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -267,7 +267,7 @@ void MainWindow::onActiveViewChange()
|
||||
bool MainWindow::isTabModified(Tabs* tabs, TabView* tabView)
|
||||
{
|
||||
if (DocumentView* docView = dynamic_cast<DocumentView*>(tabView)) {
|
||||
Document* document = docView->getDocument();
|
||||
Document* document = docView->document();
|
||||
return document->isModified();
|
||||
}
|
||||
else {
|
||||
@ -327,7 +327,7 @@ void MainWindow::onMouseOverTab(Tabs* tabs, TabView* tabView)
|
||||
{
|
||||
// Note: tabView can be NULL
|
||||
if (DocumentView* docView = dynamic_cast<DocumentView*>(tabView)) {
|
||||
Document* document = docView->getDocument();
|
||||
Document* document = docView->document();
|
||||
m_statusBar->setStatusText(250, "%s",
|
||||
document->filename().c_str());
|
||||
}
|
||||
|
@ -266,17 +266,17 @@ void PreviewEditorWindow::onWindowResize()
|
||||
|
||||
DocumentView* view = UIContext::instance()->activeView();
|
||||
if (view)
|
||||
updateUsingEditor(view->getEditor());
|
||||
updateUsingEditor(view->editor());
|
||||
}
|
||||
|
||||
bool PreviewEditorWindow::hasDocument() const
|
||||
{
|
||||
return (m_docView && m_docView->getDocument() != nullptr);
|
||||
return (m_docView && m_docView->document() != nullptr);
|
||||
}
|
||||
|
||||
DocumentPreferences& PreviewEditorWindow::docPref()
|
||||
{
|
||||
Document* doc = (m_docView ? m_docView->getDocument(): nullptr);
|
||||
Document* doc = (m_docView ? m_docView->document(): nullptr);
|
||||
return Preferences::instance().document(doc);
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ void PreviewEditorWindow::onCenterClicked()
|
||||
|
||||
void PreviewEditorWindow::onPlayClicked()
|
||||
{
|
||||
Editor* miniEditor = (m_docView ? m_docView->getEditor(): nullptr);
|
||||
Editor* miniEditor = (m_docView ? m_docView->editor(): nullptr);
|
||||
if (!miniEditor || !miniEditor->document())
|
||||
return;
|
||||
|
||||
@ -307,7 +307,7 @@ void PreviewEditorWindow::onPlayClicked()
|
||||
|
||||
void PreviewEditorWindow::onPopupSpeed()
|
||||
{
|
||||
Editor* miniEditor = (m_docView ? m_docView->getEditor(): nullptr);
|
||||
Editor* miniEditor = (m_docView ? m_docView->editor(): nullptr);
|
||||
if (!miniEditor || !miniEditor->document())
|
||||
return;
|
||||
|
||||
@ -330,7 +330,7 @@ void PreviewEditorWindow::updateUsingEditor(Editor* editor)
|
||||
m_relatedEditor = editor;
|
||||
|
||||
Document* document = editor->document();
|
||||
Editor* miniEditor = (m_docView ? m_docView->getEditor(): NULL);
|
||||
Editor* miniEditor = (m_docView ? m_docView->editor(): nullptr);
|
||||
|
||||
if (!isVisible())
|
||||
openWindow();
|
||||
@ -346,7 +346,7 @@ void PreviewEditorWindow::updateUsingEditor(Editor* editor)
|
||||
m_docView = new DocumentView(document, DocumentView::Preview, this);
|
||||
addChild(m_docView);
|
||||
|
||||
miniEditor = m_docView->getEditor();
|
||||
miniEditor = m_docView->editor();
|
||||
miniEditor->setZoom(render::Zoom::fromScale(docPref.preview.zoom()));
|
||||
miniEditor->setLayer(editor->layer());
|
||||
miniEditor->setFrame(editor->frame());
|
||||
@ -421,7 +421,7 @@ void PreviewEditorWindow::saveScrollPref()
|
||||
if (!m_docView)
|
||||
return;
|
||||
|
||||
Editor* miniEditor = m_docView->getEditor();
|
||||
Editor* miniEditor = m_docView->editor();
|
||||
ASSERT(miniEditor);
|
||||
|
||||
docPref().preview.scroll(View::getView(miniEditor)->viewScroll());
|
||||
@ -454,7 +454,7 @@ void PreviewEditorWindow::hideWindow()
|
||||
void PreviewEditorWindow::destroyDocView()
|
||||
{
|
||||
if (m_docView) {
|
||||
m_docView->getEditor()->removeObserver(this);
|
||||
m_docView->editor()->removeObserver(this);
|
||||
|
||||
delete m_docView;
|
||||
m_docView = nullptr;
|
||||
|
@ -100,7 +100,7 @@ void UIContext::setActiveView(DocumentView* docView)
|
||||
mainWin->getWorkspace()->setActiveView(docView);
|
||||
}
|
||||
|
||||
current_editor = (docView ? docView->getEditor(): NULL);
|
||||
current_editor = (docView ? docView->editor(): nullptr);
|
||||
|
||||
if (current_editor)
|
||||
current_editor->requestFocus();
|
||||
@ -151,7 +151,7 @@ DocumentView* UIContext::getFirstDocumentView(doc::Document* document) const
|
||||
|
||||
for (WorkspaceView* view : *workspace) {
|
||||
if (DocumentView* docView = dynamic_cast<DocumentView*>(view)) {
|
||||
if (docView->getDocument() == document) {
|
||||
if (docView->document() == document) {
|
||||
return docView;
|
||||
}
|
||||
}
|
||||
@ -167,7 +167,7 @@ DocumentViews UIContext::getAllDocumentViews(doc::Document* document) const
|
||||
|
||||
for (WorkspaceView* view : *workspace) {
|
||||
if (DocumentView* docView = dynamic_cast<DocumentView*>(view)) {
|
||||
if (docView->getDocument() == document) {
|
||||
if (docView->document() == document) {
|
||||
docViews.push_back(docView);
|
||||
}
|
||||
}
|
||||
@ -180,7 +180,7 @@ Editor* UIContext::activeEditor()
|
||||
{
|
||||
DocumentView* view = activeView();
|
||||
if (view)
|
||||
return view->getEditor();
|
||||
return view->editor();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@ -203,7 +203,7 @@ void UIContext::onAddDocument(doc::Document* doc)
|
||||
App::instance()->getMainWindow()->getWorkspace()->addView(view);
|
||||
|
||||
setActiveView(view);
|
||||
view->getEditor()->setDefaultScroll();
|
||||
view->editor()->setDefaultScroll();
|
||||
}
|
||||
|
||||
void UIContext::onRemoveDocument(doc::Document* doc)
|
||||
|
Loading…
x
Reference in New Issue
Block a user