diff options
| author | Florian Jung <flo@windfisch.org> | 2011-12-21 17:39:57 +0000 | 
|---|---|---|
| committer | Florian Jung <flo@windfisch.org> | 2011-12-21 17:39:57 +0000 | 
| commit | 1057d7190242cdf9248671b316a398db805f5f56 (patch) | |
| tree | ab50268a7db2f80cfb45a7ad6578fe735ab84ce5 /muse2/muse/instruments | |
| parent | 9977c7114089b8708d310268833b83343caa0fd1 (diff) | |
| parent | c36a5508aa42e596b005425208054af9a60734b4 (diff) | |
merged with trunk (that is, pulled the fixes from release_2_0)
only quickly tested, seems okay on the first glance
Diffstat (limited to 'muse2/muse/instruments')
| -rw-r--r-- | muse2/muse/instruments/editinstrument.cpp | 50 | ||||
| -rw-r--r-- | muse2/muse/instruments/minstrument.cpp | 35 | ||||
| -rw-r--r-- | muse2/muse/instruments/minstrument.h | 8 | 
3 files changed, 28 insertions, 65 deletions
| diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp index 742e0626..b90b872e 100644 --- a/muse2/muse/instruments/editinstrument.cpp +++ b/muse2/muse/instruments/editinstrument.cpp @@ -407,27 +407,10 @@ void EditInstrument::saveAs()        if(!QDir(MusEGlobal::museUserInstruments).exists())        { -        if(QMessageBox::question(this, -            tr("MusE:"), -            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, -            Qt::NoButton) == QMessageBox::Ok) -        { -          if(QDir().mkdir(MusEGlobal::museUserInstruments)) -            printf("Created user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); -          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 '%1'").arg(MusEGlobal::museUserInstruments)); -            //return; -            path = MusEGlobal::museUser; -          } -        }  -        else  -        //  return;   -          path = MusEGlobal::museUser; +        printf("MusE Error! User instrument directory: %s does not exist. Should be created at startup!\n", MusEGlobal::museUserInstruments.toLatin1().constData()); +         +        //path = MusEGlobal::museUser; +        //path = MusEGlobal::configPath;          }        //if (instrument->filePath().isEmpty()) @@ -699,27 +682,10 @@ void EditInstrument::fileSaveAs()        if(!QDir(MusEGlobal::museUserInstruments).exists())        { -        if(QMessageBox::question(this, -            tr("MusE:"), -            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, -            Qt::NoButton) == QMessageBox::Ok) -        { -          if(QDir().mkdir(MusEGlobal::museUserInstruments)) -            printf("Created user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); -          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 '%1'").arg(MusEGlobal::museUserInstruments)); -            //return; -            path = MusEGlobal::museUser; -          } -        }  -        else  -        //  return;   -          path = MusEGlobal::museUser; +        printf("MusE Error! User instrument directory: %s does not exist. Should be created at startup!\n", MusEGlobal::museUserInstruments.toLatin1().constData()); +         +        //path = MusEGlobal::museUser; +        //path = MusEGlobal::configPath;          }        path += QString("/%1.idf").arg(so); diff --git a/muse2/muse/instruments/minstrument.cpp b/muse2/muse/instruments/minstrument.cpp index c479ebc6..a01903ae 100644 --- a/muse2/muse/instruments/minstrument.cpp +++ b/muse2/muse/instruments/minstrument.cpp @@ -932,15 +932,11 @@ QString MidiInstrument::getPatchName(int channel, int prog, MType mode, bool dru        return "<unknown>";        } -} // namespace MusECore - -namespace MusEGui { -  //---------------------------------------------------------  //   populatePatchPopup  //--------------------------------------------------------- -void populatePatchPopup(MusECore::MidiInstrument* midiInstrument, PopupMenu* menu, int chan, MType songType, bool drum) +void MidiInstrument::populatePatchPopup(MusEGui::PopupMenu* menu, int chan, MType songType, bool drum)        {        menu->clear();        int mask = 0; @@ -952,7 +948,7 @@ void populatePatchPopup(MusECore::MidiInstrument* midiInstrument, PopupMenu* men                if(drumchan)                {                  int id = (0xff << 16) + (0xff << 8) + 0x00;  // First patch -                QAction* act = menu->addAction(MusECore::gmdrumname); +                QAction* act = menu->addAction(gmdrumname);                  //act->setCheckable(true);                  act->setData(id);                  return; @@ -961,16 +957,16 @@ void populatePatchPopup(MusECore::MidiInstrument* midiInstrument, PopupMenu* men                break;              case MT_UNKNOWN:  mask = 7; break;              } -      if (midiInstrument->groups()->size() > 1) { -            for (MusECore::ciPatchGroup i = midiInstrument->groups()->begin(); i != midiInstrument->groups()->end(); ++i) { -                  MusECore::PatchGroup* pgp = *i; +      if (pg.size() > 1) { +            for (ciPatchGroup i = pg.begin(); i != pg.end(); ++i) { +                  PatchGroup* pgp = *i;                    //QMenu* pm = menu->addMenu(pgp->name); -                  PopupMenu* pm = new PopupMenu(pgp->name, menu, menu->stayOpen());  // Use the parent stayOpen here. +                  MusEGui::PopupMenu* pm = new MusEGui::PopupMenu(pgp->name, menu, menu->stayOpen());  // Use the parent stayOpen here.                    menu->addMenu(pm);                    pm->setFont(MusEGlobal::config.fonts[0]); -                  const MusECore::PatchList& pl = pgp->patches; -                  for (MusECore::ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { -                        const MusECore::Patch* mp = *ipl; +                  const PatchList& pl = pgp->patches; +                  for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { +                        const Patch* mp = *ipl;                          if ((mp->typ & mask) &&                               ((drum && songType != MT_GM) ||                               (mp->drum == drumchan)) )   @@ -985,11 +981,11 @@ void populatePatchPopup(MusECore::MidiInstrument* midiInstrument, PopupMenu* men                          }                    }              } -      else if (midiInstrument->groups()->size() == 1 ){ +      else if (pg.size() == 1 ){              // no groups -            const MusECore::PatchList& pl = midiInstrument->groups()->front()->patches; -            for (MusECore::ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { -                  const MusECore::Patch* mp = *ipl; +            const PatchList& pl = pg.front()->patches; +            for (ciPatch ipl = pl.begin(); ipl != pl.end(); ++ipl) { +                  const Patch* mp = *ipl;                    if (mp->typ & mask) {                          int id = ((mp->hbank & 0xff) << 16)                                   + ((mp->lbank & 0xff) << 8) + (mp->prog & 0xff); @@ -999,6 +995,7 @@ void populatePatchPopup(MusECore::MidiInstrument* midiInstrument, PopupMenu* men                          }                    }              } -      } -} // namespace MusEGui +    } + +} // namespace MusECore diff --git a/muse2/muse/instruments/minstrument.h b/muse2/muse/instruments/minstrument.h index 3a645d7f..385e67b4 100644 --- a/muse2/muse/instruments/minstrument.h +++ b/muse2/muse/instruments/minstrument.h @@ -143,7 +143,7 @@ class MidiInstrument {        virtual void reset(int, MType);        virtual QString getPatchName(int,int,MType,bool);        //virtual void populatePatchPopup(QMenu*, int, MType, bool); -      //virtual void populatePatchPopup(MusEGui::PopupMenu*, int, MType, bool); +      virtual void populatePatchPopup(MusEGui::PopupMenu*, int, MType, bool);        void read(Xml&);        void write(int level, Xml&); @@ -171,8 +171,8 @@ extern void removeMidiInstrument(const MidiInstrument* instr);  } // namespace MusECore -namespace MusEGui { -extern void populatePatchPopup(MusECore::MidiInstrument*, PopupMenu*, int, MType, bool); -} +//namespace MusEGui { +//extern void populatePatchPopup(MusECore::MidiInstrument*, PopupMenu*, int, MType, bool); +//}  #endif | 
