From 5f5a8e76f19d6956f6d711979877028f07203d88 Mon Sep 17 00:00:00 2001 From: Orcan Ogetbil Date: Sat, 10 Sep 2011 20:16:16 +0000 Subject: added license info to new files. moved populateAddSynth / populateAddTrack into helper.cpp, Put stuff in helper.* into MusEUtil namespace. --- muse2/muse/arranger/arrangerview.cpp | 331 +++++---------------------------- muse2/muse/arranger/arrangerview.h | 15 ++ muse2/muse/arranger/tlist.cpp | 8 +- muse2/muse/dialogs.cpp | 15 ++ muse2/muse/dialogs.h | 15 ++ muse2/muse/functions.cpp | 2 +- muse2/muse/helper.cpp | 246 ++++++++++++++++++++++++ muse2/muse/helper.h | 13 +- muse2/muse/liste/listedit.cpp | 3 +- muse2/muse/midiedit/dlist.cpp | 5 +- muse2/muse/midiedit/scoreedit.cpp | 6 +- muse2/muse/miditransform.cpp | 8 +- muse2/muse/mixer/amixer.cpp | 8 +- muse2/muse/mpevent.cpp | 2 +- muse2/muse/mplugins/midiitransform.cpp | 8 +- muse2/muse/structure.h | 15 ++ muse2/muse/widgets/mdisettings.cpp | 15 ++ muse2/muse/widgets/mdisettings.h | 15 ++ muse2/muse/widgets/pastedialog.cpp | 15 ++ muse2/muse/widgets/pastedialog.h | 15 ++ muse2/muse/widgets/pitchedit.cpp | 2 +- muse2/muse/widgets/pitchedit.h | 2 - muse2/muse/widgets/pitchlabel.cpp | 2 +- 23 files changed, 448 insertions(+), 318 deletions(-) diff --git a/muse2/muse/arranger/arrangerview.cpp b/muse2/muse/arranger/arrangerview.cpp index 2c84d17e..10f43436 100644 --- a/muse2/muse/arranger/arrangerview.cpp +++ b/muse2/muse/arranger/arrangerview.cpp @@ -3,307 +3,70 @@ // Linux Music Editor // arrangerview.cpp // (C) Copyright 2011 Florian Jung (flo93@users.sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// //========================================================= -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include +#include #include -#include -#include #include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include -#include -#include - -#include "arrangerview.h" -#include "visibletracks.h" -#include "structure.h" - - -#include -#include -using namespace std; - -#include "app.h" -#include "xml.h" -#include "mtscale.h" #include "al/sig.h" -#include "scoreedit.h" -#include "tools.h" -#include "ttoolbar.h" -#include "tb1.h" -#include "globals.h" -#include "gconfig.h" -#include "icons.h" +#include "app.h" +#include "arrangerview.h" #include "audio.h" #include "functions.h" +#include "gconfig.h" +#include "globals.h" #include "helper.h" +#include "icons.h" +#include "mtscale.h" +#include "scoreedit.h" +#include "shortcuts.h" #include "sig.h" #include "song.h" -#include "shortcuts.h" -#include "synth.h" - -#ifdef DSSI_SUPPORT -#include "dssihost.h" -#endif - -#ifdef VST_SUPPORT -#include "vst.h" -#endif - - -//--------------------------------------------------------- -// populateAddSynth -//--------------------------------------------------------- - -// ORCAN - CHECK -QMenu* populateAddSynth(QWidget* parent) -{ - QMenu* synp = new QMenu(parent); - - //typedef std::multimap asmap; - typedef std::multimap asmap; - - //typedef std::multimap::iterator imap; - typedef std::multimap::iterator imap; - - MessSynth* synMESS = 0; - QMenu* synpMESS = 0; - asmap mapMESS; - - #ifdef DSSI_SUPPORT - DssiSynth* synDSSI = 0; - QMenu* synpDSSI = 0; - asmap mapDSSI; - #endif - - #ifdef VST_SUPPORT - VstSynth* synVST = 0; - QMenu* synpVST = 0; - asmap mapVST; - #endif - - // Not necessary, but what the heck. - QMenu* synpOther = 0; - asmap mapOther; - - //const int synth_base_id = 0x1000; - int ii = 0; - for(std::vector::iterator i = synthis.begin(); i != synthis.end(); ++i) - { - synMESS = dynamic_cast(*i); - if(synMESS) - { - mapMESS.insert( std::pair (std::string(synMESS->description().toLower().toLatin1().constData()), ii) ); - } - else - { - - #ifdef DSSI_SUPPORT - synDSSI = dynamic_cast(*i); - if(synDSSI) - { - mapDSSI.insert( std::pair (std::string(synDSSI->description().toLower().toLatin1().constData()), ii) ); - } - else - #endif - - { - #ifdef VST_SUPPORT - synVST = dynamic_cast(*i); - if(synVST) - { - mapVST.insert( std::pair (std::string(synVST->description().toLower().toLatin1().constData()), ii) ); - } - else - #endif - - { - mapOther.insert( std::pair (std::string((*i)->description().toLower().toLatin1().constData()), ii) ); - } - } - } - - ++ii; - } - - int sz = synthis.size(); - for(imap i = mapMESS.begin(); i != mapMESS.end(); ++i) - { - int idx = i->second; - if(idx > sz) // Sanity check - continue; - Synth* s = synthis[idx]; - if(s) - { - // No MESS sub-menu yet? Create it now. - if(!synpMESS) - synpMESS = new QMenu(parent); - QAction* sM = synpMESS->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); - sM->setData(MENU_ADD_SYNTH_ID_BASE + idx); - } - } - - #ifdef DSSI_SUPPORT - for(imap i = mapDSSI.begin(); i != mapDSSI.end(); ++i) - { - int idx = i->second; - if(idx > sz) - continue; - Synth* s = synthis[idx]; - if(s) - { - // No DSSI sub-menu yet? Create it now. - if(!synpDSSI) - synpDSSI = new QMenu(parent); - //synpDSSI->insertItem(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx); - QAction* sD = synpDSSI->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); - sD->setData(MENU_ADD_SYNTH_ID_BASE + idx); - } - } - #endif - - #ifdef VST_SUPPORT - for(imap i = mapVST.begin(); i != mapVST.end(); ++i) - { - int idx = i->second; - if(idx > sz) - continue; - Synth* s = synthis[idx]; - if(s) - { - // No VST sub-menu yet? Create it now. - if(!synpVST) - synpVST = new QMenu(parent); - QAction* sV = synpVST->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); - sV->setData(MENU_ADD_SYNTH_ID_BASE + idx); - } - } - #endif - - for(imap i = mapOther.begin(); i != mapOther.end(); ++i) - { - int idx = i->second; - if(idx > sz) - continue; - Synth* s = synthis[idx]; - // No Other sub-menu yet? Create it now. - if(!synpOther) - synpOther = new QMenu(parent); - //synpOther->insertItem(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx); - QAction* sO = synpOther->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); - sO->setData(MENU_ADD_SYNTH_ID_BASE + idx); - } - - if(synpMESS) - { - synpMESS->setIcon(*synthIcon); - synpMESS->setTitle(QT_TRANSLATE_NOOP("@default", "MESS")); - synp->addMenu(synpMESS); - } - - #ifdef DSSI_SUPPORT - if(synpDSSI) - { - synpDSSI->setIcon(*synthIcon); - synpDSSI->setTitle(QT_TRANSLATE_NOOP("@default", "DSSI")); - synp->addMenu(synpDSSI); - } - #endif - - #ifdef VST_SUPPORT - if(synpVST) - { - synpVST->setIcon(*synthIcon); - synpVST->setTitle(QT_TRANSLATE_NOOP("@default", "FST")); - synp->addMenu(synpVST); - } - #endif - - if(synpOther) - { - synpOther->setIcon(*synthIcon); - synpOther->setTitle(QObject::tr("Other")); - synp->addMenu(synpOther); - } - - return synp; -} - - -//--------------------------------------------------------- -// populateAddTrack -// this is also used in "mixer" -//--------------------------------------------------------- - -QActionGroup* populateAddTrack(QMenu* addTrack) - { - QActionGroup* grp = new QActionGroup(addTrack); - - QAction* midi = addTrack->addAction(QIcon(*addtrack_addmiditrackIcon), - QT_TRANSLATE_NOOP("@default", "Add Midi Track")); - midi->setData(Track::MIDI); - grp->addAction(midi); - QAction* drum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), - QT_TRANSLATE_NOOP("@default", "Add Drum Track")); - drum->setData(Track::DRUM); - grp->addAction(drum); - QAction* wave = addTrack->addAction(QIcon(*addtrack_wavetrackIcon), - QT_TRANSLATE_NOOP("@default", "Add Wave Track")); - wave->setData(Track::WAVE); - grp->addAction(wave); - QAction* aoutput = addTrack->addAction(QIcon(*addtrack_audiooutputIcon), - QT_TRANSLATE_NOOP("@default", "Add Audio Output")); - aoutput->setData(Track::AUDIO_OUTPUT); - grp->addAction(aoutput); - QAction* agroup = addTrack->addAction(QIcon(*addtrack_audiogroupIcon), - QT_TRANSLATE_NOOP("@default", "Add Audio Group")); - agroup->setData(Track::AUDIO_GROUP); - grp->addAction(agroup); - QAction* ainput = addTrack->addAction(QIcon(*addtrack_audioinputIcon), - QT_TRANSLATE_NOOP("@default", "Add Audio Input")); - ainput->setData(Track::AUDIO_INPUT); - grp->addAction(ainput); - QAction* aaux = addTrack->addAction(QIcon(*addtrack_auxsendIcon), - QT_TRANSLATE_NOOP("@default", "Add Aux Send")); - aaux->setData(Track::AUDIO_AUX); - grp->addAction(aaux); - - // Create a sub-menu and fill it with found synth types. Make addTrack the owner. - QMenu* synp = populateAddSynth(addTrack); - synp->setIcon(*synthIcon); - synp->setTitle(QT_TRANSLATE_NOOP("@default", "Add Synth")); - - // Add the sub-menu to the given menu. - addTrack->addMenu(synp); - - QObject::connect(addTrack, SIGNAL(triggered(QAction *)), song, SLOT(addNewTrack(QAction *))); - - return grp; - } - - - +#include "structure.h" +#include "tb1.h" +#include "tools.h" +#include "ttoolbar.h" +#include "visibletracks.h" +#include "xml.h" //--------------------------------------------------------- @@ -864,7 +627,7 @@ void ArrangerView::clearScoreMenuMappers() void ArrangerView::populateAddTrack() { - QActionGroup *grp = ::populateAddTrack(addTrack); + QActionGroup *grp = MusEUtil::populateAddTrack(addTrack); trackMidiAction = grp->actions()[0]; trackDrumAction = grp->actions()[1]; diff --git a/muse2/muse/arranger/arrangerview.h b/muse2/muse/arranger/arrangerview.h index 542b37f6..d5e06c6c 100644 --- a/muse2/muse/arranger/arrangerview.h +++ b/muse2/muse/arranger/arrangerview.h @@ -3,6 +3,21 @@ // Linux Music Editor // arrangerview.h // (C) Copyright 2011 Florian Jung (flo93@users.sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// //========================================================= #ifndef __ARRANGERVIEW_H__ diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 6dea6ae1..786b4ad7 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -55,6 +55,7 @@ #include "audio.h" #include "instruments/minstrument.h" #include "app.h" +#include "helper.h" #include "gconfig.h" #include "event.h" #include "midiedit/drummap.h" @@ -66,11 +67,6 @@ #include "dssihost.h" #endif -//namespace MusEApp { FINDMICHJETZT: again: dirty, dirty. implemented in arrangerview.cpp -// should be moved together with populateAddTrack somewhere else -extern QMenu* populateAddSynth(QWidget* parent); -//} - 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 }; @@ -1022,7 +1018,7 @@ void TList::mousePressEvent(QMouseEvent* ev) aaux->setData(Track::AUDIO_AUX); // Create a sub-menu and fill it with found synth types. Make p the owner. - QMenu* synp = populateAddSynth(p); + QMenu* synp = MusEUtil::populateAddSynth(p); synp->setIcon(*synthIcon); synp->setTitle(QT_TRANSLATE_NOOP("@default", "Add Synth")); diff --git a/muse2/muse/dialogs.cpp b/muse2/muse/dialogs.cpp index 1dd19707..a0bf265f 100644 --- a/muse2/muse/dialogs.cpp +++ b/muse2/muse/dialogs.cpp @@ -3,6 +3,21 @@ // Linux Music Editor // $Id: functions.cpp,v 1.20.2.19 2011/05/05 20:10 flo93 Exp $ // (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// //========================================================= #include "dialogs.h" diff --git a/muse2/muse/dialogs.h b/muse2/muse/dialogs.h index 4c449a6a..b8e85b91 100644 --- a/muse2/muse/dialogs.h +++ b/muse2/muse/dialogs.h @@ -3,6 +3,21 @@ // Linux Music Editor // $Id: dialogs.h,v 1.20.2.19 2011/05/05 20:10 flo93 Exp $ // (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// //========================================================= #ifndef __DIALOGS_H__ diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index 2fc9f826..2584caa3 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -1009,7 +1009,7 @@ void paste_at(const QString& pt, int pos, int max_distance, bool always_new_part Track* dest_track; if (paste_into_part == NULL) - dest_part = partFromSerialNumber(part_id); + dest_part = MusEUtil::partFromSerialNumber(part_id); else dest_part=paste_into_part; diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp index fad9959f..6aaacdb5 100644 --- a/muse2/muse/helper.cpp +++ b/muse2/muse/helper.cpp @@ -24,11 +24,25 @@ #include "part.h" #include "track.h" #include "song.h" +#include "app.h" +#include "icons.h" +#include "synth.h" + +#ifdef DSSI_SUPPORT +#include "dssihost.h" +#endif + +#ifdef VST_SUPPORT +#include "vst.h" +#endif + namespace MusEGlobal { extern bool hIsB; } +namespace MusEUtil { + static const char* vall[] = { "c","c#","d","d#","e","f","f#","g","g#","a","a#","h" }; @@ -76,3 +90,235 @@ Part* partFromSerialNumber(int serial) printf("ERROR: partFromSerialNumber(%i) wasn't able to find an appropriate part!\n",serial); return NULL; } + + +//--------------------------------------------------------- +// populateAddSynth +//--------------------------------------------------------- + +QMenu* populateAddSynth(QWidget* parent) +{ + QMenu* synp = new QMenu(parent); + + //typedef std::multimap asmap; + typedef std::multimap asmap; + + //typedef std::multimap::iterator imap; + typedef std::multimap::iterator imap; + + MessSynth* synMESS = 0; + QMenu* synpMESS = 0; + asmap mapMESS; + + #ifdef DSSI_SUPPORT + DssiSynth* synDSSI = 0; + QMenu* synpDSSI = 0; + asmap mapDSSI; + #endif + + #ifdef VST_SUPPORT + VstSynth* synVST = 0; + QMenu* synpVST = 0; + asmap mapVST; + #endif + + // Not necessary, but what the heck. + QMenu* synpOther = 0; + asmap mapOther; + + //const int synth_base_id = 0x1000; + int ii = 0; + for(std::vector::iterator i = synthis.begin(); i != synthis.end(); ++i) + { + synMESS = dynamic_cast(*i); + if(synMESS) + { + mapMESS.insert( std::pair (std::string(synMESS->description().toLower().toLatin1().constData()), ii) ); + } + else + { + + #ifdef DSSI_SUPPORT + synDSSI = dynamic_cast(*i); + if(synDSSI) + { + mapDSSI.insert( std::pair (std::string(synDSSI->description().toLower().toLatin1().constData()), ii) ); + } + else + #endif + + { + #ifdef VST_SUPPORT + synVST = dynamic_cast(*i); + if(synVST) + { + mapVST.insert( std::pair (std::string(synVST->description().toLower().toLatin1().constData()), ii) ); + } + else + #endif + + { + mapOther.insert( std::pair (std::string((*i)->description().toLower().toLatin1().constData()), ii) ); + } + } + } + + ++ii; + } + + int sz = synthis.size(); + for(imap i = mapMESS.begin(); i != mapMESS.end(); ++i) + { + int idx = i->second; + if(idx > sz) // Sanity check + continue; + Synth* s = synthis[idx]; + if(s) + { + // No MESS sub-menu yet? Create it now. + if(!synpMESS) + synpMESS = new QMenu(parent); + QAction* sM = synpMESS->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); + sM->setData(MENU_ADD_SYNTH_ID_BASE + idx); + } + } + + #ifdef DSSI_SUPPORT + for(imap i = mapDSSI.begin(); i != mapDSSI.end(); ++i) + { + int idx = i->second; + if(idx > sz) + continue; + Synth* s = synthis[idx]; + if(s) + { + // No DSSI sub-menu yet? Create it now. + if(!synpDSSI) + synpDSSI = new QMenu(parent); + //synpDSSI->insertItem(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx); + QAction* sD = synpDSSI->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); + sD->setData(MENU_ADD_SYNTH_ID_BASE + idx); + } + } + #endif + + #ifdef VST_SUPPORT + for(imap i = mapVST.begin(); i != mapVST.end(); ++i) + { + int idx = i->second; + if(idx > sz) + continue; + Synth* s = synthis[idx]; + if(s) + { + // No VST sub-menu yet? Create it now. + if(!synpVST) + synpVST = new QMenu(parent); + QAction* sV = synpVST->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); + sV->setData(MENU_ADD_SYNTH_ID_BASE + idx); + } + } + #endif + + for(imap i = mapOther.begin(); i != mapOther.end(); ++i) + { + int idx = i->second; + if(idx > sz) + continue; + Synth* s = synthis[idx]; + // No Other sub-menu yet? Create it now. + if(!synpOther) + synpOther = new QMenu(parent); + //synpOther->insertItem(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx); + QAction* sO = synpOther->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); + sO->setData(MENU_ADD_SYNTH_ID_BASE + idx); + } + + if(synpMESS) + { + synpMESS->setIcon(*synthIcon); + synpMESS->setTitle(QT_TRANSLATE_NOOP("@default", "MESS")); + synp->addMenu(synpMESS); + } + + #ifdef DSSI_SUPPORT + if(synpDSSI) + { + synpDSSI->setIcon(*synthIcon); + synpDSSI->setTitle(QT_TRANSLATE_NOOP("@default", "DSSI")); + synp->addMenu(synpDSSI); + } + #endif + + #ifdef VST_SUPPORT + if(synpVST) + { + synpVST->setIcon(*synthIcon); + synpVST->setTitle(QT_TRANSLATE_NOOP("@default", "FST")); + synp->addMenu(synpVST); + } + #endif + + if(synpOther) + { + synpOther->setIcon(*synthIcon); + synpOther->setTitle(QObject::tr("Other")); + synp->addMenu(synpOther); + } + + return synp; +} + + +//--------------------------------------------------------- +// populateAddTrack +// this is also used in "mixer" +//--------------------------------------------------------- + +QActionGroup* populateAddTrack(QMenu* addTrack) + { + QActionGroup* grp = new QActionGroup(addTrack); + + QAction* midi = addTrack->addAction(QIcon(*addtrack_addmiditrackIcon), + QT_TRANSLATE_NOOP("@default", "Add Midi Track")); + midi->setData(Track::MIDI); + grp->addAction(midi); + QAction* drum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), + QT_TRANSLATE_NOOP("@default", "Add Drum Track")); + drum->setData(Track::DRUM); + grp->addAction(drum); + QAction* wave = addTrack->addAction(QIcon(*addtrack_wavetrackIcon), + QT_TRANSLATE_NOOP("@default", "Add Wave Track")); + wave->setData(Track::WAVE); + grp->addAction(wave); + QAction* aoutput = addTrack->addAction(QIcon(*addtrack_audiooutputIcon), + QT_TRANSLATE_NOOP("@default", "Add Audio Output")); + aoutput->setData(Track::AUDIO_OUTPUT); + grp->addAction(aoutput); + QAction* agroup = addTrack->addAction(QIcon(*addtrack_audiogroupIcon), + QT_TRANSLATE_NOOP("@default", "Add Audio Group")); + agroup->setData(Track::AUDIO_GROUP); + grp->addAction(agroup); + QAction* ainput = addTrack->addAction(QIcon(*addtrack_audioinputIcon), + QT_TRANSLATE_NOOP("@default", "Add Audio Input")); + ainput->setData(Track::AUDIO_INPUT); + grp->addAction(ainput); + QAction* aaux = addTrack->addAction(QIcon(*addtrack_auxsendIcon), + QT_TRANSLATE_NOOP("@default", "Add Aux Send")); + aaux->setData(Track::AUDIO_AUX); + grp->addAction(aaux); + + // Create a sub-menu and fill it with found synth types. Make addTrack the owner. + QMenu* synp = populateAddSynth(addTrack); + synp->setIcon(*synthIcon); + synp->setTitle(QT_TRANSLATE_NOOP("@default", "Add Synth")); + + // Add the sub-menu to the given menu. + addTrack->addMenu(synp); + + QObject::connect(addTrack, SIGNAL(triggered(QAction *)), song, SLOT(addNewTrack(QAction *))); + + return grp; + } + +} // namespace MusEUtil diff --git a/muse2/muse/helper.h b/muse2/muse/helper.h index fe4d018f..94143756 100644 --- a/muse2/muse/helper.h +++ b/muse2/muse/helper.h @@ -23,13 +23,22 @@ #ifndef __HELPER_H__ #define __HELPER_H__ -#include +class QActionGroup; +class QString; +class QMenu; +class QWidget; class Part; -extern QString pitch2string(int v); +namespace MusEUtil { + +QString pitch2string(int v); Part* partFromSerialNumber(int serial); +QMenu* populateAddSynth(QWidget* parent); +QActionGroup* populateAddTrack(QMenu* addTrack); + +} #endif diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp index e76f68e5..3da8346f 100644 --- a/muse2/muse/liste/listedit.cpp +++ b/muse2/muse/liste/listedit.cpp @@ -33,6 +33,7 @@ #include "listedit.h" #include "mtscale.h" #include "globals.h" +#include "helper.h" #include "icons.h" #include "editevent.h" #include "xml.h" @@ -381,7 +382,7 @@ QString EventListItem::text(int col) const break; case 4: if (event.isNote() || event.type() == PAfter) - s = pitch2string(event.dataA()); + s = MusEUtil::pitch2string(event.dataA()); else if (event.type() == Controller) s.setNum(event.dataA() & 0xffff); // mask off type bits else diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp index 165bb4cb..8e9633c0 100644 --- a/muse2/muse/midiedit/dlist.cpp +++ b/muse2/muse/midiedit/dlist.cpp @@ -33,6 +33,7 @@ #include "pitchedit.h" #include "midiport.h" #include "drummap.h" +#include "helper.h" #include "icons.h" #include "dlist.h" #include "song.h" @@ -90,10 +91,10 @@ void DList::draw(QPainter& p, const QRect& rect) s.setNum(dm->len); break; case COL_ANOTE: - s = pitch2string(dm->anote); + s = MusEUtil::pitch2string(dm->anote); break; case COL_ENOTE: - s = pitch2string(dm->enote); + s = MusEUtil::pitch2string(dm->enote); break; case COL_LV1: s.setNum(dm->lv1); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 39f2f389..3c8f2afe 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4414,10 +4414,10 @@ void ScoreCanvas::midi_note(int pitch, int velo) void ScoreCanvas::update_parts() { if (selected_part!=NULL) //if it's null, let it be null - selected_part=partFromSerialNumber(selected_part_index); + selected_part=MusEUtil::partFromSerialNumber(selected_part_index); if (dragged_event_part!=NULL) //same thing here - dragged_event_part=partFromSerialNumber(dragged_event_part_index); + dragged_event_part=MusEUtil::partFromSerialNumber(dragged_event_part_index); for (list::iterator it=staves.begin(); it!=staves.end(); it++) it->update_parts(); @@ -4428,7 +4428,7 @@ void staff_t::update_parts() parts.clear(); for (set::iterator it=part_indices.begin(); it!=part_indices.end(); it++) - parts.insert(partFromSerialNumber(*it)); + parts.insert(MusEUtil::partFromSerialNumber(*it)); } void staff_t::update_part_indices() diff --git a/muse2/muse/miditransform.cpp b/muse2/muse/miditransform.cpp index 76a39306..8d25fdfc 100644 --- a/muse2/muse/miditransform.cpp +++ b/muse2/muse/miditransform.cpp @@ -1502,7 +1502,7 @@ void MidiTransformerDialog::selVal1aChanged(int val) data->cmt->selVal1a = val; if ((data->cmt->selEventOp != All) && (data->cmt->selType == Note)) { - selVal1a->setSuffix(" - " + pitch2string(val)); + selVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1520,7 +1520,7 @@ void MidiTransformerDialog::selVal1bChanged(int val) data->cmt->selVal1b = val; if ((data->cmt->selEventOp != All) && (data->cmt->selType == Note)) { - selVal1b->setSuffix(" - " + pitch2string(val)); + selVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1595,7 +1595,7 @@ void MidiTransformerDialog::procVal1aChanged(int val) (data->cmt->procVal1 == Fix || data->cmt->procVal1 == ScaleMap || data->cmt->procVal1 == Dynamic || data->cmt->procVal1 == Random || data->cmt->procVal1 == Flip)) { - procVal1a->setSuffix(" - " + pitch2string(val)); + procVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1617,7 +1617,7 @@ void MidiTransformerDialog::procVal1bChanged(int val) (data->cmt->procVal1 == Fix || data->cmt->procVal1 == ScaleMap || data->cmt->procVal1 == Dynamic || data->cmt->procVal1 == Random || data->cmt->procVal1 == Flip)) { - procVal1b->setSuffix(" - " + pitch2string(val)); + procVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { diff --git a/muse2/muse/mixer/amixer.cpp b/muse2/muse/mixer/amixer.cpp index 08e1aad4..35173731 100644 --- a/muse2/muse/mixer/amixer.cpp +++ b/muse2/muse/mixer/amixer.cpp @@ -35,6 +35,7 @@ #include #include "app.h" +#include "helper.h" #include "icons.h" #include "amixer.h" #include "song.h" @@ -45,11 +46,6 @@ #include "gconfig.h" #include "xml.h" -//namespace MusEApp { FINDMICHJETZT dirty, dirty. this is implemented in arrangerview.cpp, -// currently in global namespace. where to put it? in an own code file? helper.cpp? -extern QActionGroup* populateAddTrack(QMenu* addTrack); -//} - #define __WIDTH_COMPENSATION 4 //typedef std::list StripList; @@ -172,7 +168,7 @@ AudioMixerApp::AudioMixerApp(QWidget* parent, MusEConfig::MixerConfig* c) setWindowIcon(*museIcon); QMenu* menuConfig = menuBar()->addMenu(tr("&Create")); - populateAddTrack(menuConfig); + MusEUtil::populateAddTrack(menuConfig); QMenu* menuView = menuBar()->addMenu(tr("&View")); routingId = menuView->addAction(tr("Routing"), this, SLOT(toggleRouteDialog())); diff --git a/muse2/muse/mpevent.cpp b/muse2/muse/mpevent.cpp index 11c85704..67ba968c 100644 --- a/muse2/muse/mpevent.cpp +++ b/muse2/muse/mpevent.cpp @@ -88,7 +88,7 @@ void MEvent::dump() const { printf("time:%d port:%d chan:%d ", _time, _port, _channel+1); if (_type == 0x90) { // NoteOn - QString s = pitch2string(_a); + QString s = MusEUtil::pitch2string(_a); printf("NoteOn %s(0x%x) %d\n", s.toLatin1().constData(), _a, _b); } else if (_type == 0xf0) { diff --git a/muse2/muse/mplugins/midiitransform.cpp b/muse2/muse/mplugins/midiitransform.cpp index 8cc881ff..b5b4d3c8 100644 --- a/muse2/muse/mplugins/midiitransform.cpp +++ b/muse2/muse/mplugins/midiitransform.cpp @@ -1273,7 +1273,7 @@ void MidiInputTransformDialog::selVal1aChanged(int val) cmt->selVal1a = val; if ((cmt->selEventOp != All) && (cmt->selType == MIDITRANSFORM_NOTE)) { - selVal1a->setSuffix(" - " + pitch2string(val)); + selVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1291,7 +1291,7 @@ void MidiInputTransformDialog::selVal1bChanged(int val) cmt->selVal1b = val; if ((cmt->selEventOp != All) && (cmt->selType == MIDITRANSFORM_NOTE)) { - selVal1b->setSuffix(" - " + pitch2string(val)); + selVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1330,7 +1330,7 @@ void MidiInputTransformDialog::procVal1aChanged(int val) (cmt->procVal1 == Fix || cmt->procVal1 == ScaleMap || cmt->procVal1 == Dynamic || cmt->procVal1 == Random || cmt->procVal1 == Flip)) { - procVal1a->setSuffix(" - " + pitch2string(val)); + procVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1351,7 +1351,7 @@ void MidiInputTransformDialog::procVal1bChanged(int val) (cmt->procVal1 == Fix || cmt->procVal1 == ScaleMap || cmt->procVal1 == Dynamic || cmt->procVal1 == Random || cmt->procVal1 == Flip)) { - procVal1b->setSuffix(" - " + pitch2string(val)); + procVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { diff --git a/muse2/muse/structure.h b/muse2/muse/structure.h index f9f29291..38be034b 100644 --- a/muse2/muse/structure.h +++ b/muse2/muse/structure.h @@ -3,6 +3,21 @@ // Linux Music Editor // structure.h // (C) Copyright 2011 Florian Jung (flo93@users.sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// //========================================================= #ifndef __STRUCTURE_H__ diff --git a/muse2/muse/widgets/mdisettings.cpp b/muse2/muse/widgets/mdisettings.cpp index 127aa5c1..24bf7c7c 100644 --- a/muse2/muse/widgets/mdisettings.cpp +++ b/muse2/muse/widgets/mdisettings.cpp @@ -4,6 +4,21 @@ // $Id: genset.cpp,v 1.7.2.8 2009/12/01 03:52:40 terminator356 Exp $ // // (C) Copyright 2001-2004 Werner Schweer (ws@seh.de) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// //========================================================= #include diff --git a/muse2/muse/widgets/mdisettings.h b/muse2/muse/widgets/mdisettings.h index 2f1bdf55..482f9f49 100644 --- a/muse2/muse/widgets/mdisettings.h +++ b/muse2/muse/widgets/mdisettings.h @@ -4,6 +4,21 @@ // $Id: genset.h,v 1.3 2004/01/25 09:55:17 wschweer Exp $ // // (C) Copyright 2001 Werner Schweer (ws@seh.de) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// //========================================================= #ifndef __MDISETTINGS_H__ diff --git a/muse2/muse/widgets/pastedialog.cpp b/muse2/muse/widgets/pastedialog.cpp index 0a6ce463..a053bd79 100644 --- a/muse2/muse/widgets/pastedialog.cpp +++ b/muse2/muse/widgets/pastedialog.cpp @@ -3,6 +3,21 @@ // Linux Music Editor // $Id: pastedialog.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ // (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// //========================================================= #include diff --git a/muse2/muse/widgets/pastedialog.h b/muse2/muse/widgets/pastedialog.h index 866fda4c..208ffb35 100644 --- a/muse2/muse/widgets/pastedialog.h +++ b/muse2/muse/widgets/pastedialog.h @@ -3,6 +3,21 @@ // Linux Music Editor // $Id: pastedialog.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ // (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// //========================================================= #ifndef __PASTEDIALOG_H__ diff --git a/muse2/muse/widgets/pitchedit.cpp b/muse2/muse/widgets/pitchedit.cpp index 7d637d01..4b937237 100644 --- a/muse2/muse/widgets/pitchedit.cpp +++ b/muse2/muse/widgets/pitchedit.cpp @@ -51,7 +51,7 @@ QString PitchEdit::mapValueToText(int v) return s; } else - return pitch2string(v); + return MusEUtil::pitch2string(v); } //--------------------------------------------------------- diff --git a/muse2/muse/widgets/pitchedit.h b/muse2/muse/widgets/pitchedit.h index 0c334d22..d5bb7654 100644 --- a/muse2/muse/widgets/pitchedit.h +++ b/muse2/muse/widgets/pitchedit.h @@ -25,8 +25,6 @@ #include -extern QString pitch2string(int v); - namespace MusEWidget { //--------------------------------------------------------- diff --git a/muse2/muse/widgets/pitchlabel.cpp b/muse2/muse/widgets/pitchlabel.cpp index b1f062a8..b1b9c1f1 100644 --- a/muse2/muse/widgets/pitchlabel.cpp +++ b/muse2/muse/widgets/pitchlabel.cpp @@ -83,7 +83,7 @@ void PitchLabel::setValue(int val) _value = val; QString s; if (_pitchMode) - s = pitch2string(_value); + s = MusEUtil::pitch2string(_value); else s.sprintf("%d", _value); setText(s); -- cgit v1.2.3