summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2010-10-31 07:35:21 +0000
committerTim E. Real <termtech@rogers.com>2010-10-31 07:35:21 +0000
commit4f767f96be2382c3f73a9619097a8cbabe3f7587 (patch)
treee36f3ca8e2e3faa4b1596ec35c82f7adc8875bc8
parent156b4739285c8a44de92c1dbd7ace34db5f75733 (diff)
Fixed Toolbar1 class. Snap, Quantize combo boxes should work now.
-rw-r--r--muse2/ChangeLog2
-rw-r--r--muse2/muse/widgets/lcombo.cpp12
-rw-r--r--muse2/muse/widgets/lcombo.h2
-rw-r--r--muse2/muse/widgets/tb1.cpp67
4 files changed, 20 insertions, 63 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index c448ff5c..632b022e 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,5 @@
+31.10.2010
+ - Fixed Toolbar1 class. 'Snap', 'Quantize' combo boxes should work now. Thanks to Luis G. for help. (Tim)
30.10.2010
- Fixed Deicsonze crash and missing Organ. Both load now. (Tim.)
27.10.2010
diff --git a/muse2/muse/widgets/lcombo.cpp b/muse2/muse/widgets/lcombo.cpp
index 2200cca7..c41367ed 100644
--- a/muse2/muse/widgets/lcombo.cpp
+++ b/muse2/muse/widgets/lcombo.cpp
@@ -36,3 +36,15 @@ LabelCombo::LabelCombo(const QString& txt, QWidget* parent,
connect(box, SIGNAL(activated(int)), SIGNAL(activated(int)));
}
+void LabelCombo::setCurrentIndex(int i)
+{
+ int rc = box->model()->rowCount();
+ if(rc == 0)
+ return;
+ int r = i % rc;
+ int c = i / rc;
+ if(c >= box->model()->columnCount())
+ return;
+ box->setModelColumn(c);
+ box->setCurrentIndex(r);
+}
diff --git a/muse2/muse/widgets/lcombo.h b/muse2/muse/widgets/lcombo.h
index 75524d0c..885d21e7 100644
--- a/muse2/muse/widgets/lcombo.h
+++ b/muse2/muse/widgets/lcombo.h
@@ -32,7 +32,7 @@ class LabelCombo : public QWidget {
public slots:
void clearFocus() { box->clearFocus(); }
- void setCurrentIndex(int i) { box->setCurrentIndex(i); }
+ void setCurrentIndex(int i);
public:
LabelCombo(const QString& label, QWidget* parent,
diff --git a/muse2/muse/widgets/tb1.cpp b/muse2/muse/widgets/tb1.cpp
index a1847b1d..180632eb 100644
--- a/muse2/muse/widgets/tb1.cpp
+++ b/muse2/muse/widgets/tb1.cpp
@@ -57,10 +57,8 @@ static const char* quantStrings[] = {
// solo time pitch raster quant
//---------------------------------------------------------
-//Toolbar1::Toolbar1(QMainWindow* parent, int r, int q, bool sp)
Toolbar1::Toolbar1(QWidget* parent, int r, int q, bool sp)
: QToolBar(QString("Quant'n'Snap-tools"), parent)
- //: QToolBar(QString("Qant'n'Snap-tools"), parent)
{
pitch = 0;
showPitch = sp;
@@ -78,17 +76,14 @@ Toolbar1::Toolbar1(QWidget* parent, int r, int q, bool sp)
// Cursor Position
//---------------------------------------------------
- //QLabel* label = new QLabel(tr("Cursor"), this, "Cursor");
QLabel* label = new QLabel(tr("Cursor"));
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
label->setIndent(3);
addWidget(label);
- //pos = new PosLabel(this, "pos");
pos = new PosLabel(0, "pos");
pos->setFixedHeight(22);
addWidget(pos);
if (showPitch) {
- //pitch = new PitchLabel(this);
pitch = new PitchLabel(0);
pitch->setEnabled(false);
pitch->setFixedHeight(22);
@@ -99,22 +94,11 @@ Toolbar1::Toolbar1(QWidget* parent, int r, int q, bool sp)
// Raster, Quant.
//---------------------------------------------------
- //raster = new LabelCombo(tr("Snap"), this);
- //quant = new LabelCombo(tr("Quantize"), this);
raster = new LabelCombo(tr("Snap"), 0);
quant = new LabelCombo(tr("Quantize"), 0);
- //addWidget(raster);
- //addWidget(quant);
-
- //Q3ListBox* rlist = new Q3ListBox(this);
- //Q3ListBox* qlist = new Q3ListBox(this);
- // p4.0.3
- //QTableWidget* rlist = new QTableWidget(10, 3, this);
- //QTableWidget* qlist = new QTableWidget(8, 3, this);
+
rlist = new QTableWidget(10, 3);
qlist = new QTableWidget(8, 3);
- //addWidget(rlist);
- //addWidget(qlist);
rlist->verticalHeader()->setDefaultSectionSize(22);
rlist->horizontalHeader()->setDefaultSectionSize(32);
rlist->setSelectionMode(QAbstractItemView::SingleSelection);
@@ -129,18 +113,9 @@ Toolbar1::Toolbar1(QWidget* parent, int r, int q, bool sp)
rlist->setMinimumWidth(96);
qlist->setMinimumWidth(96);
- //raster->setListBox(rlist); ddskrjo
- //quant->setListBox(qlist); ddskrjo
- raster->setView(rlist); // p4.0.3
- quant->setView(qlist); //
+ raster->setView(rlist);
+ quant->setView(qlist);
- //rlist->setColumnMode(3);
- //qlist->setColumnMode(3);
- //for (int i = 0; i < 30; i++)
- // rlist->insertItem(tr(rasterStrings[i]), i);
- //for (int i = 0; i < 24; i++)
- // qlist->insertItem(tr(quantStrings[i]), i);
- // p4.0.3
for (int j = 0; j < 3; j++)
for (int i = 0; i < 10; i++)
rlist->setItem(i, j, new QTableWidgetItem(tr(rasterStrings[i + j * 10])));
@@ -162,29 +137,6 @@ Toolbar1::Toolbar1(QWidget* parent, int r, int q, bool sp)
// To Menu
//---------------------------------------------------
- /*
- //LabelCombo* to = new LabelCombo(tr("To"), this);
- LabelCombo* to = new LabelCombo(tr("To"), 0);
- addWidget(to);
-// Q3ListBox* toList = new Q3ListBox(this);
- //QListWidget* toList = new QListWidget(this); // p4.0.4
- QListWidget* toList = new QListWidget();
- toList->setFixedHeight(24);
- //addWidget(toList);
-// //to->setListBox(toList); ddskrjo
- to->setView(toList); // p4.0.4
-
-// toList->insertItem(tr("All Events"), 0);
-// toList->insertItem(tr("Looped Ev."), CMD_RANGE_LOOP);
-// toList->insertItem(tr("Selected Ev."), CMD_RANGE_SELECTED);
-// toList->insertItem(tr("Looped+Sel."), CMD_RANGE_LOOP | CMD_RANGE_SELECTED);
- // p4.0.4
- toList->insertItem(0, tr("All Events"));
- toList->insertItem(CMD_RANGE_LOOP, tr("Looped Ev."));
- toList->insertItem(CMD_RANGE_SELECTED, tr("Selected Ev."));
- toList->insertItem(CMD_RANGE_LOOP | CMD_RANGE_SELECTED, tr("Looped+Sel."));
- */
-
addWidget(new QLabel(tr("To")));
QComboBox* toList = new QComboBox;
toList->setFixedHeight(22);
@@ -198,7 +150,6 @@ Toolbar1::Toolbar1(QWidget* parent, int r, int q, bool sp)
connect(quant, SIGNAL(activated(int)), SLOT(_quantChanged(int)));
//connect(rlist, SIGNAL(cellClicked(int,int)), SLOT(_rasterChanged(int, int)));
//connect(qlist, SIGNAL(cellClicked(int,int)), SLOT(_quantChanged(int,int)));
- //connect(to, SIGNAL(activated(int)), SIGNAL(toChanged(int)));
connect(toList, SIGNAL(activated(int)), SIGNAL(toChanged(int)));
connect(solo, SIGNAL(toggled(bool)), SIGNAL(soloChanged(bool)));
pos->setEnabled(false);
@@ -273,15 +224,11 @@ void Toolbar1::setRaster(int val)
for (unsigned i = 0; i < sizeof(rasterTable)/sizeof(*rasterTable); i++) {
if (val == rasterTable[i]) {
raster->setCurrentIndex(i);
- //raster->setModelColumn(i / 10);
- //raster->setCurrentIndex(i % 10);
- //rlist->setCurrentCell(i % 10, i / 10);
return;
}
}
printf("setRaster(%d) not defined\n", val);
- //raster->setCurrentIndex(0);
- rlist->setCurrentCell(0, 0);
+ raster->setCurrentIndex(0);
}
//---------------------------------------------------------
@@ -293,15 +240,11 @@ void Toolbar1::setQuant(int val)
for (unsigned i = 0; i < sizeof(quantTable)/sizeof(*quantTable); i++) {
if (val == quantTable[i]) {
quant->setCurrentIndex(i);
- //quant->setModelColumn(i / 8);
- //quant->setCurrentIndex(i % 8);
- //qlist->setCurrentCell(i % 8, i / 8);
return;
}
}
printf("setQuant(%d) not defined\n", val);
- //quant->setCurrentIndex(0);
- qlist->setCurrentCell(0, 0);
+ quant->setCurrentIndex(0);
}
//---------------------------------------------------------