3 Copyright (c) 2012 Jakob Leben & Tim Blechmann
4 http://www.audiosynth.com
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef SCIDE_WIDGETS_MULTI_EDITOR_HPP_INCLUDED
22 #define SCIDE_WIDGETS_MULTI_EDITOR_HPP_INCLUDED
27 #include <QPushButton>
28 #include <QToolButton>
32 #include <QGridLayout>
33 #include <QTextDocument>
40 class DocumentManager
;
44 class SignalMultiplexer
;
46 namespace Settings
{ class Manager
; }
48 class MultiEditor
: public QWidget
63 TriggerAutoCompletion
,
77 GotoPreviousEmptyLine
,
98 EvaluateCurrentDocument
,
105 MultiEditor( Main
*, QWidget
* parent
= 0 );
107 int tabCount() { return mTabs
->count(); }
108 Document
* documentForTab( int index
);
109 int tabForDocument( Document
* doc
);
111 CodeEditor
*currentEditor();
112 CodeEditorBox
*currentBox() { return mCurrentEditorBox
; }
113 void split( Qt::Orientation direction
);
115 QAction
* action( ActionRole role
)
116 { return mActions
[role
]; }
118 bool stepForwardEvaluation() { return mStepForwardEvaluation
; }
120 void applySettings( Settings::Manager
* );
122 void saveSession( Session
* );
123 void switchSession( Session
* );
126 void currentDocumentChanged( Document
* );
130 void setCurrent( Document
* );
132 void showNextDocument();
133 void showPreviousDocument();
134 void switchDocument();
136 void splitHorizontally() { split(Qt::Horizontal
); }
137 void splitVertically() { split(Qt::Vertical
); }
138 void removeCurrentSplit();
139 void removeAllSplits();
143 void onOpen( Document
*, int initialCursorPosition
, int selectionLength
);
144 void onClose( Document
* );
145 void show( Document
*, int cursorPosition
= -1 );
146 void update( Document
* );
147 void onCloseRequest( int index
);
148 void onCurrentTabChanged( int index
);
149 void onCurrentEditorChanged( CodeEditor
* );
150 void onBoxActivated( CodeEditorBox
* );
151 void onModificationChanged( bool modified
);
152 void evaluateRegion();
154 void evaluateDocument();
157 void makeSignalConnections();
158 void breakSignalConnections();
159 void createActions();
160 void updateActions();
161 CodeEditorBox
*newBox();
162 void setCurrentBox( CodeEditorBox
* );
163 void setCurrentEditor( CodeEditor
* );
164 void loadBoxState( CodeEditorBox
*box
, const QVariantList
& data
, const QList
<Document
*> & documentList
);
165 void loadSplitterState( QSplitter
*, const QVariantMap
& data
, const QList
<Document
*> & documentList
);
167 SignalMultiplexer
* mSigMux
;
168 SignalMultiplexer
* mBoxSigMux
;
169 QAction
*mActions
[ActionRoleCount
];
173 CodeEditorBox
*mCurrentEditorBox
;
174 MultiSplitter
*mSplitter
;
175 QIcon mDocModifiedIcon
;
178 bool mStepForwardEvaluation
;
183 #endif // SCIDE_WIDGETS_MULTI_EDITOR_HPP_INCLUDED