Canorus
0.7
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
ui
mainwin.h
Go to the documentation of this file.
1
8
#ifndef MAINWIN_H_
9
#define MAINWIN_H_
10
11
#include <QObject>
12
#include <QFileDialog>
13
#include <QTime>
14
#include <QTimer>
15
#include <QHash>
16
17
#include "
ui_mainwin.h
"
18
19
#include "
core/document.h
"
20
#include "
core/muselement.h
"
21
#include "
core/note.h
"
22
#include "
core/clef.h
"
23
24
#include "
interface/playback.h
"
25
#include "
interface/pyconsoleinterface.h
"
26
27
#include "
widgets/viewportcontainer.h
"
28
#include "
widgets/scoreviewport.h
"
29
#include "
widgets/resourceview.h
"
30
31
class
QKeyEvent;
32
class
QSlider;
33
class
QSpinBox;
34
class
QToolBar;
35
class
QLabel;
36
class
QLineEdit
;
37
class
QComboBox;
38
class
QCheckBox;
39
class
QAction
;
40
41
class
CAHelpBrowser
;
42
class
CAMenuToolButton
;
43
class
CAUndoToolButton
;
44
class
CALCDNumber
;
45
class
CASheet
;
46
class
CAScoreViewPort
;
47
class
CASourceViewPort
;
48
class
CAMusElementFactory
;
49
class
CAPrintPreviewCtl;
50
class
CAPrintCtl
;
51
class
CAPreviewCtl
;
52
class
CAPyConsole
;
53
class
CATransposeView
;
54
class
CAMidiRecorderView
;
55
class
CAKeybdInput
;
56
class
CAExport
;
57
58
class
CAMainWin
:
public
QMainWindow
,
private
Ui::uiMainWindow
59
{
60
Q_OBJECT
61
62
public
:
63
enum
CAMode
{
64
NoDocumentMode
,
65
InsertMode
,
66
SelectMode
,
67
EditMode
,
68
ReadOnlyMode
69
};
70
71
CAMainWin
(
QMainWindow
*oParent = 0);
72
~CAMainWin
();
73
74
void
clearUI
();
75
void
rebuildUI
(
CASheet
*sheet,
bool
repaint=
true
);
76
void
rebuildUI
(
bool
repaint=
true
);
77
inline
bool
rebuildUILock
() {
return
_rebuildUILock
; }
78
void
updateWindowTitle
();
79
80
void
newDocument
();
81
void
addSheet
(
CASheet
*s);
82
void
removeSheet
(
CASheet
*s);
83
void
insertMusElementAt
(
const
QPoint coords,
CAScoreViewPort
*v );
84
void
restartTimeEditedTime
() {
_timeEditedTime
= 0; };
85
void
deleteSelection
(
CAScoreViewPort
*v,
bool
deleteSyllable,
bool
deleteNotes,
bool
undo );
86
void
copySelection
(
CAScoreViewPort
*v );
87
void
pasteAt
(
const
QPoint coords,
CAScoreViewPort
*v );
88
89
CADocument
*
openDocument
(
const
QString& fileName );
90
CADocument
*
openDocument
(
CADocument
* doc );
91
bool
saveDocument
( QString fileName );
92
93
inline
CAMode
mode
() {
return
_mode
; }
94
inline
QFileDialog *
exportDialog
() {
return
uiExportDialog
; }
95
inline
QFileDialog *
importDialog
() {
return
uiImportDialog
; }
96
inline
CAResourceView
*
resourceView
() {
return
_resourceView
; }
97
inline
QAction
*
resourceViewAction
() {
return
uiResourceView
; }
98
inline
CAMidiRecorderView
*
midiRecorderView
() {
return
_midiRecorderView
; }
99
inline
void
setMidiRecorderView
(
CAMidiRecorderView
*v ) {
_midiRecorderView
= v; }
100
inline
CAViewPort
*
currentViewPort
() {
return
_currentViewPort
; }
101
inline
void
removeViewPort
(
CAViewPort
* v) {
_viewPortList
.removeAll(v); }
102
inline
QList<CAViewPort*>
viewPortList
() {
return
_viewPortList
; }
103
104
inline
CAScoreViewPort
*
currentScoreViewPort
() {
105
if
(
currentViewPort
())
return
dynamic_cast<
CAScoreViewPort
*
>
(
currentViewPort
());
106
else
return
0;
107
}
108
109
inline
CASheet
*
currentSheet
() {
110
CAScoreViewPort
*v =
currentScoreViewPort
();
111
if
(v)
return
v->
sheet
();
112
else
return
0;
113
}
114
115
inline
CAStaff
*
currentStaff
() {
116
CAContext
*context =
currentContext
();
117
if
(context && context->
contextType
()==
CAContext::Staff
)
return
static_cast<CAStaff*>(context);
118
else
return
0;
119
}
120
121
CAContext
*
currentContext
();
122
CAVoice
*
currentVoice
();
123
inline
CAViewPortContainer
*
currentViewPortContainer
() {
return
_currentViewPortContainer
; }
124
inline
CADocument
*
document
() {
return
_document
; }
125
126
inline
void
setDocument
(
CADocument
*
document
) {
_document
=
document
;
_resourceView
->
setDocument
( document ); }
127
128
// Dialogs, Windows
129
static
QFileDialog *
uiSaveDialog
;
130
static
QFileDialog *
uiOpenDialog
;
131
static
QFileDialog *
uiExportDialog
;
132
static
QFileDialog *
uiImportDialog
;
133
134
// Python Console
135
CAPyConsole
*
pyConsole
;
136
CAPyConsoleInterface
*
pyConsoleIface
;
137
138
QDockWidget
*
helpDock
() {
return
uiHelpDock
; }
139
CAHelpBrowser
*
helpWidget
() {
return
uiHelpWidget
; }
140
141
private
slots:
143
// ToolBar/Menus actions //
145
void
closeEvent
(QCloseEvent *event);
146
// File
147
void
on_uiNewDocument_triggered
();
148
void
on_uiOpenDocument_triggered
();
149
bool
on_uiSaveDocument_triggered
();
150
bool
on_uiSaveDocumentAs_triggered
();
151
void
on_uiCloseDocument_triggered
();
152
void
on_uiExportDocument_triggered
();
153
void
on_uiImportDocument_triggered
();
154
void
on_uiExportToPdf_triggered
();
155
void
on_uiOpenRecent_aboutToShow
();
156
void
onUiOpenRecentDocumentTriggered
();
157
158
// Edit
159
void
on_uiUndo_toggled
(
bool
,
int
);
160
void
on_uiRedo_toggled
(
bool
,
int
);
161
void
on_uiCopy_triggered
();
162
void
on_uiCut_triggered
();
163
void
on_uiPaste_triggered
();
164
void
on_uiSelectAll_triggered
();
165
void
on_uiInvertSelection_triggered
();
166
void
on_uiDocumentProperties_triggered
();
167
168
// Insert
169
void
on_uiSelectMode_toggled
(
bool
);
170
void
on_uiEditMode_toggled
(
bool
);
171
void
on_uiNewSheet_triggered
();
172
void
on_uiNewVoice_triggered
();
173
void
on_uiContextType_toggled
(
bool
,
int
);
174
void
on_uiClefType_toggled
(
bool
,
int
);
175
void
on_uiInsertKeySig_toggled
(
bool
);
176
void
on_uiTimeSigType_toggled
(
bool
,
int
);
177
void
on_uiBarlineType_toggled
(
bool
,
int
);
178
void
on_uiInsertPlayable_toggled
(
bool
);
179
void
on_uiSlurType_toggled
(
bool
,
int
);
180
void
on_uiMarkType_toggled
(
bool
,
int
);
181
void
on_uiArticulationType_toggled
(
bool
,
int
);
182
void
on_uiInsertSyllable_toggled
(
bool
);
183
void
on_uiInsertFM_toggled
(
bool
);
184
185
// View
186
void
on_uiFullscreen_toggled
(
bool
);
187
void
on_uiAnimatedScroll_toggled
(
bool
);
188
void
on_uiLockScrollPlayback_toggled
(
bool
);
189
void
on_uiZoomToSelection_triggered
();
190
void
on_uiZoomToFit_triggered
();
191
void
on_uiZoomToWidth_triggered
();
192
void
on_uiZoomToHeight_triggered
();
193
void
on_uiScoreView_triggered
();
194
void
on_uiLilyPondSource_triggered
();
195
void
on_uiCanorusMLSource_triggered
();
196
void
on_uiResourceView_toggled
(
bool
);
197
198
// Sheet
199
void
on_uiRemoveSheet_triggered
();
200
void
on_uiSheetName_returnPressed
();
201
void
on_uiSheetProperties_triggered
();
202
203
// Context
204
void
on_uiContextName_returnPressed
();
205
void
on_uiRemoveContext_triggered
();
206
void
on_uiStanzaNumber_valueChanged
(
int
);
207
void
on_uiAssociatedVoice_activated
(
int
);
208
void
on_uiContextProperties_triggered
();
209
210
// Playback
211
void
on_uiPlayFromSelection_toggled
(
bool
);
212
213
// Playable
214
void
on_uiPlayableLength_toggled
(
bool
,
int
);
215
void
on_uiTupletType_toggled
(
bool
,
int
);
216
void
on_uiTupletNumber_valueChanged
(
int
);
217
void
on_uiTupletActualNumber_valueChanged
(
int
);
218
void
on_uiNoteStemDirection_toggled
(
bool
,
int
);
219
void
on_uiHiddenRest_toggled
(
bool
checked );
220
void
onMidiInEvent
( QVector<unsigned char> message );
221
222
// Key Signature
223
void
on_uiKeySig_activated
(
int
);
224
225
// Time Signature
226
void
on_uiTimeSigBeats_valueChanged
(
int
);
227
void
on_uiTimeSigBeat_valueChanged
(
int
);
228
229
// Clef
230
void
on_uiClefOffset_valueChanged
(
int
);
231
232
// Lyrics
233
void
onTextEditKeyPressEvent
(QKeyEvent *);
234
235
// Function marks
236
void
on_uiFMFunction_toggled
(
bool
,
int
);
237
void
on_uiFMChordArea_toggled
(
bool
,
int
);
238
void
on_uiFMTonicDegree_toggled
(
bool
,
int
);
239
void
on_uiFMEllipse_toggled
(
bool
);
240
241
// Dynamic marks
242
void
on_uiDynamicText_toggled
(
bool
,
int
);
243
void
on_uiDynamicVolume_valueChanged
(
int
);
244
void
on_uiDynamicCustomText_returnPressed
();
245
246
// Instrument change
247
void
on_uiInstrumentChange_activated
(
int
);
248
249
// Fermata
250
void
on_uiFermataType_toggled
(
bool
,
int
);
251
252
// Repeat Mark
253
void
on_uiRepeatMarkType_toggled
(
bool
,
int
);
254
255
// Fingering
256
void
on_uiFinger_toggled
(
bool
checked,
int
t );
257
void
on_uiFingeringOriginal_toggled
(
bool
checked );
258
259
// Tempo
260
void
on_uiTempoBeat_toggled
(
bool
,
int
);
261
void
on_uiTempoBpm_returnPressed
();
262
263
// Tools
264
void
on_uiSettings_triggered
();
265
void
on_uiTranspose_triggered
();
266
void
on_uiMidiRecorder_triggered
();
267
268
// Voice
269
void
on_uiVoiceNum_valChanged
(
int
);
270
void
on_uiVoiceName_returnPressed
();
271
void
on_uiVoiceInstrument_activated
(
int
);
272
void
on_uiRemoveVoice_triggered
();
273
void
on_uiVoiceStemDirection_toggled
(
bool
,
int
);
274
void
on_uiVoiceProperties_triggered
();
275
276
// Window
277
void
on_uiSplitHorizontally_triggered
();
278
void
on_uiSplitVertically_triggered
();
279
void
on_uiUnsplitAll_triggered
();
280
void
on_uiCloseCurrentView_triggered
();
281
void
on_uiNewViewport_triggered
();
282
void
on_uiNewWindow_triggered
();
283
284
// Help
285
public
slots:
286
void
on_uiUsersGuide_triggered
();
287
private
slots:
288
void
on_uiAboutCanorus_triggered
();
289
void
on_uiAboutQt_triggered
();
290
292
// Handle other widgets signals //
294
void
keyPressEvent
(QKeyEvent *);
295
void
on_uiTabWidget_currentChanged
(
int
);
296
297
void
viewPortClicked
();
298
299
void
scoreViewPortMousePress
(QMouseEvent *e,
const
QPoint coords);
300
void
scoreViewPortMouseMove
(QMouseEvent *e,
const
QPoint coords);
301
void
scoreViewPortMouseRelease
(QMouseEvent *e,
const
QPoint coords);
302
void
scoreViewPortDoubleClick
(QMouseEvent *e,
const
QPoint coords);
303
void
scoreViewPortTripleClick
(QMouseEvent *e,
const
QPoint coords);
304
void
scoreViewPortWheel
(QWheelEvent *e,
const
QPoint coords);
305
void
scoreViewPortKeyPress
(QKeyEvent *e);
306
void
sourceViewPortCommit
(QString inputString);
307
void
floatViewPortClosed
(
CAViewPort
*);
308
309
void
onTimeEditedTimerTimeout
();
310
311
void
playbackFinished
();
312
void
onScoreViewPortSelectionChanged
();
313
void
onRepaintTimerTimeout
();
314
315
private
:
316
void
playImmediately
( QList<CAMusElement*> elements );
317
319
// General properties //
321
CADocument
*
_document
;
322
CAMode
_mode
;
323
324
CAPreviewCtl
*
_poPrintPreviewCtl
;
325
CAPrintCtl
*
_poPrintCtl
;
326
CAExport
*
_poExp
;
// abstract export instance
327
CAResourceView
*
_resourceView
;
328
CATransposeView
*
_transposeView
;
329
CAMidiRecorderView
*
_midiRecorderView
;
330
331
void
setMode
(
CAMode
mode
);
332
inline
void
setCurrentViewPort
(
CAViewPort
*viewPort ) {
_currentViewPort
= viewPort; }
333
inline
void
setCurrentViewPortContainer
(
CAViewPortContainer
*vpc )
334
{
_currentViewPortContainer
= vpc; }
335
336
CAViewPortContainer
*
_currentViewPortContainer
;
337
QList<CAViewPortContainer *>
_viewPortContainerList
;
338
339
QList<CAViewPort *>
_viewPortList
;
340
QHash<CAViewPortContainer*, CASheet*>
_sheetMap
;
341
CAViewPort
*
_currentViewPort
;
342
bool
_animatedScroll
;
343
bool
_lockScrollPlayback
;
344
CAViewPort
*
_playbackViewPort
;
345
QList<CADrawableMusElement*>
_prePlaybackSelection
;
346
QTimer *
_repaintTimer
;
347
bool
_rebuildUILock
;
348
inline
void
setRebuildUILock
(
bool
l) {
_rebuildUILock
= l; }
349
350
CAPlayback
*
_playback
;
351
QTimer
_timeEditedTimer
;
352
unsigned
int
_timeEditedTime
;
353
CAMusElementFactory
*
_musElementFactory
;
354
public
:
355
inline
CAMusElementFactory
*
musElementFactory
() {
return
_musElementFactory
; }
356
private
:
357
inline
bool
stopPlayback
() {
358
if
(
_playback
&&
_playback
->isRunning())
359
_playback
->
stopNow
();
360
}
361
362
bool
handleUnsavedChanges
();
363
364
CAKeybdInput
*
_keybdInput
;
366
// Pure user interface - widgets that weren't created by Qt Designer yet //
368
void
createCustomActions
();
369
void
setupCustomUi
();
370
void
initViewPort
(
CAViewPort
*);
371
void
updateUndoRedoButtons
();
372
void
updateToolBars
();
373
void
updateSheetToolBar
();
374
void
updateContextToolBar
();
375
void
updateVoiceToolBar
();
376
void
updateInsertToolBar
();
377
void
updatePlayableToolBar
();
378
void
updateKeySigToolBar
();
379
void
updateTimeSigToolBar
();
380
void
updateClefToolBar
();
381
void
updateFMToolBar
();
382
void
updateDynamicToolBar
();
383
void
updateInstrumentToolBar
();
384
void
updateTempoToolBar
();
385
void
updateFermataToolBar
();
386
void
updateRepeatMarkToolBar
();
387
void
updateFingeringToolBar
();
388
390
// Toolbar section //
392
// Standard toolbar
393
//QToolBar *uiStandardToolBar;
394
CAUndoToolButton
*
uiUndo
;
395
CAUndoToolButton
*
uiRedo
;
396
397
// Insert toolbar
398
QToolBar *
uiInsertToolBar
;
399
QActionGroup *
uiInsertGroup
;
// Group for mutual exclusive selection of music elements
400
// QAction *uiSelectMode; // made by Qt Designer
401
// QAction *uiNewSheet; // made by Qt Designer
402
CAMenuToolButton
*
uiContextType
;
403
404
// QAction *uiInsertPlayable; // made by Qt Designer
405
CAMenuToolButton
*
uiClefType
;
406
// QAction *uiInsertKeySig; // made by Qt Designer
407
CAMenuToolButton
*
uiTimeSigType
;
// made by Qt Designer
408
CAMenuToolButton
*
uiBarlineType
;
409
CAMenuToolButton
*
uiMarkType
;
410
CAMenuToolButton
*
uiArticulationType
;
411
// QAction *uiInsertSyllable; // made by Qt Designer
412
// QAction *uiInsertFM; // made by Qt Designer
413
414
QToolBar *
uiSheetToolBar
;
415
// QAction *uiNewSheet; // made by Qt Designer
416
QLineEdit
*
uiSheetName
;
417
// QAction *uiRemoveSheet; // made by Qt Designer
418
// QAction *uiSheetProperties; // made by Qt Designer
419
420
QToolBar *
uiContextToolBar
;
421
// CAContext
422
QLineEdit
*
uiContextName
;
423
//QAction *uiRemoveContext; // made by Qt Designer
424
//QAction *uiContextProperties; // made by Qt Designer
425
// CAStaff
426
// CALyricsContext
427
QSpinBox *
uiStanzaNumber
;
428
QAction
*
uiStanzaNumberAction
;
429
QComboBox *
uiAssociatedVoice
;
430
QAction
*
uiAssociatedVoiceAction
;
431
// CAFunctionMarkContext
432
433
QToolBar *
uiVoiceToolBar
;
434
// QAction *uiNewVoice; // made by Qt Designer
435
CALCDNumber
*
uiVoiceNum
;
436
QLineEdit
*
uiVoiceName
;
437
QComboBox *
uiVoiceInstrument
;
438
// QAction *uiRemoveVoice; // made by Qt Designer
439
CAMenuToolButton
*
uiVoiceStemDirection
;
440
// QAction *uiVoiceProperties; // made by Qt Designer
441
442
QToolBar *
uiPlayableToolBar
;
// note and rest properties are merged for the time being
443
// Note properties
444
CAMenuToolButton
*
uiPlayableLength
;
445
CAMenuToolButton
*
uiNoteAccs
;
446
CAMenuToolButton
*
uiSlurType
;
447
public
:
// Because CAKeyboardInput (input with midi keyboard) needs to operate these widgets to
448
// provide gui feedback, these, probably even more, should become public.
449
// Some clean interface would be appropriate.
450
CAMenuToolButton
*
uiTupletType
;
451
QSpinBox *
uiTupletNumber
;
452
QSpinBox *
uiTupletActualNumber
;
453
private
:
454
QAction
*
uiTupletNumberAction
;
455
QLabel *
uiTupletInsteadOf
;
456
QAction
*
uiTupletInsteadOfAction
;
457
QAction
*
uiTupletActualNumberAction
;
458
// QAction *uiNoteAccsVisible; // made by Qt Designer
459
CAMenuToolButton
*
uiNoteStemDirection
;
460
// Rest properties
461
// CAMenuToolButton *uiPlayableLength; // same as note properties
462
// QLabel *uiPlayableDotted; // same as note properties
463
// QAction *uiHiddenRest; // made by Qt Designer
464
465
QToolBar *
uiKeySigToolBar
;
466
// CAKeySigPSP *uiKeySigPSP; /// Key signature perspective. \todo Reimplement it.
467
QComboBox *
uiKeySig
;
468
// QComboBox *uiKeySigGender;
469
470
QToolBar *
uiClefToolBar
;
471
QSpinBox *
uiClefOffset
;
472
int
oldUiClefOffsetValue
;
473
474
QToolBar *
uiTimeSigToolBar
;
475
QSpinBox *
uiTimeSigBeats
;
476
QLabel *
uiTimeSigSlash
;
477
QSpinBox *
uiTimeSigBeat
;
478
// CAMenuToolButton *uiTimeSigStyle; /// \todo Implement it. -Matevz
479
480
QToolBar *
uiFMToolBar
;
// function mark tool bar
481
CAMenuToolButton
*
uiFMFunction
;
482
CAMenuToolButton
*
uiFMChordArea
;
483
CAMenuToolButton
*
uiFMTonicDegree
;
484
QComboBox *
uiFMKeySig
;
485
//QSpinBox *uiKeySigNumberOfAccs; // defined in uiKeySigToolBar
486
//QComboBox *uiKeySigGender; // defined in uiKeySigToolBar
487
//QAction *uiFMEllipse; // made by Qt Designer
488
489
// Marks tool bars:
490
QToolBar *
uiDynamicToolBar
;
491
CAMenuToolButton
*
uiDynamicText
;
492
QSpinBox *
uiDynamicVolume
;
493
QLineEdit
*
uiDynamicCustomText
;
494
QToolBar *
uiInstrumentToolBar
;
495
QComboBox *
uiInstrumentChange
;
496
QToolBar *
uiTempoToolBar
;
497
CAMenuToolButton
*
uiTempoBeat
;
498
QLabel *
uiTempoEquals
;
499
QLineEdit
*
uiTempoBpm
;
500
QToolBar *
uiFermataToolBar
;
501
CAMenuToolButton
*
uiFermataType
;
502
QToolBar *
uiRepeatMarkToolBar
;
503
CAMenuToolButton
*
uiRepeatMarkType
;
504
QToolBar *
uiFingeringToolBar
;
505
CAMenuToolButton
*
uiFinger
;
506
QCheckBox *
uiFingeringOriginal
;
507
508
// Python console
509
QDockWidget
*
uiPyConsoleDock
;
510
511
// Help widget
512
QDockWidget
*
uiHelpDock
;
513
CAHelpBrowser
*
uiHelpWidget
;
514
};
515
#endif
/* MAINWIN_H_ */
Generated on Fri Jan 11 2013 14:40:12 for Canorus by
1.8.3