diff options
| author | Florian Jung <flo@windfisch.org> | 2011-09-27 16:08:57 +0000 | 
|---|---|---|
| committer | Florian Jung <flo@windfisch.org> | 2011-09-27 16:08:57 +0000 | 
| commit | e9e38901f1b0c8b0d4c11f6de37abf7ff6c7234f (patch) | |
| tree | 6db56ee33fda6adce28afc456c4fd84b56180453 /muse2/muse | |
| parent | 5c2eaaf143f517e1a4d52e243a761e479aeb3e5b (diff) | |
| parent | d52fac00567bb85944188f3c946b86b2a420819c (diff) | |
merged with trunk
Diffstat (limited to 'muse2/muse')
68 files changed, 1112 insertions, 479 deletions
| diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 773e550f..9f858bc3 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); @@ -1218,7 +1218,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll              }        else {              QMessageBox::critical(this, QString("MusE"), -               tr("Unknown File Format: ") + ex); +               tr("Unknown File Format: %1").arg(ex));              setUntitledProject();              }        if (!songTemplate) { @@ -1348,7 +1348,7 @@ void MusE::setUntitledProject()        QString name("untitled");        MusEGlobal::museProject = "./"; //QFileInfo(name).absolutePath();        project.setFile(name); -      setWindowTitle(tr("MusE: Song: ") + project.completeBaseName()); +      setWindowTitle(tr("MusE: Song: %1").arg(project.completeBaseName()));        }  //--------------------------------------------------------- @@ -1756,7 +1756,7 @@ bool MusE::saveAs()              ok = save(name, true);              if (ok) {                    project.setFile(name); -                  setWindowTitle(tr("MusE: Song: ") + project.completeBaseName()); +                  setWindowTitle(tr("MusE: Song: %1").arg(project.completeBaseName()));                    addProject(name);                    }              else @@ -2089,6 +2089,12 @@ void MusE::toplevelDeleted(TopWin* tl)        for (iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) {              if (*i == tl) { +                  if (tl == activeTopWin) +                  { +                    activeTopWin=NULL; +                    emit activeTopWinChanged(NULL); +                  } +                                  if (tl == currentMenuSharingTopwin)                      setCurrentMenuSharingTopwin(NULL); @@ -2651,7 +2657,7 @@ MusE::lash_idle_cb ()            int ok = save (ss.toAscii(), false);            if (ok) {              project.setFile(ss.toAscii()); -            setWindowTitle(tr("MusE: Song: ") + project.completeBaseName()); +            setWindowTitle(tr("MusE: Song: %1").arg(project.completeBaseName()));              addProject(ss.toAscii());              MusEGlobal::museProject = QFileInfo(ss.toAscii()).absolutePath();            } @@ -2943,7 +2949,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 +2966,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()); @@ -3096,9 +3102,16 @@ void MusE::activeTopWinChangedSlot(TopWin* win)  {    if (MusEGlobal::debugMsg) printf("ACTIVE TOPWIN CHANGED to '%s' (%p)\n", win ? win->windowTitle().toAscii().data() : "<None>", win); -  if ((win==NULL) || (win->isMdiWin()==false)) +  if ( (win && (win->isMdiWin()==false) && win->sharesToolsAndMenu()) && +       ( (mdiArea->currentSubWindow() != NULL) && (mdiArea->currentSubWindow()->isVisible()==true) ) )    { -    if (MusEGlobal::debugMsg) printf("  that's out of the MDI area\n"); +    if (MusEGlobal::debugMsg) printf("  that's a menu sharing muse window which isn't inside the MDI area.\n"); +    // if a window gets active which a) is a muse window, b) is not a mdi subwin and c) shares menu- and toolbar, +    // then unfocus the MDI area and/or the currently active MDI subwin. otherwise you'll be unable to use win's +    // tools or menu entries, as whenever you click at them, they're replaced by the currently active MDI subwin's +    // menus and toolbars. +    // as unfocusing the MDI area and/or the subwin does not work for some reason, we must do this workaround: +    // simply focus anything in the main window except the mdi area.      menuBar()->setFocus(Qt::MenuBarFocusReason);    } @@ -3286,7 +3299,8 @@ void MusE::bringToFront(QWidget* widget)      win->raise();    } -  activeTopWinChangedSlot(win); +  activeTopWin=win; +  emit activeTopWinChanged(win);  }  void MusE::setFullscreen(bool val) diff --git a/muse2/muse/app.h b/muse2/muse/app.h index 3bde68e1..23f3f4c4 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() const { 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..96ce4c09 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 @@ -137,7 +138,7 @@ ArrangerView::ArrangerView(QWidget* parent)    //-------- Edit Actions    editCutAction = new QAction(QIcon(*editcutIconSet), tr("C&ut"), this);    editCopyAction = new QAction(QIcon(*editcopyIconSet), tr("&Copy"), this); -  editCopyRangeAction = new QAction(QIcon(*editcopyIconSet), tr("&Copy in range"), this); +  editCopyRangeAction = new QAction(QIcon(*editcopyIconSet), tr("Copy in range"), this);    editPasteAction = new QAction(QIcon(*editpasteIconSet), tr("&Paste"), this);    editPasteDialogAction = new QAction(QIcon(*editpasteIconSet), tr("Paste (show dialog)"), this);    editPasteCloneAction = new QAction(QIcon(*editpasteCloneIconSet), tr("Paste c&lone"), this); @@ -379,6 +380,7 @@ void ArrangerView::writeStatus(int level, Xml& xml) const    xml.tag(level++, "arrangerview");    TopWin::writeStatus(level, xml);    xml.intTag(level, "tool", editTools->curTool()); +  arranger->writeStatus(level,xml);    xml.tag(level, "/arrangerview");  } @@ -398,6 +400,8 @@ void ArrangerView::readStatus(Xml& xml)            editTools->set(xml.parseInt());          else if (tag == "topwin")             TopWin::readStatus(xml); +        else if (tag == "arranger")  +          arranger->readStatus(xml);          else            xml.unknown("ArrangerView");          break; @@ -724,3 +728,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..0de8d278 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -3,7 +3,7 @@  //  Linux Music Editor  //    $Id: pcanvas.cpp,v 1.48.2.26 2009/11/22 11:08:33 spamatica Exp $  //  (C) Copyright 1999 Werner Schweer (ws@seh.de) -//  Additions, modifications (C) Copyright 2011 Tim E. Real (terminator356 on users DOT sourceforge DOT net) +//  (C) Copyright 2011 Tim E. Real (terminator356 on users DOT sourceforge DOT net)  //  //  This program is free software; you can redistribute it and/or  //  modify it under the terms of the GNU General Public License @@ -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 @@ -349,7 +332,7 @@ UndoOp PartCanvas::moveItem(MusEWidget::CItem* item, const QPoint& newpos, DragT              ntrack = tracks->size();              if (MusEGlobal::debugMsg)                  printf("PartCanvas::moveItem - add new track\n"); -            Track* newTrack = song->addTrack(type, false);  // Add at end of list. +            Track* newTrack = song->addTrack(type);  // Add at end of list.              if (type == Track::WAVE) {                    WaveTrack* st = (WaveTrack*) track;                    WaveTrack* dt = (WaveTrack*) newTrack; @@ -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);              } @@ -788,7 +771,7 @@ void PartCanvas::itemPopup(MusEWidget::CItem* item, int n, const QPoint& pt)                    {                      Part* p = item->part();                      EventList* el = p->events(); -                    QString str = tr("Part name") + ": " + p->name() + "\n" + tr("Files") + ":"; +                    QString str = tr("Part name: %1\nFiles:").arg(p->name());                      for (iEvent e = el->begin(); e != el->end(); ++e)                       {                        Event event = e->second; @@ -1771,19 +1754,16 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec        //QRect rr = p.transform().mapRect(r);    // Gives inconsistent positions. Source shows wrong operation for our needs.        QRect rr = map(r);                        // Use our own map instead.                                 +      QRect mr = map(rect); +              // Item bounding box x is in tick coordinates, same as rectangle. -      //if(item->bbox().intersect(rect).isNull()) -      //if((item->bbox() & rect).isNull()) -      if((rr & map(rect)).isNull()) +      if((rr & mr).isNull())        {          //printf("PartCanvas::drawItem rectangle is null\n");          return;        } -      //printf("PartCanvas::drawItem called map rx:%d rw:%d  rrx:%d rrw:%d\n", r.x(), r.width(), rr.x(), rr.width());   -      //printf("PartCanvas::drawItem called map rx:%d rw:%d\n", r.x(), r.width());   -       -      p.save(); +      //p.save();        p.setWorldMatrixEnabled(false);        // NOTE: Optimization: For each item, hasHiddenEvents() is called once in Canvas::draw(), and we use cachedHasHiddenEvents(). @@ -1832,6 +1812,15 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec        if(ye_2 < ys_0)          ye_2 = ys_0; +      int mrxs_0 = mr.x(); +      int mrxe_0 = mrxs_0 + mr.width(); +      bool lbt = ((NPart*)item)->leftBorderTouches; +      bool rbt = ((NPart*)item)->rightBorderTouches; +      int lbx = lbt?xs_1:xs_0; +      int rbx = rbt?xe_1:xe_0; +      int lbx_c = lbx < mrxs_0 ? mrxs_0 : lbx; +      int rbx_c = rbx > mrxe_0 ? mrxe_0 : rbx; +              int cidx = part->colorIndex();        if (item->isMoving())         { @@ -1890,8 +1879,11 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec        p.setBrush(brush);        p.setPen(Qt::NoPen); +              if(het)        { +        // TODO: Make this part respect the requested drawing rectangle (rr & mr), for speed ! +                  pts = 0;          if(het == (Part::LeftEventsHidden | Part::RightEventsHidden))          { @@ -2005,7 +1997,8 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec        }          else        { -        p.fillRect(rr, brush); +        //p.fillRect(rr, brush); +        p.fillRect(rr & mr, brush);  // Respect the requested drawing rectangle. Gives speed boost!        }        // Draw a pattern brush on muted parts... @@ -2015,8 +2008,9 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec          //brush.setStyle(Qt::DiagCrossPattern);          brush.setStyle(Qt::Dense7Pattern); -        p.fillRect(rr, brush);                                                         // FIXME: Some shifting going on +        //p.fillRect(rr, brush);                                                       // FIXME: Some shifting going on          //p.fillRect(QRect(rr.x(), rr.y(), rr.width() + 1, rr.height() + 1), brush);   // Same here +        p.fillRect(rr & mr, brush);   // Respect the requested drawing rectangle. Gives speed boost!                                                              }          p.setWorldMatrixEnabled(true); @@ -2052,7 +2046,10 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec          p.setBrush(Qt::NoBrush);          p.drawRect(r); -  #else  +  //#else  +  #endif +   +  #if 1          //          // Now draw the borders, using custom segments...          // @@ -2106,18 +2103,20 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec            penSelect2V.setDashOffset(1.0);              penNormal2V.setDashOffset(1.0);              //penHidden2.setDashPattern(customDashPattern);   +           +          // FIXME: Some shifting still going on. Values likely not quite right here.  +          int xdiff = mrxs_0 - lbx; +          if(xdiff > 0) +          { +            int doff = xdiff % 10; +            penSelect1H.setDashOffset(doff); +            penNormal1H.setDashOffset(doff); +            doff = xdiff % 5; +            penSelect2H.setDashOffset(doff); +            penNormal2H.setDashOffset(doff); +          }          }   -        bool lbt = ((NPart*)item)->leftBorderTouches; -        bool rbt = ((NPart*)item)->rightBorderTouches; -         -        QLine l1(lbt?xs_1:xs_0, ys_0,             rbt?xe_1:xe_0, ys_0);            // Top  -        //QLine l2(rbt?xe_1:xe_0, rbt?ys_1:ys_2,    rbt?xe_1:xe_0, rbt?ye_1:ye_2); // Right  -        QLine l2(rbt?xe_1:xe_0, ys_0,             rbt?xe_1:xe_0, ye_0);            // Right  -        QLine l3(lbt?xs_1:xs_0, ye_0,             rbt?xe_1:xe_0, ye_0);            // Bottom -        //QLine l4(xs_0,          lbt?ys_1:ys_2,    xs_0,          lbt?ye_1:ye_2); // Left -        QLine l4(xs_0,          ys_0,             xs_0,          ye_0);            // Left -                  //if(het & Part::RightEventsHidden)          //  p.setPen(((NPart*)item)->rightBorderTouches ? penHidden1 : penHidden2);           //else   @@ -2127,7 +2126,12 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec            else                p.setPen(part->selected() ? penSelect2V : penNormal2V);           }   -        p.drawLine(l2);        // Right line +         +        if(rbx >= mrxs_0 && rbx <= mrxe_0)  // Respect the requested drawing rectangle. Gives speed boost! +        { +          QLine l2(rbx, ys_0, rbx, ye_0);            // Right  +          p.drawLine(l2);        // Right line +        }          /*          int xx = rbt?xe_1:xe_0;  @@ -2155,7 +2159,12 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec            else                p.setPen(part->selected() ? penSelect2V : penNormal2V);           }   -        p.drawLine(l4);        //  Left line +         +        if(xs_0 >= mrxs_0 && xs_0 <= mrxe_0) +        { +          QLine l4(xs_0, ys_0, xs_0, ye_0);            // Left +          p.drawLine(l4);        //  Left line +        }          /*          xx = xs_0; @@ -2175,7 +2184,11 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec          */          p.setPen(part->selected() ? penSelect2H : penNormal2H);  +         +        // Respect the requested drawing rectangle. Gives speed boost! +        QLine l1(lbx_c, ys_0, rbx_c, ys_0);            p.drawLine(l1);  // Top line +        QLine l3(lbx_c, ye_0, rbx_c, ye_0);            p.drawLine(l3);  // Bottom line    #endif @@ -2206,8 +2219,8 @@ void PartCanvas::drawItem(QPainter& p, const MusEWidget::CItem* item, const QRec              p.drawText(tr, Qt::AlignBottom|Qt::AlignLeft, part->name());              } -      p.restore(); -      //p.setWorldMatrixEnabled(true); +      //p.restore(); +      p.setWorldMatrixEnabled(true);        }  //--------------------------------------------------------- @@ -2623,7 +2636,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 +2818,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; @@ -2958,9 +2891,8 @@ Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool        {          int tot = notDone + done;          QMessageBox::critical(this, QString("MusE"), -           QString().setNum(notDone) + (tot > 1 ? (tr(" out of ") + QString().setNum(tot)) : QString("")) +  -           (tot > 1 ? tr(" parts") : tr(" part")) +  -           tr(" could not be pasted.\nLikely the selected track is the wrong type.")); +           (tot > 1  ?  tr("%n part(s) out of %1 could not be pasted.\nLikely the selected track is the wrong type.","",notDone).arg(tot) +                     :  tr("%n part(s) could not be pasted.\nLikely the selected track is the wrong type.","",notDone)));        }        if (finalPosPtr) *finalPosPtr=finalPos; @@ -3236,9 +3168,9 @@ void PartCanvas::viewDropEvent(QDropEvent* event)                  if (!track) { // we need to create a track for this drop                      if (text.endsWith(".mpt", Qt::CaseInsensitive)) { -                        track = song->addTrack(Track::MIDI, false);    // Add at end of list. +                        track = song->addTrack(Track::MIDI);    // Add at end of list.                      } else { -                        track = song->addTrack(Track::WAVE, false);    // Add at end of list. +                        track = song->addTrack(Track::WAVE);    // Add at end of list.                      }                  }                  if (track->type() == Track::WAVE && @@ -4046,3 +3978,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..3e320e56 100644 --- a/muse2/muse/arranger/pcanvas.h +++ b/muse2/muse/arranger/pcanvas.h @@ -3,7 +3,7 @@  //  Linux Music Editor  //    $Id: pcanvas.h,v 1.11.2.4 2009/05/24 21:43:44 terminator356 Exp $  //  (C) Copyright 1999 Werner Schweer (ws@seh.de) -//  Additions, modifications (C) Copyright 2011 Tim E. Real (terminator356 on users DOT sourceforge DOT net) +//  (C) Copyright 2011 Tim E. Real (terminator356 on users DOT sourceforge DOT net)  //  //  This program is free software; you can redistribute it and/or  //  modify it under the terms of the GNU General Public License @@ -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..c28a40b2 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 }; @@ -95,6 +97,7 @@ TList::TList(MusEWidget::Header* hdr, QWidget* parent, const char* name)        _scroll    = 0;        editTrack = 0;        editor    = 0; +      chan_edit = NULL;        mode      = NORMAL;        //setBackgroundMode(Qt::NoBackground); // ORCAN - FIXME @@ -184,6 +187,16 @@ 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(0.85, mask_edge); +      mask.setColorAt(1, mask_edge); + +        TrackList* l = song->tracks();        int idx = 0;        int yy  = -ypos; @@ -203,10 +216,9 @@ void TList::paint(const QRect& r)              QColor bg;              if (track->selected()) {                    bg = MusEConfig::config.selectTrackBg; -                  //p.setPen(palette().active().text());                    p.setPen(MusEConfig::config.selectTrackFg);                    } -            else { +            else {	                    switch(type) {                          case Track::MIDI:                                bg = MusEConfig::config.midiTrackBg; @@ -233,10 +245,17 @@ void TList::paint(const QRect& r)                                bg = MusEConfig::config.synthTrackBg;                                break;                          } +                    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); @@ -378,7 +397,7 @@ void TList::paint(const QRect& r)                                }                                break;                          case COL_CLEF: -                              if (track->isMidiTrack()) { +                              if (track->isMidiTrack() && track->type() == Track::MIDI) { // no drum tracks!                                  QString s = tr("no clef");                                  if (((MidiTrack*)track)->getClef() == trebleClef)                                    s=tr("Treble"); @@ -1069,7 +1088,7 @@ void TList::mousePressEvent(QMouseEvent* ev)        switch (col) {                case COL_CLEF: -                if (t->isMidiTrack()) { +                if (t->isMidiTrack() && t->type() == Track::MIDI) {                    QMenu* p = new QMenu;                    p->addAction(tr("Treble clef"))->setData(0);                    p->addAction(tr("Bass clef"))->setData(1); @@ -1789,3 +1808,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/cobject.cpp b/muse2/muse/cobject.cpp index 42c3cad2..46d53f27 100644 --- a/muse2/muse/cobject.cpp +++ b/muse2/muse/cobject.cpp @@ -396,8 +396,8 @@ void TopWin::initConfiguration()  void TopWin::readConfiguration(ToplevelType t, Xml& xml)  { -if (initInited==false) -	initConfiguration(); +	if (initInited==false) +		initConfiguration();  	for (;;)  	{ diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 6ba4d47d..35b96591 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -520,7 +520,7 @@ static void readSeqConfiguration(Xml& xml)  //   readConfiguration  //--------------------------------------------------------- -void readConfiguration(Xml& xml, bool readOnlySequencer) +void readConfiguration(Xml& xml, bool readOnlySequencer, bool doReadGlobalConfig)        {        int mixers = 0;        for (;;) { @@ -547,8 +547,97 @@ void readConfiguration(Xml& xml, bool readOnlySequencer)                                xml.skip(tag);                                break;                                } +                               +                               +                               +                               +                               +                        else if (tag == "midiInputDevice") +                              MusEGlobal::midiInputPorts = xml.parseInt(); +                        else if (tag == "midiInputChannel") +                              MusEGlobal::midiInputChannel = xml.parseInt(); +                        else if (tag == "midiRecordType") +                              MusEGlobal::midiRecordType = xml.parseInt(); +                        else if (tag == "midiThruType") +                              MusEGlobal::midiThruType = xml.parseInt(); +                        else if (tag == "midiFilterCtrl1") +                              MusEGlobal::midiFilterCtrl1 = xml.parseInt(); +                        else if (tag == "midiFilterCtrl2") +                              MusEGlobal::midiFilterCtrl2 = xml.parseInt(); +                        else if (tag == "midiFilterCtrl3") +                              MusEGlobal::midiFilterCtrl3 = xml.parseInt(); +                        else if (tag == "midiFilterCtrl4") +                              MusEGlobal::midiFilterCtrl4 = xml.parseInt(); +                        else if (tag == "waveTracksVisible") +                                 WaveTrack::setVisible((bool)xml.parseInt()); +                        else if (tag == "auxTracksVisible") +                                 AudioAux::setVisible((bool)xml.parseInt()); +                        else if (tag == "groupTracksVisible") +                                 AudioGroup::setVisible((bool)xml.parseInt()); +                        else if (tag == "midiTracksVisible") +                                 MidiTrack::setVisible((bool)xml.parseInt()); +                        else if (tag == "inputTracksVisible") +                                 AudioInput::setVisible((bool)xml.parseInt()); +                        else if (tag == "outputTracksVisible") +                                 AudioOutput::setVisible((bool)xml.parseInt()); +                        else if (tag == "synthTracksVisible") +                                 SynthI::setVisible((bool)xml.parseInt()); +                        else if (tag == "bigtimeVisible") +                              MusEConfig::config.bigTimeVisible = xml.parseInt(); +                        else if (tag == "transportVisible") +                              MusEConfig::config.transportVisible = xml.parseInt(); +                        else if (tag == "mixer1Visible") +                              MusEConfig::config.mixer1Visible = xml.parseInt(); +                        else if (tag == "mixer2Visible") +                              MusEConfig::config.mixer2Visible = xml.parseInt(); +                        else if (tag == "mtctype") +                              mtcType= xml.parseInt(); +                        else if (tag == "sendClockDelay") +                              syncSendFirstClockDelay = xml.parseUInt(); +                        else if (tag == "extSync") +                              extSyncFlag.setValue(xml.parseInt()); +                        else if (tag == "useJackTransport") +                              { +                              useJackTransport.setValue(xml.parseInt()); +                              } +                        else if (tag == "jackTransportMaster") +                              { +                                jackTransportMaster = xml.parseInt(); +                                if(audioDevice) +                                  audioDevice->setMaster(jackTransportMaster);       +                              }   +                        else if (tag == "mtcoffset") { +                              QString qs(xml.parse1()); +                              QByteArray ba = qs.toLatin1(); +                              const char* str = ba.constData(); +                              int h, m, s, f, sf; +                              sscanf(str, "%d:%d:%d:%d:%d", &h, &m, &s, &f, &sf); +                              mtcOffset = MTC(h, m, s, f, sf); +                              } +                        else if (tag == "midiTransform") +                              readMidiTransform(xml); +                        else if (tag == "midiInputTransform") +                              readMidiInputTransform(xml); +                        else if (tag == "geometryTransport") +                              MusEConfig::config.geometryTransport = readGeometry(xml, tag); +                        else if (tag == "geometryBigTime") +                              MusEConfig::config.geometryBigTime = readGeometry(xml, tag); + +                        else if (!doReadGlobalConfig) { +                              xml.skip(tag); +                              break; +                              } + +                        // ---- Global and/or per-song config stuff ends here ---- +                         +                         -                        if (tag == "theme") +                        // ---- Global config stuff begins here ---- + +                        else if (tag == "geometryMain") +                              MusEConfig::config.geometryMain = readGeometry(xml, tag); + +                        else if (tag == "theme")                                MusEConfig::config.style = xml.parse1();                          else if (tag == "styleSheetFile")                                MusEConfig::config.styleSheetFile = xml.parse1(); @@ -743,50 +832,6 @@ void readConfiguration(Xml& xml, bool readOnlySequencer)                                MusEConfig::config.expOptimNoteOffs = xml.parseInt();                          else if (tag == "importMidiSplitParts")                                MusEConfig::config.importMidiSplitParts = xml.parseInt(); -                        else if (tag == "midiInputDevice") -                              MusEGlobal::midiInputPorts = xml.parseInt(); -                        else if (tag == "midiInputChannel") -                              MusEGlobal::midiInputChannel = xml.parseInt(); -                        else if (tag == "midiRecordType") -                              MusEGlobal::midiRecordType = xml.parseInt(); -                        else if (tag == "midiThruType") -                              MusEGlobal::midiThruType = xml.parseInt(); -                        else if (tag == "midiFilterCtrl1") -                              MusEGlobal::midiFilterCtrl1 = xml.parseInt(); -                        else if (tag == "midiFilterCtrl2") -                              MusEGlobal::midiFilterCtrl2 = xml.parseInt(); -                        else if (tag == "midiFilterCtrl3") -                              MusEGlobal::midiFilterCtrl3 = xml.parseInt(); -                        else if (tag == "midiFilterCtrl4") -                              MusEGlobal::midiFilterCtrl4 = xml.parseInt(); -                        else if (tag == "waveTracksVisible") -                                 WaveTrack::setVisible((bool)xml.parseInt()); -                        else if (tag == "auxTracksVisible") -                                 AudioAux::setVisible((bool)xml.parseInt()); -                        else if (tag == "groupTracksVisible") -                                 AudioGroup::setVisible((bool)xml.parseInt()); -                        else if (tag == "midiTracksVisible") -                                 MidiTrack::setVisible((bool)xml.parseInt()); -                        else if (tag == "inputTracksVisible") -                                 AudioInput::setVisible((bool)xml.parseInt()); -                        else if (tag == "outputTracksVisible") -                                 AudioOutput::setVisible((bool)xml.parseInt()); -                        else if (tag == "synthTracksVisible") -                                 SynthI::setVisible((bool)xml.parseInt()); -                        else if (tag == "bigtimeVisible") -                              MusEConfig::config.bigTimeVisible = xml.parseInt(); -                        else if (tag == "transportVisible") -                              MusEConfig::config.transportVisible = xml.parseInt(); -                        else if (tag == "markerVisible") -                              MusEConfig::config.markerVisible = xml.parseInt(); -                         -                        else if (tag == "mixerVisible") -                              // MusEConfig::config.mixerVisible = xml.parseInt();  // Obsolete -                              xml.skip(tag); -                        else if (tag == "mixer1Visible") -                              MusEConfig::config.mixer1Visible = xml.parseInt(); -                        else if (tag == "mixer2Visible") -                              MusEConfig::config.mixer2Visible = xml.parseInt();                          else if (tag == "showSplashScreen")                                MusEConfig::config.showSplashScreen = xml.parseInt(); @@ -800,20 +845,7 @@ void readConfiguration(Xml& xml, bool readOnlySequencer)                                MusEConfig::config.canvasBgPixmap = xml.parse1();                          else if (tag == "canvasCustomBgList")                                MusEConfig::config.canvasCustomBgList = xml.parse1().split(";", QString::SkipEmptyParts); -                        else if (tag == "geometryMain") -                              MusEConfig::config.geometryMain = readGeometry(xml, tag); -                        else if (tag == "geometryTransport") -                              MusEConfig::config.geometryTransport = readGeometry(xml, tag); -                        else if (tag == "geometryBigTime") -                              MusEConfig::config.geometryBigTime = readGeometry(xml, tag); -                        else if (tag == "geometryPianoroll") -                              MusEConfig::config.geometryPianoroll = readGeometry(xml, tag); -                        else if (tag == "geometryDrumedit") -                              MusEConfig::config.geometryDrumedit = readGeometry(xml, tag); -                        else if (tag == "geometryMixer") -                              // MusEConfig::config.geometryMixer = readGeometry(xml, tag); // Obsolete -                              xml.skip(tag);                          //else if (tag == "mixer1")                          //      MusEConfig::config.mixer1.read(xml);                          //else if (tag == "mixer2") @@ -835,69 +867,16 @@ void readConfiguration(Xml& xml, bool readOnlySequencer)                                MusEConfig::config.transportHandleColor = readColor(xml);                          else if (tag == "waveEditBackgroundColor")                                MusEConfig::config.waveEditBackgroundColor = readColor(xml); -                        else if (tag == "txDeviceId") -                                //txDeviceId = xml.parseInt(); -                                xml.parseInt(); -                        else if (tag == "rxDeviceId") -                                //rxDeviceId = xml.parseInt(); -                                xml.parseInt(); -                        else if (tag == "txSyncPort") -                                //txSyncPort= xml.parseInt(); -                                xml.parseInt(); -                        else if (tag == "rxSyncPort") -                                //rxSyncPort= xml.parseInt(); -                                xml.parseInt(); -                        else if (tag == "mtctype") -                              mtcType= xml.parseInt(); -                        else if (tag == "sendClockDelay") -                              syncSendFirstClockDelay = xml.parseUInt(); -                        else if (tag == "extSync") -                              extSyncFlag.setValue(xml.parseInt()); -                        else if (tag == "useJackTransport") -                              { -                              useJackTransport.setValue(xml.parseInt()); -                              } -                        else if (tag == "jackTransportMaster") -                              { -                                jackTransportMaster = xml.parseInt(); -                                if(audioDevice) -                                  audioDevice->setMaster(jackTransportMaster);       -                              }   -                        else if (tag == "syncgentype") { -                              // for compatibility -                              //int syncGenType= xml.parseInt(); -                              //genMTCSync = syncGenType == 1; -                              //genMCSync = syncGenType == 2; -                              xml.parseInt(); -                              } -                        else if (tag == "genMTCSync") -                              //genMTCSync = xml.parseInt(); -                              xml.parseInt(); -                        else if (tag == "genMCSync") -                              //genMCSync = xml.parseInt(); -                              xml.parseInt(); -                        else if (tag == "genMMC") -                              //genMMC = xml.parseInt(); -                              xml.parseInt(); -                        else if (tag == "acceptMTC") -                              //acceptMTC = xml.parseInt(); -                              xml.parseInt(); -                        else if (tag == "acceptMMC") -                              //acceptMMC = xml.parseInt(); -                              xml.parseInt(); -                        else if (tag == "acceptMC") -                              //acceptMC = xml.parseInt(); -                              xml.parseInt(); -                        else if (tag == "mtcoffset") { -                              QString qs(xml.parse1()); -                              QByteArray ba = qs.toLatin1(); -                              const char* str = ba.constData(); -                              int h, m, s, f, sf; -                              sscanf(str, "%d:%d:%d:%d:%d", &h, &m, &s, &f, &sf); -                              mtcOffset = MTC(h, m, s, f, sf); -                              }                          //else if (tag == "midiSyncInfo")                          //      readConfigMidiSyncInfo(xml); +                        /* Obsolete. done by song's toplevel list. arrangerview also handles arranger. +                        else if (tag == "arranger") { +                              if (MusEGlobal::muse && MusEGlobal::muse->arranger()) +                                    MusEGlobal::muse->arranger()->readStatus(xml); +                              else +                                    xml.skip(tag); +                              } +                        */                          else if (tag == "drumedit")                                DrumEdit::readConfiguration(xml);                          else if (tag == "pianoroll") @@ -917,13 +896,8 @@ void readConfiguration(Xml& xml, bool readOnlySequencer)                          else if (tag == "marker")                                MarkerView::readConfiguration(xml);                          else if (tag == "arrangerview") -                              ArrangerView::readConfiguration(xml); -                        else if (tag == "arranger") { -                              if (MusEGlobal::muse && MusEGlobal::muse->arranger()) -                                    MusEGlobal::muse->arranger()->readStatus(xml); -                              else -                                    xml.skip(tag); -                              } +                              MusEArranger::ArrangerView::readConfiguration(xml); +                                                  else if (tag == "dialogs")                                read_function_dialog_config(xml);                          else if (tag == "shortcuts") @@ -932,12 +906,6 @@ void readConfiguration(Xml& xml, bool readOnlySequencer)                                MusEConfig::config.division = xml.parseInt();                          else if (tag == "guiDivision")                                MusEConfig::config.guiDivision = xml.parseInt(); -                        else if (tag == "samplerate") -                              xml.parseInt(); -                        else if (tag == "segmentsize") -                              xml.parseInt(); -                        else if (tag == "segmentcount") -                              xml.parseInt();                          else if (tag == "rtcTicks")                                MusEConfig::config.rtcTicks = xml.parseInt();                          else if (tag == "minMeter") @@ -964,10 +932,6 @@ void readConfiguration(Xml& xml, bool readOnlySequencer)                                MusEConfig::config.guiRefresh = xml.parseInt();                          else if (tag == "userInstrumentsDir")                                MusEConfig::config.userInstrumentsDir = xml.parse1(); -                        else if (tag == "midiTransform") -                              readMidiTransform(xml); -                        else if (tag == "midiInputTransform") -                              readMidiInputTransform(xml);                          else if (tag == "startMode")                                MusEConfig::config.startMode = xml.parseInt();                          else if (tag == "startSong") @@ -980,7 +944,62 @@ void readConfiguration(Xml& xml, bool readOnlySequencer)                                MusEConfig::config.useProjectSaveDialog = xml.parseInt();                          else if (tag == "popupsDefaultStayOpen")                                MusEConfig::config.popupsDefaultStayOpen = xml.parseInt(); +                        else if (tag == "leftMouseButtonCanDecrease") +                              MusEConfig::config.leftMouseButtonCanDecrease = xml.parseInt(); +                        else if (tag == "rangeMarkerWithoutMMB") +                              MusEConfig::config.rangeMarkerWithoutMMB = xml.parseInt(); +                        // ---- the following only skips obsolete entries ---- +                        else if ((tag == "arranger") || (tag == "geometryPianoroll") || (tag == "geometryDrumedit")) +                              xml.skip(tag); +                        else if (tag == "markerVisible") +                              //MusEConfig::config.markerVisible = xml.parseInt(); //Obsolete (done by song's toplevel list) +                              xml.skip(tag); +                        else if (tag == "mixerVisible") +                              // MusEConfig::config.mixerVisible = xml.parseInt();  // Obsolete +                              xml.skip(tag); +                        else if (tag == "geometryMixer") +                              // MusEConfig::config.geometryMixer = readGeometry(xml, tag); // Obsolete +                              xml.skip(tag); +                        else if (tag == "txDeviceId") +                                //txDeviceId = xml.parseInt(); +                                xml.parseInt(); +                        else if (tag == "rxDeviceId") +                                //rxDeviceId = xml.parseInt(); +                                xml.parseInt(); +                        else if (tag == "txSyncPort") +                                //txSyncPort= xml.parseInt(); +                                xml.parseInt(); +                        else if (tag == "rxSyncPort") +                                //rxSyncPort= xml.parseInt(); +                                xml.parseInt(); +                        else if (tag == "syncgentype") { +                              // for compatibility +                              //int syncGenType= xml.parseInt(); +                              //genMTCSync = syncGenType == 1; +                              //genMCSync = syncGenType == 2; +                              xml.parseInt(); +                              } +                        else if (tag == "genMTCSync") +                              //genMTCSync = xml.parseInt(); +                              xml.parseInt(); +                        else if (tag == "genMCSync") +                              //genMCSync = xml.parseInt(); +                              xml.parseInt(); +                        else if (tag == "genMMC") +                              //genMMC = xml.parseInt(); +                              xml.parseInt(); +                        else if (tag == "acceptMTC") +                              //acceptMTC = xml.parseInt(); +                              xml.parseInt(); +                        else if (tag == "acceptMMC") +                              //acceptMMC = xml.parseInt(); +                              xml.parseInt(); +                        else if (tag == "acceptMC") +                              //acceptMC = xml.parseInt(); +                              xml.parseInt(); +                        else if ((tag == "samplerate") || (tag == "segmentsize") || (tag == "segmentcount")) +                              xml.parseInt();                          else                                xml.unknown("configuration");                          break; @@ -1039,7 +1058,7 @@ bool readConfiguration()                          else if (skipmode)                                break;                          else if (tag == "configuration") -                              readConfiguration(xml,false); +                              readConfiguration(xml,false, true /* read global config as well */);                          else                                xml.unknown("muse config");                          break; @@ -1260,6 +1279,8 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const        xml.intTag(level, "useOldStyleStopShortCut", MusEConfig::config.useOldStyleStopShortCut);        xml.intTag(level, "moveArmedCheckBox", MusEConfig::config.moveArmedCheckBox);        xml.intTag(level, "popupsDefaultStayOpen", MusEConfig::config.popupsDefaultStayOpen); +      xml.intTag(level, "leftMouseButtonCanDecrease", MusEConfig::config.leftMouseButtonCanDecrease); +      xml.intTag(level, "rangeMarkerWithoutMMB", MusEConfig::config.rangeMarkerWithoutMMB);        //for (int i = 0; i < 6; ++i) {        for (int i = 0; i < NUM_FONTS; ++i) { @@ -1335,8 +1356,6 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const        xml.qrectTag(level, "geometryMain",      MusEConfig::config.geometryMain);        xml.qrectTag(level, "geometryTransport", MusEConfig::config.geometryTransport);        xml.qrectTag(level, "geometryBigTime",   MusEConfig::config.geometryBigTime); -      xml.qrectTag(level, "geometryPianoroll", MusEConfig::config.geometryPianoroll); -      xml.qrectTag(level, "geometryDrumedit",  MusEConfig::config.geometryDrumedit);        //xml.qrectTag(level, "geometryMixer",     MusEConfig::config.geometryMixer);  // Obsolete        xml.intTag(level, "bigtimeVisible", MusEConfig::config.bigTimeVisible); @@ -1373,7 +1392,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); @@ -1463,10 +1482,11 @@ void MusE::writeConfiguration(int level, Xml& xml) const        xml.intTag(level, "bigtimeVisible",   viewBigtimeAction->isChecked());        xml.intTag(level, "transportVisible", viewTransportAction->isChecked()); -      xml.intTag(level, "markerVisible",    viewMarkerAction->isChecked()); +      //xml.intTag(level, "markerVisible",    viewMarkerAction->isChecked()); // Obsolete (done by song's toplevel list)        //xml.intTag(level, "mixerVisible",     menuView->isItemChecked(aid1));  // Obsolete -      xml.geometryTag(level, "geometryMain", this); +      xml.geometryTag(level, "geometryMain", this); // FINDME: maybe remove this? do we want +                                                    // the main win to jump around when loading?        if (transport)              xml.geometryTag(level, "geometryTransport", transport);        if (bigtime) @@ -1483,15 +1503,9 @@ void MusE::writeConfiguration(int level, Xml& xml) const              //mixer2->write(level, xml, "mixer2");              mixer2->write(level, xml); -      _arranger->writeStatus(level, xml); +      //_arranger->writeStatus(level, xml);  // Obsolete.  done by song's toplevel list. arrangerview also handles arranger.        writeSeqConfiguration(level, xml, true); -      DrumEdit::writeConfiguration(level, xml); -      PianoRoll::writeConfiguration(level, xml); -      ScoreEdit::write_configuration(level, xml); -      MasterEdit::writeConfiguration(level, xml); -      WaveEdit::writeConfiguration(level, xml); -              write_function_dialog_config(level, xml);        writeMidiTransforms(level, xml); diff --git a/muse2/muse/conf.h b/muse2/muse/conf.h index 25cba677..4190b671 100644 --- a/muse2/muse/conf.h +++ b/muse2/muse/conf.h @@ -48,6 +48,6 @@ class MidiFileConfig : public QDialog, public Ui::ConfigMidiFileBase {  class Xml;  extern bool readConfiguration(); -extern void readConfiguration(Xml&, bool readOnlySequencer); +extern void readConfiguration(Xml&, bool readOnlySequencer, bool doReadGlobalConfig);  #endif diff --git a/muse2/muse/confmport.cpp b/muse2/muse/confmport.cpp index 6e371d0e..724b5a51 100644 --- a/muse2/muse/confmport.cpp +++ b/muse2/muse/confmport.cpp @@ -1341,7 +1341,7 @@ void MPConfig::addInstanceClicked()        QTreeWidgetItem* item = synthList->currentItem();        if (item == 0)              return; -      SynthI *si = song->createSynthI(item->text(0), item->text(2), false); // Add at end of list. +      SynthI *si = song->createSynthI(item->text(0), item->text(2)); // Add at end of list.        if(!si)          return; diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index 8e9a7cd5..b6bff169 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -879,7 +879,8 @@ unsigned get_groupedevents_len(const QString& pt)  {  	unsigned maxlen=0; -	Xml xml(pt.toLatin1().constData()); +	QByteArray pt_= pt.toLatin1(); +	Xml xml(pt_.constData());  	for (;;)   	{  		Xml::Token token = xml.parse(); @@ -1062,7 +1063,8 @@ void paste_at(const QString& pt, int pos, int max_distance, bool always_new_part  	map<Part*, unsigned> expand_map;  	map<Part*, set<Part*> > new_part_map; -	Xml xml(pt.toLatin1().constData()); +	QByteArray pt_= pt.toLatin1(); +	Xml xml(pt_.constData());  	for (;;)   	{  		Xml::Token token = xml.parse(); diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index deed36b3..0a521c3a 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(109, 174, 178),        // 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 @@ -144,8 +144,6 @@ GlobalConfigValues config = {        QRect(0, 0, 400, 300),        // GeometryMain;        QRect(0, 0, 200, 100),        // GeometryTransport;        QRect(0, 0, 600, 200),        // GeometryBigTime; -      QRect(0, 0, 400, 300),        // GeometryPianoroll; -      QRect(0, 0, 400, 300),        // GeometryDrumedit;        //QRect(0, 0, 300, 500),        // GeometryMixer;  // Obsolete        {           QString("Mixer A"), @@ -187,7 +185,9 @@ GlobalConfigValues config = {        true,                         // projectStoreInFolder        true,                         // useProjectSaveDialog        64,                           // minControlProcessPeriod -      false                         // popupsDefaultStayOpen +      false,                        // popupsDefaultStayOpen +      false,                        // leftMouseButtonCanDecrease +      false                         // rangeMarkerWithoutMMB      };  } // namespace MusEConfig diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h index 1801df5f..dd5f10fd 100644 --- a/muse2/muse/gconfig.h +++ b/muse2/muse/gconfig.h @@ -126,8 +126,6 @@ struct GlobalConfigValues {        QRect geometryMain;        QRect geometryTransport;        QRect geometryBigTime; -      QRect geometryPianoroll; -      QRect geometryDrumedit;  //      QRect geometryMixer;        MixerConfig mixer1;        MixerConfig mixer2; @@ -162,10 +160,11 @@ struct GlobalConfigValues {        bool useProjectSaveDialog;        unsigned long minControlProcessPeriod;        bool popupsDefaultStayOpen; +      bool leftMouseButtonCanDecrease; +      bool rangeMarkerWithoutMMB;        };  extern GlobalConfigValues config; -  } // namespace MusEConfig  #endif diff --git a/muse2/muse/importmidi.cpp b/muse2/muse/importmidi.cpp index fd690671..558ffb69 100644 --- a/muse2/muse/importmidi.cpp +++ b/muse2/muse/importmidi.cpp @@ -618,9 +618,8 @@ void MusE::importPartToTrack(QString& filename, unsigned tick, Track* track)          {            int tot = notDone + done;            QMessageBox::critical(this, QString("MusE"), -            QString().setNum(notDone) + (tot > 1 ? (tr(" out of ") + QString().setNum(tot)) : QString("")) +  -            (tot > 1 ? tr(" parts") : tr(" part")) +  -            tr(" could not be imported.\nLikely the track is the wrong type.")); +            (tot > 1  ?  tr("%n part(s) out of %1 could not be imported.\nLikely the selected track is the wrong type.","",notDone).arg(tot) +                      :  tr("%n part(s) could not be imported.\nLikely the selected track is the wrong type.","",notDone)));          }          return; diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp index 49bdd6c2..e1639d04 100644 --- a/muse2/muse/instruments/editinstrument.cpp +++ b/muse2/muse/instruments/editinstrument.cpp @@ -408,7 +408,7 @@ void EditInstrument::saveAs()        {          if(QMessageBox::question(this,              tr("MusE:"), -            tr("The user instrument directory\n") + MusEGlobal::museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + +            tr("The user instrument directory\n%1\ndoes not exist yet. Create it now?\n").arg(MusEGlobal::museUserInstruments) +                tr("(You can change the user instruments directory at Settings->Global Settings->Midi)"),              QMessageBox::Ok | QMessageBox::Default,              QMessageBox::Cancel | QMessageBox::Escape, @@ -419,7 +419,7 @@ void EditInstrument::saveAs()            else            {              printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); -            QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + MusEGlobal::museUserInstruments); +            QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory '%1'").arg(MusEGlobal::museUserInstruments));              //return;              path = MusEGlobal::museUser;            } @@ -610,7 +610,7 @@ void EditInstrument::fileSaveAs()                  // Can not have two user files containing the same instrument name.                  if(QMessageBox::question(this,                      tr("MusE: Save instrument as"), -                    tr("The user instrument:\n") + s + tr("\nalready exists. This will overwrite its .idf instrument file.\nAre you sure?"), +                    tr("The user instrument '%1' already exists. This will overwrite its .idf instrument file.\nAre you sure?").arg(s),                      QMessageBox::Ok | QMessageBox::Default,                      QMessageBox::Cancel | QMessageBox::Escape,                      Qt::NoButton) == QMessageBox::Ok) @@ -700,7 +700,7 @@ void EditInstrument::fileSaveAs()        {          if(QMessageBox::question(this,              tr("MusE:"), -            tr("The user instrument directory\n") + MusEGlobal::museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + +            tr("The user instrument directory\n%1\ndoes not exist yet. Create it now?\n").arg(MusEGlobal::museUserInstruments) +                tr("(You can change the user instruments directory at Settings->Global Settings->Midi)"),              QMessageBox::Ok | QMessageBox::Default,              QMessageBox::Cancel | QMessageBox::Escape, @@ -711,7 +711,7 @@ void EditInstrument::fileSaveAs()            else            {              printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); -            QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + MusEGlobal::museUserInstruments); +            QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory '%1'").arg(MusEGlobal::museUserInstruments));              //return;              path = MusEGlobal::museUser;            } @@ -3111,7 +3111,7 @@ void EditInstrument::addControllerClicked()      {        QMessageBox::critical(this,            tr("MusE: Cannot add common controller"), -          tr("A controller named ") + name + tr(" already exists."), +          tr("A controller named '%1' already exists.").arg(name),            QMessageBox::Ok,            Qt::NoButton,            Qt::NoButton); @@ -3123,7 +3123,7 @@ void EditInstrument::addControllerClicked()      {        QMessageBox::critical(this,            tr("MusE: Cannot add common controller"), -          tr("A controller number ") + QString().setNum(num) + tr(" already exists."), +          tr("A controller number %1 already exists.").arg(num),            QMessageBox::Ok,            Qt::NoButton,            Qt::NoButton); diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index 783a72f5..3f80133a 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -183,7 +183,7 @@ Undo DrumCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D  	if (!forbidden)  	{ -	        std::vector< MusEWidget::CItem* > doneList; +		std::vector< MusEWidget::CItem* > doneList;  		typedef std::vector< MusEWidget::CItem* >::iterator iDoneList;  		for(MusEWidget::iCItem ici = items.begin(); ici != items.end(); ++ici)  diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index ad55b33f..b17f9b1d 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -123,6 +123,9 @@ QString IntToQStr(int i); +#define AKKOLADE_WIDTH 8 +#define AKKOLADE_LEFTMARGIN 0 +#define AKKOLADE_RIGHTMARGIN 2  #define STAFF_DISTANCE (10*YLEN)  #define GRANDSTAFF_DISTANCE (8*YLEN)  #define NOTE_YDIST 20 @@ -2014,7 +2017,7 @@ list<note_len_t> parse_note_len(int len_ticks, int begin_tick, vector<int>& foo,  		int len_now=0;  		int last_number=foo[pos]; -		do {pos++;len_done++;len_now++;} while (! ((foo[pos]<=last_number) || (len_done==len) || (pos==foo.size())) ); +		do {pos++;len_done++;len_now++;} while (! ((pos==foo.size()) || (foo[pos]<=last_number) || (len_done==len)) );  		len_now=len_now*TICKS_PER_WHOLE/64; @@ -2125,6 +2128,29 @@ void ScoreCanvas::draw_tie (QPainter& p, int x1, int x4, int yo, bool up, QColor  	p.drawPath(path);  } +void ScoreCanvas::draw_akkolade (QPainter& p, int x, int y_) +{ +	QPainterPath path; + +	qreal h = (2*2*YLEN+GRANDSTAFF_DISTANCE) /2.0  +3; //this is only the half height +	qreal w         = AKKOLADE_WIDTH; +	int y = y_ -h; +	 +	const double X1 =  2.0 * w; +	const double X2 = -0.7096 * w; +	const double X3 = -1.234 * w; +	const double X4 =  1.734 * w; + +	path.moveTo(x+ 0, y+ h); +	path.cubicTo(x+ X1,  y+ h + h * .3359, x+ X2,  y+ h + h * .5089, x+ w, y+ 2 * h); +	path.cubicTo(x+ X3,  y+ h + h * .5025, x+ X4,  y+ h + h * .2413, x+ 0, y+ h); +	path.cubicTo(x+ X1,  y+ h - h * .3359, x+ X2,  y+ h - h * .5089, x+ w, y+ 0); +	path.cubicTo(x+ X3,  y+ h - h * .5025, x+ X4,  y+ h - h * .2413, x+ 0, y+ h); + +	p.setBrush(Qt::black); +	p.drawPath(path); +} +  void ScoreCanvas::draw_accidentials(QPainter& p, int x, int y_offset, const list<int>& acc_list, const QPixmap& pix)  {  	int n_acc_drawn=0; @@ -2757,14 +2783,15 @@ QRect FloItem::bbox() const  	return bbox_center(x,y,pix->size());  } -void ScoreCanvas::draw_note_lines(QPainter& p, int y) +void ScoreCanvas::draw_note_lines(QPainter& p, int y, bool reserve_akkolade_space)  { +	int xbegin = reserve_akkolade_space ? AKKOLADE_LEFTMARGIN+AKKOLADE_WIDTH+AKKOLADE_RIGHTMARGIN : 0;  	int xend=width();  	p.setPen(Qt::black);  	for (int i=0;i<5;i++) -		p.drawLine(0,y + i*YLEN - 2*YLEN,xend,y + i*YLEN - 2*YLEN); +		p.drawLine(xbegin, y + i*YLEN - 2*YLEN, xend, y + i*YLEN - 2*YLEN);  } @@ -3272,18 +3299,30 @@ int clef_height(clef_t clef)  #define CLEF_LEFTMARGIN 5  #define CLEF_RIGHTMARGIN 5 -void ScoreCanvas::draw_preamble(QPainter& p, int y_offset, clef_t clef) +void ScoreCanvas::draw_preamble(QPainter& p, int y_offset, clef_t clef, bool reserve_akkolade_space, bool with_akkolade)  {  	int x_left_old=x_left;  	int tick=x_to_tick(x_pos); - +	 +	// maybe draw akkolade ---------------------------------------------- +	if (reserve_akkolade_space) +	{ +		if (with_akkolade) +			draw_akkolade(p, AKKOLADE_LEFTMARGIN, y_offset+GRANDSTAFF_DISTANCE/2); +		 +		x_left= AKKOLADE_LEFTMARGIN + AKKOLADE_WIDTH + AKKOLADE_RIGHTMARGIN; +	} +	else +		x_left=0; +	 +	  	// draw clef --------------------------------------------------------  	QPixmap* pix_clef= (clef==BASS) ? pix_clef_bass : pix_clef_violin;  	int y_coord=2*YLEN  -  ( clef_height(clef) -2)*YLEN/2; -	draw_pixmap(p,CLEF_LEFTMARGIN + pix_clef->width()/2,y_offset + y_coord,*pix_clef); +	draw_pixmap(p,x_left + CLEF_LEFTMARGIN + pix_clef->width()/2,y_offset + y_coord,*pix_clef); -	x_left= CLEF_LEFTMARGIN + pix_clef->width() + CLEF_RIGHTMARGIN; +	x_left+= CLEF_LEFTMARGIN + pix_clef->width() + CLEF_RIGHTMARGIN;  	// draw accidentials ------------------------------------------------ @@ -3373,11 +3412,19 @@ void ScoreCanvas::draw(QPainter& p, const QRect&)  	p.setPen(Qt::black); +	bool reserve_akkolade_space=false; +	for (list<staff_t>::iterator it=staves.begin(); it!=staves.end(); it++) +		if (it->type==GRAND_TOP) +		{ +			reserve_akkolade_space=true; +			break; +		} +	  	for (list<staff_t>::iterator it=staves.begin(); it!=staves.end(); it++)  	{  		//TODO: maybe only draw visible staves? -		draw_note_lines(p,it->y_draw - y_pos); -		draw_preamble(p,it->y_draw - y_pos, it->clef); +		draw_note_lines(p,it->y_draw - y_pos, reserve_akkolade_space); +		draw_preamble(p,it->y_draw - y_pos, it->clef, reserve_akkolade_space, (it->type==GRAND_TOP));  		p.setClipRect(x_left+1,0,p.device()->width(),p.device()->height());  		draw_items(p,it->y_draw - y_pos, *it);  		p.setClipping(false); @@ -4539,6 +4586,12 @@ void ScoreCanvas::add_new_parts(const std::map< Part*, std::set<Part*> >& param)   *    * CURRENT TODO   * ! o fix sigedit boxes (see also "important todo") + *   o fix valgrind problems + * > o drum editor: channel-stuff + * + * IMPORTANT TODO + * ! o fix sigedit boxes (see also "current todo") + *   o add "dotted quarter" quantize option (for 6/8 beat)   *   o ticks-to-quarter spinboxes   *   o newly created windows have to be focussed!   *   o mirror most menus to an additional right-click context menu to avoid the long mouse pointer @@ -4546,32 +4599,21 @@ void ScoreCanvas::add_new_parts(const std::map< Part*, std::set<Part*> >& param)   *   o implement borland-style maximize: free windows do not cover the main menu, even when maximized   *   o smart range selection: if range markers have been used recently (that is, a dialog with   *     "range" setting, or they've been modified), default to "in range" or "selected in range" - * - * IMPORTANT TODO - * ! o fix sigedit boxes (see also "current todo") - *   o add "dotted quarter" quantize option (for 6/8 beat)   *    *   o rename stuff with F2 key   *   o redo transport menu: offer "one beat" and "one bar" steps   *                          maybe also offer scrollbar - *   o quick "set left/right marker", "select between markers" - *     or even "set marker and select between immediately" - *   o support partially selected parts. when moving, automatically split - *  + *   *   o shrink a part from its beginning as well! watch out for clones!   *   *   o canvas editor: create clone via "alt+drag" moves window instead - *   o investigate with valgrind   *   o controller view in score editor   *   o solo button - *   o grand staff brace - *   o drum editor: channel-stuff - *   o do partial recalculating; recalculating can take pretty long + * > o do partial recalculating; recalculating can take pretty long   *     (0,5 sec) when displaying a whole song in scores   *   o transpose etc. must also transpose key-pressure events   *   o transpose: support in-key-transpose   *   o thin out: remove unneeded ctrl messages - *   o make muse usable without the middle mouse button   *   * less important stuff   *   o quantize-templates (everything is forced into a specified diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index 709a26ee..046fbf73 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -613,6 +613,7 @@ class ScoreCanvas : public MusEWidget::View  		static void init_pixmaps();  		static void draw_pixmap(QPainter& p, int x, int y, const QPixmap& pm);  		static void draw_tie (QPainter& p, int x1, int x4, int yo, bool up=true, QColor color=Qt::black); +		static void draw_akkolade (QPainter& p, int x, int y);  		static void draw_accidentials(QPainter& p, int x, int y_offset, const list<int>& acc_list, const QPixmap& pix); @@ -632,8 +633,8 @@ class ScoreCanvas : public MusEWidget::View -		void draw_note_lines(QPainter& p, int y); -		void draw_preamble(QPainter& p, int y, clef_t clef); +		void draw_note_lines(QPainter& p, int y, bool reserve_akkolade_space=false); +		void draw_preamble(QPainter& p, int y, clef_t clef, bool reserve_akkolade_space=false, bool with_akkolade=false);  		void draw_items(QPainter& p, int y, staff_t& staff, ScoreItemList::iterator from_it, ScoreItemList::iterator to_it);  		void draw_items(QPainter& p, int y, staff_t& staff, int x1, int x2);  		void draw_items(QPainter& p, int y, staff_t& staff); 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/osc.cpp b/muse2/muse/osc.cpp index ba0941f9..e7aaa46b 100644 --- a/muse2/muse/osc.cpp +++ b/muse2/muse/osc.cpp @@ -622,7 +622,7 @@ int OscIF::oscUpdate(lo_arg **argv)        printf(" _uiOscProgramPath:%s\n", _uiOscProgramPath);        printf(" _uiOscControlPath:%s\n",_uiOscControlPath);        printf(" _uiOscShowPath:%s\n", _uiOscShowPath); -      printf(" museProject:%s\n", museProject.toLatin1().constData()); +      printf(" museProject:%s\n", MusEGlobal::museProject.toLatin1().constData());        #endif        // Send sample rate. diff --git a/muse2/muse/plugin.cpp b/muse2/muse/plugin.cpp index e2170ebb..53e3d471 100644 --- a/muse2/muse/plugin.cpp +++ b/muse2/muse/plugin.cpp @@ -2252,22 +2252,25 @@ bool PluginI::loadControl(Xml& xml)                                // p4.0.23 Special for loader - bypass the ring buffer and store directly,                                //  so that upon the 'gui = 1' tag (show the gui), the gui has immediate                                 //  access to the values.       -                              bool found = false;       -                              for(unsigned long i = 0; i < controlPorts; ++i)  -                              { -                                if(_plugin->portName(controls[i].idx) == name)  -                                { -                                  controls[i].val = controls[i].tmpVal = val; -                                  found = true; -                                } -                              } -                              if(!found) -                              { -                                printf("PluginI:loadControl(%s, %f) controller not found\n", -                                  name.toLatin1().constData(), val); -                                return false; -                              }       -                              initControlValues = true; +                              if(_plugin) +			      {		 +				bool found = false;       +				for(unsigned long i = 0; i < controlPorts; ++i)  +				{ +				  if(_plugin->portName(controls[i].idx) == name)  +				  { +				    controls[i].val = controls[i].tmpVal = val; +				    found = true; +				  } +				} +				if(!found) +				{ +				  printf("PluginI:loadControl(%s, %f) controller not found\n", +				    name.toLatin1().constData(), val); +				  return false; +				}       +				initControlValues = true; +			      }                                }                          return true;                    default: @@ -2304,11 +2307,22 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset)                                //if (_plugin && initPluginInstance(_plugin, instances)) {                                // p3.3.41 -                              if (_plugin && initPluginInstance(_plugin, channel)) { +                              if (_plugin) +			      { +				if(initPluginInstance(_plugin, channel)) {                                      _plugin = 0;                                      xml.parse1(); -                                    break; +                                    printf("Error initializing plugin instance (%s, %s)\n", +                                       file.toLatin1().constData(), label.toLatin1().constData()); +                                    //break;      // Don't break - let it read any control tags.                                      } +			      }     +			      else +			      { +                                //printf("Warning: Plugin not found (%s, %s)\n", +                                //   file.toLatin1().constData(), label.toLatin1().constData()); +                                //break;      // Don't break - let it read any control tags. +			      }                                }                          if (tag == "control")                                loadControl(xml); @@ -2319,7 +2333,8 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset)                                }                          else if (tag == "gui") {                                bool flag = xml.parseInt(); -                              showGui(flag); +                              if (_plugin) +			        showGui(flag);                                }                          else if (tag == "nativegui") {                                // We can't tell OSC to show the native plugin gui  @@ -2368,12 +2383,20 @@ bool PluginI::readConfiguration(Xml& xml, bool readPreset)                                if (!readPreset && _plugin == 0) {                                      _plugin = plugins.find(file, label);                                      if (_plugin == 0) -                                          return true; -                                     +				    {   +                                      printf("Warning: Plugin not found (%s, %s)\n", +                                         file.toLatin1().constData(), label.toLatin1().constData()); +                                      return true; +				    } +				                                          //if (initPluginInstance(_plugin, instances))                                      // p3.3.41                                      if (initPluginInstance(_plugin, channel)) -                                          return true; +				    {   +                                      printf("Error initializing plugin instance (%s, %s)\n", +                                        file.toLatin1().constData(), label.toLatin1().constData()); +                                      return true; +				    }                                        }                                if (_gui)                                      _gui->updateValues(); diff --git a/muse2/muse/remote/pyapi.cpp b/muse2/muse/remote/pyapi.cpp index c9f9470f..27a44e49 100644 --- a/muse2/muse/remote/pyapi.cpp +++ b/muse2/muse/remote/pyapi.cpp @@ -1127,7 +1127,7 @@ bool Song::event(QEvent* _e)                    break;                    }              case QPybridgeEvent::SONG_ADD_TRACK: -                  song->addTrack((Track::TrackType)e->getP1(), false);  // Add at end of list. +                  song->addTrack((Track::TrackType)e->getP1());  // Add at end of list.                    break;              case QPybridgeEvent::SONG_CHANGE_TRACKNAME: {                    Track* t = this->findTrack(e->getS1()); diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index 7adc37f3..6a43e457 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -61,6 +61,7 @@  #include "al/sig.h"  #include "keyevent.h"  #include <sys/wait.h> +//#include "utils.h"    extern void clearMidiTransforms();  extern void clearMidiInputTransforms(); @@ -1700,6 +1701,21 @@ void Song::setMType(MType t)  void Song::beat()        { +      #if 0 +      static double _heartbeatRateTimer = 0.0; +      double t = MusEUtil::curTime(); +      if(t - _heartbeatRateTimer > 0.0) +      { +        double rate = 1/ (t - _heartbeatRateTimer); +        printf("heartbeat rate:%f\n", rate); +        // Results: Song::beat() is not even called sometimes because apparently all the other +        //  stuff connected to the heartbeat is taking up all the time before the next timer event -  +        //  apparently Song::beat() is called last, or close to last - after the others. (Possible to choose order?) +        // With fancy strip meters active, Song::beat() was quiet for long periods of time! +      } +      _heartbeatRateTimer = t; +      #endif +              // Keep the sync detectors running...         for(int port = 0; port < MIDI_PORTS; ++port)        { @@ -3804,8 +3820,7 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo              if (myProcess->exitCode()) {                QMessageBox::warning(MusEGlobal::muse, tr("MusE - external script failed"), -                                   tr("MusE was unable to launch the script, error message:\n ")+ QString(errStr) -                     ); +                                   tr("MusE was unable to launch the script, error message:\n%1").arg(QString(errStr)));                endUndo(SC_EVENT_REMOVED);                return;              } diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp index 2763f1b6..344ecc89 100644 --- a/muse2/muse/songfile.cpp +++ b/muse2/muse/songfile.cpp @@ -1247,9 +1247,9 @@ void MusE::read(Xml& xml, bool skipConfig, bool isTemplate)                          else if (tag == "configuration")                                if (skipConfig)                                      //xml.skip(tag); -                                    readConfiguration(xml,true /* only read sequencer settings */); +                                    readConfiguration(xml,true /* only read sequencer settings */, false /* do NOT read global settings */);                                else -                                    readConfiguration(xml, false); +                                    readConfiguration(xml, false, false /* do NOT read global settings */);                          else if (tag == "song")                          {                                song->read(xml, isTemplate); diff --git a/muse2/muse/waveedit/waveview.cpp b/muse2/muse/waveedit/waveview.cpp index 2b3ddfbf..9b11feb8 100644 --- a/muse2/muse/waveedit/waveview.cpp +++ b/muse2/muse/waveedit/waveview.cpp @@ -485,7 +485,10 @@ void WaveView::viewMouseMoveEvent(QMouseEvent* event)                    i = 1;                    break;              case Qt::RightButton: -                  i = 2; +                  if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) +                      i = 1; +                  else +                      i = 2;                    break;              default:                    return; diff --git a/muse2/muse/widgets/dentry.cpp b/muse2/muse/widgets/dentry.cpp index 000dec50..7c7237f7 100644 --- a/muse2/muse/widgets/dentry.cpp +++ b/muse2/muse/widgets/dentry.cpp @@ -27,6 +27,7 @@  #include "dentry.h"  #include "globals.h" +#include "gconfig.h"  #define TIMER1    400  #define TIMER2    200 @@ -172,7 +173,9 @@ void Dentry::repeat()        switch (button) {              case Qt::LeftButton: -                  return; +                  if (!MusEConfig::config.leftMouseButtonCanDecrease) +                    return; +                  // else fall through              case Qt::MidButton:                    if(_slider)                      _slider->stepPages(-1); diff --git a/muse2/muse/widgets/filedialog.cpp b/muse2/muse/widgets/filedialog.cpp index 0df0fa7f..4e3c1fb2 100644 --- a/muse2/muse/widgets/filedialog.cpp +++ b/muse2/muse/widgets/filedialog.cpp @@ -78,8 +78,7 @@ static bool testDirCreate(QWidget* parent, const QString& path)        {          if(QMessageBox::information(parent,              QWidget::tr("MusE: get file name"), -            QWidget::tr("The directory\n") + path -              + QWidget::tr("\ndoes not exist.\nCreate it?"), +            QWidget::tr("The directory\n%1\ndoes not exist.\nCreate it?").arg(path),              QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok) != QMessageBox::Ok)            return true; @@ -483,7 +482,7 @@ FILE* fileOpen(QWidget* parent, QString name, const QString& ext,              }        if (strcmp(mode,"w") == 0 && overwriteWarning && info.exists()) { -            QString s(QWidget::tr("File\n") + name + QWidget::tr("\nexists. Overwrite?")); +            QString s(QWidget::tr("File\n%1\nexists. Overwrite?").arg(name));              /*              int rv = QMessageBox::warning(parent,                 QWidget::tr("MusE: write"), @@ -516,8 +515,7 @@ FILE* fileOpen(QWidget* parent, QString name, const QString& ext,              fp = fopen(name.toAscii().data(), mode);              }        if (fp == 0 && !noError) { -            QString s(QWidget::tr("Open File\n") + name + QWidget::tr("\nfailed: ") -               + QString(strerror(errno))); +            QString s(QWidget::tr("Open File\n%1\nfailed: %2").arg(name).arg(strerror(errno)));              QMessageBox::critical(parent, QWidget::tr("MusE: Open File"), s);              return 0;              } diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp index c6761a07..1a317d0b 100644 --- a/muse2/muse/widgets/genset.cpp +++ b/muse2/muse/widgets/genset.cpp @@ -169,6 +169,8 @@ Shorter periods are desirable.</string>        moveArmedCheckBox->setChecked(MusEConfig::config.moveArmedCheckBox);        projectSaveCheckBox->setChecked(MusEConfig::config.useProjectSaveDialog);        popsDefStayOpenCheckBox->setChecked(MusEConfig::config.popupsDefaultStayOpen); +      lmbDecreasesCheckBox->setChecked(MusEConfig::config.leftMouseButtonCanDecrease); +      rangeMarkerWithoutMMBCheckBox->setChecked(MusEConfig::config.rangeMarkerWithoutMMB);        //updateSettings();    // TESTING @@ -305,6 +307,8 @@ void GlobalSettingsConfig::updateSettings()        moveArmedCheckBox->setChecked(MusEConfig::config.moveArmedCheckBox);        projectSaveCheckBox->setChecked(MusEConfig::config.useProjectSaveDialog);        popsDefStayOpenCheckBox->setChecked(MusEConfig::config.popupsDefaultStayOpen); +      lmbDecreasesCheckBox->setChecked(MusEConfig::config.leftMouseButtonCanDecrease); +      rangeMarkerWithoutMMBCheckBox->setChecked(MusEConfig::config.rangeMarkerWithoutMMB);        updateMdiSettings();  } @@ -401,6 +405,8 @@ void GlobalSettingsConfig::apply()        MusEConfig::config.moveArmedCheckBox = moveArmedCheckBox->isChecked();        MusEConfig::config.useProjectSaveDialog = projectSaveCheckBox->isChecked();        MusEConfig::config.popupsDefaultStayOpen = popsDefStayOpenCheckBox->isChecked(); +      MusEConfig::config.leftMouseButtonCanDecrease = lmbDecreasesCheckBox->isChecked(); +      MusEConfig::config.rangeMarkerWithoutMMB = rangeMarkerWithoutMMBCheckBox->isChecked();        //MusEGlobal::muse->showMixer(MusEConfig::config.mixerVisible);        MusEGlobal::muse->showMixer1(MusEConfig::config.mixer1Visible); diff --git a/muse2/muse/widgets/gensetbase.ui b/muse2/muse/widgets/gensetbase.ui index b5fb56b6..ba26cf38 100644 --- a/muse2/muse/widgets/gensetbase.ui +++ b/muse2/muse/widgets/gensetbase.ui @@ -7,7 +7,7 @@      <x>0</x>      <y>0</y>      <width>556</width> -    <height>506</height> +    <height>527</height>     </rect>    </property>    <property name="windowTitle"> @@ -1345,15 +1345,67 @@ Adjusts responsiveness of audio controls and            </item>            <item row="4" column="1">             <widget class="QCheckBox" name="popsDefStayOpenCheckBox"> +            <property name="sizePolicy"> +             <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +              <horstretch>0</horstretch> +              <verstretch>0</verstretch> +             </sizepolicy> +            </property>              <property name="toolTip">               <string>Allows some popup menus to stay open.  Otherwise, hold Ctrl to keep them open.</string>              </property>              <property name="text"> +             <string notr="true"/> +            </property> +           </widget> +          </item> +          <item row="5" column="0"> +           <widget class="QLabel" name="label_2"> +            <property name="toolTip"> +             <string>In some areas, the middle mouse button decreases +values, while the right button increases. Users without a +middle mouse button can select this option to make the +left button behave like the middle button in such areas.</string> +            </property> +            <property name="text"> +             <string>Use left mouse button for decreasing values</string> +            </property> +           </widget> +          </item> +          <item row="5" column="1"> +           <widget class="QCheckBox" name="lmbDecreasesCheckBox"> +            <property name="sizePolicy"> +             <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +              <horstretch>0</horstretch> +              <verstretch>0</verstretch> +             </sizepolicy> +            </property> +            <property name="text"> +             <string notr="true"/> +            </property> +           </widget> +          </item> +          <item row="6" column="1"> +           <widget class="QCheckBox" name="rangeMarkerWithoutMMBCheckBox"> +            <property name="sizePolicy"> +             <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> +              <horstretch>0</horstretch> +              <verstretch>0</verstretch> +             </sizepolicy> +            </property> +            <property name="text">               <string/>              </property>             </widget>            </item> +          <item row="6" column="0"> +           <widget class="QLabel" name="label_3"> +            <property name="text"> +             <string>Shift + Right click sets left range marker</string> +            </property> +           </widget> +          </item>           </layout>          </widget>         </item> @@ -1409,7 +1461,7 @@ Otherwise, hold Ctrl to keep them open.</string>                 <x>0</x>                 <y>0</y>                 <width>482</width> -               <height>168</height> +               <height>143</height>                </rect>               </property>               <layout class="QHBoxLayout" name="horizontalLayout_3"> diff --git a/muse2/muse/widgets/hitscale.cpp b/muse2/muse/widgets/hitscale.cpp index c1fcdd87..6db0172d 100644 --- a/muse2/muse/widgets/hitscale.cpp +++ b/muse2/muse/widgets/hitscale.cpp @@ -22,6 +22,7 @@  #include "hitscale.h"  #include "midieditor.h" +#include "gconfig.h"  #include <QMouseEvent>  #include <QPainter> @@ -97,7 +98,10 @@ void HitScale::viewMouseMoveEvent(QMouseEvent* event)                    i = 1;                    break;              case Qt::RightButton: -                  i = 2; +                  if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) +                      i = 1; +                  else +                      i = 2;                    break;              default:                    return; diff --git a/muse2/muse/widgets/meter.cpp b/muse2/muse/widgets/meter.cpp index 239f7655..50d265b5 100644 --- a/muse2/muse/widgets/meter.cpp +++ b/muse2/muse/widgets/meter.cpp @@ -6,6 +6,7 @@  //  //  (C) Copyright 2000 Werner Schweer (ws@seh.de)  //  (C) Copyright 2011 Orcan Ogetbil (ogetbilo at sf.net) +//  (C) Copyright 2011 Tim E. Real (terminator356 on users DOT sourceforge DOT net)  //  //  This program is free software; you can redistribute it and/or  //  modify it under the terms of the GNU General Public License @@ -34,6 +35,9 @@  #include "gconfig.h"  #include "fastlog.h" +// Uncomment to use the new meters. Warning: They are currently very time-consuming and unoptimized. +#define _USE_NEW_METERS 1  +  namespace MusEWidget {  //--------------------------------------------------------- @@ -49,11 +53,15 @@ Meter::Meter(QWidget* parent, MeterType type)        // This is absolutely required for speed! Otherwise painfully slow because we get         //  full rect paint events even on small scrolls! See help on QPainter::scroll().        // Commented out for now. Orcan 20110911 -      //setAttribute(Qt::WA_OpaquePaintEvent); +      #ifndef _USE_NEW_METERS +      setAttribute(Qt::WA_OpaquePaintEvent);     +      #endif        //setFrameStyle(QFrame::Raised | QFrame::StyledPanel);        mtype = type;        overflow    = false; +      cur_yv      = -1;     // Flag as -1 to initialize in paint. +      last_yv     = 0;        val         = 0.0;        maxVal      = 0.0;        minScale    = mtype == DBMeter ? MusEConfig::config.minMeter : 0.0;      // min value in dB or int @@ -152,8 +160,39 @@ void Meter::setVal(double v, double max, bool ovl)          ud = true;        } -      if(ud) -        update(); +      if(ud)         +      { +        #ifdef _USE_NEW_METERS +        update();  +         +        #else +        double range = maxScale - minScale; +        int fw = frameWidth(); +        int w  = width() - 2*fw; +        int h  = height() - 2*fw; +         +        if(mtype == DBMeter) +          cur_yv = val == 0 ? h : int(((maxScale - (fast_log10(val) * 20.0)) * h)/range); +        else +          cur_yv = val == 0 ? h : int(((maxScale - val) * h)/range); +         +        if(cur_yv > h) cur_yv = h; +         +        int y1, y2; +        if(last_yv < cur_yv) +        { +          y1 = last_yv; +          y2 = cur_yv; +        } +        else +        { +          y1 = cur_yv; +          y2 = last_yv; +        } +        last_yv = cur_yv; +        update(fw, y1, w, y2);  +        #endif +      }      }  //---------------------------------------------------------  //   resetPeaks @@ -164,7 +203,7 @@ void Meter::resetPeaks()        {        maxVal   = val;        overflow = val > 0.0; -      update(); +      update();                       }  //--------------------------------------------------------- @@ -175,6 +214,7 @@ void Meter::setRange(double min, double max)        {        minScale = min;        maxScale = max; +      cur_yv = -1;  // Force re-initialization.        update();        } @@ -182,12 +222,14 @@ void Meter::setRange(double min, double max)  //   paintEvent  //--------------------------------------------------------- -void Meter::paintEvent(QPaintEvent* /*ev*/) +void Meter::paintEvent(QPaintEvent* ev)        {        // TODO: Could make better use of event rectangle, for speed.        QPainter p(this); -      p.setRenderHint(QPainter::Antialiasing); +      #ifdef _USE_NEW_METERS +      p.setRenderHint(QPainter::Antialiasing);   +      #endif        double range = maxScale - minScale; @@ -195,22 +237,25 @@ void Meter::paintEvent(QPaintEvent* /*ev*/)        int w  = width() - 2*fw;        int h  = height() - 2*fw; -      /* -      QRect rect = ev->rect(); -      int w = rect.width() - 2*fw; -      int h = rect.height() - 2*fw; -      */ -      int yv; -       -      if(mtype == DBMeter) -        yv = val == 0 ? h : int(((maxScale - (fast_log10(val) * 20.0)) * h)/range); -      else -        yv = val == 0 ? h : int(((maxScale - val) * h)/range); +      const QRect& rect = ev->rect(); +      //printf("Meter::paintEvent rx:%d ry:%d rw:%d rh:%d w:%d h:%d\n", rect.x(), rect.y(), rect.width(), rect.height(), w, h);  +      //p.setClipRect(rect); // Nope, didn't help (I think it's already clipped. So check why we bother to do it in View). -      if(yv > h) yv = h; +      // Initialize. Can't do in ctor, must be done after layouts have been done. Most reliable to do it here. +      #ifndef _USE_NEW_METERS +      if(cur_yv == -1)  +      #endif     +      { +        if(mtype == DBMeter) +          cur_yv = val == 0 ? h : int(((maxScale - (fast_log10(val) * 20.0)) * h)/range); +        else +          cur_yv = val == 0 ? h : int(((maxScale - val) * h)/range); +        if(cur_yv > h) cur_yv = h; +        //last_yv = cur_yv; +      }        // Draw the red, green, and yellow sections. -      drawVU(p, w, h, yv); +      drawVU(p, rect, cur_yv);        // Draw the peak white line.        int ymax; @@ -218,9 +263,13 @@ void Meter::paintEvent(QPaintEvent* /*ev*/)          ymax = maxVal == 0 ? 0 : int(((maxScale - (fast_log10(maxVal) * 20.0)) * h)/range);        else          ymax = maxVal == 0 ? 0 : int(((maxScale - maxVal) * h)/range); -      p.setPen(peak_color); -      p.drawLine(0, ymax, w, ymax); +      if(ymax >= rect.y() && ymax < rect.height()) +      { +        p.setPen(peak_color); +        p.drawLine(0, ymax, w, ymax); +      } +      #ifdef _USE_NEW_METERS        // Draw the transparent layer on top of everything to give a 3d look        QPainterPath round_path = MusEUtil::roundedPath(0, 0, w, h,                                              xrad, yrad, @@ -228,6 +277,7 @@ void Meter::paintEvent(QPaintEvent* /*ev*/)        maskGrad.setStart(QPointF(0, 0));        maskGrad.setFinalStop(QPointF(w, 0));        p.fillPath(round_path, QBrush(maskGrad)); +      #endif        } @@ -236,8 +286,17 @@ void Meter::paintEvent(QPaintEvent* /*ev*/)  //   drawVU  //--------------------------------------------------------- -void Meter::drawVU(QPainter& p, int w, int h, int yv) +void Meter::drawVU(QPainter& p, const QRect& rect, int yv)  { +      int fw = frameWidth(); +      int w  = width() - 2*fw; +      int h  = height() - 2*fw; +       +      // Test OK. We are passed small rectangles on small value changes. +      //printf("Meter::drawVU rx:%d ry:%d rw:%d rh:%d w:%d h:%d\n", rect.x(), rect.y(), rect.width(), rect.height(), w, h);  + +  #ifdef _USE_NEW_METERS +              if(mtype == DBMeter)        {          double range = maxScale - minScale; @@ -373,15 +432,234 @@ void Meter::drawVU(QPainter& p, int w, int h, int yv)          }        } +       +      /*  WIP... +      // TODO: Instead of drawing the whole area, make this respect the requested drawing rectangle, for speed... +      //       Done. But not correct yet. And could possibly simplify the whole drawing some more... +      QRect pr(0, 0,  w, 0); +      QPainterPath rectp; +      rectp.addRect(rect.x(), rect.y(), rect.width(), rect.height()); +      if(mtype == DBMeter) +      { +        double range = maxScale - minScale; +        int y1 = int((maxScale - redScale) * h / range); +        int y2 = int((maxScale - yellowScale) * h / range); + +        darkGradGreen.setStart(QPointF(0, y2)); +        darkGradGreen.setFinalStop(QPointF(0, h)); +        darkGradYellow.setStart(QPointF(0, y1)); +        darkGradYellow.setFinalStop(QPointF(0, y2)); +        darkGradRed.setStart(QPointF(0, 0)); +        darkGradRed.setFinalStop(QPointF(0, y1)); + +        lightGradGreen.setStart(QPointF(0, y2)); +        lightGradGreen.setFinalStop(QPointF(0, h)); +        lightGradYellow.setStart(QPointF(0, y1)); +        lightGradYellow.setFinalStop(QPointF(0, y2)); +        lightGradRed.setStart(QPointF(0, 0)); +        lightGradRed.setFinalStop(QPointF(0, y1)); + +        QPainterPath p_top = MusEUtil::roundedPath(0, 0, w, y1, +                                         xrad, yrad, +                                         (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) ); + +        QPainterPath p_bottom = MusEUtil::roundedPath(0, y2, w, h-y2, +                                            xrad, yrad, +                                            (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) ); + +        if(yv < y1) +        { + +          QPainterPath p_dark_red = MusEUtil::roundedPath(0, 0, w, yv, +                                                xrad, yrad, +                                                (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) ); +          p_top = p_top.subtracted(p_dark_red); + +          // Red section: +          p.fillPath(p_dark_red & rectp,        QBrush(darkGradRed));       // dark red   +          p.fillPath(p_top & rectp,             QBrush(lightGradRed));      // light red + +          // Yellow section: +          pr.setTop(y1); pr.setHeight(y2-y1); +          p.fillRect(pr & rect, QBrush(lightGradYellow));   // light yellow + +          // Green section: +          p.fillPath(p_bottom & rectp, QBrush(lightGradGreen));    // light green +        } +        else +        if(yv < y2) +        { +          // Red section: +          p.fillPath(p_top & rectp, QBrush(darkGradRed));       // dark red   + +          // Yellow section: +          pr.setTop(y1); pr.setHeight(yv-y1); +          p.fillRect(pr & rect, QBrush(darkGradYellow));    // dark yellow +          pr.setTop(yv); pr.setHeight(y2-yv); +          p.fillRect(pr & rect, QBrush(lightGradYellow));   // light yellow + +          // Green section: +          p.fillPath(p_bottom & rectp, QBrush(lightGradGreen));    // light green +        } +        else +        //if(yv <= y3)    +        { +          QPainterPath p_light_green = MusEUtil::roundedPath(0, yv, w, h-yv, +                                                   xrad, yrad, +                                                   (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) ); +          p_bottom = p_bottom.subtracted(p_light_green); + +          // Red section: +          p.fillPath(p_top & rectp, QBrush(darkGradRed));      // dark red   + +          // Yellow section: +          pr.setTop(y1); pr.setHeight(y2-y1); +          p.fillRect(pr & rect, QBrush(darkGradYellow));   // dark yellow + +          // Green section: +          p.fillPath(p_bottom & rectp, QBrush(darkGradGreen));    // dark green +          p.fillPath(p_light_green & rectp, QBrush(lightGradGreen));   // light green +        } + +        pr.setTop(y1); pr.setHeight(1); +        p.fillRect(pr & rect, separator_color); +        pr.setTop(y2); //pr.setHeight(1); +        p.fillRect(pr & rect, separator_color); + +      }   +      else +      { +        darkGradGreen.setStart(QPointF(0, 0)); +        darkGradGreen.setFinalStop(QPointF(0, h)); + +        lightGradGreen.setStart(QPointF(0, 0)); +        lightGradGreen.setFinalStop(QPointF(0, h)); + +        // We need to draw the meter in two parts. The cutoff for upper rectangle can be +        // anywhere between yrad and h-yrad. Without loss of generality we pick the lower limit. +        int cut = yrad; + +        QPainterPath p_top = MusEUtil::roundedPath(0, 0, w, cut, +                                         xrad, yrad, +                                         (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) ); + +        QPainterPath p_bottom = MusEUtil::roundedPath(0, cut, w, h-cut, +                                            xrad, yrad, +                                            (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) ); + +        if(yv < cut) +        { + +          QPainterPath p_dark = MusEUtil::roundedPath(0, 0, w, yv, +                                            xrad, yrad, +                                            (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) ); + +          p_top = p_top.subtracted(p_dark); + +          // top section: +          p.fillPath(p_dark & rectp, QBrush(darkGradGreen));       // dark green +          p.fillPath(p_top & rectp, QBrush(lightGradGreen));      // light green + +          // bottom section: +          p.fillPath(p_bottom & rectp, QBrush(lightGradGreen));      // light green +        } +        else +        { +          QPainterPath p_light = MusEUtil::roundedPath(0, yv, w, h-yv, +                                                   xrad, yrad, +                                                   (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) ); +          p_bottom = p_bottom.subtracted(p_light); + +          // top section: +          p.fillPath(p_top & rectp, QBrush(darkGradGreen));       // dark green + +          // bottom section: +          p.fillPath(p_bottom & rectp, QBrush(darkGradGreen));       // dark green +          p.fillPath(p_light & rectp, QBrush(lightGradGreen));      // light green +        } + +      } +      */ +       +  #else +       +      QRect pr(0, 0,  w, 0); +      if(mtype == DBMeter) +      { +        double range = maxScale - minScale; +        int y1 = int((maxScale - redScale) * h / range); +        int y2 = int((maxScale - yellowScale) * h / range); +         +        if(yv < y1) +        { +          // Red section: +          pr.setTop(0); pr.setHeight(yv); +          p.fillRect(pr & rect, QBrush(0x8e0000));     // dark red   +          pr.setTop(yv); pr.setHeight(y1-yv); +          p.fillRect(pr & rect, QBrush(0xff0000));     // light red +           +          // Yellow section: +          pr.setTop(y1); pr.setHeight(y2-y1); +          p.fillRect(pr & rect, QBrush(0xffff00));     // light yellow +           +          // Green section: +          pr.setTop(y2); pr.setHeight(h-y2); +          p.fillRect(pr & rect, QBrush(0x00ff00));     // light green +        } +        else +        if(yv < y2) +        { +          // Red section: +          pr.setTop(0); pr.setHeight(y1); +          p.fillRect(pr & rect, QBrush(0x8e0000));     // dark red   +           +          // Yellow section: +          pr.setTop(y1); pr.setHeight(yv-y1); +          p.fillRect(pr & rect, QBrush(0x8e8e00));     // dark yellow +          pr.setTop(yv); pr.setHeight(y2-yv); +          p.fillRect(pr & rect, QBrush(0xffff00));     // light yellow +           +          // Green section: +          pr.setTop(y2); pr.setHeight(h-y2); +          p.fillRect(pr & rect, QBrush(0x00ff00));     // light green +        } +        else +        //if(yv <= y3)    +        { +          // Red section: +          pr.setTop(0); pr.setHeight(y1); +          p.fillRect(pr & rect, QBrush(0x8e0000));     // dark red   +           +          // Yellow section: +          pr.setTop(y1); pr.setHeight(y2-y1); +          p.fillRect(pr & rect, QBrush(0x8e8e00));     // dark yellow +           +          // Green section: +          pr.setTop(y2); pr.setHeight(yv-y2); +          p.fillRect(pr & rect, QBrush(0x007000));     // dark green +          pr.setTop(yv); pr.setHeight(h-yv); +          p.fillRect(pr & rect, QBrush(0x00ff00));     // light green +        } +      }   +      else +      { +        pr.setTop(0); pr.setHeight(yv); +        p.fillRect(pr & rect, QBrush(0x007000));   // dark green +        pr.setTop(yv); pr.setHeight(h-yv); +        p.fillRect(pr & rect, QBrush(0x00ff00));   // light green +      } +       +  #endif  }  //---------------------------------------------------------  //   resizeEvent  //--------------------------------------------------------- -  void Meter::resizeEvent(QResizeEvent* /*ev*/) +void Meter::resizeEvent(QResizeEvent* /*ev*/)      {   +      cur_yv = -1;  // Force re-initialization.      }  //--------------------------------------------------------- diff --git a/muse2/muse/widgets/meter.h b/muse2/muse/widgets/meter.h index 06f35ca2..ba816319 100644 --- a/muse2/muse/widgets/meter.h +++ b/muse2/muse/widgets/meter.h @@ -6,6 +6,7 @@  //  //  (C) Copyright 2000 Werner Schweer (ws@seh.de)  //  (C) Copyright 2011 Orcan Ogetbil (ogetbilo at sf.net) +//  (C) Copyright 2011 Tim E. Real (terminator356 on users DOT sourceforge DOT net)  //  //  This program is free software; you can redistribute it and/or  //  modify it under the terms of the GNU General Public License @@ -81,8 +82,9 @@ class Meter : public QFrame {        double maxVal;        double minScale, maxScale;        int yellowScale, redScale; +      int cur_yv, last_yv; -      void drawVU(QPainter& p, int, int, int); +      void drawVU(QPainter& p, const QRect&, int);        void paintEvent(QPaintEvent*);        void resizeEvent(QResizeEvent*); diff --git a/muse2/muse/widgets/mtscale.cpp b/muse2/muse/widgets/mtscale.cpp index 1bd34de3..8f63c36b 100644 --- a/muse2/muse/widgets/mtscale.cpp +++ b/muse2/muse/widgets/mtscale.cpp @@ -175,7 +175,10 @@ void MTScale::viewMouseMoveEvent(QMouseEvent* event)                    i = 1;                    break;              case Qt::RightButton: -                  i = 2; +                  if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) +                      i = 1; +                  else +                      i = 2;                    break;              default:                    return; // if no button is pressed the function returns here diff --git a/muse2/muse/widgets/mtscale_flo.cpp b/muse2/muse/widgets/mtscale_flo.cpp index 50abf75d..beb7eef3 100644 --- a/muse2/muse/widgets/mtscale_flo.cpp +++ b/muse2/muse/widgets/mtscale_flo.cpp @@ -145,7 +145,10 @@ void MTScaleFlo::mouseMoveEvent(QMouseEvent* event)                    i = 1;                    break;              case Qt::RightButton: -                  i = 2; +                  if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) +                      i = 1; +                  else +                      i = 2;                    break;              default:                    return; // if no button is pressed the function returns here diff --git a/muse2/muse/widgets/musewidgetsplug.cpp b/muse2/muse/widgets/musewidgetsplug.cpp index 7141fe4e..3ebd1aa5 100644 --- a/muse2/muse/widgets/musewidgetsplug.cpp +++ b/muse2/muse/widgets/musewidgetsplug.cpp @@ -212,7 +212,9 @@ GlobalConfigValues config = {        true,                         // projectStoreInFolder        true,                         // useProjectSaveDialog        64,                           // minControlProcessPeriod -      false                         // popupsDefaultStayOpen +      false,                        // popupsDefaultStayOpen +      false,                        // leftMouseButtonCanDecrease +      false                         // rangeMarkerWithoutMMBCheckBox        };  //--------------------------------------------------------- diff --git a/muse2/muse/widgets/nentry.cpp b/muse2/muse/widgets/nentry.cpp index 13569b0d..a70b1a54 100644 --- a/muse2/muse/widgets/nentry.cpp +++ b/muse2/muse/widgets/nentry.cpp @@ -28,6 +28,7 @@  #include <QTimer>  #include "nentry.h" +#include "gconfig.h"  #define TIMER1    400  #define TIMER2    200 @@ -254,7 +255,9 @@ void Nentry::repeat()        switch (button) {              case Qt::LeftButton: -                  return; +                  if (!MusEConfig::config.leftMouseButtonCanDecrease) +                    return; +                  // else fall through              case Qt::MidButton:                    decValue(evx);                    break; diff --git a/muse2/muse/widgets/pastedialog.cpp b/muse2/muse/widgets/pastedialog.cpp index 7c9c2248..bc031b30 100644 --- a/muse2/muse/widgets/pastedialog.cpp +++ b/muse2/muse/widgets/pastedialog.cpp @@ -85,9 +85,9 @@ QString PasteDialog::ticks_to_quarter_string(int ticks)  		double quarters = (double) ticks/config.division;  		bool one = ( quarters > 0.995 && quarters < 1.005 );  		if (one) -			return QString::number(quarters, 'f', 2) + " " + tr("quarter"); +			return tr("%1 quarter", "for floating-point arguments like 1.5").arg(quarters, 0, 'f', 2);  		else -			return QString::number(quarters, 'f', 2) + " " + tr("quarters"); +			return tr("%1 quarters", "for floating-point arguments like 1.5").arg(quarters, 0, 'f', 2);  	}  } diff --git a/muse2/muse/widgets/pasteeventsdialog.cpp b/muse2/muse/widgets/pasteeventsdialog.cpp index 04b7cbd7..e8436711 100644 --- a/muse2/muse/widgets/pasteeventsdialog.cpp +++ b/muse2/muse/widgets/pasteeventsdialog.cpp @@ -99,9 +99,9 @@ QString PasteEventsDialog::ticks_to_quarter_string(int ticks)  		double quarters = (double) ticks/config.division;  		bool one = ( quarters > 0.995 && quarters < 1.005 );  		if (one) -			return QString::number(quarters, 'f', 2) + " " + tr("quarter"); +			return tr("%1 quarter", "for floating-point arguments like 1.5").arg(quarters, 0, 'f', 2);  		else -			return QString::number(quarters, 'f', 2) + " " + tr("quarters"); +			return tr("%1 quarters", "for floating-point arguments like 1.5").arg(quarters, 0, 'f', 2);  	}  } diff --git a/muse2/muse/widgets/routepopup.cpp b/muse2/muse/widgets/routepopup.cpp index ec3f3ea0..0336f8ed 100644 --- a/muse2/muse/widgets/routepopup.cpp +++ b/muse2/muse/widgets/routepopup.cpp @@ -1152,7 +1152,7 @@ void RoutePopupMenu::prepare()            continue;          PopupMenu* subp = new PopupMenu(morep, true); -        subp->setTitle(QString("%1:").arg(i) + tr("<none>"));  +        subp->setTitle(QString("%1:%2").arg(i).arg(tr("<none>")));           // MusE-2: Check this - needed with QMenu? Help says no. No - verified, it actually causes double triggers!          //connect(subp, SIGNAL(triggered(QAction*)), pup, SIGNAL(triggered(QAction*))); diff --git a/muse2/muse/widgets/shortcutcapturedialog.cpp b/muse2/muse/widgets/shortcutcapturedialog.cpp index a470d698..26526f1e 100644 --- a/muse2/muse/widgets/shortcutcapturedialog.cpp +++ b/muse2/muse/widgets/shortcutcapturedialog.cpp @@ -105,7 +105,7 @@ void ShortcutCaptureDialog::keyPressEvent(QKeyEvent* e)                        (( shortcuts[i].type  & (shortcuts[shortcutindex].type | INVIS_SHRT)) ||                           shortcuts[i].type & GLOBAL_SHRT ||                           shortcuts[shortcutindex].type & GLOBAL_SHRT)) { // affect the same scope -                      msgString = tr("Shortcut conflicts with ") + QString(shortcuts[i].descr); +                      msgString = tr("Shortcut conflicts with %1").arg(shortcuts[i].descr);                        conflict = true;                        break;                        } diff --git a/muse2/muse/widgets/siglabel.cpp b/muse2/muse/widgets/siglabel.cpp index 1a1c9164..9916bd0a 100644 --- a/muse2/muse/widgets/siglabel.cpp +++ b/muse2/muse/widgets/siglabel.cpp @@ -31,6 +31,7 @@  #define TIMER4    50  #include "globals.h" +#include "gconfig.h"  #include <QMouseEvent>  #include <QWheelEvent>  #include <QLabel> @@ -70,7 +71,9 @@ void SigLabel::mousePressEvent(QMouseEvent* event)        int zz = z, nn = n;        switch (button) {              case Qt::LeftButton: -                  return; +                  if (!MusEConfig::config.leftMouseButtonCanDecrease) +                    return; +                  // else fall through              case Qt::MidButton:                    incValue(zaehler, false, zz, nn);                    break; diff --git a/muse2/muse/widgets/sigscale.cpp b/muse2/muse/widgets/sigscale.cpp index bcfb540e..2a4350b3 100644 --- a/muse2/muse/widgets/sigscale.cpp +++ b/muse2/muse/widgets/sigscale.cpp @@ -102,7 +102,10 @@ void SigScale::viewMouseMoveEvent(QMouseEvent* event)                    i = 1;                    break;              case Qt::RightButton: -                  i = 2; +                  if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) +                      i = 1; +                  else +                      i = 2;                    break;              default:                    return; 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 diff --git a/muse2/muse/widgets/wtscale.cpp b/muse2/muse/widgets/wtscale.cpp index 3b6aa6eb..94bd058d 100644 --- a/muse2/muse/widgets/wtscale.cpp +++ b/muse2/muse/widgets/wtscale.cpp @@ -29,6 +29,7 @@  #include "wtscale.h"  #include "midieditor.h"  #include "globals.h" +#include "gconfig.h"  #include "song.h"  #include "../marker/marker.h"  #include "icons.h" @@ -133,7 +134,10 @@ void WTScale::viewMouseMoveEvent(QMouseEvent* event)                    i = 1;                    break;              case Qt::RightButton: -                  i = 2; +                  if ((MusEConfig::config.rangeMarkerWithoutMMB) && (event->modifiers() & Qt::ControlModifier)) +                      i = 1; +                  else +                      i = 2;                    break;              default:                    return; | 
