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_MAIN_WINDOW_HPP_INCLUDED
22 #define SCIDE_WIDGETS_MAIN_WINDOW_HPP_INCLUDED
25 #include <QMainWindow>
27 #include <QSignalMapper>
35 class TextFindReplacePanel
;
41 class DocumentsDialog
;
44 class StatusClockLabel
;
46 namespace Settings
{ class Manager
; }
48 class MainWindow
: public QMainWindow
71 OpenSessionSwitchDialog
,
105 ServerDumpNodeTreeWithControls
,
110 explicit MainWindow(Main
*);
112 QAction
*action( ActionRole
);
116 void saveWindowState();
117 void restoreWindowState();
118 void focusCodeEditor();
120 static MainWindow
*instance() { return mInstance
; }
122 static bool close( Document
* );
123 static bool save( Document
*, bool forceChoose
= false );
124 static bool reload( Document
* );
128 void saveCurrentSessionAs();
129 void openSessionsDialog();
134 void saveDocumentAs();
135 void saveAllDocuments();
136 void reloadDocument();
137 void closeDocument();
138 void closeAllDocuments();
142 void showReplaceTool();
143 void showGoToLineTool();
149 void evaluateCode( const QString
&, bool silent
= true );
152 void showStatusMessage( QString
const & string
);
155 void switchSession( Session
*session
);
156 void saveSession( Session
*session
);
158 void openDocumentation();
159 void onInterpreterStateChanged( QProcess::ProcessState
);
160 void onServerStatusReply(int ugens
, int synths
, int groups
, int synthDefs
, float avgCPU
, float peakCPU
);
161 void onServerRunningChanged( bool running
, QString
const & hostName
, int port
);
163 void onCurrentDocumentChanged( Document
* );
164 void onDocumentChangedExternally( Document
* );
165 void onDocDialogFinished();
166 void updateRecentDocsMenu();
167 void onRecentDocAction( QAction
* );
168 void onOpenSessionAction( QAction
* );
169 void updateWindowTitle();
170 void toggleFullScreen();
171 void openDefinition();
172 void lookupDefinition();
173 void lookupDocumentation();
174 void findReferences();
175 void lookupReferences();
176 void serverToggleRunning();
178 void serverDumpNodeTree();
179 void serverDumpNodeTreeWithControls();
180 void serverShowMeters();
181 void applySettings( Settings::Manager
* );
182 void showSwitchSessionDialog();
185 virtual void closeEvent(QCloseEvent
*event
);
186 virtual void dragEnterEvent( QDragEnterEvent
* );
187 virtual void dropEvent( QDropEvent
* );
190 void createActions();
192 bool promptSaveDocs();
193 void updateSessionsMenu();
194 void updateClockWidget( bool isFullScreen
);
195 void openSession( QString
const & sessionName
);
199 QAction
* mActions
[ActionCount
];
200 QMenu
* mRecentDocsMenu
;
201 QMenu
* mSessionsMenu
;
203 MultiEditor
*mEditors
;
208 GoToLineTool
*mGoToLineTool
;
209 TextFindReplacePanel
*mFindReplaceTool
;
212 QStatusBar
*mStatusBar
;
213 StatusLabel
*mLangStatus
;
214 StatusLabel
*mServerStatus
;
215 StatusClockLabel
*mClockLabel
;
218 PostDock
* mPostDock
;
219 DocumentsDock
*mDocListDock
;
221 QSignalMapper mCodeEvalMapper
;
222 DocumentsDialog
* mDocDialog
;
224 static MainWindow
*mInstance
;
227 class StatusLabel
: public QLabel
230 StatusLabel(QWidget
*parent
= 0);
231 void setBackground(const QBrush
&);
232 void setTextColor(const QColor
&);
235 class StatusClockLabel
: public StatusLabel
238 StatusClockLabel (QWidget
* parent
= 0);
242 void timerEvent(QTimerEvent
*);