summaryrefslogtreecommitdiff
path: root/muse2/muse/master
diff options
context:
space:
mode:
authorOrcan Ogetbil <oget.fedora@gmail.com>2011-10-07 02:20:29 +0000
committerOrcan Ogetbil <oget.fedora@gmail.com>2011-10-07 02:20:29 +0000
commitf16b2037025918e32c5fd90527f76e1102e5ecb9 (patch)
tree0da3b7a29d13b5b826b291ccb2f2676d2e227b40 /muse2/muse/master
parent42039e7f7f215f6008829d8c6be591c998f1228c (diff)
(hopefully) final huge namespace update.
Diffstat (limited to 'muse2/muse/master')
-rw-r--r--muse2/muse/master/lmaster.cpp143
-rw-r--r--muse2/muse/master/lmaster.h31
-rw-r--r--muse2/muse/master/master.cpp52
-rw-r--r--muse2/muse/master/master.h8
-rw-r--r--muse2/muse/master/masteredit.cpp88
-rw-r--r--muse2/muse/master/masteredit.h42
-rw-r--r--muse2/muse/master/tscale.cpp11
-rw-r--r--muse2/muse/master/tscale.h6
8 files changed, 204 insertions, 177 deletions
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
index a64d444f..bf31cc91 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -55,6 +55,7 @@
#define LMASTER_MSGBOX_STRING "MusE: List Editor"
+namespace MusECore {
//don't remove or insert new elements in keyStrs.
//only renaming (keeping the semantic sense) is allowed! (flo)
@@ -111,6 +112,10 @@ QString keyToString(key_enum key)
return keyStrs[keyToIndex(key)];
}
+} // namespace MusECore
+
+namespace MusEGui {
+
//---------------------------------------------------------
// closeEvent
//---------------------------------------------------------
@@ -262,15 +267,15 @@ LMaster::LMaster()
pos_editor->hide();
connect(pos_editor, SIGNAL(returnPressed()), SLOT(returnPressed()));
key_editor = new QComboBox(view->viewport());
- key_editor->addItems(keyStrs);
+ key_editor->addItems(MusECore::keyStrs);
key_editor->hide();
connect(key_editor, SIGNAL(activated(int)), SLOT(returnPressed()));
connect(view, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(select(QTreeWidgetItem*, QTreeWidgetItem*)));
connect(view, SIGNAL(itemPressed(QTreeWidgetItem*, int)), SLOT(itemPressed(QTreeWidgetItem*, int)));
connect(view, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), SLOT(itemDoubleClicked(QTreeWidgetItem*)));
- connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
- connect(this, SIGNAL(seekTo(int)), song, SLOT(seekTo(int)));
+ connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(this, SIGNAL(seekTo(int)), MusEGlobal::song, SLOT(seekTo(int)));
connect(tempoButton, SIGNAL(clicked()), SLOT(tempoButtonClicked()));
connect(timeSigButton, SIGNAL(clicked()), SLOT(timeSigButtonClicked()));
connect(keyButton, SIGNAL(clicked()), SLOT(insertKey()));
@@ -300,12 +305,12 @@ void LMaster::insertSig(const AL::SigEvent* ev)
// insertTempo
//---------------------------------------------------------
-void LMaster::insertTempo(const TEvent* ev)
+void LMaster::insertTempo(const MusECore::TEvent* ev)
{
new LMasterTempoItem(view, ev);
}
-void LMaster::insertKey(const KeyEvent& ev)
+void LMaster::insertKey(const MusECore::KeyEvent& ev)
{
new LMasterKeyEventItem(view, ev);
}
@@ -325,13 +330,13 @@ void LMaster::updateList()
}
view->clear();
- const TempoList* t = &tempomap;
+ const MusECore::TempoList* t = &MusEGlobal::tempomap;
const AL::SigList* s = &AL::sigmap;
- const KeyList* k = &keymap;
+ const MusECore::KeyList* k = &MusEGlobal::keymap;
- criTEvent it = t->rbegin();
+ MusECore::criTEvent it = t->rbegin();
AL::criSigEvent is = s->rbegin();
- criKeyEvent ik = k->rbegin();
+ MusECore::criKeyEvent ik = k->rbegin();
// three lists that should be added to the view.
// question if it would not be easier to merge the lists and use a sorting algorithm?
@@ -402,21 +407,21 @@ void LMaster::updateList()
// readStatus
//---------------------------------------------------------
-void LMaster::readStatus(Xml& xml)
+void LMaster::readStatus(MusECore::Xml& xml)
{
for (;;) {
- Xml::Token token = xml.parse();
+ MusECore::Xml::Token token = xml.parse();
const QString& tag = xml.s1();
- if (token == Xml::Error || token == Xml::End)
+ if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
break;
switch (token) {
- case Xml::TagStart:
+ case MusECore::Xml::TagStart:
if (tag == "midieditor")
MidiEditor::readStatus(xml);
else
xml.unknown("LMaster");
break;
- case Xml::TagEnd:
+ case MusECore::Xml::TagEnd:
if (tag == "lmaster")
return;
default:
@@ -429,7 +434,7 @@ void LMaster::readStatus(Xml& xml)
// writeStatus
//---------------------------------------------------------
-void LMaster::writeStatus(int level, Xml& xml) const
+void LMaster::writeStatus(int level, MusECore::Xml& xml) const
{
xml.tag(level++, "lmaster");
MidiEditor::writeStatus(level, xml);
@@ -440,22 +445,22 @@ void LMaster::writeStatus(int level, Xml& xml) const
// readConfiguration
//---------------------------------------------------------
-void LMaster::readConfiguration(Xml& xml)
+void LMaster::readConfiguration(MusECore::Xml& xml)
{
for (;;) {
- Xml::Token token = xml.parse();
+ MusECore::Xml::Token token = xml.parse();
const QString& tag = xml.s1();
switch (token) {
- case Xml::Error:
- case Xml::End:
+ case MusECore::Xml::Error:
+ case MusECore::Xml::End:
return;
- case Xml::TagStart:
+ case MusECore::Xml::TagStart:
if (tag == "topwin")
TopWin::readConfiguration(LMASTER, xml);
else
xml.unknown("LMaster");
break;
- case Xml::TagEnd:
+ case MusECore::Xml::TagEnd:
if (tag == "lmaster")
return;
default:
@@ -468,7 +473,7 @@ void LMaster::readConfiguration(Xml& xml)
// writeConfiguration
//---------------------------------------------------------
-void LMaster::writeConfiguration(int level, Xml& xml)
+void LMaster::writeConfiguration(int level, MusECore::Xml& xml)
{
xml.tag(level++, "lmaster");
TopWin::writeConfiguration(LMASTER, level, xml);
@@ -506,20 +511,20 @@ void LMaster::cmd(int cmd)
case LMASTER_TEMPO:
{
LMasterTempoItem* t = (LMasterTempoItem*) l;
- audio->msgDeleteTempo(t->tick(), t->tempo(), true);
+ MusEGlobal::audio->msgDeleteTempo(t->tick(), t->tempo(), true);
break;
}
case LMASTER_SIGEVENT:
{
LMasterSigEventItem* s = (LMasterSigEventItem*) l;
- audio->msgRemoveSig(s->tick(), s->z(), s->n());
+ MusEGlobal::audio->msgRemoveSig(s->tick(), s->z(), s->n());
break;
}
case LMASTER_KEYEVENT:
{
LMasterKeyEventItem* k = (LMasterKeyEventItem*) l;
//keymap.delKey(l->tick());
- audio->msgRemoveKey(k->tick(), k->key());
+ MusEGlobal::audio->msgRemoveKey(k->tick(), k->key());
break;
}
default:
@@ -657,7 +662,7 @@ void LMaster::returnPressed()
tempo_editor->hide();
repaint();
LMasterTempoItem* e = (LMasterTempoItem*) editedItem;
- const TEvent* t = e->getEvent();
+ const MusECore::TEvent* t = e->getEvent();
unsigned tick = t->tick;
bool conversionOK;
double dbl_input = input.toDouble(&conversionOK);
@@ -665,16 +670,16 @@ void LMaster::returnPressed()
int tempo = (int) ((1000000.0 * 60.0)/dbl_input);
if (!editingNewItem) {
- song->startUndo();
- audio->msgDeleteTempo(tick, e->tempo(), false);
- audio->msgAddTempo(tick, tempo, false);
- song->endUndo(SC_TEMPO);
+ MusEGlobal::song->startUndo();
+ MusEGlobal::audio->msgDeleteTempo(tick, e->tempo(), false);
+ MusEGlobal::audio->msgAddTempo(tick, tempo, false);
+ MusEGlobal::song->endUndo(SC_TEMPO);
}
//
// New item edited:
//
else {
- audio->msgAddTempo(tick, tempo, true);
+ MusEGlobal::audio->msgAddTempo(tick, tempo, true);
}
}
else {
@@ -700,10 +705,10 @@ void LMaster::returnPressed()
if (editedItem->getType() == LMASTER_TEMPO) {
LMasterTempoItem* t = (LMasterTempoItem*) editedItem;
int tempo = t->tempo();
- song->startUndo();
- audio->msgDeleteTempo(oldtick, tempo, false);
- audio->msgAddTempo(newtick, tempo, false);
- song->endUndo(SC_TEMPO);
+ MusEGlobal::song->startUndo();
+ MusEGlobal::audio->msgDeleteTempo(oldtick, tempo, false);
+ MusEGlobal::audio->msgAddTempo(newtick, tempo, false);
+ MusEGlobal::song->endUndo(SC_TEMPO);
// Select the item:
QTreeWidgetItem* newSelected = (QTreeWidgetItem*) getItemAtPos(newtick, LMASTER_TEMPO);
if (newSelected) {
@@ -716,15 +721,15 @@ void LMaster::returnPressed()
int z = t->z();
int n = t->n();
if (!editingNewItem) {
- song->startUndo();
- audio->msgRemoveSig(oldtick, z, n, false); //Delete first, in order to get sane tick-value
+ MusEGlobal::song->startUndo();
+ MusEGlobal::audio->msgRemoveSig(oldtick, z, n, false); //Delete first, in order to get sane tick-value
newtick = pos_editor->pos().tick();
- audio->msgAddSig(newtick, z, n, false);
- song->endUndo(SC_SIG);
+ MusEGlobal::audio->msgAddSig(newtick, z, n, false);
+ MusEGlobal::song->endUndo(SC_SIG);
}
else
- audio->msgAddSig(newtick, z, n, false);
- //audio->msgAddSig(newtick, z, n, true);
+ MusEGlobal::audio->msgAddSig(newtick, z, n, false);
+ //MusEGlobal::audio->msgAddSig(newtick, z, n, true);
// Select the item:
QTreeWidgetItem* newSelected = (QTreeWidgetItem*) getItemAtPos(newtick, LMASTER_SIGEVENT);
@@ -735,11 +740,11 @@ void LMaster::returnPressed()
}
else if (editedItem->getType() == LMASTER_KEYEVENT) {
LMasterKeyEventItem* k = (LMasterKeyEventItem*) editedItem;
- key_enum key = k->key();
- song->startUndo();
- audio->msgRemoveKey(oldtick, key, false);
- audio->msgAddKey(newtick, key, false);
- song->endUndo(SC_KEY);
+ MusECore::key_enum key = k->key();
+ MusEGlobal::song->startUndo();
+ MusEGlobal::audio->msgRemoveKey(oldtick, key, false);
+ MusEGlobal::audio->msgAddKey(newtick, key, false);
+ MusEGlobal::song->endUndo(SC_KEY);
// Select the item:
QTreeWidgetItem* newSelected = (QTreeWidgetItem*) getItemAtPos(newtick, LMASTER_KEYEVENT);
@@ -773,13 +778,13 @@ void LMaster::returnPressed()
//printf("adding sig %d %d\n", e->z(),e->n());
int tick = e->tick();
if (!editingNewItem) {
- song->startUndo();
- audio->msgRemoveSig(tick, e->z(), e->n(), false);
- audio->msgAddSig(tick, newSig.z, newSig.n, false);
- song->endUndo(SC_SIG);
+ MusEGlobal::song->startUndo();
+ MusEGlobal::audio->msgRemoveSig(tick, e->z(), e->n(), false);
+ MusEGlobal::audio->msgAddSig(tick, newSig.z, newSig.n, false);
+ MusEGlobal::song->endUndo(SC_SIG);
}
else
- audio->msgAddSig(tick, newSig.z, newSig.n, true);
+ MusEGlobal::audio->msgAddSig(tick, newSig.z, newSig.n, true);
}
else {
printf("Signature is not valid!\n");
@@ -791,21 +796,21 @@ void LMaster::returnPressed()
key_editor->hide();
repaint();
LMasterKeyEventItem* e = (LMasterKeyEventItem*) editedItem;
- const KeyEvent& t = e->getEvent();
+ const MusECore::KeyEvent& t = e->getEvent();
unsigned tick = t.tick;
- key_enum key = stringToKey(input);
+ MusECore::key_enum key = MusECore::stringToKey(input);
if (!editingNewItem) {
- song->startUndo();
- audio->msgRemoveKey(tick, e->key(), false);
- audio->msgAddKey(tick, key, false);
- song->endUndo(SC_KEY);
+ MusEGlobal::song->startUndo();
+ MusEGlobal::audio->msgRemoveKey(tick, e->key(), false);
+ MusEGlobal::audio->msgAddKey(tick, key, false);
+ MusEGlobal::song->endUndo(SC_KEY);
}
//
// New item edited:
//
else {
- audio->msgAddKey(tick, key, true);
+ MusEGlobal::audio->msgAddKey(tick, key, true);
}
}
updateList();
@@ -849,7 +854,7 @@ QString LMasterLViewItem::text(int column) const
// LMasterKeyEventItem
//! Initializes a LMasterKeyEventItem with a KeyEvent
//---------------------------------------------------------
-LMasterKeyEventItem::LMasterKeyEventItem(QTreeWidget* parent, const KeyEvent& ev)
+LMasterKeyEventItem::LMasterKeyEventItem(QTreeWidget* parent, const MusECore::KeyEvent& ev)
: LMasterLViewItem(parent)
{
keyEvent = ev;
@@ -859,7 +864,7 @@ LMasterKeyEventItem::LMasterKeyEventItem(QTreeWidget* parent, const KeyEvent& ev
AL::sigmap.tickValues(t, &bar, &beat, &tick);
c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
- double time = double(tempomap.tick2frame(t)) / double(MusEGlobal::sampleRate);
+ double time = double(MusEGlobal::tempomap.tick2frame(t)) / double(MusEGlobal::sampleRate);
int min = int(time) / 60;
int sec = int(time) % 60;
int msec = int((time - (min*60 + sec)) * 1000.0);
@@ -879,7 +884,7 @@ LMasterKeyEventItem::LMasterKeyEventItem(QTreeWidget* parent, const KeyEvent& ev
// LMasterTempoItem
//! Initializes a LMasterTempoItem with a TEvent
//---------------------------------------------------------
-LMasterTempoItem::LMasterTempoItem(QTreeWidget* parent, const TEvent* ev)
+LMasterTempoItem::LMasterTempoItem(QTreeWidget* parent, const MusECore::TEvent* ev)
: LMasterLViewItem(parent)
{
tempoEvent = ev;
@@ -890,7 +895,7 @@ LMasterTempoItem::LMasterTempoItem(QTreeWidget* parent, const TEvent* ev)
AL::sigmap.tickValues(t, &bar, &beat, &tick);
c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
- double time = double(tempomap.tick2frame(t) /*ev->frame*/) / double(MusEGlobal::sampleRate);
+ double time = double(MusEGlobal::tempomap.tick2frame(t) /*ev->frame*/) / double(MusEGlobal::sampleRate);
int min = int(time) / 60;
int sec = int(time) % 60;
int msec = int((time - (min*60 + sec)) * 1000.0);
@@ -918,7 +923,7 @@ LMasterSigEventItem::LMasterSigEventItem(QTreeWidget* parent, const AL::SigEvent
AL::sigmap.tickValues(t, &bar, &beat, &tick);
c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
- double time = double(tempomap.tick2frame(t)) / double (MusEGlobal::sampleRate);
+ double time = double(MusEGlobal::tempomap.tick2frame(t)) / double (MusEGlobal::sampleRate);
int min = int(time) / 60;
int sec = int(time) % 60;
int msec = int((time - (min*60 + sec)) * 1000.0);
@@ -944,8 +949,8 @@ void LMaster::tempoButtonClicked()
// p.mbt(&m, &b, &t);
// m++; //Next bar
// int newTick = AL::sigmap.bar2tick(m, b, t);
- int newTick = song->cpos();
- TEvent* ev = new TEvent(lastTempo->tempo(), newTick);
+ int newTick = MusEGlobal::song->cpos();
+ MusECore::TEvent* ev = new MusECore::TEvent(lastTempo->tempo(), newTick);
new LMasterTempoItem(view, ev);
QTreeWidgetItem* newTempoItem = view->topLevelItem(0);
//LMasterTempoItem* newTempoItem = new LMasterTempoItem(view, ev);
@@ -971,7 +976,7 @@ void LMaster::timeSigButtonClicked()
// p.mbt(&m, &b, &t);
// m++;
// int newTick = AL::sigmap.bar2tick(m, b, t);
- int newTick = song->cpos();
+ int newTick = MusEGlobal::song->cpos();
AL::SigEvent* ev = new AL::SigEvent(AL::TimeSignature(lastSig->z(), lastSig->n()), newTick);
new LMasterSigEventItem(view, ev);
QTreeWidgetItem* newSigItem = view->topLevelItem(0);
@@ -999,8 +1004,8 @@ void LMaster::insertKey()
//m++; //Next bar
//int newTick = AL::sigmap.bar2tick(m, b, t);
- int newTick = song->cpos();
- new LMasterKeyEventItem(view, KeyEvent(lastKey->key(), newTick));
+ int newTick = MusEGlobal::song->cpos();
+ new LMasterKeyEventItem(view, MusECore::KeyEvent(lastKey->key(), newTick));
QTreeWidgetItem* newKeyItem = view->topLevelItem(0);
editingNewItem = true; // State
@@ -1078,3 +1083,5 @@ void LMaster::comboboxTimerSlot()
// }
// MidiEditor::keyPressEvent(ev);
//}
+
+} // namespace MusEGui
diff --git a/muse2/muse/master/lmaster.h b/muse2/muse/master/lmaster.h
index 66acff47..6bc90019 100644
--- a/muse2/muse/master/lmaster.h
+++ b/muse2/muse/master/lmaster.h
@@ -43,6 +43,8 @@ using Awl::SigEdit;
class QLineEdit;
class QComboBox;
+namespace MusEGui {
+
enum LMASTER_LVTYPE
{
LMASTER_TEMPO = 0,
@@ -74,12 +76,12 @@ class LMasterLViewItem : public QTreeWidgetItem {
class LMasterTempoItem : public LMasterLViewItem {
private:
- const TEvent* tempoEvent;
+ const MusECore::TEvent* tempoEvent;
public:
- LMasterTempoItem(QTreeWidget* parent, const TEvent* t);
+ LMasterTempoItem(QTreeWidget* parent, const MusECore::TEvent* t);
virtual LMASTER_LVTYPE getType() { return LMASTER_TEMPO; }
- const TEvent* getEvent() { return tempoEvent; }
+ const MusECore::TEvent* getEvent() { return tempoEvent; }
virtual unsigned tick() { return tempoEvent->tick; }
int tempo() { return tempoEvent->tempo; }
};
@@ -91,14 +93,14 @@ class LMasterTempoItem : public LMasterLViewItem {
class LMasterKeyEventItem : public LMasterLViewItem {
private:
- KeyEvent keyEvent;
+ MusECore::KeyEvent keyEvent;
public:
- LMasterKeyEventItem(QTreeWidget* parent, const KeyEvent& t);
+ LMasterKeyEventItem(QTreeWidget* parent, const MusECore::KeyEvent& t);
virtual LMASTER_LVTYPE getType() { return LMASTER_KEYEVENT; }
- const KeyEvent& getEvent() { return keyEvent; }
+ const MusECore::KeyEvent& getEvent() { return keyEvent; }
virtual unsigned tick() { return keyEvent.tick; }
- key_enum key() { return keyEvent.key; }
+ MusECore::key_enum key() { return keyEvent.key; }
};
//---------------------------------------------------------
// LMasterTempoItem
@@ -136,9 +138,9 @@ class LMaster : public MidiEditor {
virtual void closeEvent(QCloseEvent*);
void updateList();
- void insertTempo(const TEvent*);
+ void insertTempo(const MusECore::TEvent*);
void insertSig(const AL::SigEvent*);
- void insertKey(const KeyEvent&);
+ void insertKey(const MusECore::KeyEvent&);
LMasterLViewItem* getItemAtPos(unsigned tick, LMASTER_LVTYPE t);
void initShortcuts();
QLineEdit* tempo_editor;
@@ -171,19 +173,20 @@ class LMaster : public MidiEditor {
void configChanged();
signals:
- void deleted(TopWin*);
+ void deleted(MusEGui::TopWin*);
void seekTo(int tick);
public:
LMaster();
~LMaster();
- virtual void readStatus(Xml&);
- virtual void writeStatus(int, Xml&) const;
- static void readConfiguration(Xml&);
- static void writeConfiguration(int, Xml&);
+ virtual void readStatus(MusECore::Xml&);
+ virtual void writeStatus(int, MusECore::Xml&) const;
+ static void readConfiguration(MusECore::Xml&);
+ static void writeConfiguration(int, MusECore::Xml&);
LMasterLViewItem* getLastOfType(LMASTER_LVTYPE t);
};
+} // namespace MusEGui
#endif
diff --git a/muse2/muse/master/master.cpp b/muse2/muse/master/master.cpp
index e9212be9..50c3f518 100644
--- a/muse2/muse/master/master.cpp
+++ b/muse2/muse/master/master.cpp
@@ -37,6 +37,8 @@
#include "icons.h"
#include "audio.h"
+namespace MusEGui {
+
//---------------------------------------------------------
// Master
//---------------------------------------------------------
@@ -52,8 +54,8 @@ Master::Master(MidiEditor* e, QWidget* parent, int xmag, int ymag)
pos[2] = 0;
setFocusPolicy(Qt::StrongFocus); // Tim.
setMouseTracking(true);
- connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool)));
- connect(song, SIGNAL(songChanged(int)), this, SLOT(redraw()));
+ connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool)));
+ connect(MusEGlobal::song, SIGNAL(songChanged(int)), this, SLOT(redraw()));
}
//---------------------------------------------------------
@@ -69,10 +71,10 @@ void Master::setPos(int idx, unsigned val, bool adjustScrollbar)
int npos = mapx(val);
if (adjustScrollbar && idx == 0) {
- switch (song->follow()) {
- case Song::NO:
+ switch (MusEGlobal::song->follow()) {
+ case MusECore::Song::NO:
break;
- case Song::JUMP:
+ case MusECore::Song::JUMP:
if (npos >= width()) {
int ppos = val - rmapxDev(width()/8);
if (ppos < 0)
@@ -90,7 +92,7 @@ void Master::setPos(int idx, unsigned val, bool adjustScrollbar)
npos = mapx(val);
}
break;
- case Song::CONTINUOUS:
+ case MusECore::Song::CONTINUOUS:
if (npos > (width()/2)) {
int ppos = pos[idx] - rmapxDev(width()/2);
if (ppos < 0)
@@ -154,9 +156,9 @@ void Master::pdraw(QPainter& p, const QRect& rect)
// draw Canvas Items
//---------------------------------------------------
- const TempoList* tl = &tempomap;
- for (ciTEvent i = tl->begin(); i != tl->end(); ++i) {
- TEvent* e = i->second;
+ const MusECore::TempoList* tl = &MusEGlobal::tempomap;
+ for (MusECore::ciTEvent i = tl->begin(); i != tl->end(); ++i) {
+ MusECore::TEvent* e = i->second;
int etick = mapx(i->first);
int stick = mapx(i->second->tick);
int tempo = mapy(280000 - int(60000000000.0/(e->tempo)));
@@ -206,23 +208,23 @@ void Master::draw(QPainter& p, const QRect& rect)
void Master::viewMousePressEvent(QMouseEvent* event)
{
start = event->pos();
- MusEWidget::Tool activeTool = tool;
+ MusEGui::Tool activeTool = tool;
// bool shift = event->state() & ShiftButton;
switch (activeTool) {
- case MusEWidget::PointerTool:
+ case MusEGui::PointerTool:
drag = DRAG_LASSO_START;
break;
- case MusEWidget::PencilTool:
+ case MusEGui::PencilTool:
drag = DRAG_NEW;
- song->startUndo();
+ MusEGlobal::song->startUndo();
newVal(start.x(), start.x(), start.y());
break;
- case MusEWidget::RubberTool:
+ case MusEGui::RubberTool:
drag = DRAG_DELETE;
- song->startUndo();
+ MusEGlobal::song->startUndo();
deleteVal(start.x(), start.x());
break;
@@ -272,7 +274,7 @@ void Master::viewMouseReleaseEvent(QMouseEvent*)
case DRAG_RESIZE:
case DRAG_NEW:
case DRAG_DELETE:
- song->endUndo(SC_TEMPO);
+ MusEGlobal::song->endUndo(SC_TEMPO);
break;
default:
break;
@@ -288,17 +290,17 @@ bool Master::deleteVal1(unsigned int x1, unsigned int x2)
{
bool songChanged = false;
- TempoList* tl = &tempomap;
- for (iTEvent i = tl->begin(); i != tl->end(); ++i) {
+ MusECore::TempoList* tl = &MusEGlobal::tempomap;
+ for (MusECore::iTEvent i = tl->begin(); i != tl->end(); ++i) {
if (i->first < x1)
continue;
if (i->first >= x2)
break;
- iTEvent ii = i;
+ MusECore::iTEvent ii = i;
++ii;
if (ii != tl->end()) {
int tempo = ii->second->tempo;
- audio->msgDeleteTempo(i->first, tempo, false);
+ MusEGlobal::audio->msgDeleteTempo(i->first, tempo, false);
songChanged = true;
}
}
@@ -317,11 +319,11 @@ void Master::deleteVal(int x1, int x2)
void Master::setTool(int t)
{
- if (tool == MusEWidget::Tool(t))
+ if (tool == MusEGui::Tool(t))
return;
- tool = MusEWidget::Tool(t);
+ tool = MusEGui::Tool(t);
switch(tool) {
- case MusEWidget::PencilTool:
+ case MusEGui::PencilTool:
setCursor(QCursor(*pencilIcon, 4, 15));
break;
default:
@@ -345,6 +347,8 @@ void Master::newVal(int x1, int x2, int y)
xx1 = tmp;
}
deleteVal1(xx1, xx2);
- audio->msgAddTempo(xx1, int(60000000000.0/(280000 - y)), false);
+ MusEGlobal::audio->msgAddTempo(xx1, int(60000000000.0/(280000 - y)), false);
redraw();
}
+
+} // namespace MusEGui
diff --git a/muse2/muse/master/master.h b/muse2/muse/master/master.h
index 4f181755..098df9f0 100644
--- a/muse2/muse/master/master.h
+++ b/muse2/muse/master/master.h
@@ -33,6 +33,8 @@ class QPoint;
class QRect;
class QToolBar;
+namespace MusEGui {
+
class MidiEditor;
class ScrollScale;
@@ -40,7 +42,7 @@ class ScrollScale;
// Master
//---------------------------------------------------------
-class Master : public MusEWidget::View {
+class Master : public MusEGui::View {
Q_OBJECT
enum DragMode { DRAG_OFF, DRAG_NEW, DRAG_MOVE_START, DRAG_MOVE,
DRAG_DELETE, DRAG_COPY_START, DRAG_COPY,
@@ -49,7 +51,7 @@ class Master : public MusEWidget::View {
ScrollScale* vscroll;
unsigned pos[3];
QPoint start;
- MusEWidget::Tool tool;
+ MusEGui::Tool tool;
DragMode drag;
MidiEditor* editor;
@@ -80,5 +82,7 @@ class Master : public MusEWidget::View {
Master(MidiEditor*, QWidget* parent, int xmag, int ymag);
};
+} // namespace MusEGui
+
#endif
diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp
index c3fde313..e9d669e1 100644
--- a/muse2/muse/master/masteredit.cpp
+++ b/muse2/muse/master/masteredit.cpp
@@ -49,6 +49,8 @@
#include <QMenuBar>
#include <QMenu>
+namespace MusEGui {
+
int MasterEdit::_rasterInit = 0;
//---------------------------------------------------------
@@ -68,7 +70,7 @@ void MasterEdit::closeEvent(QCloseEvent* e)
void MasterEdit::songChanged(int type)
{
if (type & SC_TEMPO) {
- int tempo = tempomap.tempo(song->cpos());
+ int tempo = MusEGlobal::tempomap.tempo(MusEGlobal::song->cpos());
curTempo->blockSignals(true);
curTempo->setValue(double(60000000.0/tempo));
@@ -76,7 +78,7 @@ void MasterEdit::songChanged(int type)
}
if (type & SC_SIG) {
int z, n;
- AL::sigmap.timesig(song->cpos(), z, n);
+ AL::sigmap.timesig(MusEGlobal::song->cpos(), z, n);
curSig->blockSignals(true);
curSig->setValue(AL::TimeSignature(z, n));
curSig->blockSignals(false);
@@ -84,7 +86,7 @@ void MasterEdit::songChanged(int type)
}
if (type & SC_MASTER) {
enableButton->blockSignals(true);
- enableButton->setChecked(song->masterFlag());
+ enableButton->setChecked(MusEGlobal::song->masterFlag());
enableButton->blockSignals(false);
}
}
@@ -122,7 +124,7 @@ MasterEdit::MasterEdit()
transport_toolbar->setObjectName("transport");
transport_toolbar->addActions(MusEGlobal::transportAction->actions());
- MusEWidget::EditToolBar* tools2 = new MusEWidget::EditToolBar(this, MusEWidget::PointerTool | MusEWidget::PencilTool | MusEWidget::RubberTool);
+ MusEGui::EditToolBar* tools2 = new MusEGui::EditToolBar(this, MusEGui::PointerTool | MusEGui::PencilTool | MusEGui::RubberTool);
addToolBar(tools2);
QToolBar* enableMaster = addToolBar(tr("Enable master"));
@@ -131,9 +133,9 @@ MasterEdit::MasterEdit()
enableButton->setCheckable(true);
enableButton->setText(tr("Enable"));
enableButton->setToolTip(tr("Enable usage of master track"));
- enableButton->setChecked(song->masterFlag());
+ enableButton->setChecked(MusEGlobal::song->masterFlag());
enableMaster->addWidget(enableButton);
- connect(enableButton, SIGNAL(toggled(bool)), song, SLOT(setMasterFlag(bool)));
+ connect(enableButton, SIGNAL(toggled(bool)), MusEGlobal::song, SLOT(setMasterFlag(bool)));
QToolBar* info = addToolBar(tr("Info"));
info->setObjectName("Info");
@@ -142,11 +144,11 @@ MasterEdit::MasterEdit()
label->setIndent(3);
info->addWidget(label);
- cursorPos = new MusEWidget::PosLabel(0);
+ cursorPos = new MusEGui::PosLabel(0);
cursorPos->setFixedHeight(22);
cursorPos->setToolTip(tr("time at cursor position"));
info->addWidget(cursorPos);
- tempo = new MusEWidget::TempoLabel(0);
+ tempo = new MusEGui::TempoLabel(0);
tempo->setFixedHeight(22);
tempo->setToolTip(tr("tempo at cursor position"));
info->addWidget(tempo);
@@ -154,7 +156,7 @@ MasterEdit::MasterEdit()
const char* rastval[] = {
QT_TRANSLATE_NOOP("@default", "Off"), "Bar", "1/2", "1/4", "1/8", "1/16"
};
- rasterLabel = new MusEWidget::LabelCombo(tr("Snap"), 0);
+ rasterLabel = new MusEGui::LabelCombo(tr("Snap"), 0);
rasterLabel->setFocusPolicy(Qt::NoFocus);
for (int i = 0; i < 6; i++)
rasterLabel->insertItem(i, tr(rastval[i]));
@@ -164,7 +166,7 @@ MasterEdit::MasterEdit()
//---------values for current position---------------
info->addWidget(new QLabel(tr("CurPos ")));
- curTempo = new MusEWidget::TempoEdit(0);
+ curTempo = new MusEGui::TempoEdit(0);
curSig = new SigEdit(0);
curSig->setValue(AL::TimeSignature(4, 4));
curTempo->setToolTip(tr("tempo at current position"));
@@ -172,10 +174,10 @@ MasterEdit::MasterEdit()
info->addWidget(curTempo);
info->addWidget(curSig);
///connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int)));
- connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), song, SLOT(setSig(const AL::TimeSignature&)));
+ connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), MusEGlobal::song, SLOT(setSig(const AL::TimeSignature&)));
///connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double)));
- connect(curTempo, SIGNAL(tempoChanged(double)), song, SLOT(setTempo(double)));
+ connect(curTempo, SIGNAL(tempoChanged(double)), MusEGlobal::song, SLOT(setTempo(double)));
//---------------------------------------------------
// master
@@ -183,17 +185,17 @@ MasterEdit::MasterEdit()
int xscale = -20;
int yscale = -500;
- hscroll = new MusEWidget::ScrollScale(-100, -2, xscale, song->len(), Qt::Horizontal, mainw);
- vscroll = new MusEWidget::ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw);
+ hscroll = new MusEGui::ScrollScale(-100, -2, xscale, MusEGlobal::song->len(), Qt::Horizontal, mainw);
+ vscroll = new MusEGui::ScrollScale(-1000, -100, yscale, 120000, Qt::Vertical, mainw);
vscroll->setRange(30000, 250000);
- time1 = new MusEWidget::MTScale(&_raster, mainw, xscale);
- sign = new MusEWidget::SigScale(&_raster, mainw, xscale);
-// thits = new MusEWidget::HitScale(&_raster, mainw, xscale);
+ time1 = new MusEGui::MTScale(&_raster, mainw, xscale);
+ sign = new MusEGui::SigScale(&_raster, mainw, xscale);
+// thits = new MusEGui::HitScale(&_raster, mainw, xscale);
canvas = new Master(this, mainw, xscale, yscale);
-// zhits = new MusEWidget::HitScale(&_raster, mainw, xscale);
- time2 = new MusEWidget::MTScale(&_raster, mainw, xscale);
+// zhits = new MusEGui::HitScale(&_raster, mainw, xscale);
+ time2 = new MusEGui::MTScale(&_raster, mainw, xscale);
tscale = new TScale(mainw, yscale);
time2->setBarLocator(true);
@@ -206,18 +208,18 @@ MasterEdit::MasterEdit()
mainGrid->setRowStretch(5, 100);
mainGrid->setColumnStretch(1, 100);
- mainGrid->addWidget(MusEUtil::hLine(mainw), 0, 1);
+ mainGrid->addWidget(MusECore::hLine(mainw), 0, 1);
mainGrid->addWidget(time1, 1, 1);
- mainGrid->addWidget(MusEUtil::hLine(mainw), 2, 1);
+ mainGrid->addWidget(MusECore::hLine(mainw), 2, 1);
mainGrid->addWidget(sign, 3, 1);
- mainGrid->addWidget(MusEUtil::hLine(mainw), 4, 1);
+ mainGrid->addWidget(MusECore::hLine(mainw), 4, 1);
// mainGrid->addWidget(thits, 5, 1);
-// mainGrid->addWidget(MusEUtil::hLine(mainw), 6, 1);
+// mainGrid->addWidget(MusECore::hLine(mainw), 6, 1);
mainGrid->addWidget(canvas, 5, 1);
mainGrid->addWidget(tscale, 5, 0);
- mainGrid->addWidget(MusEUtil::hLine(mainw), 6, 1);
+ mainGrid->addWidget(MusECore::hLine(mainw), 6, 1);
// mainGrid->addWidget(zhits, 9, 1);
-// mainGrid->addWidget(MusEUtil::hLine(mainw), 7, 1);
+// mainGrid->addWidget(MusECore::hLine(mainw), 7, 1);
mainGrid->addWidget(time2, 7, 1);
mainGrid->addWidget(hscroll, 8, 1);
mainGrid->addWidget(vscroll, 0, 2, 10, 1);
@@ -255,8 +257,8 @@ MasterEdit::MasterEdit()
connect(tscale, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
connect(canvas, SIGNAL(tempoChanged(int)), SLOT(setTempo(int)));
- connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
- connect(song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(posChanged(int,unsigned,bool)));
+ connect(MusEGlobal::song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ connect(MusEGlobal::song, SIGNAL(posChanged(int,unsigned,bool)), SLOT(posChanged(int,unsigned,bool)));
connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
@@ -277,16 +279,16 @@ MasterEdit::~MasterEdit()
// readStatus
//---------------------------------------------------------
-void MasterEdit::readStatus(Xml& xml)
+void MasterEdit::readStatus(MusECore::Xml& xml)
{
for (;;) {
- Xml::Token token = xml.parse();
+ MusECore::Xml::Token token = xml.parse();
const QString& tag = xml.s1();
switch (token) {
- case Xml::Error:
- case Xml::End:
+ case MusECore::Xml::Error:
+ case MusECore::Xml::End:
return;
- case Xml::TagStart:
+ case MusECore::Xml::TagStart:
if (tag == "midieditor")
MidiEditor::readStatus(xml);
else if (tag == "ypos")
@@ -299,7 +301,7 @@ void MasterEdit::readStatus(Xml& xml)
else
xml.unknown("MasterEdit");
break;
- case Xml::TagEnd:
+ case MusECore::Xml::TagEnd:
if (tag == "master") {
// raster setzen
int item = 0;
@@ -325,7 +327,7 @@ void MasterEdit::readStatus(Xml& xml)
// writeStatus
//---------------------------------------------------------
-void MasterEdit::writeStatus(int level, Xml& xml) const
+void MasterEdit::writeStatus(int level, MusECore::Xml& xml) const
{
xml.tag(level++, "master");
xml.intTag(level, "ypos", vscroll->pos());
@@ -338,16 +340,16 @@ void MasterEdit::writeStatus(int level, Xml& xml) const
// readConfiguration
//---------------------------------------------------------
-void MasterEdit::readConfiguration(Xml& xml)
+void MasterEdit::readConfiguration(MusECore::Xml& xml)
{
for (;;) {
- Xml::Token token = xml.parse();
+ MusECore::Xml::Token token = xml.parse();
const QString& tag = xml.s1();
switch (token) {
- case Xml::Error:
- case Xml::End:
+ case MusECore::Xml::Error:
+ case MusECore::Xml::End:
return;
- case Xml::TagStart:
+ case MusECore::Xml::TagStart:
if (tag == "raster")
_rasterInit = xml.parseInt();
else if (tag == "topwin")
@@ -355,7 +357,7 @@ void MasterEdit::readConfiguration(Xml& xml)
else
xml.unknown("MasterEdit");
break;
- case Xml::TagEnd:
+ case MusECore::Xml::TagEnd:
if (tag == "masteredit")
return;
default:
@@ -368,7 +370,7 @@ void MasterEdit::readConfiguration(Xml& xml)
// writeConfiguration
//---------------------------------------------------------
-void MasterEdit::writeConfiguration(int level, Xml& xml)
+void MasterEdit::writeConfiguration(int level, MusECore::Xml& xml)
{
xml.tag(level++, "masteredit");
xml.intTag(level, "raster", _rasterInit);
@@ -397,7 +399,7 @@ void MasterEdit::posChanged(int idx, unsigned val, bool)
{
if (idx == 0) {
int z, n;
- int tempo = tempomap.tempo(val);
+ int tempo = MusEGlobal::tempomap.tempo(val);
AL::sigmap.timesig(val, z, n);
curTempo->blockSignals(true);
curSig->blockSignals(true);
@@ -440,4 +442,4 @@ void MasterEdit::setTempo(int val)
}
}
-
+} // namespace MusEGui
diff --git a/muse2/muse/master/masteredit.h b/muse2/muse/master/masteredit.h
index 4f188813..fdf8dd71 100644
--- a/muse2/muse/master/masteredit.h
+++ b/muse2/muse/master/masteredit.h
@@ -39,19 +39,17 @@ class QCloseEvent;
class QToolBar;
class QToolButton;
-class Master;
-class TScale;
-
-namespace MusEWidget {
+namespace MusEGui {
class HitScale;
class LabelCombo;
+class Master;
class MTScale;
class PosLabel;
class ScrollScale;
class SigScale;
class TempoEdit;
class TempoLabel;
-}
+class TScale;
//---------------------------------------------------------
// MasterEdit
@@ -61,21 +59,21 @@ class MasterEdit : public MidiEditor {
Q_OBJECT
Master* canvas;
- MusEWidget::ScrollScale* hscroll;
- MusEWidget::ScrollScale* vscroll;
- MusEWidget::MTScale* time1;
- MusEWidget::MTScale* time2;
- MusEWidget::SigScale* sign;
- MusEWidget::HitScale* thits;
- MusEWidget::HitScale* zhits;
+ MusEGui::ScrollScale* hscroll;
+ MusEGui::ScrollScale* vscroll;
+ MusEGui::MTScale* time1;
+ MusEGui::MTScale* time2;
+ MusEGui::SigScale* sign;
+ MusEGui::HitScale* thits;
+ MusEGui::HitScale* zhits;
TScale* tscale;
- MusEWidget::TempoEdit* curTempo;
+ MusEGui::TempoEdit* curTempo;
SigEdit* curSig;
- MusEWidget::LabelCombo* rasterLabel;
+ MusEGui::LabelCombo* rasterLabel;
QToolBar* tools;
- MusEWidget::PosLabel* cursorPos;
- MusEWidget::TempoLabel* tempo;
+ MusEGui::PosLabel* cursorPos;
+ MusEGui::TempoLabel* tempo;
QToolButton* enableButton;
static int _rasterInit;
@@ -93,16 +91,18 @@ class MasterEdit : public MidiEditor {
// void tempoChanged(double);
signals:
- void deleted(TopWin*);
+ void deleted(MusEGui::TopWin*);
public:
MasterEdit();
~MasterEdit();
- virtual void readStatus(Xml&);
- virtual void writeStatus(int, Xml&) const;
- static void readConfiguration(Xml&);
- static void writeConfiguration(int, Xml&);
+ virtual void readStatus(MusECore::Xml&);
+ virtual void writeStatus(int, MusECore::Xml&) const;
+ static void readConfiguration(MusECore::Xml&);
+ static void writeConfiguration(int, MusECore::Xml&);
};
+} // namespace MusEGui
+
#endif
diff --git a/muse2/muse/master/tscale.cpp b/muse2/muse/master/tscale.cpp
index e25c3454..23e7337b 100644
--- a/muse2/muse/master/tscale.cpp
+++ b/muse2/muse/master/tscale.cpp
@@ -28,6 +28,8 @@
#include <QMouseEvent>
#include <QPainter>
+namespace MusEGui {
+
//---------------------------------------------------------
// TScale
//---------------------------------------------------------
@@ -35,8 +37,8 @@
TScale::TScale(QWidget* parent, int ymag)
: View(parent, 1, ymag)
{
- setFont(MusEConfig::config.fonts[4]);
- //int w = 4 * QFontMetrics(MusEConfig::config.fonts[4]).width('0');
+ setFont(MusEGlobal::config.fonts[4]);
+ //int w = 4 * QFontMetrics(MusEGlobal::config.fonts[4]).width('0');
int w = 4 * fontMetrics().width('0');
setFixedWidth(w);
setMouseTracking(true);
@@ -50,7 +52,7 @@ void TScale::pdraw(QPainter& p, const QRect& r)
{
int y = r.y();
int h = r.height();
- //p.setFont(MusEConfig::config.fonts[4]);
+ //p.setFont(MusEGlobal::config.fonts[4]);
QString s;
for (int i = 30000; i <= 250000; i += 10000) {
int yy = mapy(280000 - i);
@@ -60,7 +62,7 @@ void TScale::pdraw(QPainter& p, const QRect& r)
continue;
p.drawLine(0, yy, width(), yy);
s.setNum(i/1000);
- //QFontMetrics fm(MusEConfig::config.fonts[4]);
+ //QFontMetrics fm(MusEGlobal::config.fonts[4]);
//p.drawText(width() - fm.width(s) - 1, yy-2, s);
p.drawText(width() - fontMetrics().width(s) - 1, yy-2, s); // Use the window font. Tim p4.0.31
}
@@ -76,3 +78,4 @@ void TScale::leaveEvent(QEvent*)
emit tempoChanged(-1);
}
+} // namespace MusEGui
diff --git a/muse2/muse/master/tscale.h b/muse2/muse/master/tscale.h
index 2c03839f..9f811c53 100644
--- a/muse2/muse/master/tscale.h
+++ b/muse2/muse/master/tscale.h
@@ -25,11 +25,13 @@
#include "view.h"
+namespace MusEGui {
+
//---------------------------------------------------------
// Tscale
//---------------------------------------------------------
-class TScale : public MusEWidget::View {
+class TScale : public View {
Q_OBJECT
double curTempo;
@@ -47,5 +49,7 @@ class TScale : public MusEWidget::View {
TScale(QWidget*, int);
};
+} // namespace MusEGui
+
#endif