From: werner s. <wsc...@us...> - 2005-10-11 18:32:06
|
Update of /cvsroot/lmuse/muse/muse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8396/muse Modified Files: transport.cpp transport.h Log Message: more updates Index: transport.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/transport.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** transport.h 10 Oct 2005 19:34:08 -0000 1.11 --- transport.h 11 Oct 2005 18:31:58 -0000 1.12 *************** *** 20,67 **** using AL::Pos; - class DoubleLabel; - class SigLabel; - - //--------------------------------------------------------- - // TempoSig - //--------------------------------------------------------- - - class TempoSig : public QWidget { - DoubleLabel* l1; - SigLabel* l2; - QLabel* l3; - Q_OBJECT - - private slots: - void configChanged(); - - public slots: - void setTempo(double); - void setTempo(int tempo); - - signals: - void tempoChanged(int); - void sigChanged(int, int); - - public: - TempoSig(QWidget* parent); - void setTimesig(int a, int b); - }; - - //--------------------------------------------------------- - // Handle - //--------------------------------------------------------- - - class Handle : public QWidget { - QWidget* rootWin; - int dx, dy; - void mouseMoveEvent(QMouseEvent* ev); - void mousePressEvent(QMouseEvent* ev); - public: - Handle(QWidget* root); - }; - - class TimeLLabel; - //--------------------------------------------------------- // Transport --- 20,23 ---- *************** *** 70,82 **** class Transport : public QWidget, public Ui::TransportBase { - // QHBoxLayout* tb; QToolButton* buttons[6]; // transport buttons - // QLabel* l2; - // QLabel* l3; - // QLabel* l5; - // QLabel* l6; - - // Handle *lefthandle, *righthandle; - Q_OBJECT --- 26,30 ---- *************** *** 98,102 **** void setTempo(int tempo); void setTimesig(int a, int b); ! void setPos(int idx, const AL::Pos& pos, bool); void setMasterFlag(bool); void setClickFlag(bool); --- 46,50 ---- void setTempo(int tempo); void setTimesig(int a, int b); ! void setPos(int idx, const AL::Pos& pos); void setMasterFlag(bool); void setClickFlag(bool); *************** *** 108,112 **** public: Transport(); - //TD QColor getHandleColor() const { return lefthandle->backgroundColor(); } }; #endif --- 56,59 ---- Index: transport.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/transport.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** transport.cpp 10 Oct 2005 19:34:08 -0000 1.16 --- transport.cpp 11 Oct 2005 18:31:58 -0000 1.17 *************** *** 31,187 **** //--------------------------------------------------------- - // toolButton - //--------------------------------------------------------- - - static QToolButton* newButton(const QString& s, - const QString& tt, bool toggle=false) - { - QToolButton* button = new QToolButton; - button->setFixedHeight(25); - button->setText(s); - button->setToggleButton(toggle); - button->setToolTip(tt); - return button; - } - - static QToolButton* newButton(const QPixmap* pm, - const QString& tt, bool toggle=false) - { - QToolButton* button = new QToolButton; - button->setFixedHeight(25); - button->setPixmap(*pm); - button->setToggleButton(toggle); - button->setToolTip(tt); - return button; - } - - //--------------------------------------------------------- - // Handle - // erlaubt das Verschieben eines Root-Windows mit der - // Maus - //--------------------------------------------------------- - - Handle::Handle(QWidget* r) - { - rootWin = r; - setFixedWidth(20); - setCursor(Qt::pointingHandCursor); - setBackgroundRole(QPalette::Background); - QPalette p(palette()); - p.setBrush(QPalette::Background, config.transportHandleColor); - setPalette(p); - } - - //--------------------------------------------------------- - // mouseMoveEvent - //--------------------------------------------------------- - - void Handle::mouseMoveEvent(QMouseEvent* ev) - { - rootWin->move(ev->globalX()-dx, ev->globalY() - dy); - } - - //--------------------------------------------------------- - // mousePressEvent - //--------------------------------------------------------- - - void Handle::mousePressEvent(QMouseEvent* ev) - { - rootWin->raise(); - dx = ev->globalX() - rootWin->x(); - dy = ev->globalY() - rootWin->y(); - } - - //--------------------------------------------------------- - // TempoSig - // Widget für Tempo + Signature - //--------------------------------------------------------- - - TempoSig::TempoSig(QWidget* parent) - : QWidget(parent, "TempoSig") - { - #if 0 - QBoxLayout* vb1 = new QVBoxLayout(this); - vb1->setAutoAdd(true); - - Q3Frame* f = new Q3Frame(this); - f->setFrameStyle(Q3Frame::Panel | Q3Frame::Sunken); - f->setLineWidth(1); - - QBoxLayout* vb2 = new QVBoxLayout(f); - vb2->setAutoAdd(true); - - l1 = new DoubleLabel(120.0, 20.0, 400.0, f); - l1->setSpecialText(QString("extern")); - l2 = new SigLabel(4, 4, f); - - l3 = new QLabel(tr("Tempo/Sig"), this); - l3->setFont(*config.fonts[2]); - - l1->setBackgroundMode(Qt::PaletteLight); - l1->setAlignment(Qt::AlignCenter); - l1->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); - l2->setBackgroundMode(Qt::PaletteLight); - l2->setAlignment(Qt::AlignCenter); - l2->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); - l3->setAlignment(Qt::AlignCenter); - l3->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); - - connect(l1, SIGNAL(valueChanged(double,int)), SLOT(setTempo(double))); - connect(l2, SIGNAL(valueChanged(int,int)), SIGNAL(sigChanged(int,int))); - connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); - #endif - } - - //--------------------------------------------------------- - // configChanged - //--------------------------------------------------------- - - void TempoSig::configChanged() - { - l3->setFont(*config.fonts[2]); - } - - //--------------------------------------------------------- - // setTempo - //--------------------------------------------------------- - - void TempoSig::setTempo(double t) - { - int tempo = int ((1000000.0 * 60.0)/t); - emit tempoChanged(tempo); - } - - //--------------------------------------------------------- - // setTempo - //--------------------------------------------------------- - - void TempoSig::setTempo(int tempo) - { - double t = (1000000.0 * 60.0)/tempo; - l1->blockSignals(true); - l1->setValue(t); - l1->blockSignals(false); - } - - //--------------------------------------------------------- - // setTimesig - //--------------------------------------------------------- - - void TempoSig::setTimesig(int a, int b) - { - l2->setValue(a, b); - } - - //--------------------------------------------------------- - // setRecord - //--------------------------------------------------------- - - void Transport::setRecord(bool flag) - { - buttons[5]->setChecked(flag); - } - - //--------------------------------------------------------- // Transport //--------------------------------------------------------- --- 31,34 ---- *************** *** 193,245 **** punchoutButton->setIcon(QIcon(*punchoutIcon)); loopButton->setIcon(QIcon(*loopIcon)); - #if 0 - : QWidget(0, name, Qt::WStyle_Customize | Qt::WType_TopLevel | Qt::WStyle_Tool - | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop) - { - setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); - QHBoxLayout* hbox = new QHBoxLayout; - hbox->setMargin(1); - hbox->setSpacing(1); - setLayout(hbox); - - lefthandle = new Handle(this); - hbox->addWidget(lefthandle); - - //----------------------------------------------------- - // Record & Cycle Mode - //----------------------------------------------------- - - QWidget* wbox1 = new QWidget; - hbox->addWidget(wbox1); - QVBoxLayout* box1 = new QVBoxLayout; - box1->setMargin(0); - box1->setSpacing(0); - wbox1->setLayout(box1); - - recMode = new QComboBox; - box1->addWidget(recMode); - - recMode->insertItem(tr("Overdub"), Song::REC_OVERDUP); - recMode->insertItem(tr("Replace"), Song::REC_REPLACE); - recMode->setCurrentItem(song->recMode()); - l2 = new QLabel(tr("Rec Mode")); - box1->addWidget(l2); - l2->setFont(*config.fonts[2]); - l2->setAlignment(Qt::AlignCenter); connect(recMode, SIGNAL(activated(int)), SLOT(setRecMode(int))); - - cycleMode = new QComboBox; - box1->addWidget(cycleMode); - cycleMode->insertItem(tr("Normal"), Song::CYCLE_NORMAL); - cycleMode->insertItem(tr("Mix"), Song::CYCLE_MIX); - cycleMode->insertItem(tr("Replace"), Song::CYCLE_REPLACE); - cycleMode->setCurrentItem(song->cycleMode()); - l3 = new QLabel(tr("Cycle Rec")); - box1->addWidget(l3); - l3->setFont(*config.fonts[2]); - l3->setAlignment(Qt::AlignCenter); connect(cycleMode, SIGNAL(activated(int)), SLOT(setCycleMode(int))); ! #endif //----------------------------------------------------- // loop flags --- 40,47 ---- punchoutButton->setIcon(QIcon(*punchoutIcon)); loopButton->setIcon(QIcon(*loopIcon)); connect(recMode, SIGNAL(activated(int)), SLOT(setRecMode(int))); connect(cycleMode, SIGNAL(activated(int)), SLOT(setCycleMode(int))); ! //----------------------------------------------------- // loop flags *************** *** 305,337 **** connect(song, SIGNAL(recordChanged(bool)), SLOT(setRecord(bool))); ! #if 0 //----------------------------------------------------- // AQ - Click - Sync //----------------------------------------------------- - QWidget* wbutton1 = new QWidget; - hbox->addWidget(wbutton1); - QVBoxLayout* button1 = new QVBoxLayout; - button1->setMargin(0); - button1->setSpacing(0); - wbutton1->setLayout(button1); - button1->setMargin(3); - - quantizeButton = newButton(tr("AC"), tr("quantize during record"), true); - button1->addWidget(quantizeButton); - clickButton = newButton(tr("Click"), tr("metronom click on/off"), true); - button1->addWidget(clickButton); clickButton->setAccel(shortcuts[SHRT_TOGGLE_METRO].key); ! syncButton = newButton(tr("Sync"), tr("external sync on/off"), true); ! button1->addWidget(syncButton); ! ! quantizeButton->setOn(song->quantize()); ! clickButton->setOn(song->click()); ! syncButton->setOn(extSyncFlag.value()); ! ! connect(quantizeButton, SIGNAL(toggled(bool)), song, SLOT(setQuantize(bool))); ! connect(clickButton, SIGNAL(toggled(bool)), song, SLOT(setClick(bool))); ! connect(syncButton, SIGNAL(toggled(bool)), &extSyncFlag, SLOT(setValue(bool))); connect(&extSyncFlag, SIGNAL(valueChanged(bool)), SLOT(syncChanged(bool))); --- 107,123 ---- connect(song, SIGNAL(recordChanged(bool)), SLOT(setRecord(bool))); ! //----------------------------------------------------- // AQ - Click - Sync //----------------------------------------------------- clickButton->setAccel(shortcuts[SHRT_TOGGLE_METRO].key); + quantizeButton->setChecked(song->quantize()); + clickButton->setChecked(song->click()); + syncButton->setChecked(extSyncFlag.value()); ! connect(quantizeButton, SIGNAL(clicked(bool)), song, SLOT(setQuantize(bool))); ! connect(clickButton, SIGNAL(clicked(bool)), song, SLOT(setClick(bool))); ! connect(syncButton, SIGNAL(clicked(bool)), &extSyncFlag, SLOT(setValue(bool))); connect(&extSyncFlag, SIGNAL(valueChanged(bool)), SLOT(syncChanged(bool))); *************** *** 343,365 **** //----------------------------------------------------- ! QWidget* wbox5 = new QWidget; ! hbox->addWidget(wbox5); ! QVBoxLayout* box5 = new QVBoxLayout; ! box5->setMargin(0); ! box5->setSpacing(0); ! wbox5->setLayout(box5); ! ! tempo = new TempoSig(wbox5); ! box5->addWidget(tempo); ! ! tempo->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); ! masterButton = newButton(tr("Master"), tr("use master track"), true); ! box5->addWidget(masterButton); ! masterButton->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); ! ! connect(masterButton, SIGNAL(toggled(bool)), song, SLOT(setMasterFlag(bool))); //----------------------------------------------------- ! #endif connect(tl1, SIGNAL(valueChanged(const Pos&)), SLOT(lposChanged(const Pos&))); connect(tl2, SIGNAL(valueChanged(const Pos&)), SLOT(rposChanged(const Pos&))); --- 129,136 ---- //----------------------------------------------------- ! connect(masterButton, SIGNAL(clicked(bool)), song, SLOT(setMasterFlag(bool))); //----------------------------------------------------- ! connect(tl1, SIGNAL(valueChanged(const Pos&)), SLOT(lposChanged(const Pos&))); connect(tl2, SIGNAL(valueChanged(const Pos&)), SLOT(rposChanged(const Pos&))); *************** *** 367,377 **** connect(time2, SIGNAL(valueChanged(const Pos&)), SLOT(cposChanged(const Pos&))); ! connect(slider,SIGNAL(valueChanged(int)), SLOT(cposChanged(int))); ! connect(song, SIGNAL(posChanged(int,const AL::Pos&, bool)), SLOT(setPos(int,const AL::Pos&, bool))); ! connect(tempo, SIGNAL(tempoChanged(int)), song, SLOT(setTempo(int))); ! connect(tempo, SIGNAL(sigChanged(int, int)), song, SLOT(setSig(int, int))); connect(song, SIGNAL(playChanged(bool)), SLOT(setPlay(bool))); connect(song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int))); connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); } --- 138,151 ---- connect(time2, SIGNAL(valueChanged(const Pos&)), SLOT(cposChanged(const Pos&))); ! connect(slider,SIGNAL(sliderMoved(int)), SLOT(cposChanged(int))); ! connect(song, SIGNAL(posChanged(int,const AL::Pos&, bool)), SLOT(setPos(int,const AL::Pos&))); ! //TD connect(tempo, SIGNAL(tempoChanged(int)), song, SLOT(setTempo(int))); ! //TD connect(tempo, SIGNAL(sigChanged(int, int)), song, SLOT(setSig(int, int))); connect(song, SIGNAL(playChanged(bool)), SLOT(setPlay(bool))); connect(song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int))); connect(muse, SIGNAL(configChanged()), SLOT(configChanged())); + setPos(0, song->cpos()); + setPos(1, song->lpos()); + setPos(2, song->rpos()); } *************** *** 431,461 **** //--------------------------------------------------------- ! void Transport::setPos(int idx, const AL::Pos& pos, bool) { - #if 0 //TD - unsigned v = pos.tick(); switch (idx) { case 0: ! time1->setValue(v); ! time2->setValue(v); ! slider->blockSignals(true); ! slider->setValue(v); ! slider->blockSignals(false); if (song->masterFlag()) ! setTempo(AL::tempomap.tempo(v)); { int z, n; ! AL::sigmap.timesig(v, z, n); setTimesig(z, n); } break; case 1: ! tl1->setValue(v); break; case 2: ! tl2->setValue(v); break; } - #endif } --- 205,230 ---- //--------------------------------------------------------- ! void Transport::setPos(int idx, const AL::Pos& pos) { switch (idx) { case 0: ! time1->setValue(pos); ! time2->setValue(pos); ! slider->setValue(pos.tick()); if (song->masterFlag()) ! setTempo(AL::tempomap.tempo(pos.tick())); { int z, n; ! AL::sigmap.timesig(pos.tick(), z, n); setTimesig(z, n); } break; case 1: ! tl1->setValue(pos); break; case 2: ! tl2->setValue(pos); break; } } *************** *** 640,641 **** --- 409,420 ---- } + //--------------------------------------------------------- + // setRecord + //--------------------------------------------------------- + + void Transport::setRecord(bool flag) + { + buttons[5]->setChecked(flag); + } + + |