Commit 04ad1360 authored by Eike Ziller's avatar Eike Ziller

Editors: Create a EditorArea class

That manages its own context. Only the first step in supporting/fixing
things like window titles, and getting rid of the editor manager
placeholder.

Change-Id: I90e681d8470728f9fab4a04dd4d1e91d37c993f3
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 9738422f
......@@ -28,6 +28,7 @@ SOURCES += mainwindow.cpp \
vcsmanager.cpp \
statusbarmanager.cpp \
versiondialog.cpp \
editormanager/editorarea.cpp \
editormanager/editormanager.cpp \
editormanager/editorview.cpp \
editormanager/documentmodel.cpp \
......@@ -117,6 +118,7 @@ HEADERS += mainwindow.h \
outputwindow.h \
vcsmanager.h \
statusbarmanager.h \
editormanager/editorarea.h \
editormanager/editormanager.h \
editormanager/editormanager_p.h \
editormanager/editorview.h \
......
......@@ -140,6 +140,7 @@ QtcPlugin {
files: [
"BinFiles.mimetypes.xml",
"documentmodel.cpp", "documentmodel.h",
"editorarea.cpp", "editorarea.h",
"editormanager.cpp", "editormanager.h", "editormanager_p.h",
"editorview.cpp", "editorview.h",
"ieditor.cpp", "ieditor.h",
......
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "editorarea.h"
#include "coreconstants.h"
#include "icontext.h"
#include "icore.h"
namespace Core {
namespace Internal {
EditorArea::EditorArea()
{
m_context = new IContext;
m_context->setContext(Context(Constants::C_EDITORMANAGER));
m_context->setWidget(this);
ICore::addContextObject(m_context);
}
EditorArea::~EditorArea()
{
ICore::removeContextObject(m_context);
delete m_context;
}
} // Internal
} // Core
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef EDITORAREA_H
#define EDITORAREA_H
#include "editorview.h"
namespace Core {
class IContext;
namespace Internal {
class EditorArea : public SplitterOrView
{
Q_OBJECT
public:
EditorArea();
~EditorArea();
private:
IContext *m_context;
};
} // Internal
} // Core
#endif // EDITORAREA_H
......@@ -30,10 +30,11 @@
#ifndef EDITORMANAGER_P_H
#define EDITORMANAGER_P_H
#include "idocument.h"
#include "documentmodel.h"
#include "editorarea.h"
#include "editormanager.h"
#include "editorview.h"
#include "idocument.h"
#include "ieditor.h"
#include <QList>
......@@ -65,7 +66,7 @@ class EditorManagerPrivate : public QObject
friend class Core::EditorManager;
public:
static QWidget *rootWidget();
static QWidget *mainEditorArea();
static EditorView *currentEditorView();
static void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
static IEditor *openEditor(EditorView *view,
......@@ -114,7 +115,7 @@ public slots:
static void gotoNextSplit();
void handleDocumentStateChange();
static void rootDestroyed(QObject *root);
static void editorAreaDestroyed(QObject *area);
private slots:
static void gotoNextDocHistory();
......@@ -153,7 +154,7 @@ private:
static void activateView(EditorView *view);
static void restoreEditorState(IEditor *editor);
static int visibleDocumentsCount();
static SplitterOrView *findRoot(const EditorView *view, int *rootIndex = 0);
static EditorArea *findEditorArea(const EditorView *view, int *areaIndex = 0);
static IEditor *pickUnusedEditor(Internal::EditorView **foundView = 0);
static void addDocumentToRecentFiles(IDocument *document);
static void updateAutoSave();
......@@ -169,8 +170,7 @@ private:
void init();
QList<EditLocation> m_globalHistory;
QList<SplitterOrView *> m_root;
QList<IContext *> m_rootContext;
QList<EditorArea *> m_editorAreas;
QPointer<IEditor> m_currentEditor;
QPointer<IEditor> m_scheduledCurrentEditor;
QPointer<EditorView> m_currentView;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment