summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog3
-rw-r--r--muse2/muse/midiedit/dlist.cpp42
-rw-r--r--muse2/muse/midiedit/dlist.h16
-rw-r--r--muse2/muse/midiedit/drumedit.cpp281
-rw-r--r--muse2/muse/midiedit/drumedit.h61
-rw-r--r--muse2/muse/widgets/header.cpp105
-rw-r--r--muse2/muse/widgets/header.h24
7 files changed, 322 insertions, 210 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index af2e9c39..b2792258 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,6 +1,9 @@
29.11.2010
- In Mess::processEvent(), added ME_PITCHBEND case. For synths which don't override
processEvent (like Vam and Deicsonze). Pitchbend should work in them now. (Tim)
+ - Added a new HeaderNew (Qt4 based) class to be used instead of Header (Qt3 based). (Orcan)
+ - Ported drumedit except a Q3PopupMenu reference that needs to be ported in midiport.cpp.
+ This update restores the tooltips, adds icons to edit menu items in drumedit window. (Orcan)
28.11.2010
- Finished porting Marker View. (Orcan)
- Ported ctrlpanel. Needs some testing. I also removed usage of the Oxygen's "pen" icon
diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp
index 24ced3d0..06c9ffbf 100644
--- a/muse2/muse/midiedit/dlist.cpp
+++ b/muse2/muse/midiedit/dlist.cpp
@@ -5,14 +5,12 @@
// (C) Copyright 1999 Werner Schweer (ws@seh.de)
//=========================================================
-#include <qpainter.h>
-#include <q3header.h>
-#include <qcursor.h>
-#include <q3popupmenu.h>
-#include <qlineedit.h>
-//Added by qt3to4:
-#include <QPixmap>
+#include <QCursor>
+#include <QHeaderView>
+#include <Q3PopupMenu>
#include <QMouseEvent>
+#include <QPainter>
+#include <QPixmap>
#include <stdio.h>
@@ -58,9 +56,10 @@ void DList::draw(QPainter& p, const QRect& rect)
p.fillRect(x, yy, w, TH, Qt::yellow);
// else
// p.eraseRect(x, yy, w, TH);
- for (int k = 0; k < header->count(); ++k) {
- int x = header->sectionPos(k);
- int w = header->sectionSize(k);
+ QHeaderView *h = header;
+ for (int k = 0; k < h->count(); ++k) {
+ int x = h->sectionPosition(k);
+ int w = h->sectionSize(k);
QRect r = p.xForm(QRect(x+2, yy, w-4, TH));
QString s;
int align = Qt::AlignVCenter | Qt::AlignHCenter;
@@ -153,7 +152,7 @@ void DList::draw(QPainter& p, const QRect& rect)
x = 0;
for (int i = 0; i < n; i++) {
//x += header->sectionSize(i);
- x += header->sectionSize(header->mapToSection(i));
+ x += header->sectionSize(header->visualIndex(i));
p.drawLine(x, 0, x, height());
}
p.setWorldXForm(true);
@@ -416,7 +415,7 @@ void DList::viewMouseDoubleClickEvent(QMouseEvent* ev)
// int button = ev->button();
unsigned pitch = y / TH;
- int section = header->sectionAt(x);
+ int section = header->logicalIndexAt(x);
if ((section == COL_NAME || section == COL_VOL || section == COL_LEN || section == COL_LV1 ||
section == COL_LV2 || section == COL_LV3 || section == COL_LV4) && (ev->button() == Qt::LeftButton))
@@ -442,7 +441,7 @@ void DList::lineEdit(int line, int section)
SLOT(returnPressed()));
editor->setFrame(true);
}
- int colx = mapx(header->sectionPos(section));
+ int colx = mapx(header->sectionPosition(section));
int colw = rmapx(header->sectionSize(section));
int coly = mapy(line * TH);
int colh = rmapy(TH);
@@ -513,13 +512,13 @@ int DList::x2col(int x) const
int col = 0;
int w = 0;
for (; col < header->count(); col++) {
- w += header->cellSize(col);
+ w += header->sectionSize(col);
if (x < w)
break;
}
if (col == header->count())
return -1;
- return header->mapToLogical(col);
+ return header->logicalIndex(col);
}
//---------------------------------------------------------
@@ -620,7 +619,7 @@ void DList::returnPressed()
// moved
//---------------------------------------------------------
-void DList::moved(int, int)
+void DList::moved(int, int, int)
{
redraw();
}
@@ -644,21 +643,22 @@ void DList::songChanged(int flags)
}
}
-
//---------------------------------------------------------
// DList
//---------------------------------------------------------
-DList::DList(Q3Header* h, QWidget* parent, int ymag)
+DList::DList(QHeaderView* h, QWidget* parent, int ymag)
: View(parent, 1, ymag)
{
setBg(Qt::white);
+ if (!h){
+ h = new QHeaderView(Qt::Horizontal, parent);}
header = h;
scroll = 0;
- header->setTracking(true);
- connect(header, SIGNAL(sizeChange(int,int,int)),
+ //ORCAN- CHECK if really needed: header->setTracking(true);
+ connect(header, SIGNAL(sectionResized(int,int,int)),
SLOT(sizeChange(int,int,int)));
- connect(header, SIGNAL(moved(int,int)), SLOT(moved(int,int)));
+ connect(header, SIGNAL(sectionMoved(int, int,int)), SLOT(moved(int,int,int)));
setFocusPolicy(Qt::StrongFocus);
drag = NORMAL;
editor = 0;
diff --git a/muse2/muse/midiedit/dlist.h b/muse2/muse/midiedit/dlist.h
index 1d7e0114..5299fcb3 100644
--- a/muse2/muse/midiedit/dlist.h
+++ b/muse2/muse/midiedit/dlist.h
@@ -8,16 +8,16 @@
#ifndef __DLIST_H__
#define __DLIST_H__
-#include <qlineedit.h>
-//Added by qt3to4:
-#include <QMouseEvent>
-#include <QKeyEvent>
+#include <QLineEdit>
+
#include "view.h"
#define TH 18 // normal Track-hight
+class QKeyEvent;
+class QMouseEvent;
class QPainter;
-class Q3Header;
+
class ScrollScale;
class Device;
class QLineEdit;
@@ -49,7 +49,7 @@ class DLineEdit: public QLineEdit
//---------------------------------------------------------
class DList : public View {
- Q3Header* header;
+ QHeaderView* header;
ScrollScale* scroll;
QLineEdit* editor;
DrumMap* editEntry;
@@ -76,7 +76,7 @@ class DList : public View {
private slots:
void sizeChange(int, int, int);
void returnPressed();
- void moved(int, int);
+ void moved(int, int, int);
signals:
void channelChanged();
@@ -91,7 +91,7 @@ class DList : public View {
public:
void lineEdit(int line, int section);
void setCurDrumInstrument(int n);
- DList(Q3Header*, QWidget* parent, int ymag);
+ DList(QHeaderView*, QWidget* parent, int ymag);
~DList();
void setScroll(ScrollScale* s) { scroll = s; }
int getSelectedInstrument();
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 06205e14..511bbd0e 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -5,34 +5,18 @@
// (C) Copyright 1999 Werner Schweer (ws@seh.de)
//=========================================================
-#include <QToolButton>
-//#include <q3accel.h>
-#include <QLayout>
-#include <q3hbox.h>
-#include <QSizeGrip>
-#include <QScrollBar>
-#include <QLabel>
-#include <QPushButton>
-#include <QRadioButton>
-#include <q3buttongroup.h>
-#include <q3listbox.h>
-#include <q3popupmenu.h>
-#include <QMenuBar>
-#include <QToolTip>
-#include <QApplication>
-#include <QClipboard>
-#include <QMessageBox>
#include <QAction>
-#include <QWhatsThis>
-#include <QList>
+#include <QClipboard>
+#include <QCloseEvent>
#include <QGridLayout>
-
-//Added by qt3to4:
#include <QKeyEvent>
-//#include <Q3ValueList>
-//#include <Q3GridLayout>
+#include <QList>
+#include <QMessageBox>
+#include <QPushButton>
#include <QResizeEvent>
-#include <QCloseEvent>
+#include <QSizeGrip>
+#include <QToolButton>
+#include <QWhatsThis>
#include "drumedit.h"
#include "mtscale.h"
@@ -82,65 +66,45 @@ static const int yscale = 1;
static const int drumeditTools = PointerTool | PencilTool | RubberTool;
//---------------------------------------------------------
-// DWhatsThis::text
+// setHeaderWhatsThis
//---------------------------------------------------------
-QString DWhatsThis::text(const QPoint& pos)
+void DrumEdit::setHeaderWhatsThis()
{
- int section = header->sectionAt(pos.x());
- if (section == -1)
- return QString::null;
- switch(section) {
- case 0: return Q3Header::tr("mute instrument"); break;
- case 1: return Q3Header::tr("sound name"); break;
- case 2: return Q3Header::tr("volume percent"); break;
- case 3: return Q3Header::tr("quantisation"); break;
- case 4: return Q3Header::tr("this input note triggers the sound"); break;
- case 5: return Q3Header::tr("note length"); break;
- case 6: return Q3Header::tr("this is the note which is played"); break;
- case 7: return Q3Header::tr("output channel (hold ctl to affect all rows)"); break;
- case 8: return Q3Header::tr("output port"); break;
- case 9: return Q3Header::tr("shift + control key: draw velocity level 1"); break;
- case 10: return Q3Header::tr("control key: draw velocity level 2"); break;
- case 11: return Q3Header::tr("shift key: draw velocity level 3"); break;
- case 12: return Q3Header::tr("draw velocity level 4"); break;
- default: break;
- }
- return QString::null;
+ header->setWhatsThis(0, tr("mute instrument"));
+ header->setWhatsThis(1, tr("sound name"));
+ header->setWhatsThis(2, tr("volume percent"));
+ header->setWhatsThis(3, tr("quantisation"));
+ header->setWhatsThis(4, tr("this input note triggers the sound"));
+ header->setWhatsThis(5, tr("note length"));
+ header->setWhatsThis(6, tr("this is the note which is played"));
+ header->setWhatsThis(7, tr("output channel (hold ctl to affect all rows)"));
+ header->setWhatsThis(8, tr("output port"));
+ header->setWhatsThis(9, tr("shift + control key: draw velocity level 1"));
+ header->setWhatsThis(10, tr("control key: draw velocity level 2"));
+ header->setWhatsThis(11, tr("shift key: draw velocity level 3"));
+ header->setWhatsThis(12, tr("draw velocity level 4"));
}
//---------------------------------------------------------
-// DHeaderTip::maybeTip
+// setHeaderToolTips
//---------------------------------------------------------
-void DHeaderTip::maybeTip(const QPoint &pos)
+void DrumEdit::setHeaderToolTips()
{
-#if 0 // ddskrjo
- Header* w = (Header*)parentWidget();
- int section = w->sectionAt(pos.x());
- if (section == -1)
- return;
- QRect r(w->sectionPos(section), 0, w->sectionSize(section),
- w->height());
- QString p;
- switch(section) {
- case 0: p = Q3Header::tr("mute instrument"); break;
- case 1: p = Q3Header::tr("sound name"); break;
- case 2: p = Q3Header::tr("volume percent"); break;
- case 3: p = Q3Header::tr("quantisation"); break;
- case 4: p = Q3Header::tr("this input note triggers the sound"); break;
- case 5: p = Q3Header::tr("note length"); break;
- case 6: p = Q3Header::tr("this is the note which is played"); break;
- case 7: p = Q3Header::tr("output channel (ctl: affect all rows)"); break;
- case 8: p = Q3Header::tr("output port"); break;
- case 9: p = Q3Header::tr("shift + control key: draw velocity level 1"); break;
- case 10: p = Q3Header::tr("control key: draw velocity level 2"); break;
- case 11: p = Q3Header::tr("shift key: draw velocity level 3"); break;
- case 12: p = Q3Header::tr("draw velocity level 4"); break;
- default: return;
- }
- tip(r, p);
-#endif
+ header->setToolTip(0, tr("mute instrument"));
+ header->setToolTip(1, tr("sound name"));
+ header->setToolTip(2, tr("volume percent"));
+ header->setToolTip(3, tr("quantisation"));
+ header->setToolTip(4, tr("this input note triggers the sound"));
+ header->setToolTip(5, tr("note length"));
+ header->setToolTip(6, tr("this is the note which is played"));
+ header->setToolTip(7, tr("output channel (ctl: affect all rows)"));
+ header->setToolTip(8, tr("output port"));
+ header->setToolTip(9, tr("shift + control key: draw velocity level 1"));
+ header->setToolTip(10, tr("control key: draw velocity level 2"));
+ header->setToolTip(11, tr("shift key: draw velocity level 3"));
+ header->setToolTip(12, tr("draw velocity level 4"));
}
//---------------------------------------------------------
@@ -150,8 +114,8 @@ void DHeaderTip::maybeTip(const QPoint &pos)
void DrumEdit::closeEvent(QCloseEvent* e)
{
//Store values of the horizontal splitter
- Q3ValueList<int> sizes = split2->sizes();
- Q3ValueList<int>::Iterator it = sizes.begin();
+ QList<int> sizes = split2->sizes();
+ QList<int>::iterator it = sizes.begin();
_dlistWidthInit = *it; //There are only 2 values stored in the sizelist, size of dlist widget and dcanvas widget
it++;
_dcanvasWidthInit = *it;
@@ -170,58 +134,95 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
resize(_widthInit, _heightInit);
selPart = 0;
_to = _toInit;
+ QSignalMapper *signalMapper = new QSignalMapper(this);
//---------Pulldown Menu----------------------------
- menuFile = new Q3PopupMenu(this);
- menuBar()->insertItem(tr("&File"), menuFile);
+ menuFile = new QMenu(tr("&File"));
+ menuBar()->addMenu(menuFile);
+
+ loadAction = menuFile->addAction(QIcon(*openIcon), tr("Load Map"));
+ saveAction = menuFile->addAction(QIcon(*saveIcon), tr("Save Map"));
+ resetAction = menuFile->addAction(tr("Reset GM Map"));
- menuFile->insertItem(QIcon(*openIcon), tr("Load Map"), DrumCanvas::CMD_LOAD);
- menuFile->insertItem(QIcon(*saveIcon), tr("Save Map"), DrumCanvas::CMD_SAVE);
- menuFile->insertItem(tr("Reset GM Map"), DrumCanvas::CMD_RESET);
+ connect(loadAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(saveAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(resetAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
- menuEdit = new Q3PopupMenu(this);
- menuBar()->insertItem(tr("&Edit"), menuEdit);
+ signalMapper->setMapping(loadAction, DrumCanvas::CMD_LOAD);
+ signalMapper->setMapping(saveAction, DrumCanvas::CMD_SAVE);
+ signalMapper->setMapping(resetAction, DrumCanvas::CMD_RESET);
+
+ menuEdit = new QMenu(tr("&Edit"));
+ menuBar()->addMenu(menuEdit);
undoRedo->addTo(menuEdit);
///Q3Accel* qa = new Q3Accel(this);
- ///qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Z), song, SLOT(undo()));
+ ///qa->connectItem(qa->addAction(Qt::CTRL+Qt::Key_Z), song, SLOT(undo()));
menuEdit->insertSeparator();
- menuEdit->insertItem(tr("Cut"), DrumCanvas::CMD_CUT);
- menuEdit->insertItem(tr("Copy"), DrumCanvas::CMD_COPY);
- menuEdit->insertItem(tr("Paste"), DrumCanvas::CMD_PASTE);
+ cutAction = menuEdit->addAction(QIcon(*editcutIconSet), tr("Cut"));
+ copyAction = menuEdit->addAction(QIcon(*editcopyIconSet), tr("Copy"));
+ pasteAction = menuEdit->addAction(QIcon(*editpasteIconSet), tr("Paste"));
menuEdit->insertSeparator();
- menuEdit->insertItem(tr("Delete Events"), DrumCanvas::CMD_DEL);
+ deleteAction = menuEdit->addAction(tr("Delete Events"));
- // Functions
- menuFunctions = new Q3PopupMenu(this);
- menuBar()->insertItem(tr("&Functions"), menuFunctions);
- menuFunctions->insertTearOffHandle();
- menuFunctions->insertItem(tr("Set fixed length"), DrumCanvas::CMD_FIXED_LEN);
- menuFunctions->insertItem(tr("Modify Velocity"), DrumCanvas::CMD_MODIFY_VELOCITY);
+ connect(cutAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(copyAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(pasteAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(deleteAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+
+ signalMapper->setMapping(cutAction, DrumCanvas::CMD_CUT);
+ signalMapper->setMapping(copyAction, DrumCanvas::CMD_COPY);
+ signalMapper->setMapping(pasteAction, DrumCanvas::CMD_PASTE);
+ signalMapper->setMapping(deleteAction, DrumCanvas::CMD_DEL);
- menuSelect = new Q3PopupMenu(this);
- menuSelect->insertItem(tr("Select All"), DrumCanvas::CMD_SELECT_ALL);
- menuSelect->insertItem(tr("Select None"), DrumCanvas::CMD_SELECT_NONE);
- menuSelect->insertItem(tr("Invert"), DrumCanvas::CMD_SELECT_INVERT);
+ menuSelect = menuEdit->addMenu(QIcon(*selectIcon), tr("&Select"));
+
+ sallAction = menuSelect->addAction(QIcon(*select_allIcon), tr("Select All"));
+ snoneAction = menuSelect->addAction(QIcon(*select_deselect_allIcon), tr("Select None"));
+ invAction = menuSelect->addAction(QIcon(*select_invert_selectionIcon), tr("Invert"));
menuSelect->insertSeparator();
- menuSelect->insertItem(tr("Inside Loop"), DrumCanvas::CMD_SELECT_ILOOP);
- menuSelect->insertItem(tr("Outside Loop"), DrumCanvas::CMD_SELECT_OLOOP);
+ inAction = menuSelect->addAction(QIcon(*select_inside_loopIcon), tr("Inside Loop"));
+ outAction = menuSelect->addAction(QIcon(*select_outside_loopIcon), tr("Outside Loop"));
menuSelect->insertSeparator();
- menuSelect->insertItem(tr("Previous Part"), DrumCanvas::CMD_SELECT_PREV_PART);
- menuSelect->insertItem(tr("Next Part"), DrumCanvas::CMD_SELECT_NEXT_PART);
-
- menuEdit->insertItem(tr("&Select"), menuSelect);
+ prevAction = menuSelect->addAction(QIcon(*select_all_parts_on_trackIcon), tr("Previous Part"));
+ nextAction = menuSelect->addAction(QIcon(*select_all_parts_on_trackIcon), tr("Next Part"));
+
+ connect(sallAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(snoneAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(invAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(inAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(outAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(prevAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(nextAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+
+ signalMapper->setMapping(sallAction, DrumCanvas::CMD_SELECT_ALL);
+ signalMapper->setMapping(snoneAction, DrumCanvas::CMD_SELECT_NONE);
+ signalMapper->setMapping(invAction, DrumCanvas::CMD_SELECT_INVERT);
+ signalMapper->setMapping(inAction, DrumCanvas::CMD_SELECT_ILOOP);
+ signalMapper->setMapping(outAction, DrumCanvas::CMD_SELECT_OLOOP);
+ signalMapper->setMapping(prevAction, DrumCanvas::CMD_SELECT_PREV_PART);
+ signalMapper->setMapping(nextAction, DrumCanvas::CMD_SELECT_NEXT_PART);
+
+ // Functions
+ menuFunctions = new QMenu(tr("&Functions"));
+ menuBar()->addMenu(menuFunctions);
+ menuFunctions->insertTearOffHandle();
+ fixedAction = menuFunctions->addAction(tr("Set fixed length"));
+ veloAction = menuFunctions->addAction(tr("Modify Velocity"));
+
+ connect(fixedAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(veloAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
- Q3PopupMenu* menuScriptPlugins = new Q3PopupMenu(this);
+ signalMapper->setMapping(fixedAction, DrumCanvas::CMD_FIXED_LEN);
+ signalMapper->setMapping(veloAction, DrumCanvas::CMD_MODIFY_VELOCITY);
+
+ QMenu* menuScriptPlugins = new QMenu(tr("&Plugins"));
song->populateScriptMenu(menuScriptPlugins, this);
- menuBar()->insertItem(tr("&Plugins"), menuScriptPlugins);
+ menuBar()->addMenu(menuScriptPlugins);
- connect(menuFile, SIGNAL(activated(int)), SLOT(cmd(int)));
- connect(menuEdit, SIGNAL(activated(int)), SLOT(cmd(int)));
- connect(menuSelect, SIGNAL(activated(int)), SLOT(cmd(int)));
- connect(menuFunctions, SIGNAL(activated(int)), SLOT(cmd(int)));
+ connect(signalMapper, SIGNAL(mapped(int)), SLOT(cmd(int)));
//---------------------------------------------------
// Toolbars
@@ -241,7 +242,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
connect(sdm, SIGNAL(clicked()), SLOT(save()));
tools->addWidget(sdm);
- tools->addAction(QWhatsThis::createAction(this));
+ tools->addAction(QWhatsThis::createAction());
tools->addSeparator();
tools->addActions(undoRedo->actions());
@@ -282,7 +283,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
//---------------------------------------------------
split1 = new Splitter(Qt::Vertical, mainw, "split1");
- QPushButton* ctrl = new QPushButton(tr("ctrl"), mainw, "Ctrl");
+ QPushButton* ctrl = new QPushButton(tr("ctrl"), mainw);
ctrl->setFont(config.fonts[3]);
hscroll = new ScrollScale(-25, -2, xscale, 20000, Qt::Horizontal, mainw);
ctrl->setFixedSize(40, hscroll->sizeHint().height());
@@ -302,8 +303,8 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
// mainGrid->addItem(new QSpacerItem(0, hscroll->sizeHint().height()), 1, 0);
split2 = new Splitter(Qt::Horizontal, split1, "split2");
- split1w1 = new QWidget(split2, "split1w1");
- QWidget* split1w2 = new QWidget(split2, "split1w2");
+ split1w1 = new QWidget(split2);
+ QWidget* split1w2 = new QWidget(split2);
QGridLayout* gridS1 = new QGridLayout(split1w1);
QGridLayout* gridS2 = new QGridLayout(split1w2);
gridS1->setContentsMargins(0, 0, 0, 0);
@@ -339,23 +340,24 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
//
// Reihenfolge in dlist.c festgeschrieben ("Dcols")
//
- header = new Header(split1w1, "header");
- header->setFixedHeight(30);
+ header = new HeaderNew(split1w1, "header");
+ header->setFixedHeight(31);
header->addLabel(tr("M"), 20);
- header->addLabel(tr("Sound"), 100);
+ header->addLabel(tr("Sound"), 120);
header->addLabel(tr("Vol"));
- header->addLabel(tr("QNT"));
- header->addLabel(tr("E-Note"));
+ header->addLabel(tr("QNT"), 30);
+ header->addLabel(tr("E-Note"), 50);
header->addLabel(tr("Len"));
- header->addLabel(tr("A-Note"));
+ header->addLabel(tr("A-Note"), 50);
header->addLabel(tr("Ch"));
- header->addLabel(tr("Port"), 60);
+ header->addLabel(tr("Port"), 70);
header->addLabel(tr("LV1"));
header->addLabel(tr("LV2"));
header->addLabel(tr("LV3"));
header->addLabel(tr("LV4"));
- new DHeaderTip(header);
- new DWhatsThis(header, header);
+
+ setHeaderToolTips();
+ setHeaderWhatsThis();
dlist = new DList(header, split1w1, yscale);
// p3.3.44
@@ -1153,22 +1155,25 @@ void DrumEdit::keyPressEvent(QKeyEvent* event)
void DrumEdit::initShortcuts()
{
- menuEdit->setAccel(shortcuts[SHRT_CUT].key, DrumCanvas::CMD_CUT);
- menuEdit->setAccel(shortcuts[SHRT_COPY].key, DrumCanvas::CMD_COPY);;
- menuEdit->setAccel(shortcuts[SHRT_PASTE].key, DrumCanvas::CMD_PASTE);
- menuEdit->setAccel(shortcuts[SHRT_DELETE].key, DrumCanvas::CMD_DEL);
- menuFile->setAccel(shortcuts[SHRT_OPEN].key, DrumCanvas::CMD_LOAD);
- menuFile->setAccel(shortcuts[SHRT_SAVE].key, DrumCanvas::CMD_SAVE);
- menuFunctions->setAccel(shortcuts[SHRT_FIXED_LEN].key, DrumCanvas::CMD_FIXED_LEN);
- menuFunctions->setAccel(shortcuts[SHRT_MODIFY_VELOCITY].key, DrumCanvas::CMD_MODIFY_VELOCITY);
- menuSelect->setAccel(shortcuts[SHRT_SELECT_ALL].key, DrumCanvas::CMD_SELECT_ALL);
- menuSelect->setAccel(shortcuts[SHRT_SELECT_NONE].key, DrumCanvas::CMD_SELECT_NONE);
- menuSelect->setAccel(shortcuts[SHRT_SELECT_INVERT].key, DrumCanvas::CMD_SELECT_INVERT);
- menuSelect->setAccel(shortcuts[SHRT_SELECT_ILOOP].key, DrumCanvas::CMD_SELECT_ILOOP);
- menuSelect->setAccel(shortcuts[SHRT_SELECT_OLOOP].key, DrumCanvas::CMD_SELECT_OLOOP);
+ loadAction->setAccel(shortcuts[SHRT_OPEN].key);
+ saveAction->setAccel(shortcuts[SHRT_SAVE].key);
+
+ cutAction->setAccel(shortcuts[SHRT_CUT].key);
+ copyAction->setAccel(shortcuts[SHRT_COPY].key);
+ pasteAction->setAccel(shortcuts[SHRT_PASTE].key);
+ deleteAction->setAccel(shortcuts[SHRT_DELETE].key);
+
+ fixedAction->setAccel(shortcuts[SHRT_FIXED_LEN].key);
+ veloAction->setAccel(shortcuts[SHRT_MODIFY_VELOCITY].key);
+
+ sallAction->setAccel(shortcuts[SHRT_SELECT_ALL].key);
+ snoneAction->setAccel(shortcuts[SHRT_SELECT_NONE].key);
+ invAction->setAccel(shortcuts[SHRT_SELECT_INVERT].key);
+ inAction->setAccel(shortcuts[SHRT_SELECT_ILOOP].key);
+ outAction->setAccel(shortcuts[SHRT_SELECT_OLOOP].key);
- menuSelect->setAccel(shortcuts[SHRT_SELECT_PREV_PART].key, DrumCanvas::CMD_SELECT_PREV_PART);
- menuSelect->setAccel(shortcuts[SHRT_SELECT_NEXT_PART].key, DrumCanvas::CMD_SELECT_NEXT_PART);
+ prevAction->setAccel(shortcuts[SHRT_SELECT_PREV_PART].key);
+ nextAction->setAccel(shortcuts[SHRT_SELECT_NEXT_PART].key);
}
//---------------------------------------------------------
diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h
index affb0b19..39f68deb 100644
--- a/muse2/muse/midiedit/drumedit.h
+++ b/muse2/muse/midiedit/drumedit.h
@@ -8,17 +8,6 @@
#ifndef __DRUM_EDIT_H__
#define __DRUM_EDIT_H__
-#include <QWidget>
-//#include <q3mainwindow.h>
-#include <QToolTip>
-#include <q3whatsthis.h>
-//Added by qt3to4:
-#include <QResizeEvent>
-#include <QLabel>
-#include <QKeyEvent>
-#include <Q3PopupMenu>
-#include <QCloseEvent>
-
#include <values.h>
#include "midieditor.h"
#include "noteinfo.h"
@@ -28,19 +17,23 @@
#include "shortcuts.h"
#include "event.h"
-class MidiPart;
+class QCloseEvent;
class QLabel;
+class QMenu;
+class QKeyEvent;
+class QResizeEvent;
+class QWidget;
+
+class MidiPart;
class DrumCanvas;
class ScrollScale;
class ScoreConfig;
-class QToolButton;
class MTScale;
class Splitter;
class PartList;
class Toolbar1;
class CtrlCanvas;
class Xml;
-class Q3PopupMenu;
class DList;
class Header;
class CtrlEdit;
@@ -48,32 +41,6 @@ class Part;
class SNode;
//---------------------------------------------------------
-// DWhatsThis
-//---------------------------------------------------------
-
-class DWhatsThis : public Q3WhatsThis {
- Header* header;
- protected:
- QString text(const QPoint&);
- public:
- DWhatsThis(QWidget* parent, Header* h) : Q3WhatsThis(parent) {
- header = h;
- }
- };
-
-//----------------------------------------------------------
-// DHeaderTip
-//----------------------------------------------------------
-
-class DHeaderTip { // : public QToolTip { ddskrjo
- public:
- DHeaderTip(QWidget * parent) {} // : QToolTip(parent) {} ddskrjo
- virtual ~DHeaderTip(){}
- protected:
- void maybeTip(const QPoint &);
- };
-
-//---------------------------------------------------------
// DrumEdit
//---------------------------------------------------------
@@ -81,7 +48,7 @@ class DrumEdit : public MidiEditor {
Event selEvent;
MidiPart* selPart;
int selTick;
- Q3PopupMenu* menuEdit, *menuFunctions, *menuFile, *menuSelect;
+ QMenu* menuEdit, *menuFunctions, *menuFile, *menuSelect;
NoteInfo* info;
QToolButton* srec;
@@ -93,7 +60,7 @@ class DrumEdit : public MidiEditor {
Splitter* split2;
QWidget* split1w1;
DList* dlist;
- Header* header;
+ HeaderNew* header;
QToolBar* tools;
static int _quantInit, _rasterInit;
@@ -101,6 +68,13 @@ class DrumEdit : public MidiEditor {
static int _dlistWidthInit, _dcanvasWidthInit;
static int _toInit; //Used in function dialog for applying modification to selection
+
+ QAction *loadAction, *saveAction, *resetAction;
+ QAction *cutAction, *copyAction, *pasteAction, *deleteAction;
+ QAction *fixedAction, *veloAction;
+ QAction *sallAction, *snoneAction, *invAction, *inAction , *outAction;
+ QAction *prevAction, *nextAction;
+
Q_OBJECT
void initShortcuts();
@@ -109,7 +83,8 @@ class DrumEdit : public MidiEditor {
virtual void resizeEvent(QResizeEvent*);
virtual void keyPressEvent(QKeyEvent*);
int _to;//TODO: Make this work
-
+ void setHeaderToolTips();
+ void setHeaderWhatsThis();
private slots:
void setRaster(int);
diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp
index 6cbf9c3a..fe53b16e 100644
--- a/muse2/muse/widgets/header.cpp
+++ b/muse2/muse/widgets/header.cpp
@@ -9,6 +9,9 @@
#include "xml.h"
#include <qstringlist.h>
+
+#include <QStandardItemModel>
+
//---------------------------------------------------------
// readStatus
//---------------------------------------------------------
@@ -60,3 +63,105 @@ void Header::writeStatus(int level, Xml& xml) const
xml.put("</%s>", Xml::xmlString(name()).latin1());
}
+
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void HeaderNew::readStatus(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::Text:
+ {
+ QStringList l = QStringList::split(QString(" "), tag);
+ int index = count();
+ for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ int section = (*it).toInt();
+ moveSection(section, index);
+ --index;
+ }
+ }
+ break;
+ case Xml::TagStart:
+ xml.unknown("Header");
+ break;
+ case Xml::TagEnd:
+ if (tag == name())
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+void HeaderNew::writeStatus(int level, Xml& xml) const
+ {
+ //xml.nput(level, "<%s> ", name());
+ xml.nput(level, "<%s> ", Xml::xmlString(name()).latin1());
+ int n = count() - 1;
+ for (int i = n; i >= 0; --i)
+ xml.nput("%d ", visualIndex(i));
+ //xml.put("</%s>", name());
+ xml.put("</%s>", Xml::xmlString(name()).latin1());
+ }
+
+//---------------------------------------------------------
+// writeStatus
+//---------------------------------------------------------
+
+HeaderNew::HeaderNew(QWidget* parent, const char* name)
+ : QHeaderView(Qt::Horizontal, parent)
+ {
+ setObjectName(name);
+ itemModel = new QStandardItemModel;
+ setModel(itemModel);
+ columncount = 0;
+ //setResizeMode(QHeaderView::ResizeToContents);
+ setDefaultSectionSize(30);
+ }
+
+//---------------------------------------------------------
+// addLabel
+//---------------------------------------------------------
+
+int HeaderNew::addLabel(const QString & text, int size )
+ {
+ QStandardItem *sitem = new QStandardItem(text );
+ itemModel->setHorizontalHeaderItem(columncount, sitem);
+ if (size > -1)
+ resizeSection(columncount, size);
+
+ return columncount++;
+ }
+
+//---------------------------------------------------------
+// setToolTip
+//---------------------------------------------------------
+
+void HeaderNew::setToolTip(int col, const QString &text)
+ {
+ QStandardItem *item = itemModel->horizontalHeaderItem(col);
+ item->setToolTip(text);
+ }
+
+//---------------------------------------------------------
+// setWhatsThis
+//---------------------------------------------------------
+
+void HeaderNew::setWhatsThis(int col, const QString &text)
+ {
+ QStandardItem *item = itemModel->horizontalHeaderItem(col);
+ item->setWhatsThis(text);
+ }
+
diff --git a/muse2/muse/widgets/header.h b/muse2/muse/widgets/header.h
index 11b69b66..850b6676 100644
--- a/muse2/muse/widgets/header.h
+++ b/muse2/muse/widgets/header.h
@@ -10,6 +10,9 @@
#include <q3header.h>
+class QHeaderView;
+class QStandardItemModel;
+
class Xml;
//---------------------------------------------------------
@@ -27,4 +30,25 @@ class Header : public Q3Header {
void writeStatus(int level, Xml&) const;
void readStatus(Xml&);
};
+
+
+// ORCAN - TODO: Once everything is ported to use the new class below, we
+// can remove the above Qt3 based class.
+
+class HeaderNew : public QHeaderView {
+ Q_OBJECT
+
+ QStandardItemModel *itemModel;
+ int columncount;
+
+ public:
+ HeaderNew(QWidget* parent=0, const char* name=0);
+ void writeStatus(int level, Xml&) const;
+ void readStatus(Xml&);
+ int addLabel ( const QString & s, int size = -1 );
+ void setToolTip(int col, const QString &text);
+ void setWhatsThis(int col, const QString &text);
+};
+
#endif
+