From: werner s. <wsc...@us...> - 2005-10-20 08:49:30
|
Update of /cvsroot/lmuse/muse/muse/ctrl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1279/muse/ctrl Modified Files: Makefile.am ctrledit.cpp ctrledit.h ctrlpanel.cpp Log Message: updates Index: Makefile.am =================================================================== RCS file: /cvsroot/lmuse/muse/muse/ctrl/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.am 1 Oct 2005 15:16:47 -0000 1.5 --- Makefile.am 20 Oct 2005 08:49:17 -0000 1.6 *************** *** 14,15 **** --- 14,16 ---- obj/moc_ctrledit.cpp \ obj/moc_ctrlpanel.cpp + Index: ctrlpanel.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/ctrl/ctrlpanel.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ctrlpanel.cpp 10 Oct 2005 19:34:08 -0000 1.19 --- ctrlpanel.cpp 20 Oct 2005 08:49:17 -0000 1.20 *************** *** 21,24 **** --- 21,25 ---- #include "arranger/configmidictrl.h" #include "widgets/simplebutton.h" + #include "widgets/utils.h" //--------------------------------------------------------- *************** *** 42,46 **** // destroy button ! SimpleButton* minus = new SimpleButton(this, minusIcon, minusIcon); minus->setBackgroundColor(this->backgroundColor()); QToolTip::add(minus, tr("remove panel")); --- 43,47 ---- // destroy button ! SimpleButton* minus = newMinusButton(this); minus->setBackgroundColor(this->backgroundColor()); QToolTip::add(minus, tr("remove panel")); Index: ctrledit.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/ctrl/ctrledit.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ctrledit.cpp 18 Oct 2005 19:41:41 -0000 1.19 --- ctrledit.cpp 20 Oct 2005 08:49:17 -0000 1.20 *************** *** 16,19 **** --- 16,22 ---- #include "midictrl.h" #include "debug.h" + #include "widgets/simplebutton.h" + #include "icons.h" + #include "widgets/utils.h" static Ctrl veloList(CTRL_VELOCITY, "velocity", Ctrl::DISCRETE, 0.0, 127.0); // dummy *************** *** 23,77 **** //--------------------------------------------------------- ! CtrlEdit::CtrlEdit(ExtMidiEditor* e) { editor = e; ! ctrl = 0; ctrlId = 0; track = 0; y = 0; height = 0; #if 0 //TD - _ctrl = &veloList; - // _controller = &veloCtrl; velocity_change = false; - - track = (MidiTrack*)(e->parts()->find(0)->track()); - - QHBoxLayout* hbox = new QHBoxLayout(this); - panel = new CtrlPanel(this, e, "panel"); - canvas = new CanvasSWidget(track, this); - QWidget* vscale = new VScale(this); - - setMapOffset(10); - canvas->setMapOffset(10); - canvas->setDrawBackground(false); - canvas->setDrawCtrlName(true); - - canvas->setMinimumHeight(50); - panel->setMinimumHeight(50); - panel->setFixedWidth(40); - - hbox->addWidget(panel, expand ? 100 : 0, Qt::AlignRight); - hbox->addWidget(canvas, 100); - hbox->addWidget(vscale, 0); - - connect(panel, SIGNAL(destroyPanel()), SLOT(destroy())); connect(panel, SIGNAL(controllerChanged(int)), canvas, SLOT(setController(int))); ! connect(canvas, SIGNAL(cursorPos(unsigned)), SIGNAL(timeChanged(unsigned))); ! connect(track, SIGNAL(controllerChanged(int)), canvas, SLOT(controllerChanged(int))); // Velocity: connect(canvas, SIGNAL(velocityChangeStart(unsigned, float)), SLOT(velocityChangeStart(unsigned, float))); connect(canvas, SIGNAL(velocityChangeStop(void)), SLOT(velocityChangeStop(void))); - connect(canvas, SIGNAL(yposChanged(unsigned, CVal)), SLOT(controllerManipulation(unsigned, CVal))); - connect(song, SIGNAL(posChanged(int,unsigned,bool)), this, SLOT(setPos(int,unsigned))); - connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); connect(track, SIGNAL(controllerChanged(int)), canvas, SLOT(controllerChanged(int))); - connect(panel, SIGNAL(controllerChanged(int)), this, SLOT(controllerChanged(int))); #endif } #if 0 //--------------------------------------------------------- --- 26,74 ---- //--------------------------------------------------------- ! CtrlEdit::CtrlEdit(QWidget* parent, ExtMidiEditor* e) ! : QObject(parent) { editor = e; ! ctrl = &veloList; ctrlId = 0; track = 0; y = 0; height = 0; + sel = new SimpleButton(parent, QString("Sel")); + minus = newMinusButton(parent); + minus->setAutoRaise(true); + pop = new QMenu(sel); + pop->addAction(tr("Velocity")); + sel->setAutoRaise(true); + + sel->setMenu(pop); + sel->setPopupMode(QToolButton::InstantPopup); + connect(pop, SIGNAL(aboutToShow()), SLOT(populateController())); + connect(pop, SIGNAL(triggered(QAction*)), SLOT(changeController(QAction*))); #if 0 //TD velocity_change = false; connect(panel, SIGNAL(controllerChanged(int)), canvas, SLOT(setController(int))); ! connect(track, SIGNAL(controllerChanged(int)), canvas, SLOT(controllerChanged(int))); // Velocity: connect(canvas, SIGNAL(velocityChangeStart(unsigned, float)), SLOT(velocityChangeStart(unsigned, float))); connect(canvas, SIGNAL(velocityChangeStop(void)), SLOT(velocityChangeStop(void))); connect(track, SIGNAL(controllerChanged(int)), canvas, SLOT(controllerChanged(int))); #endif } + //--------------------------------------------------------- + // CtrlEdit + //--------------------------------------------------------- + + CtrlEdit::~CtrlEdit() + { + delete sel; + delete minus; + } + + #if 0 //--------------------------------------------------------- *************** *** 250,251 **** --- 247,308 ---- #endif + //--------------------------------------------------------- + // populateController + //--------------------------------------------------------- + + void CtrlEdit::populateController() + { + //--------------------------------------------------- + // build list of midi controllers for current + // MidiPort/channel + //--------------------------------------------------- + + PartList* parts = editor->parts(); + Part* part = parts->begin()->second; + MidiTrack* track = (MidiTrack*)(part->track()); + + ControllerNameList* cn = track->controllerNames(); + int nCtrl = cn->size(); + + pop->clear(); + + QAction* a; + a = pop->addAction(tr("Velocity")); + a->setData(nCtrl); + + int idx = 0; + for (iControllerName i = cn->begin(); i != cn->end(); ++i, ++idx) { + a = pop->addAction(i->name); + a->setData(idx); + } + a = pop->addAction(QIcon(*configureIcon), tr("other ...")); + a->setData(nCtrl+1); + } + + //--------------------------------------------------------- + // changeController + //--------------------------------------------------------- + + void CtrlEdit::changeController(QAction* a) + { + if (a == 0) + return; + int rv = a->data().toInt(); + printf("selected %d\n", rv); + #if 0 + if (rv == nCtrl) { // special case velocity + emit controllerChanged(CTRL_VELOCITY); + } + else if (rv == nCtrl+1) { // "other" + // ConfigMidiCtrl* mce = new ConfigMidiCtrl(track, this); + // mce->exec(); + // emit controllerChanged((*cn)[0].id); + // TODO + } + else { + emit controllerChanged((*cn)[rv].id); + } + #endif + } + + Index: ctrledit.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/ctrl/ctrledit.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ctrledit.h 18 Oct 2005 19:41:41 -0000 1.15 --- ctrledit.h 20 Oct 2005 08:49:17 -0000 1.16 *************** *** 12,15 **** --- 12,16 ---- class ExtMidiEditor; + class SimpleButton; //--------------------------------------------------------- *************** *** 17,21 **** //--------------------------------------------------------- ! struct CtrlEdit { ExtMidiEditor* editor; Ctrl* ctrl; --- 18,25 ---- //--------------------------------------------------------- ! class CtrlEdit : public QObject { ! Q_OBJECT ! ! public: ExtMidiEditor* editor; Ctrl* ctrl; *************** *** 24,35 **** int y; int height; // void controllerChanged(int); // void velocityChange(unsigned time, float val); // void velocityChangeStart(unsigned time, float val); ! void velocityChangeStop(); ! void controllerManipulation(unsigned time, CVal c); ! CtrlEdit(ExtMidiEditor* e); }; --- 28,48 ---- int y; int height; + SimpleButton* minus; + SimpleButton* sel; + QMenu* pop; + + private slots: + void populateController(); + void changeController(QAction*); // void controllerChanged(int); // void velocityChange(unsigned time, float val); // void velocityChangeStart(unsigned time, float val); ! // void velocityChangeStop(); ! // void controllerManipulation(unsigned time, CVal c); ! public: ! CtrlEdit(QWidget* parent, ExtMidiEditor* e); ! ~CtrlEdit(); }; |