summaryrefslogtreecommitdiff
path: root/muse2/muse/master
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2012-03-15 18:21:23 +0000
committerFlorian Jung <flo@windfisch.org>2012-03-15 18:21:23 +0000
commit27b7bf6815cda7abb67026c37b3e44daee1803cb (patch)
tree0b9d1c0bc84ac7ff8032e707f2b5fb4e0aaabb5c /muse2/muse/master
parent2d6f113a10eb485694e20a78500f650776d701e3 (diff)
merged with trunk
Diffstat (limited to 'muse2/muse/master')
-rw-r--r--muse2/muse/master/lmaster.cpp71
-rw-r--r--muse2/muse/master/lmaster.h4
-rw-r--r--muse2/muse/master/master.cpp2
-rw-r--r--muse2/muse/master/masteredit.cpp88
-rw-r--r--muse2/muse/master/masteredit.h4
-rw-r--r--muse2/muse/master/tscale.cpp4
6 files changed, 90 insertions, 83 deletions
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
index 91ffdf7e..1553e17f 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -29,8 +29,6 @@
#include "globals.h"
#include "app.h"
#include "audio.h"
-//#include "posedit.h"
-//#include "sigedit.h"
#include "shortcuts.h"
#include "debug.h"
@@ -157,8 +155,8 @@ LMaster::LMaster()
editingNewItem = false;
setWindowTitle(tr("MusE: Mastertrack"));
setMinimumHeight(100);
- setFixedWidth(400);
- setFocusPolicy(Qt::StrongFocus);
+ //setFixedWidth(400); // FIXME: Arbitrary. But without this, sig editor is too wide. Must fix sig editor width...
+ setFocusPolicy(Qt::NoFocus);
comboboxTimer=new QTimer(this);
@@ -208,6 +206,9 @@ LMaster::LMaster()
QToolButton* tempoButton = new QToolButton();
QToolButton* timeSigButton = new QToolButton();
QToolButton* keyButton = new QToolButton();
+ tempoButton->setFocusPolicy(Qt::NoFocus);
+ timeSigButton->setFocusPolicy(Qt::NoFocus);
+ keyButton->setFocusPolicy(Qt::NoFocus);
tempoButton->setText(tr("Tempo"));
timeSigButton->setText(tr("Timesig"));
keyButton->setText(tr("Key"));
@@ -218,10 +219,6 @@ LMaster::LMaster()
edit->addWidget(timeSigButton);
edit->addWidget(keyButton);
- ///Q3Accel* qa = new Q3Accel(this);
- ///qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Z), song, SLOT(undo()));
- ///qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Y), song, SLOT(redo()));
-
//---------------------------------------------------
// master
//---------------------------------------------------
@@ -242,25 +239,26 @@ LMaster::LMaster()
// Rest
//---------------------------------------------------
-// QSizeGrip* corner = new QSizeGrip(mainw);
-
mainGrid->setRowStretch(0, 100);
mainGrid->setColumnStretch(0, 100);
mainGrid->addWidget(view, 0, 0);
-// mainGrid->addWidget(corner, 1, 1, AlignBottom | AlignRight);
updateList();
tempo_editor = new QLineEdit(view->viewport());
+ tempo_editor->setFrame(false);
tempo_editor->hide();
connect(tempo_editor, SIGNAL(returnPressed()), SLOT(returnPressed()));
sig_editor = new SigEdit(view->viewport());
+ sig_editor->setFrame(false);
sig_editor->hide();
connect(sig_editor, SIGNAL(returnPressed()), SLOT(returnPressed()));
pos_editor = new Awl::PosEdit(view->viewport());
+ pos_editor->setFrame(false);
pos_editor->hide();
connect(pos_editor, SIGNAL(returnPressed()), SLOT(returnPressed()));
key_editor = new QComboBox(view->viewport());
+ key_editor->setFrame(false);
key_editor->addItems(MusECore::keyStrs);
key_editor->hide();
connect(key_editor, SIGNAL(activated(int)), SLOT(returnPressed()));
@@ -284,7 +282,6 @@ LMaster::LMaster()
LMaster::~LMaster()
{
- //undoRedo->removeFrom(tools); // p4.0.6 Removed
}
//---------------------------------------------------------
@@ -479,9 +476,9 @@ void LMaster::writeConfiguration(int level, MusECore::Xml& xml)
// select
//---------------------------------------------------------
+//DELETETHIS (whole function)? or is this todo?
void LMaster::select(QTreeWidgetItem* /*item*/, QTreeWidgetItem* /*previous_item*/)
{
-// printf("select %x\n", unsigned(item));
}
//---------------------------------------------------------
@@ -518,7 +515,6 @@ void LMaster::cmd(int cmd)
case LMASTER_KEYEVENT:
{
LMasterKeyEventItem* k = (LMasterKeyEventItem*) l;
- //keymap.delKey(l->tick());
MusEGlobal::audio->msgRemoveKey(k->tick(), k->key());
break;
}
@@ -553,7 +549,6 @@ void LMaster::cmd(int cmd)
*/
void LMaster::itemPressed(QTreeWidgetItem* i, int column)
{
- //printf("itemPressed, column: %d\n", column);
if (editedItem) {
if (editorColumn != column || editedItem != i)
returnPressed();
@@ -572,9 +567,10 @@ void LMaster::itemPressed(QTreeWidgetItem* i, int column)
//---------------------------------------------------------
void LMaster::itemDoubleClicked(QTreeWidgetItem* i)
{
- //printf("itemDoubleClicked\n");
emit seekTo(((LMasterLViewItem*) i)->tick());
+ QFontMetrics fm(font());
+ int fnt_w = fm.width('0');
if (!editedItem && editorColumn == LMASTER_VAL_COL) {
editedItem = (LMasterLViewItem*) i;
QRect itemRect = view->visualItemRect(editedItem);
@@ -583,7 +579,6 @@ void LMaster::itemDoubleClicked(QTreeWidgetItem* i)
itemRect.setX(x1);
//Qt makes crazy things with itemRect if this is called directly..
if (editingNewItem) {
- QFontMetrics fm(font());
int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0 , this); // ddskrjo 0
int h = fm.height() + fw * 2;
itemRect.setWidth(view->columnWidth(LMASTER_VAL_COL));
@@ -601,9 +596,11 @@ void LMaster::itemDoubleClicked(QTreeWidgetItem* i)
tempo_editor->selectAll();
}
else if (editedItem->getType() == LMASTER_SIGEVENT) { // Edit signatur value:
- //sig_editor->setValue(editedItem->text(LMASTER_VAL_COL));
sig_editor->setValue(((LMasterSigEventItem*)editedItem)->getEvent()->sig);
- sig_editor->setGeometry(itemRect);
+ int w = fnt_w * 14;
+ if(w > itemRect.width())
+ w = itemRect.width();
+ sig_editor->setGeometry(itemRect.x(), itemRect.y(), w, itemRect.height());
sig_editor->show();
sig_editor->setFocus();
}
@@ -631,8 +628,11 @@ void LMaster::itemDoubleClicked(QTreeWidgetItem* i)
else {
pos_editor->setValue(editedItem->tick());
QRect itemRect = view->visualItemRect(editedItem);
- itemRect.setX(0);
- itemRect.setWidth(view->columnWidth(LMASTER_BEAT_COL));
+ itemRect.setX(view->indentation());
+ int w = view->columnWidth(LMASTER_BEAT_COL) - view->indentation();
+ if(w < (fnt_w * 13))
+ w = fnt_w * 13;
+ itemRect.setWidth(w);
pos_editor->setGeometry(itemRect);
pos_editor->show();
pos_editor->setFocus();
@@ -724,7 +724,6 @@ void LMaster::returnPressed()
}
else
MusEGlobal::audio->msgAddSig(newtick, z, n, false);
- //MusEGlobal::audio->msgAddSig(newtick, z, n, true);
// Select the item:
QTreeWidgetItem* newSelected = (QTreeWidgetItem*) getItemAtPos(newtick, LMASTER_SIGEVENT);
@@ -761,7 +760,6 @@ void LMaster::returnPressed()
//
else if (editedItem->getType() == LMASTER_SIGEVENT && editorColumn == LMASTER_VAL_COL)
{
- ///Sig newSig = sig_editor->sig();
AL::TimeSignature newSig = sig_editor->sig();
sig_editor->hide();
@@ -770,7 +768,6 @@ void LMaster::returnPressed()
if(newSig.isValid())
{
LMasterSigEventItem* e = (LMasterSigEventItem*) editedItem;
- //printf("adding sig %d %d\n", e->z(),e->n());
int tick = e->tick();
if (!editingNewItem) {
MusEGlobal::song->startUndo();
@@ -865,7 +862,6 @@ LMasterKeyEventItem::LMasterKeyEventItem(QTreeWidget* parent, const MusECore::Ke
int msec = int((time - (min*60 + sec)) * 1000.0);
c2.sprintf("%03d:%02d:%03d", min, sec, msec);
c3 = "Key";
- //int dt = ev.key;
c4 = keyToString(ev.key);
setText(0, c1);
setText(1, c2);
@@ -884,13 +880,12 @@ LMasterTempoItem::LMasterTempoItem(QTreeWidget* parent, const MusECore::TEvent*
{
tempoEvent = ev;
unsigned t = ev->tick;
- //QString c1, c2, c3, c4;
int bar, beat;
unsigned tick;
AL::sigmap.tickValues(t, &bar, &beat, &tick);
c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
- double time = double(MusEGlobal::tempomap.tick2frame(t) /*ev->frame*/) / 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);
@@ -938,7 +933,7 @@ LMasterSigEventItem::LMasterSigEventItem(QTreeWidget* parent, const AL::SigEvent
void LMaster::tempoButtonClicked()
{
LMasterTempoItem* lastTempo = (LMasterTempoItem*) getLastOfType(LMASTER_TEMPO);
-// QString beatString = ((LMasterLViewItem*)lastTempo)->text(LMASTER_BEAT_COL);
+// QString beatString = ((LMasterLViewItem*)lastTempo)->text(LMASTER_BEAT_COL); DELETETHIS?
// int m, b, t;
// Pos p = Pos(beatString);
// p.mbt(&m, &b, &t);
@@ -948,7 +943,6 @@ void LMaster::tempoButtonClicked()
MusECore::TEvent* ev = new MusECore::TEvent(lastTempo->tempo(), newTick);
new LMasterTempoItem(view, ev);
QTreeWidgetItem* newTempoItem = view->topLevelItem(0);
- //LMasterTempoItem* newTempoItem = new LMasterTempoItem(view, ev);
editingNewItem = true; // State
editorColumn = LMASTER_VAL_COL; // Set that we edit editorColumn
@@ -965,7 +959,7 @@ void LMaster::tempoButtonClicked()
void LMaster::timeSigButtonClicked()
{
LMasterSigEventItem* lastSig = (LMasterSigEventItem*) getLastOfType(LMASTER_SIGEVENT);
-// QString beatString = ((LMasterLViewItem*)lastSig)->text(LMASTER_BEAT_COL);
+// QString beatString = ((LMasterLViewItem*)lastSig)->text(LMASTER_BEAT_COL); DELETETHIS
// int m, b, t;
// Pos p = Pos(beatString);
// p.mbt(&m, &b, &t);
@@ -975,7 +969,6 @@ void LMaster::timeSigButtonClicked()
AL::SigEvent* ev = new AL::SigEvent(AL::TimeSignature(lastSig->z(), lastSig->n()), newTick);
new LMasterSigEventItem(view, ev);
QTreeWidgetItem* newSigItem = view->topLevelItem(0);
- //LMasterSigEventItem* newSigItem = new LMasterSigEventItem(view, ev);
editingNewItem = true; // State
editorColumn = LMASTER_VAL_COL; // Set that we edit editorColumn
@@ -992,13 +985,12 @@ void LMaster::insertKey()
{
LMasterKeyEventItem* lastKey = (LMasterKeyEventItem*) getLastOfType(LMASTER_KEYEVENT);
- //QString beatString = ((LMasterLViewItem*)lastKey)->text(LMASTER_BEAT_COL);
+ //QString beatString = ((LMasterLViewItem*)lastKey)->text(LMASTER_BEAT_COL); DELETETHIS
//int m, b, t;
//Pos p = Pos(beatString);
//p.mbt(&m, &b, &t);
//m++; //Next bar
- //int newTick = AL::sigmap.bar2tick(m, b, t);
int newTick = MusEGlobal::song->cpos();
new LMasterKeyEventItem(view, MusECore::KeyEvent(lastKey->key(), newTick));
QTreeWidgetItem* newKeyItem = view->topLevelItem(0);
@@ -1066,17 +1058,4 @@ void LMaster::comboboxTimerSlot()
key_editor->showPopup();
}
-//void LMaster::keyPressEvent(QKeyEvent*ev)
-//{
-// switch (ev->key()) {
-// case Qt::Key_Return:
-// // add return as a valid action for editing values too
-// cmd (CMD_EDIT_VALUE);
-// break;
-// default:
-// break;
-// }
-// MidiEditor::keyPressEvent(ev);
-//}
-
} // namespace MusEGui
diff --git a/muse2/muse/master/lmaster.h b/muse2/muse/master/lmaster.h
index 33b40f30..367eff77 100644
--- a/muse2/muse/master/lmaster.h
+++ b/muse2/muse/master/lmaster.h
@@ -28,7 +28,6 @@
#include "cobject.h"
#include "tempo.h"
#include "keyevent.h"
-///#include "sig.h"
#include "al/sig.h"
#include <QTreeWidgetItem>
@@ -154,9 +153,6 @@ class LMaster : public MidiEditor {
QAction *tempoAction, *signAction, *posAction, *valAction, *delAction, *keyAction;
-// protected:
-// virtual void keyPressEvent(QKeyEvent*);
-
private slots:
void select(QTreeWidgetItem*, QTreeWidgetItem*);
void itemDoubleClicked(QTreeWidgetItem* item);
diff --git a/muse2/muse/master/master.cpp b/muse2/muse/master/master.cpp
index 02bef8a1..239467ee 100644
--- a/muse2/muse/master/master.cpp
+++ b/muse2/muse/master/master.cpp
@@ -245,7 +245,7 @@ void Master::viewMouseMoveEvent(QMouseEvent* event)
{
QPoint pos = event->pos();
// QPoint dist = pos - start;
-// bool moving = dist.y() >= 3 || dist.y() <= 3 || dist.x() >= 3 || dist.x() <= 3;
+// bool moving = dist.y() >= 3 || dist.y() <= 3 || dist.x() >= 3 || dist.x() <= 3; DELETETHIS
switch (drag) {
case DRAG_NEW:
diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp
index 571d3c83..82ac697b 100644
--- a/muse2/muse/master/masteredit.cpp
+++ b/muse2/muse/master/masteredit.cpp
@@ -35,9 +35,10 @@
#include "xml.h"
#include "lcombo.h"
#include "doublelabel.h"
-///#include "sigedit.h"
#include "globals.h"
#include "app.h"
+#include "gconfig.h"
+#include "audio.h"
#include <values.h>
@@ -76,7 +77,7 @@ void MasterEdit::songChanged(int type)
return;
if (type & SC_TEMPO) {
- int tempo = MusEGlobal::tempomap.tempo(MusEGlobal::song->cpos());
+ int tempo = MusEGlobal::tempomap.tempoAt(MusEGlobal::song->cpos()); // Bypass the useList flag and read from the list.
curTempo->blockSignals(true);
curTempo->setValue(double(60000000.0/tempo));
@@ -105,12 +106,10 @@ MasterEdit::MasterEdit()
: MidiEditor(TopWin::MASTER, _rasterInit, 0)
{
setWindowTitle(tr("MusE: Mastertrack"));
+ setFocusPolicy(Qt::NoFocus);
_raster = 0; // measure
//---------Pulldown Menu----------------------------
-// QPopupMenu* file = new QPopupMenu(this);
-// menuBar()->insertItem("&File", file);
-
QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config"));
settingsMenu->addAction(subwinAction);
settingsMenu->addAction(shareAction);
@@ -123,6 +122,7 @@ MasterEdit::MasterEdit()
QToolBar* enableMaster = addToolBar(tr("Enable master"));
enableMaster->setObjectName("Enable master");
enableButton = new QToolButton();
+ enableButton->setFocusPolicy(Qt::NoFocus);
enableButton->setCheckable(true);
enableButton->setText(tr("Enable"));
enableButton->setToolTip(tr("Enable usage of master track"));
@@ -150,7 +150,7 @@ MasterEdit::MasterEdit()
QT_TRANSLATE_NOOP("MusEGui::MasterEdit", "Off"), QT_TRANSLATE_NOOP("MusEGui::MasterEdit", "Bar"), "1/2", "1/4", "1/8", "1/16"
};
rasterLabel = new MusEGui::LabelCombo(tr("Snap"), 0);
- rasterLabel->setFocusPolicy(Qt::NoFocus);
+ rasterLabel->setFocusPolicy(Qt::TabFocus);
for (int i = 0; i < 6; i++)
rasterLabel->insertItem(i, tr(rastval[i]));
rasterLabel->setCurrentIndex(1);
@@ -160,17 +160,16 @@ MasterEdit::MasterEdit()
//---------values for current position---------------
info->addWidget(new QLabel(tr("CurPos ")));
curTempo = new MusEGui::TempoEdit(0);
- curSig = new SigEdit(0);
+ curSig = new SigEdit(0); // SigEdit is already StrongFocus.
+ curTempo->setFocusPolicy(Qt::StrongFocus);
curSig->setValue(AL::TimeSignature(4, 4));
curTempo->setToolTip(tr("tempo at current position"));
curSig->setToolTip(tr("time signature at current position"));
info->addWidget(curTempo);
info->addWidget(curSig);
- ///connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int)));
- 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)), MusEGlobal::song, SLOT(setTempo(double)));
+
+ connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), SLOT(sigChange(const AL::TimeSignature&)));
+ connect(curTempo, SIGNAL(tempoChanged(double)), SLOT(tempoChange(double)));
//---------------------------------------------------
// master
@@ -183,7 +182,7 @@ MasterEdit::MasterEdit()
vscroll->setRange(30000, 250000);
time1 = new MusEGui::MTScale(&_raster, mainw, xscale);
sign = new MusEGui::SigScale(&_raster, mainw, xscale);
-// thits = new MusEGui::HitScale(&_raster, mainw, xscale);
+// thits = new MusEGui::HitScale(&_raster, mainw, xscale); DELETETHIS what IS this? delete zhits as well
canvas = new Master(this, mainw, xscale, yscale);
@@ -196,8 +195,6 @@ MasterEdit::MasterEdit()
// Rest
//---------------------------------------------------
-// QSizeGrip* corner = new QSizeGrip(mainw);
-
mainGrid->setRowStretch(5, 100);
mainGrid->setColumnStretch(1, 100);
@@ -206,19 +203,18 @@ MasterEdit::MasterEdit()
mainGrid->addWidget(MusECore::hLine(mainw), 2, 1);
mainGrid->addWidget(sign, 3, 1);
mainGrid->addWidget(MusECore::hLine(mainw), 4, 1);
-// mainGrid->addWidget(thits, 5, 1);
+// mainGrid->addWidget(thits, 5, 1); DELETETHIS
// mainGrid->addWidget(MusECore::hLine(mainw), 6, 1);
mainGrid->addWidget(canvas, 5, 1);
mainGrid->addWidget(tscale, 5, 0);
mainGrid->addWidget(MusECore::hLine(mainw), 6, 1);
-// mainGrid->addWidget(zhits, 9, 1);
+// mainGrid->addWidget(zhits, 9, 1); DELETETHIS
// mainGrid->addWidget(MusECore::hLine(mainw), 7, 1);
mainGrid->addWidget(time2, 7, 1);
mainGrid->addWidget(hscroll, 8, 1);
mainGrid->addWidget(vscroll, 0, 2, 10, 1);
-// mainGrid->addWidget(corner, 9, 2, AlignBottom | AlignRight);
- canvas->setFocus(); // Tim.
+ canvas->setFocus();
connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int)));
connect(vscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setYPos(int)));
@@ -229,20 +225,20 @@ MasterEdit::MasterEdit()
connect(hscroll, SIGNAL(scrollChanged(int)), time1, SLOT(setXPos(int)));
connect(hscroll, SIGNAL(scrollChanged(int)), sign, SLOT(setXPos(int)));
-// connect(hscroll, SIGNAL(scrollChanged(int)), thits, SLOT(setXPos(int)));
+// connect(hscroll, SIGNAL(scrollChanged(int)), thits, SLOT(setXPos(int))); DELETETHIS
connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
-// connect(hscroll, SIGNAL(scrollChanged(int)), zhits, SLOT(setXPos(int)));
+// connect(hscroll, SIGNAL(scrollChanged(int)), zhits, SLOT(setXPos(int)));DELETETHIS
connect(hscroll, SIGNAL(scrollChanged(int)), time2, SLOT(setXPos(int)));
connect(hscroll, SIGNAL(scaleChanged(int)), time1, SLOT(setXMag(int)));
connect(hscroll, SIGNAL(scaleChanged(int)), sign, SLOT(setXMag(int)));
-// connect(hscroll, SIGNAL(scaleChanged(int)), thits, SLOT(setXMag(int)));
+// connect(hscroll, SIGNAL(scaleChanged(int)), thits, SLOT(setXMag(int)));DELETETHIS
connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int)));
-// connect(hscroll, SIGNAL(scaleChanged(int)), zhits, SLOT(setXMag(int)));
+// connect(hscroll, SIGNAL(scaleChanged(int)), zhits, SLOT(setXMag(int))); DELETETHIS
connect(hscroll, SIGNAL(scaleChanged(int)), time2, SLOT(setXMag(int)));
connect(time1, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
-// connect(sign, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
+// connect(sign, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned))); DELETETHIS
// connect(thits, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
// connect(canvas, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
// connect(zhits, SIGNAL(timeChanged(unsigned)), pos, SLOT(setValue(unsigned)));
@@ -256,6 +252,14 @@ MasterEdit::MasterEdit()
connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned)));
+ if(MusEGlobal::config.smartFocus)
+ {
+ connect(curSig, SIGNAL(returnPressed()), SLOT(focusCanvas()));
+ connect(curSig, SIGNAL(escapePressed()), SLOT(focusCanvas()));
+ connect(curTempo, SIGNAL(returnPressed()), SLOT(focusCanvas()));
+ connect(curTempo, SIGNAL(escapePressed()), SLOT(focusCanvas()));
+ }
+
initTopwinState();
MusEGlobal::muse->topwinMenuInited(this);
}
@@ -266,7 +270,6 @@ MasterEdit::MasterEdit()
MasterEdit::~MasterEdit()
{
- //undoRedo->removeFrom(tools); // p4.0.6 Removed
}
//---------------------------------------------------------
@@ -297,7 +300,7 @@ void MasterEdit::readStatus(MusECore::Xml& xml)
break;
case MusECore::Xml::TagEnd:
if (tag == "master") {
- // raster setzen
+ // set raster
int item = 0;
switch(_raster) {
case 1: item = 0; break;
@@ -373,6 +376,16 @@ void MasterEdit::writeConfiguration(int level, MusECore::Xml& xml)
}
//---------------------------------------------------------
+// focusCanvas
+//---------------------------------------------------------
+
+void MasterEdit::focusCanvas()
+{
+ canvas->setFocus();
+ canvas->activateWindow();
+}
+
+//---------------------------------------------------------
// _setRaster
//---------------------------------------------------------
@@ -383,6 +396,8 @@ void MasterEdit::_setRaster(int index)
};
_raster = rasterTable[index];
_rasterInit = _raster;
+ if(MusEGlobal::config.smartFocus)
+ focusCanvas();
}
//---------------------------------------------------------
@@ -393,7 +408,7 @@ void MasterEdit::posChanged(int idx, unsigned val, bool)
{
if (idx == 0) {
int z, n;
- int tempo = MusEGlobal::tempomap.tempo(val);
+ int tempo = MusEGlobal::tempomap.tempoAt(val); // Bypass the useList flag and read from the list.
AL::sigmap.timesig(val, z, n);
curTempo->blockSignals(true);
curSig->blockSignals(true);
@@ -435,5 +450,24 @@ void MasterEdit::setTempo(int val)
tempo->setValue(val);
}
}
+
+void MasterEdit::sigChange(const AL::TimeSignature& sig)
+{
+ // TODO: FIXME: Tempo/sig undo + redo broken here. Either fix tempo and sig, or finish something here...
+ MusEGlobal::audio->msgAddSig(MusEGlobal::song->cPos().tick(), sig.z, sig.n); // Add will replace if found.
+}
+
+void MasterEdit::tempoChange(double t)
+{
+ if(int(t) == 0)
+ return;
+
+ // TODO: FIXME: Tempo/sig undo + redo broken here. Either fix tempo and sig, or finish something here... Also in transport.
+ //MusEGlobal::song->startUndo();
+ //iTEvent e = find(tick);
+ //MusEGlobal::audio->msgDeleteTempo(it->first, it->second, false);
+ MusEGlobal::audio->msgAddTempo(MusEGlobal::song->cPos().tick(), int(60000000.0/t), true); // Add will replace if found.
+ //MusEGlobal::song->endUndo(SC_TEMPO);
+}
} // namespace MusEGui
diff --git a/muse2/muse/master/masteredit.h b/muse2/muse/master/masteredit.h
index 835ca879..faff69e2 100644
--- a/muse2/muse/master/masteredit.h
+++ b/muse2/muse/master/masteredit.h
@@ -85,10 +85,12 @@ class MasterEdit : public MidiEditor {
void posChanged(int,unsigned,bool);
void setTime(unsigned);
void setTempo(int);
+ void sigChange(const AL::TimeSignature&);
+ void tempoChange(double);
+ void focusCanvas();
public slots:
void songChanged(int);
-// void tempoChanged(double);
signals:
void isDeleting(MusEGui::TopWin*);
diff --git a/muse2/muse/master/tscale.cpp b/muse2/muse/master/tscale.cpp
index 57bb898d..2dbc9eac 100644
--- a/muse2/muse/master/tscale.cpp
+++ b/muse2/muse/master/tscale.cpp
@@ -38,7 +38,6 @@ TScale::TScale(QWidget* parent, int ymag)
: View(parent, 1, ymag)
{
setFont(MusEGlobal::config.fonts[5]);
- //int w = 4 * QFontMetrics(MusEGlobal::config.fonts[4]).width('0');
int w = 4 * fontMetrics().width('0');
setFixedWidth(w);
setMouseTracking(true);
@@ -52,7 +51,6 @@ void TScale::pdraw(QPainter& p, const QRect& r)
{
int y = r.y();
int h = r.height();
- //p.setFont(MusEGlobal::config.fonts[4]);
QString s;
for (int i = 30000; i <= 250000; i += 10000) {
int yy = mapy(280000 - i);
@@ -62,8 +60,6 @@ void TScale::pdraw(QPainter& p, const QRect& r)
continue;
p.drawLine(0, yy, width(), yy);
s.setNum(i/1000);
- //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
}
}