3
3
// Linux Music Editor
4
4
// $Id: masteredit.cpp,v 1.4.2.5 2009/07/01 22:14:56 spamatica Exp $
5
5
// (C) Copyright 1999 Werner Schweer (ws@seh.de)
7
// This program is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU General Public License
9
// as published by the Free Software Foundation; version 2 of
10
// the License, or (at your option) any later version.
12
// This program is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with this program; if not, write to the Free Software
19
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
6
21
//=========================================================
8
23
#include "awl/sigedit.h"
77
102
//---------------------------------------------------------
79
104
MasterEdit::MasterEdit()
80
: MidiEditor(0, _rasterInit, 0)
105
: MidiEditor(TopWin::MASTER, _rasterInit, 0)
82
107
setWindowTitle(tr("MusE: Mastertrack"));
83
108
_raster = 0; // measure
84
setMinimumSize(400, 300);
87
110
//---------Pulldown Menu----------------------------
88
111
// QPopupMenu* file = new QPopupMenu(this);
89
112
// menuBar()->insertItem("&File", file);
91
//---------ToolBar----------------------------------
93
tools = addToolBar(tr("Master tools"));
94
tools->addActions(undoRedo->actions());
96
EditToolBar* tools2 = new EditToolBar(this, PointerTool | PencilTool | RubberTool);
114
QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config"));
115
settingsMenu->addAction(subwinAction);
116
settingsMenu->addAction(shareAction);
117
settingsMenu->addAction(fullscreenAction);
119
// 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
MusEGui::EditToolBar* tools2 = new MusEGui::EditToolBar(this, MusEGui::PointerTool | MusEGui::PencilTool | MusEGui::RubberTool);
97
134
addToolBar(tools2);
99
136
QToolBar* enableMaster = addToolBar(tr("Enable master"));
137
enableMaster->setObjectName("Enable master");
100
138
enableButton = new QToolButton();
101
139
enableButton->setCheckable(true);
102
140
enableButton->setText(tr("Enable"));
103
141
enableButton->setToolTip(tr("Enable usage of master track"));
104
enableButton->setChecked(song->masterFlag());
142
enableButton->setChecked(MusEGlobal::song->masterFlag());
105
143
enableMaster->addWidget(enableButton);
106
connect(enableButton, SIGNAL(toggled(bool)), song, SLOT(setMasterFlag(bool)));
144
connect(enableButton, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setMasterFlag(bool)));
108
146
QToolBar* info = addToolBar(tr("Info"));
147
info->setObjectName("Info");
109
148
QLabel* label = new QLabel(tr("Cursor"));
110
149
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
111
150
label->setIndent(3);
112
151
info->addWidget(label);
114
cursorPos = new PosLabel(0);
153
cursorPos = new MusEGui::PosLabel(0);
115
154
cursorPos->setFixedHeight(22);
116
155
cursorPos->setToolTip(tr("time at cursor position"));
117
156
info->addWidget(cursorPos);
118
tempo = new TempoLabel(0);
157
tempo = new MusEGui::TempoLabel(0);
119
158
tempo->setFixedHeight(22);
120
159
tempo->setToolTip(tr("tempo at cursor position"));
121
160
info->addWidget(tempo);
123
162
const char* rastval[] = {
124
QT_TRANSLATE_NOOP("@default", "Off"), "Bar", "1/2", "1/4", "1/8", "1/16"
163
QT_TRANSLATE_NOOP("MusEGui::MasterEdit", "Off"), QT_TRANSLATE_NOOP("MusEGui::MasterEdit", "Bar"), "1/2", "1/4", "1/8", "1/16"
126
rasterLabel = new LabelCombo(tr("Snap"), 0);
165
rasterLabel = new MusEGui::LabelCombo(tr("Snap"), 0);
127
166
rasterLabel->setFocusPolicy(Qt::NoFocus);
128
167
for (int i = 0; i < 6; i++)
129
168
rasterLabel->insertItem(i, tr(rastval[i]));
141
180
info->addWidget(curTempo);
142
181
info->addWidget(curSig);
143
182
///connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int)));
144
connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), song, SLOT(setSig(const AL::TimeSignature&)));
183
connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), MusEGlobal::song, SLOT(setSig(const AL::TimeSignature&)));
146
185
///connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double)));
147
connect(curTempo, SIGNAL(tempoChanged(double)), song, SLOT(setTempo(double)));
186
connect(curTempo, SIGNAL(tempoChanged(double)), MusEGlobal::song, SLOT(setTempo(double)));
149
188
//---------------------------------------------------
153
192
int xscale = -20;
154
193
int yscale = -500;
155
hscroll = new ScrollScale(-100, -2, xscale, song->len(), Qt::Horizontal, mainw);
156
vscroll = new ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw);
194
hscroll = new MusEGui::ScrollScale(-100, -2, xscale, MusEGlobal::song->len(), Qt::Horizontal, mainw);
195
vscroll = new MusEGui::ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw);
157
196
vscroll->setRange(30000, 250000);
158
time1 = new MTScale(&_raster, mainw, xscale);
159
sign = new SigScale(&_raster, mainw, xscale);
160
// thits = new HitScale(&_raster, mainw, xscale);
197
time1 = new MusEGui::MTScale(&_raster, mainw, xscale);
198
sign = new MusEGui::SigScale(&_raster, mainw, xscale);
199
// thits = new MusEGui::HitScale(&_raster, mainw, xscale);
162
201
canvas = new Master(this, mainw, xscale, yscale);
164
// zhits = new HitScale(&_raster, mainw, xscale);
165
time2 = new MTScale(&_raster, mainw, xscale);
203
// zhits = new MusEGui::HitScale(&_raster, mainw, xscale);
204
time2 = new MusEGui::MTScale(&_raster, mainw, xscale);
166
205
tscale = new TScale(mainw, yscale);
167
206
time2->setBarLocator(true);
175
214
mainGrid->setRowStretch(5, 100);
176
215
mainGrid->setColumnStretch(1, 100);
178
mainGrid->addWidget(hLine(mainw), 0, 1);
217
mainGrid->addWidget(MusECore::hLine(mainw), 0, 1);
179
218
mainGrid->addWidget(time1, 1, 1);
180
mainGrid->addWidget(hLine(mainw), 2, 1);
219
mainGrid->addWidget(MusECore::hLine(mainw), 2, 1);
181
220
mainGrid->addWidget(sign, 3, 1);
182
mainGrid->addWidget(hLine(mainw), 4, 1);
221
mainGrid->addWidget(MusECore::hLine(mainw), 4, 1);
183
222
// mainGrid->addWidget(thits, 5, 1);
184
// mainGrid->addWidget(hLine(mainw), 6, 1);
223
// mainGrid->addWidget(MusECore::hLine(mainw), 6, 1);
185
224
mainGrid->addWidget(canvas, 5, 1);
186
225
mainGrid->addWidget(tscale, 5, 0);
187
mainGrid->addWidget(hLine(mainw), 6, 1);
226
mainGrid->addWidget(MusECore::hLine(mainw), 6, 1);
188
227
// mainGrid->addWidget(zhits, 9, 1);
189
// mainGrid->addWidget(hLine(mainw), 7, 1);
228
// mainGrid->addWidget(MusECore::hLine(mainw), 7, 1);
190
229
mainGrid->addWidget(time2, 7, 1);
191
230
mainGrid->addWidget(hscroll, 8, 1);
192
231
mainGrid->addWidget(vscroll, 0, 2, 10, 1);
225
264
connect(tscale, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
226
265
connect(canvas, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
227
connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
228
connect(song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(posChanged(int,unsigned,bool)));
266
connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
267
connect(MusEGlobal::song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(posChanged(int,unsigned,bool)));
230
269
connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
231
270
connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
273
MusEGlobal::muse->topwinMenuInited(this);
234
276
//---------------------------------------------------------
305
347
// readConfiguration
306
348
//---------------------------------------------------------
308
void MasterEdit::readConfiguration(Xml& xml)
350
void MasterEdit::readConfiguration(MusECore::Xml& xml)
311
Xml::Token token = xml.parse();
353
MusECore::Xml::Token token = xml.parse();
312
354
const QString& tag = xml.s1();
356
case MusECore::Xml::Error:
357
case MusECore::Xml::End:
359
case MusECore::Xml::TagStart:
318
360
if (tag == "raster")
319
361
_rasterInit = xml.parseInt();
362
else if (tag == "topwin")
363
TopWin::readConfiguration(MASTER, xml);
321
365
xml.unknown("MasterEdit");
367
case MusECore::Xml::TagEnd:
324
368
if (tag == "masteredit")