105
106
: MidiEditor(TopWin::MASTER, _rasterInit, 0)
107
108
setWindowTitle(tr("MusE: Mastertrack"));
109
setFocusPolicy(Qt::NoFocus);
108
110
_raster = 0; // measure
110
112
//---------Pulldown Menu----------------------------
111
// QPopupMenu* file = new QPopupMenu(this);
112
// menuBar()->insertItem("&File", file);
114
113
QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config"));
115
114
settingsMenu->addAction(subwinAction);
116
115
settingsMenu->addAction(shareAction);
117
116
settingsMenu->addAction(fullscreenAction);
119
118
// Toolbars ---------------------------------------------------------
120
QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools"));
121
undo_tools->setObjectName("Undo/Redo tools");
122
undo_tools->addActions(MusEGlobal::undoRedo->actions());
125
QToolBar* panic_toolbar = addToolBar(tr("panic"));
126
panic_toolbar->setObjectName("panic");
127
panic_toolbar->addAction(MusEGlobal::panicAction);
129
QToolBar* transport_toolbar = addToolBar(tr("transport"));
130
transport_toolbar->setObjectName("transport");
131
transport_toolbar->addActions(MusEGlobal::transportAction->actions());
133
119
MusEGui::EditToolBar* tools2 = new MusEGui::EditToolBar(this, MusEGui::PointerTool | MusEGui::PencilTool | MusEGui::RubberTool);
134
120
addToolBar(tools2);
136
122
QToolBar* enableMaster = addToolBar(tr("Enable master"));
137
123
enableMaster->setObjectName("Enable master");
138
124
enableButton = new QToolButton();
125
enableButton->setFocusPolicy(Qt::NoFocus);
139
126
enableButton->setCheckable(true);
140
127
enableButton->setText(tr("Enable"));
141
128
enableButton->setToolTip(tr("Enable usage of master track"));
163
150
QT_TRANSLATE_NOOP("MusEGui::MasterEdit", "Off"), QT_TRANSLATE_NOOP("MusEGui::MasterEdit", "Bar"), "1/2", "1/4", "1/8", "1/16"
165
152
rasterLabel = new MusEGui::LabelCombo(tr("Snap"), 0);
166
rasterLabel->setFocusPolicy(Qt::NoFocus);
153
rasterLabel->setFocusPolicy(Qt::TabFocus);
167
154
for (int i = 0; i < 6; i++)
168
155
rasterLabel->insertItem(i, tr(rastval[i]));
169
156
rasterLabel->setCurrentIndex(1);
173
160
//---------values for current position---------------
174
161
info->addWidget(new QLabel(tr("CurPos ")));
175
162
curTempo = new MusEGui::TempoEdit(0);
176
curSig = new SigEdit(0);
163
curSig = new SigEdit(0); // SigEdit is already StrongFocus.
164
curTempo->setFocusPolicy(Qt::StrongFocus);
177
165
curSig->setValue(AL::TimeSignature(4, 4));
178
166
curTempo->setToolTip(tr("tempo at current position"));
179
167
curSig->setToolTip(tr("time signature at current position"));
180
168
info->addWidget(curTempo);
181
169
info->addWidget(curSig);
182
///connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int)));
183
connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), MusEGlobal::song, SLOT(setSig(const AL::TimeSignature&)));
185
///connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double)));
186
connect(curTempo, SIGNAL(tempoChanged(double)), MusEGlobal::song, SLOT(setTempo(double)));
171
connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), SLOT(sigChange(const AL::TimeSignature&)));
172
connect(curTempo, SIGNAL(tempoChanged(double)), SLOT(tempoChange(double)));
188
174
//---------------------------------------------------
196
182
vscroll->setRange(30000, 250000);
197
183
time1 = new MusEGui::MTScale(&_raster, mainw, xscale);
198
184
sign = new MusEGui::SigScale(&_raster, mainw, xscale);
199
// thits = new MusEGui::HitScale(&_raster, mainw, xscale);
185
// thits = new MusEGui::HitScale(&_raster, mainw, xscale); DELETETHIS what IS this? delete zhits as well
201
187
canvas = new Master(this, mainw, xscale, yscale);
219
203
mainGrid->addWidget(MusECore::hLine(mainw), 2, 1);
220
204
mainGrid->addWidget(sign, 3, 1);
221
205
mainGrid->addWidget(MusECore::hLine(mainw), 4, 1);
222
// mainGrid->addWidget(thits, 5, 1);
206
// mainGrid->addWidget(thits, 5, 1); DELETETHIS
223
207
// mainGrid->addWidget(MusECore::hLine(mainw), 6, 1);
224
208
mainGrid->addWidget(canvas, 5, 1);
225
209
mainGrid->addWidget(tscale, 5, 0);
226
210
mainGrid->addWidget(MusECore::hLine(mainw), 6, 1);
227
// mainGrid->addWidget(zhits, 9, 1);
211
// mainGrid->addWidget(zhits, 9, 1); DELETETHIS
228
212
// mainGrid->addWidget(MusECore::hLine(mainw), 7, 1);
229
213
mainGrid->addWidget(time2, 7, 1);
230
214
mainGrid->addWidget(hscroll, 8, 1);
231
215
mainGrid->addWidget(vscroll, 0, 2, 10, 1);
232
// mainGrid->addWidget(corner, 9, 2, AlignBottom | AlignRight);
234
canvas->setFocus(); // Tim.
236
219
connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int)));
237
220
connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int)));
243
226
connect(hscroll, SIGNAL(scrollChanged(int)), time1, SLOT(setXPos(int)));
244
227
connect(hscroll, SIGNAL(scrollChanged(int)), sign, SLOT(setXPos(int)));
245
// connect(hscroll, SIGNAL(scrollChanged(int)), thits, SLOT(setXPos(int)));
228
// connect(hscroll, SIGNAL(scrollChanged(int)), thits, SLOT(setXPos(int))); DELETETHIS
246
229
connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
247
// connect(hscroll, SIGNAL(scrollChanged(int)), zhits, SLOT(setXPos(int)));
230
// connect(hscroll, SIGNAL(scrollChanged(int)), zhits, SLOT(setXPos(int)));DELETETHIS
248
231
connect(hscroll, SIGNAL(scrollChanged(int)), time2, SLOT(setXPos(int)));
250
233
connect(hscroll, SIGNAL(scaleChanged(int)), time1, SLOT(setXMag(int)));
251
234
connect(hscroll, SIGNAL(scaleChanged(int)), sign, SLOT(setXMag(int)));
252
// connect(hscroll, SIGNAL(scaleChanged(int)), thits, SLOT(setXMag(int)));
235
// connect(hscroll, SIGNAL(scaleChanged(int)), thits, SLOT(setXMag(int)));DELETETHIS
253
236
connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int)));
254
// connect(hscroll, SIGNAL(scaleChanged(int)), zhits, SLOT(setXMag(int)));
237
// connect(hscroll, SIGNAL(scaleChanged(int)), zhits, SLOT(setXMag(int))); DELETETHIS
255
238
connect(hscroll, SIGNAL(scaleChanged(int)), time2, SLOT(setXMag(int)));
257
240
connect(time1, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
258
// connect(sign, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
241
// connect(sign, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned))); DELETETHIS
259
242
// connect(thits, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
260
243
// connect(canvas, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
261
244
// connect(zhits, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
269
252
connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
270
253
connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
255
connect(curSig, SIGNAL(returnPressed()), SLOT(focusCanvas()));
256
connect(curSig, SIGNAL(escapePressed()), SLOT(focusCanvas()));
257
connect(curTempo, SIGNAL(returnPressed()), SLOT(focusCanvas()));
258
connect(curTempo, SIGNAL(escapePressed()), SLOT(focusCanvas()));
272
260
initTopwinState();
273
MusEGlobal::muse->topwinMenuInited(this);
276
264
//---------------------------------------------------------
388
375
//---------------------------------------------------------
377
//---------------------------------------------------------
379
void MasterEdit::focusCanvas()
381
if(MusEGlobal::config.smartFocus)
384
canvas->activateWindow();
388
//---------------------------------------------------------
390
390
//---------------------------------------------------------
448
449
tempo->setValue(val);
453
void MasterEdit::sigChange(const AL::TimeSignature& sig)
455
// TODO: FIXME: Tempo/sig undo + redo broken here. Either fix tempo and sig, or finish something here...
456
MusEGlobal::audio->msgAddSig(MusEGlobal::song->cPos().tick(), sig.z, sig.n); // Add will replace if found.
459
void MasterEdit::tempoChange(double t)
464
// TODO: FIXME: Tempo/sig undo + redo broken here. Either fix tempo and sig, or finish something here... Also in transport.
465
//MusEGlobal::song->startUndo();
466
//iTEvent e = find(tick);
467
//MusEGlobal::audio->msgDeleteTempo(it->first, it->second, false);
468
MusEGlobal::audio->msgAddTempo(MusEGlobal::song->cPos().tick(), int(60000000.0/t), true); // Add will replace if found.
469
//MusEGlobal::song->endUndo(SC_TEMPO);
452
472
} // namespace MusEGui