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 ScCodeEditor
*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();
142 void onOpen( Document
*, int initialCursorPosition
, int selectionLength
);
143 void onClose( Document
* );
144 void show( Document
*, int cursorPosition
= -1, int selectionLenght
= 0 );
145 void update( Document
* );
146 void onCloseRequest( int index
);
147 void onCurrentTabChanged( int index
);
148 void onCurrentEditorChanged( ScCodeEditor
* );
149 void onBoxActivated( CodeEditorBox
* );
150 void onModificationChanged( bool modified
);
151 void evaluateRegion();
153 void evaluateDocument();
156 void makeSignalConnections();
157 void breakSignalConnections();
158 void createActions();
159 void updateActions();
160 CodeEditorBox
*newBox();
161 void setCurrentBox( CodeEditorBox
* );
162 void setCurrentEditor( ScCodeEditor
* );
163 void loadBoxState( CodeEditorBox
*box
, const QVariantList
& data
, const QList
<Document
*> & documentList
);
164 void loadSplitterState( QSplitter
*, const QVariantMap
& data
, const QList
<Document
*> & documentList
);
166 SignalMultiplexer
* mSigMux
;
167 SignalMultiplexer
* mBoxSigMux
;
168 QAction
*mActions
[ActionRoleCount
];
172 CodeEditorBox
*mCurrentEditorBox
;
173 MultiSplitter
*mSplitter
;
174 QIcon mDocModifiedIcon
;
177 bool mStepForwardEvaluation
;
182 #endif // SCIDE_WIDGETS_MULTI_EDITOR_HPP_INCLUDED