diff options
author | Orcan Ogetbil <oget.fedora@gmail.com> | 2011-09-15 04:13:10 +0000 |
---|---|---|
committer | Orcan Ogetbil <oget.fedora@gmail.com> | 2011-09-15 04:13:10 +0000 |
commit | 3859b10f9a5eaca7df8f85394756375af0b17a1c (patch) | |
tree | 4ed55ccfbc5691a212e2a995982db7cf662541c8 /muse2 | |
parent | d020b82fd8108351eacb56a2d0c39f149a1c5057 (diff) |
New namespaces and change in default colors. See ChangeLog.
Diffstat (limited to 'muse2')
35 files changed, 296 insertions, 172 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 51ef9e30..960d558f 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -4,6 +4,13 @@ - added MDI-like and borland-like user interface (flo93) - improved pasting, added dialogs, added "copy in range", changed shortcut keys (flo93) + - New namespaces MusEArranger and MusEMixer. (Orcan) + - Updated default track colors on arranger. Indicate the selected track with a gradient instead of a + separate color. (Orcan) + - moved colorRect() and get_paste_len() into utils.cpp. (Orcan) + - Updated default colors of transport handles, bigtime foreground, waveedit background, track labels. + Made them more pastelish, easier on eyes. (Orcan) + - Made horizontal alignment of meter and slider in mstrip consistent with in astrip. (Orcan) 13.09.2011: *Added: You can now insert new tracks instead of always at the track list end. (Tim) If main menu 'Add track': Inserts before currently selected track, else adds at end. diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 773e550f..3d52e4f2 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -925,7 +925,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() connect(windowsCascadeAction, SIGNAL(activated()), mdiArea, SLOT(cascadeSubWindows())); - arrangerView = new ArrangerView(this); + arrangerView = new MusEArranger::ArrangerView(this); arrangerView->shareToolsAndMenu(true); connect(arrangerView, SIGNAL(closed()), SLOT(arrangerClosed())); toplevels.push_back(arrangerView); @@ -2943,7 +2943,7 @@ void MusE::bigtimeClosed() void MusE::showMixer1(bool on) { if (on && mixer1 == 0) { - mixer1 = new AudioMixerApp(this, &(MusEConfig::config.mixer1)); + mixer1 = new MusEMixer::AudioMixerApp(this, &(MusEConfig::config.mixer1)); connect(mixer1, SIGNAL(closed()), SLOT(mixer1Closed())); mixer1->resize(MusEConfig::config.mixer1.geometry.size()); mixer1->move(MusEConfig::config.mixer1.geometry.topLeft()); @@ -2960,7 +2960,7 @@ void MusE::showMixer1(bool on) void MusE::showMixer2(bool on) { if (on && mixer2 == 0) { - mixer2 = new AudioMixerApp(this, &(MusEConfig::config.mixer2)); + mixer2 = new MusEMixer::AudioMixerApp(this, &(MusEConfig::config.mixer2)); connect(mixer2, SIGNAL(closed()), SLOT(mixer2Closed())); mixer2->resize(MusEConfig::config.mixer2.geometry.size()); mixer2->move(MusEConfig::config.mixer2.geometry.topLeft()); diff --git a/muse2/muse/app.h b/muse2/muse/app.h index 3bde68e1..50064f96 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -56,23 +56,30 @@ class ShortcutConfig; class VisibleTracks; } +namespace MusEArranger { +class Arranger; +class ArrangerView; +} + class Part; class PartList; class Transport; -class Arranger; class Instrument; class Track; class PrinterConfig; class MRConfig; class AudioConf; class Xml; + +namespace MusEMixer { class AudioMixerApp; +} + class ClipListEdit; class AudioRecord; class MidiFileConfig; class MidiFilterConfig; class MarkerView; -class ArrangerView; class GlobalSettingsConfig; class MidiControllerEditDialog; class MidiInputTransformDialog; @@ -202,14 +209,14 @@ class MusE : public QMainWindow MidiInputTransformDialog* midiInputTransform; MusEWidget::ShortcutConfig* shortcutConfig; Appearance* appearance; - AudioMixerApp* mixer1; - AudioMixerApp* mixer2; + MusEMixer::AudioMixerApp* mixer1; + MusEMixer::AudioMixerApp* mixer2; - Arranger* _arranger; + MusEArranger::Arranger* _arranger; ToplevelList toplevels; ClipListEdit* clipListEdit; MarkerView* markerView; - ArrangerView* arrangerView; + MusEArranger::ArrangerView* arrangerView; MidiTransformerDialog* midiTransformerDialog; QMenu* openRecent; @@ -377,7 +384,7 @@ class MusE : public QMainWindow public: MusE(int argc, char** argv); ~MusE(); - Arranger* arranger() { return _arranger; } + MusEArranger::Arranger* arranger() { return _arranger; } QRect configGeometryMain; QProgressDialog *progress; bool importMidi(const QString name, bool merge); diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp index 835ced81..b49b951b 100644 --- a/muse2/muse/appearance.cpp +++ b/muse2/muse/appearance.cpp @@ -116,7 +116,7 @@ class IdListViewItem : public QTreeWidgetItem { // Appearance //--------------------------------------------------------- -Appearance::Appearance(Arranger* a, QWidget* parent) +Appearance::Appearance(MusEArranger::Arranger* a, QWidget* parent) : QDialog(parent, Qt::Window) { setupUi(this); diff --git a/muse2/muse/appearance.h b/muse2/muse/appearance.h index 5193f679..2020d199 100644 --- a/muse2/muse/appearance.h +++ b/muse2/muse/appearance.h @@ -29,7 +29,9 @@ class QColor; class QDialog; class MusE; +namespace MusEArranger { class Arranger; +} namespace MusEConfig { class GlobalConfigValues; } @@ -43,7 +45,7 @@ class Appearance : public QDialog, public Ui::AppearanceDialogBase { Q_OBJECT private: - Arranger* arr; + MusEArranger::Arranger* arr; QColor* color; MusEConfig::GlobalConfigValues* config; QButtonGroup* aPalette; @@ -88,7 +90,7 @@ class Appearance : public QDialog, public Ui::AppearanceDialogBase { void colorNameEditFinished(); public: - Appearance(Arranger*, QWidget* parent=0); + Appearance(MusEArranger::Arranger*, QWidget* parent=0); ~Appearance(); void resetValues(); }; diff --git a/muse2/muse/arranger/alayout.cpp b/muse2/muse/arranger/alayout.cpp index f316dec9..2c2ee719 100644 --- a/muse2/muse/arranger/alayout.cpp +++ b/muse2/muse/arranger/alayout.cpp @@ -25,6 +25,8 @@ #include <QScrollBar> +namespace MusEArranger { + //--------------------------------------------------------- // wadd //--------------------------------------------------------- @@ -213,3 +215,5 @@ void TLLayout::clear() delete child; } } + +} // namespace MusEArranger diff --git a/muse2/muse/arranger/alayout.h b/muse2/muse/arranger/alayout.h index 88f03e7a..fe41eeb2 100644 --- a/muse2/muse/arranger/alayout.h +++ b/muse2/muse/arranger/alayout.h @@ -29,6 +29,8 @@ class QLayoutItem; class QScrollBar; +namespace MusEArranger { + class WidgetStack; //--------------------------------------------------------- @@ -72,4 +74,7 @@ class TLLayout : public QLayout virtual QLayoutItem* takeAt(int); // { return 0;} // ddskrjo, is pure virtual, overridden ///virtual int count() const { return ilist.count(); } // ddskrjo, is pure virtual, overridden }; + +} // namespace MusEArranger + #endif diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index 09e67151..1900b622 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -70,6 +70,8 @@ #include "spinbox.h" #include "shortcuts.h" +namespace MusEArranger { + //--------------------------------------------------------- // Arranger::setHeaderToolTips //--------------------------------------------------------- @@ -595,7 +597,7 @@ void Arranger::songChanged(int type) if(type & SC_TRACK_REMOVED) { - AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2)); + MusEMixer::AudioStrip* w = (MusEMixer::AudioStrip*)(trackInfo->getWidget(2)); //AudioStrip* w = (AudioStrip*)(trackInfo->widget(2)); if(w) { @@ -954,7 +956,7 @@ QSize WidgetStack::minimumSizeHint() const void Arranger::clear() { - AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2)); + MusEMixer::AudioStrip* w = (MusEMixer::AudioStrip*)(trackInfo->getWidget(2)); if (w) delete w; trackInfo->addWidget(0, 2); @@ -1054,11 +1056,11 @@ void Arranger::updateTrackInfo(int flags) void Arranger::switchInfo(int n) { if (n == 2) { - AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2)); + MusEMixer::AudioStrip* w = (MusEMixer::AudioStrip*)(trackInfo->getWidget(2)); if (w == 0 || selected != w->getTrack()) { if (w) delete w; - w = new AudioStrip(trackInfo, (AudioTrack*)selected); + w = new MusEMixer::AudioStrip(trackInfo, (AudioTrack*)selected); //w->setFocusPolicy(Qt::TabFocus); // p4.0.9 connect(song, SIGNAL(songChanged(int)), w, SLOT(songChanged(int))); connect(MusEGlobal::muse, SIGNAL(configChanged()), w, SLOT(configChanged())); @@ -1138,3 +1140,5 @@ void Arranger::horizontalZoomOut() hscroll->setMag(newmag); } + +} // namespace MusEArranger diff --git a/muse2/muse/arranger/arranger.h b/muse2/muse/arranger/arranger.h index 1e3943be..f65c69a6 100644 --- a/muse2/muse/arranger/arranger.h +++ b/muse2/muse/arranger/arranger.h @@ -39,12 +39,13 @@ class QWheelEvent; class QKeyEvent; //class QStackedWidget; -class TList; class Track; class Xml; -class TLLayout; class WidgetStack; + +namespace MusEMixer { class AudioStrip; +} namespace MusEWidget { class Header; @@ -57,7 +58,10 @@ class Splitter; class SpinBox; } +namespace MusEArranger { class ArrangerView; +class TList; +class TLLayout; //--------------------------------------------------------- // WidgetStack @@ -101,7 +105,7 @@ class Arranger : public QWidget { QScrollBar* infoScroll; //MidiTrackInfoBase* midiTrackInfo; MusEWidget::MidiTrackInfo* midiTrackInfo; - AudioStrip* waveTrackInfo; + MusEMixer::AudioStrip* waveTrackInfo; QWidget* noTrackInfo; TLLayout* tgrid; @@ -193,5 +197,7 @@ class Arranger : public QWidget { ArrangerView* parentWin; }; +} // namespace MusEArranger + #endif diff --git a/muse2/muse/arranger/arrangerview.cpp b/muse2/muse/arranger/arrangerview.cpp index 0cc75db9..db1a9778 100644 --- a/muse2/muse/arranger/arrangerview.cpp +++ b/muse2/muse/arranger/arrangerview.cpp @@ -68,6 +68,7 @@ #include "visibletracks.h" #include "xml.h" +namespace MusEArranger { //--------------------------------------------------------- // ArrangerView @@ -724,3 +725,5 @@ void ArrangerView::updateVisibleTracksButtons() void ArrangerView::globalCut() { ::globalCut(); } void ArrangerView::globalInsert() { ::globalInsert(); } void ArrangerView::globalSplit() { ::globalSplit(); } + +} // namespace MusEArranger diff --git a/muse2/muse/arranger/arrangerview.h b/muse2/muse/arranger/arrangerview.h index bdb450ae..20655840 100644 --- a/muse2/muse/arranger/arrangerview.h +++ b/muse2/muse/arranger/arrangerview.h @@ -55,6 +55,7 @@ namespace MusEWidget { class VisibleTracks; } +namespace MusEArranger { class ArrangerView : public TopWin { @@ -149,8 +150,7 @@ class ArrangerView : public TopWin static void writeConfiguration(int, Xml&); }; - - +} // namespace MusEArranger #endif diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 056dcce7..10cd9735 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -34,7 +34,7 @@ #include <QLineEdit> #include <QMenu> #include <QMessageBox> -#include <QPainter> +//#include <QPainter> #include <QUrl> #include <QPoint> @@ -48,7 +48,7 @@ #include "globals.h" #include "icons.h" #include "event.h" -#include "xml.h" +//#include "xml.h" #include "wave.h" #include "audio.h" #include "shortcuts.h" @@ -70,24 +70,7 @@ using std::set; -int get_paste_len(); - -//--------------------------------------------------------- -// colorRect -// paints a rectangular icon with a given color -//--------------------------------------------------------- - -QIcon colorRect(const QColor& color, int width, int height) { - QPainter painter; - QPixmap image(width, height); - painter.begin(&image); - painter.setBrush(color); - QRect rectangle(0, 0, width, height); - painter.drawRect(rectangle); - painter.end(); - QIcon icon(image); - return icon; -} +namespace MusEArranger { //--------------------------------------------------------- // NPart @@ -646,7 +629,7 @@ QMenu* PartCanvas::genItemPopup(MusEWidget::CItem* item) // part color selection for (int i = 0; i < NUM_PARTCOLORS; ++i) { - QAction *act_color = colorPopup->addAction(colorRect(MusEConfig::config.partColors[i], 80, 80), MusEConfig::config.partColorNames[i]); + QAction *act_color = colorPopup->addAction(MusEUtil::colorRect(MusEConfig::config.partColors[i], 80, 80), MusEConfig::config.partColorNames[i]); act_color->setData(20+i); } @@ -2623,7 +2606,7 @@ void PartCanvas::cmd(int cmd) case CMD_PASTE_CLONE_DIALOG: { unsigned temp_begin = AL::sigmap.raster1(song->vcpos(),0); - unsigned temp_end = AL::sigmap.raster2(temp_begin + get_paste_len(), 0); + unsigned temp_end = AL::sigmap.raster2(temp_begin + MusEUtil::get_paste_len(), 0); paste_dialog->raster = temp_end - temp_begin; paste_dialog->clone = (cmd == CMD_PASTE_CLONE_DIALOG); @@ -2805,86 +2788,6 @@ void PartCanvas::copy(PartList* pl) } - -int get_paste_len() -{ - QClipboard* cb = QApplication::clipboard(); - const QMimeData* md = cb->mimeData(QClipboard::Clipboard); - - QString pfx("text/"); - QString mdpl("x-muse-midipartlist"); - QString wvpl("x-muse-wavepartlist"); - QString mxpl("x-muse-mixedpartlist"); - QString txt; - - if(md->hasFormat(pfx + mdpl)) - txt = cb->text(mdpl, QClipboard::Clipboard); - else if(md->hasFormat(pfx + wvpl)) - txt = cb->text(wvpl, QClipboard::Clipboard); - else if(md->hasFormat(pfx + mxpl)) - txt = cb->text(mxpl, QClipboard::Clipboard); - else - return 0; - - - QByteArray ba = txt.toLatin1(); - const char* ptxt = ba.constData(); - Xml xml(ptxt); - bool end = false; - - unsigned begin_tick=-1; //this uses the greatest possible begin_tick - unsigned end_tick=0; - - for (;;) - { - Xml::Token token = xml.parse(); - const QString& tag = xml.s1(); - switch (token) - { - case Xml::Error: - case Xml::End: - end = true; - break; - - case Xml::TagStart: - if (tag == "part") - { - Part* p = 0; - p = readXmlPart(xml, NULL, false, false); - - if (p) - { - if (p->tick() < begin_tick) - begin_tick=p->tick(); - - if (p->endTick() > end_tick) - end_tick=p->endTick(); - - delete p; - } - } - else - xml.unknown("PartCanvas::get_paste_len"); - break; - - case Xml::TagEnd: - break; - - default: - end = true; - break; - } - if(end) - break; - } - - if (begin_tick > end_tick) - return 0; - else - return end_tick - begin_tick; -} - - Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool clone, bool toTrack, int* finalPosPtr, set<Track*>* affected_tracks) { Undo operations; @@ -4046,3 +3949,4 @@ void PartCanvas::endMoveItems(const QPoint& pos, DragType dragtype, int dir) redraw(); } +} // namespace MusEArranger diff --git a/muse2/muse/arranger/pcanvas.h b/muse2/muse/arranger/pcanvas.h index 2bce9035..7eec87c6 100644 --- a/muse2/muse/arranger/pcanvas.h +++ b/muse2/muse/arranger/pcanvas.h @@ -36,9 +36,17 @@ class QMouseEvent; class QKeyEvent; class QEvent; class QDragEnterEvent; +class QLineEdit; + +class MidiEditor; +class QMenu; +class Xml; +class CtrlVal; #define beats 4 +namespace MusEArranger { + //--------------------------------------------------------- // NPart // ''visual'' Part @@ -68,12 +76,6 @@ struct AutomationObject { ControllerVals controllerState; }; -class QLineEdit; -class MidiEditor; -class QMenu; -class Xml; -class CtrlVal; - //--------------------------------------------------------- // PartCanvas //--------------------------------------------------------- @@ -176,5 +178,7 @@ class PartCanvas : public MusEWidget::Canvas { void controllerChanged(Track *t); }; +} // namespace MusEArranger + #endif diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 28b12fdc..91c939db 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -67,6 +67,8 @@ #include "dssihost.h" #endif +namespace MusEArranger { + static const int MIN_TRACKHEIGHT = 20; static const int WHEEL_DELTA = 120; QColor collist[] = { Qt::red, Qt::yellow, Qt::blue , Qt::black, Qt::white, Qt::green }; @@ -184,6 +186,14 @@ void TList::paint(const QRect& r) // Tracks //--------------------------------------------------- + QColor mask_edge = QColor(90, 90, 90, 45); + QColor mask_center = QColor(240, 240, 240, 175); + QLinearGradient mask; + mask.setColorAt(0, mask_edge); + mask.setColorAt(0.15, mask_center); + mask.setColorAt(0.3, mask_center); + mask.setColorAt(1, mask_edge); + TrackList* l = song->tracks(); int idx = 0; int yy = -ypos; @@ -201,12 +211,7 @@ void TList::paint(const QRect& r) // clear one row // QColor bg; - if (track->selected()) { - bg = MusEConfig::config.selectTrackBg; - //p.setPen(palette().active().text()); - p.setPen(MusEConfig::config.selectTrackFg); - } - else { + switch(type) { case Track::MIDI: bg = MusEConfig::config.midiTrackBg; @@ -233,10 +238,16 @@ void TList::paint(const QRect& r) bg = MusEConfig::config.synthTrackBg; break; } - p.setPen(palette().color(QPalette::Active, QPalette::Text)); - } + + p.setPen(palette().color(QPalette::Active, QPalette::Text)); p.fillRect(x1, yy, w, trackHeight, bg); + if (track->selected()) { + mask.setStart(QPointF(0, yy)); + mask.setFinalStop(QPointF(0, yy + trackHeight)); + p.fillRect(x1, yy, w, trackHeight, mask); + } + int x = 0; for (int index = 0; index < header->count(); ++index) { int section = header->logicalIndex(index); @@ -1789,3 +1800,4 @@ void TList::classesPopupMenu(Track* t, int x, int y) } } +} // namespace MusEArranger diff --git a/muse2/muse/arranger/tlist.h b/muse2/muse/arranger/tlist.h index 970df420..01b13eb3 100644 --- a/muse2/muse/arranger/tlist.h +++ b/muse2/muse/arranger/tlist.h @@ -46,6 +46,8 @@ class Header; class PopupMenu; } +namespace MusEArranger { + enum TrackColumn { COL_RECORD = 0, COL_MUTE, @@ -140,5 +142,7 @@ class TList : public QWidget { void readStatus(Xml&, const char* name); }; +} // namespace MusEArranger + #endif diff --git a/muse2/muse/arranger/trackautomationview.cpp b/muse2/muse/arranger/trackautomationview.cpp index 343d853f..13973a68 100644 --- a/muse2/muse/arranger/trackautomationview.cpp +++ b/muse2/muse/arranger/trackautomationview.cpp @@ -28,6 +28,8 @@ #include "track.h" +namespace MusEArranger { + TrackAutomationView::TrackAutomationView(QWidget *parent, Track *t) : QWidget(parent) { printf("created trackautomationview\n"); @@ -72,3 +74,5 @@ void TrackAutomationView::collectAutomationData() // CtrlListList cll =((AudioTrack*)_t)->controller(); // cll.count() } + +} // namespace MusEArranger diff --git a/muse2/muse/arranger/trackautomationview.h b/muse2/muse/arranger/trackautomationview.h index 360ea898..f169e968 100644 --- a/muse2/muse/arranger/trackautomationview.h +++ b/muse2/muse/arranger/trackautomationview.h @@ -28,6 +28,8 @@ class QWidget; #include "track.h" +namespace MusEArranger { + class TrackAutomationView : public QWidget { Track *_t; @@ -39,4 +41,6 @@ public: void collectAutomationData(); }; +} // namespace MusEArranger + #endif // TRACKAUTOMATIONVIEW_H diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 6ba4d47d..ac6a7de6 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -917,7 +917,7 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) else if (tag == "marker") MarkerView::readConfiguration(xml); else if (tag == "arrangerview") - ArrangerView::readConfiguration(xml); + MusEArranger::ArrangerView::readConfiguration(xml); else if (tag == "arranger") { if (MusEGlobal::muse && MusEGlobal::muse->arranger()) MusEGlobal::muse->arranger()->readStatus(xml); @@ -1373,7 +1373,7 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const ClipListEdit::writeConfiguration(level, xml); LMaster::writeConfiguration(level, xml); MarkerView::writeConfiguration(level, xml); - ArrangerView::writeConfiguration(level, xml); + MusEArranger::ArrangerView::writeConfiguration(level, xml); write_function_dialog_config(level, xml); diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index deed36b3..7d6dcde6 100644 --- a/muse2/muse/gconfig.cpp +++ b/muse2/muse/gconfig.cpp @@ -83,10 +83,10 @@ GlobalConfigValues config = { QString("Piano"), QString("Saxophone") }, - QColor(0, 0, 255), // transportHandleColor; - QColor(255, 0, 0), // bigTimeForegroundColor; + QColor(51, 114, 178), // transportHandleColor; + QColor(219, 65, 65), // bigTimeForegroundColor; QColor(0, 0, 0), // bigTimeBackgroundColor; - QColor(200, 200, 200), // waveEditBackgroundColor; + QColor(200, 192, 171), // waveEditBackgroundColor; { QFont(QString("arial"), 10, QFont::Normal), QFont(QString("arial"), 8, QFont::Normal), @@ -97,27 +97,27 @@ GlobalConfigValues config = { QFont(QString("arial"), 8, QFont::Bold, true) // Mixer strip labels. Looks and fits better with bold + italic than bold alone, // at the price of only few more pixels than Normal mode. }, - QColor(84, 97, 114), // trackBg; - QColor(0x80, 0xff, 0x80), // selected track Bg; + QColor(84, 97, 114), // trackBg; + QColor(120, 229, 166), // selected track Bg; QColor(0x00, 0x00, 0x00), // selected track Fg; - QColor(0, 160, 255), // midiTrackLabelBg; // Med blue - QColor(0, 160, 255), // drumTrackLabelBg; // Med blue - Qt::magenta, // waveTrackLabelBg; - Qt::green, // outputTrackLabelBg; - Qt::red, // inputTrackLabelBg; - Qt::yellow, // groupTrackLabelBg; - QColor(120, 255, 255), // auxTrackLabelBg; // Light blue - QColor(255, 130, 0), // synthTrackLabelBg; // Med orange + QColor(74, 150, 194), // midiTrackLabelBg; // Med blue + QColor(74, 150, 194), // drumTrackLabelBg; // Med blue + QColor(213, 128, 202), // waveTrackLabelBg; // magenta + QColor(84, 185, 58), // outputTrackLabelBg; // green + QColor(199, 75, 64), // inputTrackLabelBg; // red + QColor(236, 214, 90), // groupTrackLabelBg; // yellow + QColor(161, 234, 242), // auxTrackLabelBg; // Light blue + QColor(229, 157, 101), // synthTrackLabelBg; // Med orange - QColor(220, 220, 220), // midiTrackBg; - QColor(220, 220, 220), // drumTrackBg; - QColor(220, 220, 220), // waveTrackBg; - QColor(189, 220, 193), // outputTrackBg; - QColor(189, 220, 193), // inputTrackBg; - QColor(220, 220, 220), // groupTrackBg; - QColor(220, 220, 220), // auxTrackBg; - QColor(220, 220, 220), // synthTrackBg; + QColor(215, 220, 230), // midiTrackBg; + QColor(215, 220, 230), // drumTrackBg; + QColor(220, 209, 217), // waveTrackBg; + QColor(197, 220, 206), // outputTrackBg; + QColor(220, 214, 206), // inputTrackBg; + QColor(220, 216, 202), // groupTrackBg; + QColor(208, 215, 220), // auxTrackBg; + QColor(220, 211, 202), // synthTrackBg; QColor(98, 124, 168), // part canvas bg QColor(255, 170, 0), // ctrlGraphFg; Medium orange diff --git a/muse2/muse/mixer/amixer.cpp b/muse2/muse/mixer/amixer.cpp index e30524ae..18fe926f 100644 --- a/muse2/muse/mixer/amixer.cpp +++ b/muse2/muse/mixer/amixer.cpp @@ -51,6 +51,7 @@ //typedef std::list<Strip*> StripList; //static StripList stripList; +namespace MusEMixer { /* Nov 16, 2010: After making the strips variable width, we need a way to @@ -596,7 +597,7 @@ void AudioMixerApp::toggleRouteDialog() void AudioMixerApp::showRouteDialog(bool on) { if (on && routingDialog == 0) { - routingDialog = new RouteDialog(this); + routingDialog = new MusEDialog::RouteDialog(this); connect(routingDialog, SIGNAL(closed()), SLOT(routingDialogClosed())); } if (routingDialog) @@ -721,3 +722,4 @@ void AudioMixerApp::write(int level, Xml& xml) xml.etag(level, "Mixer"); } +} // namespace MusEMixer diff --git a/muse2/muse/mixer/amixer.h b/muse2/muse/mixer/amixer.h index 41f1e5e1..5be12659 100644 --- a/muse2/muse/mixer/amixer.h +++ b/muse2/muse/mixer/amixer.h @@ -45,15 +45,20 @@ class Slider; class Knob; class DoubleLabel; class ComboBox; -class RouteDialog; -class Strip; namespace MusEConfig { struct MixerConfig; } +namespace MusEDialog { +class RouteDialog; +} + #define EFX_HEIGHT 16 +namespace MusEMixer { + +class Strip; typedef std::list<Strip*> StripList; //--------------------------------------------------------- @@ -90,7 +95,7 @@ class AudioMixerApp : public QMainWindow { //Strip* master; QHBoxLayout* layout; QMenu* menuView; - RouteDialog* routingDialog; + MusEDialog::RouteDialog* routingDialog; QAction* routingId; int oldAuxsSize; @@ -148,5 +153,7 @@ class AudioMixerApp : public QMainWindow { void clear(); }; +} // namespace MusEMixer + #endif diff --git a/muse2/muse/mixer/astrip.cpp b/muse2/muse/mixer/astrip.cpp index 1aa9ae2b..156017e8 100644 --- a/muse2/muse/mixer/astrip.cpp +++ b/muse2/muse/mixer/astrip.cpp @@ -67,6 +67,8 @@ //#include "popupmenu.h" #include "routepopup.h" +namespace MusEMixer { + /* //--------------------------------------------------------- // minimumSizeHint @@ -229,7 +231,7 @@ void AudioStrip::songChanged(int val) //QLinearGradient gradient(autoType->geometry().topLeft(), autoType->geometry().bottomLeft()); if(track->automationType() == AUTO_TOUCH || track->automationType() == AUTO_WRITE) { - palette.setColor(QPalette::Button, QColor(Qt::red)); + palette.setColor(QPalette::Button, QColor(215, 76, 39)); // red //QColor c(Qt::red); //gradient.setColorAt(0, c); //gradient.setColorAt(1, c.darker()); @@ -238,7 +240,7 @@ void AudioStrip::songChanged(int val) } else if(track->automationType() == AUTO_READ) { - palette.setColor(QPalette::Button, QColor(Qt::green)); + palette.setColor(QPalette::Button, QColor(100, 172, 49)); // green //QColor c(Qt::green); //gradient.setColorAt(0, c); //gradient.setColorAt(1, c.darker()); @@ -1041,3 +1043,4 @@ void AudioStrip::oRoutePressed() pup->exec(QCursor::pos(), track, true); } +} // namespace MusEMixer diff --git a/muse2/muse/mixer/astrip.h b/muse2/muse/mixer/astrip.h index fc25bb9b..72e88cca 100644 --- a/muse2/muse/mixer/astrip.h +++ b/muse2/muse/mixer/astrip.h @@ -43,8 +43,11 @@ class QToolButton; //class PopupMenu; class QButton; class AudioTrack; -class EffectRack; +namespace MusEMixer { + +class EffectRack; + //--------------------------------------------------------- // AudioStrip //--------------------------------------------------------- @@ -113,5 +116,7 @@ class AudioStrip : public Strip { //virtual QSize sizeHint () const; }; +} // namespace MusEMixer + #endif diff --git a/muse2/muse/mixer/mstrip.cpp b/muse2/muse/mixer/mstrip.cpp index d8e09adb..c6832e6b 100644 --- a/muse2/muse/mixer/mstrip.cpp +++ b/muse2/muse/mixer/mstrip.cpp @@ -61,6 +61,8 @@ //#include "popupmenu.h" #include "routepopup.h" +namespace MusEMixer { + enum { KNOB_PAN, KNOB_VAR_SEND, KNOB_REV_SEND, KNOB_CHO_SEND }; //--------------------------------------------------------- @@ -218,8 +220,8 @@ MidiStrip::MidiStrip(QWidget* parent, MidiTrack* t) sliderGrid = new QGridLayout(); sliderGrid->setRowStretch(0, 100); - sliderGrid->addWidget(slider, 0, 0, Qt::AlignRight); - sliderGrid->addWidget(meter[0], 0, 1, Qt::AlignLeft); + sliderGrid->addWidget(slider, 0, 0, Qt::AlignHCenter); + sliderGrid->addWidget(meter[0], 0, 1, Qt::AlignHCenter); grid->addLayout(sliderGrid, _curGridRow++, 0, 1, 2); sl = new MusEWidget::DoubleLabel(0.0, -98.0, 0.0, this); @@ -1028,4 +1030,4 @@ void MidiStrip::oRoutePressed() pup->exec(QCursor::pos(), track, true); } - +} // namespace MusEMixer diff --git a/muse2/muse/mixer/mstrip.h b/muse2/muse/mixer/mstrip.h index 2f0a133d..d8e947f9 100644 --- a/muse2/muse/mixer/mstrip.h +++ b/muse2/muse/mixer/mstrip.h @@ -41,6 +41,7 @@ class TransparentToolButton; class MidiTrack; +namespace MusEMixer { //--------------------------------------------------------- // MidiStrip @@ -94,6 +95,7 @@ class MidiStrip : public Strip { MidiStrip(QWidget* parent, MidiTrack*); }; +} // namespace MusEMixer #endif diff --git a/muse2/muse/mixer/panknob.cpp b/muse2/muse/mixer/panknob.cpp index f645ddf7..9a12d58f 100644 --- a/muse2/muse/mixer/panknob.cpp +++ b/muse2/muse/mixer/panknob.cpp @@ -26,6 +26,8 @@ #include "panknob.h" #include "track.h" +namespace MusEWidget { + //--------------------------------------------------------- // PanKnob //--------------------------------------------------------- @@ -49,4 +51,4 @@ void PanKnob::valueChanged(double val) song->controllerChange(src); } - +} // namespace MusEWidget diff --git a/muse2/muse/mixer/panknob.h b/muse2/muse/mixer/panknob.h index 5fcb2171..7f0d3232 100644 --- a/muse2/muse/mixer/panknob.h +++ b/muse2/muse/mixer/panknob.h @@ -28,6 +28,8 @@ class AudioTrack; +namespace MusEWidget { + //--------------------------------------------------------- // PanKnob //--------------------------------------------------------- @@ -43,5 +45,7 @@ class PanKnob : public Knob { PanKnob(QWidget* parent, AudioTrack*); }; +} // namespace MusEWidget + #endif diff --git a/muse2/muse/mixer/rack.cpp b/muse2/muse/mixer/rack.cpp index fdd80e60..7daf142d 100644 --- a/muse2/muse/mixer/rack.cpp +++ b/muse2/muse/mixer/rack.cpp @@ -46,6 +46,8 @@ #include "plugin.h" #include "filedialog.h" +namespace MusEMixer { + //--------------------------------------------------------- // class EffectRackDelegate //--------------------------------------------------------- @@ -700,3 +702,4 @@ void EffectRack::initPlugin(Xml xml, int idx) } } +} // namespace MusEMixer diff --git a/muse2/muse/mixer/rack.h b/muse2/muse/mixer/rack.h index 65d112e9..2ea053bf 100644 --- a/muse2/muse/mixer/rack.h +++ b/muse2/muse/mixer/rack.h @@ -34,6 +34,8 @@ class QMouseEvent; class AudioTrack; class Xml; +namespace MusEMixer { + //--------------------------------------------------------- // EffectRack //--------------------------------------------------------- @@ -80,5 +82,7 @@ class EffectRack : public QListWidget { }; +} // namespace MusEMixer + #endif diff --git a/muse2/muse/mixer/routedialog.cpp b/muse2/muse/mixer/routedialog.cpp index 53b8d48b..a9441343 100644 --- a/muse2/muse/mixer/routedialog.cpp +++ b/muse2/muse/mixer/routedialog.cpp @@ -32,6 +32,8 @@ #include "audio.h" #include "driver/jackaudio.h" +namespace MusEDialog { + //--------------------------------------------------------- // RouteDialog //--------------------------------------------------------- @@ -199,3 +201,5 @@ void RouteDialog::closeEvent(QCloseEvent* e) emit closed(); e->accept(); } + +} // namespace MusEDialog diff --git a/muse2/muse/mixer/routedialog.h b/muse2/muse/mixer/routedialog.h index d5326ab3..de5dfbc3 100644 --- a/muse2/muse/mixer/routedialog.h +++ b/muse2/muse/mixer/routedialog.h @@ -29,6 +29,8 @@ class QCloseEvent; class QDialog; +namespace MusEDialog { + //--------------------------------------------------------- // RouteDialog //--------------------------------------------------------- @@ -55,5 +57,7 @@ class RouteDialog : public QDialog, public Ui::RouteDialogBase { }; +} // namespace MusEDialog + #endif diff --git a/muse2/muse/mixer/strip.cpp b/muse2/muse/mixer/strip.cpp index 750f1623..e9f92e9b 100644 --- a/muse2/muse/mixer/strip.cpp +++ b/muse2/muse/mixer/strip.cpp @@ -39,6 +39,8 @@ #include "meter.h" #include "utils.h" +namespace MusEMixer { + //--------------------------------------------------------- // setRecordFlag //--------------------------------------------------------- @@ -278,3 +280,4 @@ void Strip::setAutomationType(int t) song->update(SC_AUTOMATION); } +} // namespace MusEMixer diff --git a/muse2/muse/mixer/strip.h b/muse2/muse/mixer/strip.h index 602e6e07..ea4d2693 100644 --- a/muse2/muse/mixer/strip.h +++ b/muse2/muse/mixer/strip.h @@ -44,6 +44,8 @@ class ComboBox; class Meter; } +namespace MusEMixer { + static const int STRIP_WIDTH = 65; //--------------------------------------------------------- @@ -92,5 +94,7 @@ class Strip : public QFrame { void setLabelFont(); }; +} // namespace MusEMixer + #endif diff --git a/muse2/muse/widgets/utils.cpp b/muse2/muse/widgets/utils.cpp index 1ed9001a..c900f3b6 100644 --- a/muse2/muse/widgets/utils.cpp +++ b/muse2/muse/widgets/utils.cpp @@ -26,13 +26,20 @@ #include <sys/time.h> //#include <time.h> +#include <QApplication> #include <QFrame> +#include <QClipboard> #include <QColor> #include <QGradient> +#include <QIcon> #include <QLinearGradient> +#include <QMimeData> +#include <QPainter> #include <QPointF> +#include "part.h" #include "utils.h" +#include "xml.h" namespace MusEUtil { @@ -456,4 +463,99 @@ QPainterPath roundedPath(int x, int y, int w, int h, int xrad, int yrad, Corner return rounded_rect; } +//--------------------------------------------------------- +// colorRect +// paints a rectangular icon with a given color +//--------------------------------------------------------- + +QIcon colorRect(const QColor& color, int width, int height) { + QPainter painter; + QPixmap image(width, height); + painter.begin(&image); + painter.setBrush(color); + QRect rectangle(0, 0, width, height); + painter.drawRect(rectangle); + painter.end(); + QIcon icon(image); + return icon; +} + +int get_paste_len() + { + QClipboard* cb = QApplication::clipboard(); + const QMimeData* md = cb->mimeData(QClipboard::Clipboard); + + QString pfx("text/"); + QString mdpl("x-muse-midipartlist"); + QString wvpl("x-muse-wavepartlist"); + QString mxpl("x-muse-mixedpartlist"); + QString txt; + + if(md->hasFormat(pfx + mdpl)) + txt = cb->text(mdpl, QClipboard::Clipboard); + else if(md->hasFormat(pfx + wvpl)) + txt = cb->text(wvpl, QClipboard::Clipboard); + else if(md->hasFormat(pfx + mxpl)) + txt = cb->text(mxpl, QClipboard::Clipboard); + else + return 0; + + + QByteArray ba = txt.toLatin1(); + const char* ptxt = ba.constData(); + Xml xml(ptxt); + bool end = false; + + unsigned begin_tick=-1; //this uses the greatest possible begin_tick + unsigned end_tick=0; + + for (;;) + { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) + { + case Xml::Error: + case Xml::End: + end = true; + break; + + case Xml::TagStart: + if (tag == "part") + { + Part* p = 0; + p = readXmlPart(xml, NULL, false, false); + + if (p) + { + if (p->tick() < begin_tick) + begin_tick=p->tick(); + + if (p->endTick() > end_tick) + end_tick=p->endTick(); + + delete p; + } + } + else + xml.unknown("PartCanvas::get_paste_len"); + break; + + case Xml::TagEnd: + break; + + default: + end = true; + break; + } + if(end) + break; + } + + if (begin_tick > end_tick) + return 0; + else + return end_tick - begin_tick; +} + } // namespace MusEUtils diff --git a/muse2/muse/widgets/utils.h b/muse2/muse/widgets/utils.h index c6e1ad6b..6e4c8758 100644 --- a/muse2/muse/widgets/utils.h +++ b/muse2/muse/widgets/utils.h @@ -52,6 +52,9 @@ extern double curTime(); extern QPainterPath roundedPath(QRect r, int xrad, int yrad, Corner roundCorner); extern QPainterPath roundedPath(int x, int y, int w, int h, int xrad, int yrad, Corner roundCorner); +extern QIcon colorRect(const QColor& color, int width, int height); +extern int get_paste_len(); + } // namespace MusEUtils #endif |