summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2010-12-07 03:27:48 +0000
committerTim E. Real <termtech@rogers.com>2010-12-07 03:27:48 +0000
commit8e9886770af1022d88e6f92ff4fcceb3e50d0e55 (patch)
treefb42340c5d7a75278b7ed37478f066324fa59dde
parent45f13100f9b5d0fd5a9f4950e135c2ed6de0429c (diff)
Built Awl::posedit and Awl::sigedit, and replaced /widget versions and all usages.
Reverted class SpinBox to previous revision.
-rw-r--r--muse2/ChangeLog5
-rw-r--r--muse2/al/CMakeLists.txt4
-rw-r--r--muse2/al/sig.cpp617
-rw-r--r--muse2/al/sig.h115
-rw-r--r--muse2/awl/CMakeLists.txt6
-rw-r--r--muse2/awl/posedit.cpp10
-rw-r--r--muse2/awl/posedit.h5
-rw-r--r--muse2/awl/sigedit.cpp9
-rw-r--r--muse2/awl/sigedit.h2
-rw-r--r--muse2/muse/CMakeLists.txt1
-rw-r--r--muse2/muse/app.cpp6
-rw-r--r--muse2/muse/arranger/arranger.cpp12
-rw-r--r--muse2/muse/arranger/pcanvas.cpp30
-rw-r--r--muse2/muse/audio.cpp6
-rw-r--r--muse2/muse/conf.cpp3
-rw-r--r--muse2/muse/driver/jack.cpp2
-rw-r--r--muse2/muse/exportmidi.cpp17
-rw-r--r--muse2/muse/importmidi.cpp9
-rw-r--r--muse2/muse/liste/editctrlbase.ui10
-rw-r--r--muse2/muse/liste/editevent.cpp13
-rw-r--r--muse2/muse/liste/editevent.h16
-rw-r--r--muse2/muse/liste/listedit.cpp2
-rw-r--r--muse2/muse/marker/markerview.cpp14
-rw-r--r--muse2/muse/marker/markerview.h12
-rw-r--r--muse2/muse/master/lmaster.cpp33
-rw-r--r--muse2/muse/master/lmaster.h22
-rw-r--r--muse2/muse/master/masteredit.cpp18
-rw-r--r--muse2/muse/master/masteredit.h6
-rw-r--r--muse2/muse/midi.cpp9
-rw-r--r--muse2/muse/midiedit/drumedit.cpp4
-rw-r--r--muse2/muse/midiedit/ecanvas.cpp6
-rw-r--r--muse2/muse/midiedit/pianoroll.cpp4
-rw-r--r--muse2/muse/midiedit/prcanvas.cpp16
-rw-r--r--muse2/muse/midieditor.h15
-rw-r--r--muse2/muse/miditransform.cpp4
-rw-r--r--muse2/muse/pos.cpp9
-rw-r--r--muse2/muse/seqmsg.cpp3
-rw-r--r--muse2/muse/song.cpp44
-rw-r--r--muse2/muse/song.h4
-rw-r--r--muse2/muse/songfile.cpp6
-rw-r--r--muse2/muse/transport.cpp28
-rw-r--r--muse2/muse/transport.h12
-rw-r--r--muse2/muse/undo.cpp15
-rw-r--r--muse2/muse/wave.cpp7
-rw-r--r--muse2/muse/waveedit/waveedit.cpp4
-rw-r--r--muse2/muse/widgets/CMakeLists.txt9
-rw-r--r--muse2/muse/widgets/bigtime.cpp2
-rw-r--r--muse2/muse/widgets/cliplisteditorbase.ui15
-rw-r--r--muse2/muse/widgets/editnotedialogbase.ui8
-rw-r--r--muse2/muse/widgets/editsysexdialogbase.ui10
-rw-r--r--muse2/muse/widgets/hitscale.cpp2
-rw-r--r--muse2/muse/widgets/mtscale.cpp18
-rw-r--r--muse2/muse/widgets/noteinfo.cpp12
-rw-r--r--muse2/muse/widgets/noteinfo.h10
-rw-r--r--muse2/muse/widgets/poslabel.cpp5
-rw-r--r--muse2/muse/widgets/sigedit.cpp3
-rw-r--r--muse2/muse/widgets/siglabel.cpp17
-rw-r--r--muse2/muse/widgets/siglabel.h12
-rw-r--r--muse2/muse/widgets/sigscale.cpp12
-rw-r--r--muse2/muse/widgets/spinbox.cpp48
-rw-r--r--muse2/muse/widgets/spinbox.h16
61 files changed, 1116 insertions, 278 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 89791bfe..0ddf4bb9 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,8 @@
+06.12.2010
+ - Built Awl::posedit and Awl::sigedit, and replaced /widget versions and all usages. (Tim)
+ TODO: Awl::sigedit has no returnPressed signal, for lmaster.
+ TODO: Transport position posedits jump to sub-ticks sections - can't auto-inc other sections.
+ - Reverted class SpinBox to previous revision. Test OK. (Tim)
05.12.2010
- Completed porting of dlist module (the drum list). Test OK. (Tim)
- Ported sigedit and posedit. Used SpinBox in place of Q3SpinWidget. TODO: Needs some work on
diff --git a/muse2/al/CMakeLists.txt b/muse2/al/CMakeLists.txt
index 044f1a8f..12df9a72 100644
--- a/muse2/al/CMakeLists.txt
+++ b/muse2/al/CMakeLists.txt
@@ -6,7 +6,7 @@
include(${PROJECT_SOURCE_DIR}/pch.txt)
set (al_src
- al.cpp dsp.cpp xml.cpp
+ al.cpp sig.cpp xml.cpp dsp.cpp
)
if (USE_SSE)
@@ -19,7 +19,7 @@ add_library(al STATIC
)
set_source_files_properties(
- al.cpp dsp.cpp xml.cpp
+ al.cpp sig.cpp xml.cpp dsp.cpp
dspXMM.cpp
PROPERTIES COMPILE_FLAGS "-fPIC -include ${PROJECT_BINARY_DIR}/all.h"
)
diff --git a/muse2/al/sig.cpp b/muse2/al/sig.cpp
new file mode 100644
index 00000000..026104b2
--- /dev/null
+++ b/muse2/al/sig.cpp
@@ -0,0 +1,617 @@
+//=============================================================================
+// AL
+// Audio Utility Library
+// $Id:$
+//
+// Copyright (C) 2002-2006 by Werner Schweer and others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+
+///#include "al.h"
+#include "gconfig.h" // Tim
+#include "sig.h"
+///#include "xml.h"
+
+
+namespace AL {
+
+SigList sigmap;
+
+//---------------------------------------------------------
+// isValid
+//---------------------------------------------------------
+
+bool TimeSignature::isValid() const
+{
+ if((z < 1) || (z > 63))
+ return false;
+
+ switch(n)
+ {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 8:
+ case 16:
+ case 32:
+ case 64:
+ case 128:
+ return true;
+ default:
+ return false;
+ }
+}
+
+//---------------------------------------------------------
+// SigList
+//---------------------------------------------------------
+
+SigList::SigList()
+ {
+ insert(std::pair<const unsigned, SigEvent*> (MAX_TICK, new SigEvent(TimeSignature(4, 4), 0)));
+ }
+
+//---------------------------------------------------------
+// add
+// signatures are only allowed at the beginning of
+// a bar
+//---------------------------------------------------------
+
+void SigList::add(unsigned tick, const TimeSignature& s)
+ {
+ if (s.z == 0 || s.n == 0) {
+ printf("illegal signature %d/%d\n", s.z, s.n);
+ // Added by Tim.
+ return;
+ }
+ tick = raster1(tick, 0);
+ iSigEvent e = upper_bound(tick);
+ if(e == end())
+ {
+ printf("SigList::add Signal not found tick:%d\n", tick);
+ return;
+ }
+
+ if (tick == e->second->tick) {
+ e->second->sig = s;
+ }
+ else {
+ SigEvent* ne = e->second;
+ SigEvent* ev = new SigEvent(ne->sig, ne->tick);
+ ne->sig = s;
+ ne->tick = tick;
+ insert(std::pair<const unsigned, SigEvent*> (tick, ev));
+ }
+ normalize();
+ }
+
+/*
+void SigList::add(unsigned tick, int z, int n)
+ {
+ if (z == 0 || n == 0) {
+ printf("SigList::add illegal signature %d/%d\n", z, n);
+ // Added by Tim.
+ return;
+ }
+ tick = raster1(tick, 0);
+ iSigEvent e = upper_bound(tick);
+ if(e == end())
+ {
+ printf("SigList::add Signal not found tick:%d\n", tick);
+ return;
+ }
+
+ if (tick == e->second->tick) {
+ e->second->sig.z = z;
+ e->second->sig.n = n;
+ }
+ else {
+ SigEvent* ne = e->second;
+ SigEvent* ev = new SigEvent(ne->sig.z, ne->sig.n, ne->tick);
+ ne->sig.z = z;
+ ne->sig.n = n;
+ ne->tick = tick;
+ insert(std::pair<const unsigned, SigEvent*> (tick, ev));
+ }
+ normalize();
+ }
+*/
+
+//---------------------------------------------------------
+// del
+//---------------------------------------------------------
+
+void SigList::del(unsigned tick)
+ {
+// printf("SigList::del(%d)\n", tick);
+ iSigEvent e = find(tick);
+ if (e == end()) {
+ printf("SigList::del(%d): not found\n", tick);
+ return;
+ }
+ iSigEvent ne = e;
+ ++ne;
+ if (ne == end()) {
+ printf("SigList::del() next event not found!\n");
+ return;
+ }
+ ne->second->sig = e->second->sig;
+ ne->second->tick = e->second->tick;
+ erase(e);
+ normalize();
+ }
+
+//---------------------------------------------------------
+// SigList::normalize
+//---------------------------------------------------------
+
+void SigList::normalize()
+ {
+ TimeSignature sig(0, 0);
+ unsigned tick = 0;
+ iSigEvent ee;
+
+ for (iSigEvent e = begin(); e != end();) {
+ if (sig.z == e->second->sig.z && sig.n == e->second->sig.n) {
+ e->second->tick = tick;
+ erase(ee);
+ }
+ sig = e->second->sig;
+ ee = e;
+ tick = e->second->tick;
+ ++e;
+ }
+
+ int bar = 0;
+ for (iSigEvent e = begin(); e != end();) {
+ e->second->bar = bar;
+ int delta = e->first - e->second->tick;
+ int ticksB = ticks_beat(e->second->sig.n);
+ int ticksM = ticksB * e->second->sig.z;
+ bar += delta / ticksM;
+ if (delta % ticksM) // Teil eines Taktes
+ ++bar;
+ ++e;
+ }
+ }
+
+//---------------------------------------------------------
+// SigList::dump
+//---------------------------------------------------------
+
+void SigList::dump() const
+ {
+ printf("\nSigList:\n");
+ for (ciSigEvent i = begin(); i != end(); ++i) {
+ printf("%6d %06d Bar %3d %02d/%d\n",
+ i->first, i->second->tick,
+ i->second->bar, i->second->sig.z, i->second->sig.n);
+ }
+ }
+
+void SigList::clear()
+ {
+ for (iSigEvent i = begin(); i != end(); ++i)
+ delete i->second;
+ SIGLIST::clear();
+ insert(std::pair<const unsigned, SigEvent*> (MAX_TICK, new SigEvent(TimeSignature(4, 4), 0)));
+ }
+
+//---------------------------------------------------------
+// ticksMeasure
+//---------------------------------------------------------
+
+int SigList::ticksMeasure(const TimeSignature& sig) const
+ {
+ return ticks_beat(sig.n) * sig.z;
+ }
+
+int SigList::ticksMeasure(int Z, int N) const
+ {
+ return ticks_beat(N) * Z;
+ }
+
+int SigList::ticksMeasure(unsigned tick) const
+ {
+ ciSigEvent i = upper_bound(tick);
+ if (i == end()) {
+ printf("ticksMeasure: not found %d\n", tick);
+ // abort();
+ return 0;
+ }
+ return ticksMeasure(i->second->sig);
+ }
+
+//---------------------------------------------------------
+// ticksBeat
+//---------------------------------------------------------
+
+int SigList::ticksBeat(unsigned tick) const
+ {
+ ciSigEvent i = upper_bound(tick);
+ if(i == end())
+ {
+ printf("SigList::ticksBeat event not found! tick:%d\n", tick);
+ return 0;
+ }
+ return ticks_beat(i->second->sig.n);
+ }
+
+int SigList::ticks_beat(int n) const
+ {
+
+ ///int m = AL::division;
+ int m = config.division;
+
+ switch (n) {
+ case 1: m <<= 2; break; // 1536
+ case 2: m <<= 1; break; // 768
+ case 3: m += m >> 1; break; // 384+192
+ case 4: break; // 384
+ case 8: m >>= 1; break; // 192
+ case 16: m >>= 2; break; // 96
+ case 32: m >>= 3; break; // 48
+ case 64: m >>= 4; break; // 24
+ case 128: m >>= 5; break; // 12
+ default: break;
+ }
+ return m;
+ }
+
+//---------------------------------------------------------
+// timesig
+//---------------------------------------------------------
+
+TimeSignature SigList::timesig(unsigned tick) const
+ {
+ ciSigEvent i = upper_bound(tick);
+ if (i == end()) {
+ printf("timesig(%d): not found\n", tick);
+ // abort();
+ return TimeSignature(4,4);
+ }
+ return i->second->sig;
+ }
+
+void SigList::timesig(unsigned tick, int& z, int& n) const
+ {
+ ciSigEvent i = upper_bound(tick);
+ if (i == end()) {
+ printf("timesig(%d): not found\n", tick);
+ // abort();
+ z = 4;
+ n = 4;
+ }
+ else {
+ z = i->second->sig.z;
+ n = i->second->sig.n;
+ }
+ }
+
+//---------------------------------------------------------
+// tickValues
+//---------------------------------------------------------
+
+void SigList::tickValues(unsigned t, int* bar, int* beat, unsigned* tick) const
+ {
+ ciSigEvent e = upper_bound(t);
+ if (e == end()) {
+ fprintf(stderr, "tickValues(0x%x) not found(%zd)\n", t, size());
+ *bar = 0;
+ *beat = 0;
+ *tick = 0;
+ return;
+ }
+
+ int delta = t - e->second->tick;
+ int ticksB = ticks_beat(e->second->sig.n);
+ int ticksM = ticksB * e->second->sig.z;
+ *bar = e->second->bar + delta / ticksM;
+ int rest = delta % ticksM;
+ *beat = rest / ticksB;
+ *tick = rest % ticksB;
+ }
+
+//---------------------------------------------------------
+// bar2tick
+//---------------------------------------------------------
+
+unsigned SigList::bar2tick(int bar, int beat, unsigned tick) const
+ {
+ ciSigEvent e;
+
+ if (bar < 0)
+ bar = 0;
+ for (e = begin(); e != end();) {
+ ciSigEvent ee = e;
+ ++ee;
+ if (ee == end())
+ break;
+ if (bar < ee->second->bar)
+ break;
+ e = ee;
+ }
+ int ticksB = ticks_beat(e->second->sig.n);
+ int ticksM = ticksB * e->second->sig.z;
+ return e->second->tick + (bar-e->second->bar)*ticksM + ticksB*beat + tick;
+ }
+
+//---------------------------------------------------------
+// raster
+//---------------------------------------------------------
+
+unsigned SigList::raster(unsigned t, int raster) const
+ {
+ if (raster == 1)
+ return t;
+ ciSigEvent e = upper_bound(t);
+ if (e == end()) {
+ printf("SigList::raster(%x,)\n", t);
+ // abort();
+ return t;
+ }
+ int delta = t - e->second->tick;
+ int ticksM = ticks_beat(e->second->sig.n) * e->second->sig.z;
+ if (raster == 0)
+ raster = ticksM;
+ int rest = delta % ticksM;
+ int bb = (delta/ticksM)*ticksM;
+ return e->second->tick + bb + ((rest + raster/2)/raster)*raster;
+ }
+
+//---------------------------------------------------------
+// raster1
+// round down
+//---------------------------------------------------------
+
+unsigned SigList::raster1(unsigned t, int raster) const
+ {
+ if (raster == 1)
+ return t;
+ ciSigEvent e = upper_bound(t);
+ if(e == end())
+ {
+ printf("SigList::raster1 event not found tick:%d\n", t);
+ //return 0;
+ return t;
+ }
+
+ int delta = t - e->second->tick;
+ int ticksM = ticks_beat(e->second->sig.n) * e->second->sig.z;
+ if (raster == 0)
+ raster = ticksM;
+ int rest = delta % ticksM;
+ int bb = (delta/ticksM)*ticksM;
+ return e->second->tick + bb + (rest/raster)*raster;
+ }
+
+//---------------------------------------------------------
+// raster2
+// round up
+//---------------------------------------------------------
+
+unsigned SigList::raster2(unsigned t, int raster) const
+ {
+ if (raster == 1)
+ return t;
+ ciSigEvent e = upper_bound(t);
+ if(e == end())
+ {
+ printf("SigList::raster2 event not found tick:%d\n", t);
+ //return 0;
+ return t;
+ }
+
+ int delta = t - e->second->tick;
+ int ticksM = ticks_beat(e->second->sig.n) * e->second->sig.z;
+ if (raster == 0)
+ raster = ticksM;
+ int rest = delta % ticksM;
+ int bb = (delta/ticksM)*ticksM;
+ return e->second->tick + bb + ((rest+raster-1)/raster)*raster;
+ }
+
+//---------------------------------------------------------
+// rasterStep
+//---------------------------------------------------------
+
+int SigList::rasterStep(unsigned t, int raster) const
+ {
+ if (raster == 0) {
+ ciSigEvent e = upper_bound(t);
+ if(e == end())
+ {
+ printf("SigList::rasterStep event not found tick:%d\n", t);
+ //return 0;
+ return raster;
+ }
+
+ return ticks_beat(e->second->sig.n) * e->second->sig.z;
+ }
+ return raster;
+ }
+
+//---------------------------------------------------------
+// SigList::write
+//---------------------------------------------------------
+
+#if 0
+void SigList::write(Xml& xml) const
+ {
+ xml.stag("siglist");
+ for (ciSigEvent i = begin(); i != end(); ++i)
+ i->second->write(xml, i->first);
+ xml.etag("siglist");
+ }
+#endif
+
+void SigList::write(int level, Xml& xml) const
+ {
+ xml.tag(level++, "siglist");
+ for (ciSigEvent i = begin(); i != end(); ++i)
+ i->second->write(level, xml, i->first);
+ xml.tag(level, "/siglist");
+ }
+
+//---------------------------------------------------------
+// SigList::read
+//---------------------------------------------------------
+
+#if 0
+void SigList::read(QDomNode node)
+ {
+ while (!node.isNull()) {
+ QDomElement e = node.toElement();
+ if (e.tagName() == "sig") {
+ SigEvent* t = new SigEvent();
+ unsigned tick = t->read(node);
+ iSigEvent pos = find(tick);
+ if (pos != end())
+ erase(pos);
+ insert(std::pair<const unsigned, SigEvent*> (tick, t));
+ }
+ else
+ printf("MusE:SigList: unknown tag %s\n", e.tagName().toLatin1().data());
+ node = node.nextSibling();
+ }
+ normalize();
+ }
+#endif
+
+void SigList::read(Xml& xml)
+ {
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return;
+ case Xml::TagStart:
+ if (tag == "sig") {
+ SigEvent* t = new SigEvent();
+ unsigned tick = t->read(xml);
+ iSigEvent pos = find(tick);
+ if (pos != end())
+ erase(pos);
+ insert(std::pair<const unsigned, SigEvent*> (tick, t));
+ }
+ else
+ xml.unknown("SigList");
+ break;
+ case Xml::Attribut:
+ break;
+ case Xml::TagEnd:
+ if (tag == "siglist") {
+ normalize();
+ return;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// SigEvent::write
+//---------------------------------------------------------
+
+#if 0
+void SigEvent::write(Xml& xml, int at) const
+ {
+ xml.stag(QString("sig at=\"%1\"").arg(at));
+ xml.tag("tick", tick);
+ xml.tag("nom", sig.z);
+ xml.tag("denom", sig.n);
+ xml.etag("sig");
+ }
+#endif
+
+void SigEvent::write(int level, Xml& xml, int at) const
+ {
+ xml.tag(level++, "sig at=\"%d\"", at);
+ xml.intTag(level, "tick", tick);
+ xml.intTag(level, "nom", sig.z);
+ xml.intTag(level, "denom", sig.n);
+ xml.tag(level, "/sig");
+ }
+
+//---------------------------------------------------------
+// SigEvent::read
+//---------------------------------------------------------
+
+#if 0
+int SigEvent::read(QDomNode node)
+ {
+ QDomElement e = node.toElement();
+ int at = e.attribute("at", "0").toInt();
+ node = node.firstChild();
+
+ while (!node.isNull()) {
+ QDomElement e = node.toElement();
+ if (e.tagName() == "tick")
+ tick = e.text().toInt();
+ else if (e.tagName() == "nom")
+ sig.z = e.text().toInt();
+ else if (e.tagName() == "denom")
+ sig.n = e.text().toInt();
+ else
+ printf("MusE:SigEvent: unknown tag %s\n", e.tagName().toLatin1().data());
+ node = node.nextSibling();
+ }
+ return at;
+ }
+
+}
+#endif
+
+int SigEvent::read(Xml& xml)
+ {
+ int at = 0;
+ for (;;) {
+ Xml::Token token = xml.parse();
+ const QString& tag = xml.s1();
+ switch (token) {
+ case Xml::Error:
+ case Xml::End:
+ return 0;
+ case Xml::TagStart:
+ if (tag == "tick")
+ tick = xml.parseInt();
+ else if (tag == "nom")
+ sig.z = xml.parseInt();
+ else if (tag == "denom")
+ sig.n = xml.parseInt();
+ else
+ xml.unknown("SigEvent");
+ break;
+ case Xml::Attribut:
+ if (tag == "at")
+ at = xml.s2().toInt();
+ break;
+ case Xml::TagEnd:
+ if (tag == "sig")
+ return at;
+ default:
+ break;
+ }
+ }
+ return 0;
+ }
+
+
+} // namespace AL
+
diff --git a/muse2/al/sig.h b/muse2/al/sig.h
new file mode 100644
index 00000000..53f060b5
--- /dev/null
+++ b/muse2/al/sig.h
@@ -0,0 +1,115 @@
+//=============================================================================
+// AL
+// Audio Utility Library
+// $Id:$
+//
+// Copyright (C) 2002-2006 by Werner Schweer and others
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2.
+//
+// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+//=============================================================================
+
+#ifndef __SIG_H__
+#define __SIG_H__
+
+#include "../muse/xml.h"
+class Xml;
+
+namespace AL {
+
+#ifndef MAX_TICK
+#define MAX_TICK (0x7fffffff/100)
+#endif
+
+///class Xml;
+
+//---------------------------------------------------------
+// TimeSignature
+//---------------------------------------------------------
+
+struct TimeSignature {
+ int z, n;
+ TimeSignature() { z = 4; n = 4; }
+ TimeSignature(int a, int b) { z = a; n = b; }
+ bool isValid() const;
+ };
+
+//---------------------------------------------------------
+// Signature Event
+//---------------------------------------------------------
+
+struct SigEvent {
+ TimeSignature sig;
+ unsigned tick; // signature valid from this position
+ int bar; // precomputed
+
+ ///int read(QDomNode);
+ ///void write(Xml&, int) const;
+ int read(Xml&);
+ void write(int, Xml&, int) const;
+
+ SigEvent() { }
+ SigEvent(const TimeSignature& s, unsigned tk) {
+ sig = s;
+ tick = tk;
+ bar = 0;
+ }
+ };
+
+//---------------------------------------------------------
+// SigList
+//---------------------------------------------------------
+
+typedef std::map<unsigned, SigEvent*, std::less<unsigned> > SIGLIST;
+typedef SIGLIST::iterator iSigEvent;
+typedef SIGLIST::const_iterator ciSigEvent;
+typedef SIGLIST::reverse_iterator riSigEvent;
+typedef SIGLIST::const_reverse_iterator criSigEvent;
+
+class SigList : public SIGLIST {
+ int ticks_beat(int N) const;
+ void normalize();
+ int ticksMeasure(const TimeSignature&) const;
+ int ticksMeasure(int z, int n) const;
+
+ public:
+ SigList();
+ void clear();
+ void add(unsigned tick, const TimeSignature& s);
+ //void add(unsigned tick, int z, int n);
+ void del(unsigned tick);
+
+ ///void read(QDomNode);
+ ///void write(Xml&) const;
+ void read(Xml&);
+ void write(int, Xml&) const;
+
+ void dump() const;
+
+ TimeSignature timesig(unsigned tick) const;
+ void timesig(unsigned tick, int& z, int& n) const;
+ void tickValues(unsigned t, int* bar, int* beat, unsigned* tick) const;
+ unsigned bar2tick(int bar, int beat, unsigned tick) const;
+
+ int ticksMeasure(unsigned tick) const;
+ int ticksBeat(unsigned tick) const;
+ unsigned raster(unsigned tick, int raster) const;
+ unsigned raster1(unsigned tick, int raster) const; // round down
+ unsigned raster2(unsigned tick, int raster) const; // round up
+ int rasterStep(unsigned tick, int raster) const;
+ };
+
+extern SigList sigmap;
+
+}
+
+#endif
diff --git a/muse2/awl/CMakeLists.txt b/muse2/awl/CMakeLists.txt
index 9045e028..7e36ba87 100644
--- a/muse2/awl/CMakeLists.txt
+++ b/muse2/awl/CMakeLists.txt
@@ -4,7 +4,7 @@
# $Id:$
#
# Copyright (C) 2002-2006 by Werner Schweer and others
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
#
@@ -36,11 +36,11 @@ set(mocs
aslider knob panknob slider volknob volslider floatentry
volentry panentry midivolentry midipanentry midipanknob
mslider midimslider midimeter combobox checkbox
- # posedit
+ posedit
pitchedit
# poslabel
pitchlabel tempolabel
- # sigedit
+ sigedit
# tcanvas
tempoedit drawbar
)
diff --git a/muse2/awl/posedit.cpp b/muse2/awl/posedit.cpp
index 4f8b19b2..51cea634 100644
--- a/muse2/awl/posedit.cpp
+++ b/muse2/awl/posedit.cpp
@@ -22,10 +22,13 @@
#include "awl.h"
#include "posedit.h"
#include "al/sig.h"
+//#include "sig.h"
+
+//#include "sync.h" // Tim.
namespace Awl {
- using AL::mtcType;
+ ///using AL::mtcType;
using AL::sigmap;
//---------------------------------------------------------
@@ -239,8 +242,11 @@ QAbstractSpinBox::StepEnabled PosEdit::stepEnabled() const
int bar, beat;
unsigned tick;
AL::sigmap.tickValues(_pos.tick(), &bar, &beat, &tick);
+ //sigmap.tickValues(_pos.tick(), &bar, &beat, &tick);
unsigned tb = AL::sigmap.ticksBeat(_pos.tick());
+ //unsigned tb = sigmap.ticksBeat(_pos.tick());
unsigned tm = AL::sigmap.ticksMeasure(_pos.tick());
+ //unsigned tm = sigmap.ticksMeasure(_pos.tick());
int bm = tm / tb;
switch (segment) {
@@ -386,7 +392,9 @@ void PosEdit::stepBy(int steps)
_pos.mbt(&bar, &beat, &tick);
int tb = AL::sigmap.ticksBeat(_pos.tick());
+ //int tb = sigmap.ticksBeat(_pos.tick());
unsigned tm = AL::sigmap.ticksMeasure(_pos.tick());
+ //unsigned tm = sigmap.ticksMeasure(_pos.tick());
int bm = tm / tb;
switch(segment) {
diff --git a/muse2/awl/posedit.h b/muse2/awl/posedit.h
index effa0537..314b2b9d 100644
--- a/muse2/awl/posedit.h
+++ b/muse2/awl/posedit.h
@@ -21,11 +21,12 @@
#ifndef __POSEDIT_H__
#define __POSEDIT_H__
-#include "al/pos.h"
+///#include "al/pos.h"
+#include "pos.h"
namespace Awl {
- using AL::Pos;
+ ///using AL::Pos;
//---------------------------------------------------------
// PosEdit
diff --git a/muse2/awl/sigedit.cpp b/muse2/awl/sigedit.cpp
index 6493ad6c..193a9bd7 100644
--- a/muse2/awl/sigedit.cpp
+++ b/muse2/awl/sigedit.cpp
@@ -22,6 +22,7 @@
#include "awl.h"
#include "sigedit.h"
#include "al/sig.h"
+//#include "sig.h"
namespace Awl {
@@ -99,6 +100,14 @@ void SigEdit::setValue(const AL::TimeSignature& s)
updateValue();
}
+void SigEdit::setValue(const QString& s)
+ {
+ int z = 4, n = 4;
+ sscanf(s.latin1(), "%d/%d", &z, &n);
+ AL::TimeSignature sig(z, n);
+ setValue(sig);
+ }
+
//---------------------------------------------------------
// updateValue
//---------------------------------------------------------
diff --git a/muse2/awl/sigedit.h b/muse2/awl/sigedit.h
index 35e762ca..35cb0f12 100644
--- a/muse2/awl/sigedit.h
+++ b/muse2/awl/sigedit.h
@@ -22,6 +22,7 @@
#define __SIGEDIT_H__
#include "al/sig.h"
+//#include "sig.h"
namespace AL {
class TimeSignature;
@@ -54,6 +55,7 @@ class SigEdit : public QAbstractSpinBox
public slots:
void setValue(const AL::TimeSignature&);
+ void setValue(const QString& s);
public:
SigEdit(QWidget* parent = 0);
diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt
index 14c96a7a..ad607c43 100644
--- a/muse2/muse/CMakeLists.txt
+++ b/muse2/muse/CMakeLists.txt
@@ -323,6 +323,7 @@ target_link_libraries(muse
cliplist instruments widgets
synti
al
+ awl
${QT_LIBRARIES}
QtSvg
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index 91ede963..1870642a 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -49,6 +49,9 @@
#include <QCloseEvent>
#include "app.h"
+#include "master/lmaster.h"
+#include "master/masteredit.h"
+#include "marker/markerview.h"
#include "popupmenu.h"
#include "transport.h"
#include "bigtime.h"
@@ -58,8 +61,6 @@
#include "midi.h"
#include "conf.h"
#include "listedit.h"
-#include "master/masteredit.h"
-#include "master/lmaster.h"
#include "drumedit.h"
#include "ttoolbar.h"
#include "amixer.h"
@@ -74,7 +75,6 @@
#include "midictrl.h"
#include "filedialog.h"
#include "plugin.h"
-#include "marker/markerview.h"
#include "transpose.h"
#include "appearance.h"
#include "gatetime.h"
diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp
index 4a79b1c2..94acca5a 100644
--- a/muse2/muse/arranger/arranger.cpp
+++ b/muse2/muse/arranger/arranger.cpp
@@ -311,7 +311,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name)
// Editor
//---------------------------------------------------
- int offset = sigmap.ticksMeasure(0);
+ int offset = AL::sigmap.ticksMeasure(0);
hscroll = new ScrollScale(-1000, -10, xscale, song->len(), Qt::Horizontal, editor, -offset);
ib->setFixedHeight(hscroll->sizeHint().height());
@@ -394,9 +394,9 @@ Arranger::Arranger(QMainWindow* parent, const char* name)
//{
// int s = 0, e = song->len();
// Show one more measure.
-// e += sigmap.ticksMeasure(e);
+// e += AL::sigmap.ticksMeasure(e);
// Show another quarter measure due to imprecise drawing at canvas end point.
-// e += sigmap.ticksMeasure(e) / 4;
+// e += AL::sigmap.ticksMeasure(e) / 4;
// Compensate for the fixed vscroll width.
// e += canvas->rmapxDev(-vscroll->width());
// int s1, e1;
@@ -477,7 +477,7 @@ void Arranger::configChanged()
void Arranger::songlenChanged(int n)
{
- int newLen = sigmap.bar2tick(n, 0, 0);
+ int newLen = AL::sigmap.bar2tick(n, 0, 0);
song->setLen(newLen);
}
//---------------------------------------------------------
@@ -490,14 +490,14 @@ void Arranger::songChanged(int type)
if(type != SC_MIDI_CONTROLLER)
{
unsigned endTick = song->len();
- int offset = sigmap.ticksMeasure(endTick);
+ int offset = AL::sigmap.ticksMeasure(endTick);
hscroll->setRange(-offset, endTick + offset); //DEBUG
canvas->setOrigin(-offset, 0);
time->setOrigin(-offset, 0);
int bar, beat;
unsigned tick;
- sigmap.tickValues(endTick, &bar, &beat, &tick);
+ AL::sigmap.tickValues(endTick, &bar, &beat, &tick);
if (tick || beat)
++bar;
lenEntry->blockSignals(true);
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index 49d756d9..baa94747 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -555,7 +555,7 @@ QPoint PartCanvas::raster(const QPoint& p) const
int x = p.x();
if (x < 0)
x = 0;
- x = sigmap.raster(x, *_raster);
+ x = AL::sigmap.raster(x, *_raster);
if (x < 0)
x = 0;
return QPoint(x, y);
@@ -609,11 +609,11 @@ void PartCanvas::resizeItem(CItem* i, bool noSnap)
int pos = p->tick() + i->width();
int snappedpos = p->tick();
if (!noSnap) {
- snappedpos = sigmap.raster(pos, *_raster);
+ snappedpos = AL::sigmap.raster(pos, *_raster);
}
unsigned int newwidth = snappedpos - p->tick();
if (newwidth == 0)
- newwidth = sigmap.rasterStep(p->tick(), *_raster);
+ newwidth = AL::sigmap.rasterStep(p->tick(), *_raster);
song->cmdResizePart(t, p, newwidth);
}
@@ -628,7 +628,7 @@ CItem* PartCanvas::newItem(const QPoint& pos, int)
int x = pos.x();
if (x < 0)
x = 0;
- x = sigmap.raster(x, *_raster);
+ x = AL::sigmap.raster(x, *_raster);
unsigned trackIndex = y2pitch(pos.y());
if (trackIndex >= tracks->size())
return 0;
@@ -673,9 +673,9 @@ void PartCanvas::newItem(CItem* i, bool noSnap)
int len = i->width();
if (!noSnap)
- len = sigmap.raster(len, *_raster);
+ len = AL::sigmap.raster(len, *_raster);
if (len == 0)
- len = sigmap.rasterStep(p->tick(), *_raster);
+ len = AL::sigmap.rasterStep(p->tick(), *_raster);
p->setLenTick(len);
p->setSelected(true);
audio->msgAddPart(p);
@@ -704,7 +704,7 @@ void PartCanvas::splitItem(CItem* item, const QPoint& pt)
int x = pt.x();
if (x < 0)
x = 0;
- song->cmdSplitPart(t, p, sigmap.raster(x, *_raster));
+ song->cmdSplitPart(t, p, AL::sigmap.raster(x, *_raster));
}
//---------------------------------------------------------
@@ -1051,7 +1051,7 @@ void PartCanvas::mouseMove(const QPoint& pos)
int x = pos.x();
if (x < 0)
x = 0;
- emit timeChanged(sigmap.raster(x, *_raster));
+ emit timeChanged(AL::sigmap.raster(x, *_raster));
}
//---------------------------------------------------------
@@ -1102,7 +1102,7 @@ void PartCanvas::keyPress(QKeyEvent* event)
return;
}
else if (key == shortcuts[SHRT_POS_DEC].key) {
- int frames = pos[0] - sigmap.rasterStep(pos[0], *_raster);
+ int frames = pos[0] - AL::sigmap.rasterStep(pos[0], *_raster);
if (frames < 0)
frames = 0;
Pos p(frames,true);
@@ -1110,7 +1110,7 @@ void PartCanvas::keyPress(QKeyEvent* event)
return;
}
else if (key == shortcuts[SHRT_POS_INC].key) {
- Pos p(pos[0] + sigmap.rasterStep(pos[0], *_raster), true);
+ Pos p(pos[0] + AL::sigmap.rasterStep(pos[0], *_raster), true);
song->setPos(0, p, true, true, true); //CDW
return;
}
@@ -1758,7 +1758,7 @@ void PartCanvas::cmd(int cmd)
case CMD_INSERT_EMPTYMEAS:
song->startUndo();
int startPos=song->vcpos();
- int oneMeas=sigmap.ticksMeasure(startPos);
+ int oneMeas=AL::sigmap.ticksMeasure(startPos);
movePartsTotheRight(startPos,oneMeas);
song->endUndo(SC_PART_INSERTED);
break;
@@ -2621,7 +2621,7 @@ void PartCanvas::viewDropEvent(QDropEvent* event)
{
text = QString(event->mimeData()->data("text/partlist"));
- int x = sigmap.raster(event->pos().x(), *_raster);
+ int x = AL::sigmap.raster(event->pos().x(), *_raster);
if (x < 0)
x = 0;
unsigned trackNo = y2pitch(event->pos().y());
@@ -2643,7 +2643,7 @@ void PartCanvas::viewDropEvent(QDropEvent* event)
text.endsWith(".ogg",Qt::CaseInsensitive) ||
text.endsWith(".mpt", Qt::CaseInsensitive) )
{
- int x = sigmap.raster(event->pos().x(), *_raster);
+ int x = AL::sigmap.raster(event->pos().x(), *_raster);
if (x < 0)
x = 0;
unsigned trackNo = y2pitch(event->pos().y());
@@ -2712,9 +2712,9 @@ void PartCanvas::drawCanvas(QPainter& p, const QRect& rect)
int bar, beat;
unsigned tick;
- sigmap.tickValues(x, &bar, &beat, &tick);
+ AL::sigmap.tickValues(x, &bar, &beat, &tick);
for (;;) {
- int xt = sigmap.bar2tick(bar++, 0, 0);
+ int xt = AL::sigmap.bar2tick(bar++, 0, 0);
if (xt >= x + w)
break;
if (!((bar-1) % 4))
diff --git a/muse2/muse/audio.cpp b/muse2/muse/audio.cpp
index 69ff7caf..e0ebd4a3 100644
--- a/muse2/muse/audio.cpp
+++ b/muse2/muse/audio.cpp
@@ -1076,7 +1076,7 @@ void Audio::startRolling()
state = PRECOUNT;
int z, n;
if (precountFromMastertrackFlag)
- sigmap.timesig(playTickPos, z, n);
+ AL::sigmap.timesig(playTickPos, z, n);
else {
z = precountSigZ;
n = precountSigN;
@@ -1092,10 +1092,10 @@ void Audio::startRolling()
//
int bar, beat;
unsigned tick;
- sigmap.tickValues(curTickPos, &bar, &beat, &tick);
+ AL::sigmap.tickValues(curTickPos, &bar, &beat, &tick);
if (tick)
beat += 1;
- midiClick = sigmap.bar2tick(bar, beat, 0);
+ midiClick = AL::sigmap.bar2tick(bar, beat, 0);
}
// reenable sustain
diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp
index feaf123d..aa1ffef6 100644
--- a/muse2/muse/conf.cpp
+++ b/muse2/muse/conf.cpp
@@ -26,12 +26,13 @@
#include <qstyle.h>
#include "app.h"
+#include "transport.h"
#include "icons.h"
#include "globals.h"
#include "drumedit.h"
#include "pianoroll.h"
#include "master/masteredit.h"
-#include "transport.h"
+///#include "transport.h"
#include "bigtime.h"
#include "arranger.h"
#include "conf.h"
diff --git a/muse2/muse/driver/jack.cpp b/muse2/muse/driver/jack.cpp
index e23f2de8..6c237622 100644
--- a/muse2/muse/driver/jack.cpp
+++ b/muse2/muse/driver/jack.cpp
@@ -372,7 +372,7 @@ static void timebase_callback(jack_transport_state_t /* state */,
*/
//
int z, n;
- sigmap.timesig(p.tick(), z, n);
+ AL::sigmap.timesig(p.tick(), z, n);
pos->beats_per_bar = z;
pos->beat_type = n;
//pos->ticks_per_beat = config.division;
diff --git a/muse2/muse/exportmidi.cpp b/muse2/muse/exportmidi.cpp
index c068d719..f1fc28f8 100644
--- a/muse2/muse/exportmidi.cpp
+++ b/muse2/muse/exportmidi.cpp
@@ -9,6 +9,8 @@
#include <stdio.h>
#include <qstring.h>
+#include "al/sig.h" // Tim.
+
#include "app.h"
#include "midifile.h"
#include "midi.h"
@@ -222,13 +224,16 @@ void MusE::exportMidi()
//---------------------------------------------------
// Write Signatures
//
- const SigList* sl = &sigmap;
- for (ciSigEvent e = sl->begin(); e != sl->end(); ++e) {
- SigEvent* event = e->second;
+ ///const SigList* sl = &sigmap;
+ const AL::SigList* sl = &AL::sigmap;
+ ///for (ciSigEvent e = sl->begin(); e != sl->end(); ++e) {
+ for (AL::ciSigEvent e = sl->begin(); e != sl->end(); ++e) {
+ ///SigEvent* event = e->second;
+ AL::SigEvent* event = e->second;
int sz = (config.exp2ByteTimeSigs ? 2 : 4); // export 2 byte timesigs instead of 4 ?
unsigned char data[sz];
- data[0] = event->z;
- switch(event->n) {
+ data[0] = event->sig.z;
+ switch(event->sig.n) {
case 1: data[1] = 0; break;
case 2: data[1] = 1; break;
case 4: data[1] = 2; break;
@@ -237,7 +242,7 @@ void MusE::exportMidi()
case 32: data[1] = 5; break;
case 64: data[1] = 6; break;
default:
- fprintf(stderr, "falsche Signatur; nenner %d\n", event->n);
+ fprintf(stderr, "falsche Signatur; nenner %d\n", event->sig.n);
break;
}
// By T356. In muse the metronome pulse is fixed at 24 (once per quarter-note).
diff --git a/muse2/muse/importmidi.cpp b/muse2/muse/importmidi.cpp
index 63cccffc..e844bb43 100644
--- a/muse2/muse/importmidi.cpp
+++ b/muse2/muse/importmidi.cpp
@@ -240,7 +240,8 @@ bool MusE::importMidi(const QString name, bool merge)
song->initLen();
int z, n;
- sigmap.timesig(0, z, n);
+ ///sigmap.timesig(0, z, n);
+ AL::sigmap.timesig(0, z, n);
int tempo = tempomap.tempo(0);
transport->setTimesig(z, n);
@@ -300,7 +301,8 @@ void MusE::processTrack(MidiTrack* track)
int bar2, beat;
unsigned tick;
- sigmap.tickValues(len, &bar2, &beat, &tick);
+ ///sigmap.tickValues(len, &bar2, &beat, &tick);
+ AL::sigmap.tickValues(len, &bar2, &beat, &tick);
int lastOff = 0;
int st = -1; // start tick current part
@@ -308,7 +310,8 @@ void MusE::processTrack(MidiTrack* track)
int x2 = 0; // end tick current measure
for (int bar = 0; bar < bar2; ++bar, x1 = x2) {
- x2 = sigmap.bar2tick(bar+1, 0, 0);
+ ///x2 = sigmap.bar2tick(bar+1, 0, 0);
+ x2 = AL::sigmap.bar2tick(bar+1, 0, 0);
if (lastOff > x2) {
// this measure is busy!
continue;
diff --git a/muse2/muse/liste/editctrlbase.ui b/muse2/muse/liste/editctrlbase.ui
index e3b28a69..2af3d884 100644
--- a/muse2/muse/liste/editctrlbase.ui
+++ b/muse2/muse/liste/editctrlbase.ui
@@ -54,7 +54,7 @@
</widget>
</item>
<item row="0" column="4">
- <widget class="PosEdit" name="timePos" native="true"/>
+ <widget class="Awl::PosEdit" name="timePos"/>
</item>
<item row="1" column="3" rowspan="2" colspan="2">
<widget class="QStackedWidget" name="widgetStack">
@@ -800,14 +800,12 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
- <class>PosEdit</class>
+ <class>Awl::PosEdit</class>
<extends>QWidget</extends>
- <header location="global">posedit.h</header>
+ <header>awl/posedit.h</header>
+ <container>0</container>
</customwidget>
</customwidgets>
- <includes>
- <include location="local">../widgets/posedit.h</include>
- </includes>
<resources/>
<connections>
<connection>
diff --git a/muse2/muse/liste/editevent.cpp b/muse2/muse/liste/editevent.cpp
index 8d8318c9..99c1ed1d 100644
--- a/muse2/muse/liste/editevent.cpp
+++ b/muse2/muse/liste/editevent.cpp
@@ -21,6 +21,8 @@
#include <QTextEdit>
#include <QVBoxLayout>
+#include "awl/posedit.h"
+
#include "song.h"
#include "event.h"
#include "midictrl.h"
@@ -28,7 +30,7 @@
#include "pitchedit.h"
#include "intlabel.h"
#include "globals.h"
-#include "posedit.h"
+///#include "posedit.h"
#include "gconfig.h"
#include "midiport.h"
#include "midiedit/drummap.h"
@@ -287,7 +289,8 @@ EditMetaDialog::EditMetaDialog(int tick, const Event& ev,
setCaption(tr("MusE: Enter Meta Event"));
QLabel* l1 = new QLabel(tr("Time Position"));
- epos = new PosEdit;
+ ///epos = new PosEdit;
+ epos = new Awl::PosEdit;
QLabel* l2 = new QLabel(tr("Meta Type"));
il2 = new IntLabel(-1, 0, 127, this, -1);
@@ -417,7 +420,8 @@ EditCAfterDialog::EditCAfterDialog(int tick, const Event& event,
setCaption(tr("MusE: Enter Channel Aftertouch"));
QLabel* l1 = new QLabel(tr("Time Position"));
- epos = new PosEdit;
+ ///epos = new PosEdit;
+ epos = new Awl::PosEdit;
QLabel* l2 = new QLabel(tr("Pressure"));
il2 = new IntLabel(-1, 0, 127, this, -1);
@@ -469,7 +473,8 @@ EditPAfterDialog::EditPAfterDialog(int tick, const Event& event,
setCaption(tr("MusE: Enter Poly Aftertouch"));
QLabel* l1 = new QLabel(tr("Time Position"));
- epos = new PosEdit;
+ ///epos = new PosEdit;
+ epos = new Awl::PosEdit;
QLabel* l2 = new QLabel(tr("Pitch"));
pl = new PitchEdit;
diff --git a/muse2/muse/liste/editevent.h b/muse2/muse/liste/editevent.h
index 076ba4eb..bff39181 100644
--- a/muse2/muse/liste/editevent.h
+++ b/muse2/muse/liste/editevent.h
@@ -13,7 +13,11 @@
#include "ui_editctrlbase.h"
#include "event.h"
-class PosEdit;
+namespace Awl {
+ class PosEdit;
+ };
+
+///class PosEdit;
class IntLabel;
class PitchEdit;
class QDialog;
@@ -21,7 +25,6 @@ class QLabel;
class QGridLayout;
class QTextEdit;
class QRadioButton;
-class PosEdit;
class MidiPart;
class QListWidgetItem;
class QMenu;
@@ -122,7 +125,8 @@ class EditMetaDialog : public EditEventDialog {
unsigned char* meta;
int len;
- PosEdit* epos;
+ ///PosEdit* epos;
+ Awl::PosEdit* epos;
QTextEdit* edit;
IntLabel* il2;
QRadioButton* hexButton;
@@ -152,7 +156,8 @@ class EditMetaDialog : public EditEventDialog {
class EditCAfterDialog : public EditEventDialog {
Q_OBJECT
- PosEdit* epos;
+ ///PosEdit* epos;
+ Awl::PosEdit* epos;
IntLabel* il2;
protected:
@@ -173,7 +178,8 @@ class EditCAfterDialog : public EditEventDialog {
class EditPAfterDialog : public EditEventDialog {
Q_OBJECT
- PosEdit* epos;
+ ///PosEdit* epos;
+ Awl::PosEdit* epos;
PitchEdit* pl;
IntLabel* il2;
diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp
index 4c0bd982..44cab35a 100644
--- a/muse2/muse/liste/listedit.cpp
+++ b/muse2/muse/liste/listedit.cpp
@@ -261,7 +261,7 @@ QString EventListItem::text(int col) const
int t = event.tick() + part->tick();
int bar, beat;
unsigned tick;
- sigmap.tickValues(t, &bar, &beat, &tick);
+ AL::sigmap.tickValues(t, &bar, &beat, &tick);
s.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
}
break;
diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp
index 14712429..873a22d1 100644
--- a/muse2/muse/marker/markerview.cpp
+++ b/muse2/muse/marker/markerview.cpp
@@ -5,6 +5,8 @@
// (C) Copyright 2000 Werner Schweer (ws@seh.de)
//=========================================================
+#include "al/sig.h" // Tim.
+
#include "marker.h"
#include "markerview.h"
#include "xml.h"
@@ -12,7 +14,8 @@
#include "sync.h"
#include "icons.h"
#include "song.h"
-#include "posedit.h"
+///#include "posedit.h"
+#include "awl/posedit.h"
#include <QCloseEvent>
#include <QMenu>
@@ -97,7 +100,8 @@ void MarkerItem::setTick(unsigned v)
QString s;
int bar, beat;
unsigned tick;
- sigmap.tickValues(v, &bar, &beat, &tick);
+ ///sigmap.tickValues(v, &bar, &beat, &tick);
+ AL::sigmap.tickValues(v, &bar, &beat, &tick);
s.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
setText(COL_TICK, s);
@@ -203,11 +207,13 @@ MarkerView::MarkerView(QWidget* parent)
QGroupBox* props = new QGroupBox(tr("Marker Properties"));
QHBoxLayout *hbox = new QHBoxLayout;
- editTick = new PosEdit;
+ ///editTick = new PosEdit;
+ editTick = new Awl::PosEdit;
editTick->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
QSizePolicy::Fixed));
- editSMPTE = new PosEdit;
+ ///editSMPTE = new PosEdit;
+ editSMPTE = new Awl::PosEdit;
editSMPTE->setSmpte(true);
editSMPTE->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
QSizePolicy::Fixed));
diff --git a/muse2/muse/marker/markerview.h b/muse2/muse/marker/markerview.h
index 9e91d428..ff140a13 100644
--- a/muse2/muse/marker/markerview.h
+++ b/muse2/muse/marker/markerview.h
@@ -18,8 +18,12 @@ class QToolBar;
class QToolButton;
class QTreeWidget;
+namespace Awl {
+ class PosEdit;
+ };
+
class Marker;
-class PosEdit;
+///class PosEdit;
class Pos;
//---------------------------------------------------------
@@ -47,8 +51,10 @@ class MarkerItem : public QTreeWidgetItem {
class MarkerView : public TopWin {
QTreeWidget* table;
QLineEdit* editName;
- PosEdit* editSMPTE;
- PosEdit* editTick;
+ ///PosEdit* editSMPTE;
+ ///PosEdit* editTick;
+ Awl::PosEdit* editSMPTE;
+ Awl::PosEdit* editTick;
QToolButton* lock;
QToolBar* tools;
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
index 03054fd6..06f816ba 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -5,13 +5,16 @@
// (C) Copyright 2000 Werner Schweer (ws@seh.de)
//=========================================================
+#include "awl/posedit.h"
+#include "awl/sigedit.h"
+
#include "lmaster.h"
#include "xml.h"
#include "song.h"
#include "globals.h"
#include "audio.h"
-#include "posedit.h"
-#include "sigedit.h"
+///#include "posedit.h"
+///#include "sigedit.h"
#include "shortcuts.h"
#include "debug.h"
@@ -165,7 +168,7 @@ LMaster::~LMaster()
// insertSig
//---------------------------------------------------------
-void LMaster::insertSig(const SigEvent* ev)
+void LMaster::insertSig(const AL::SigEvent* ev)
{
new LMasterSigEventItem(view, ev);
}
@@ -196,10 +199,10 @@ void LMaster::updateList()
view->clear();
const TempoList* t = &tempomap;
- const SigList* s = &sigmap;
+ const AL::SigList* s = &AL::sigmap;
criTEvent it = t->rbegin();
- criSigEvent is = s->rbegin();
+ AL::criSigEvent is = s->rbegin();
for (;;) {
if (it == t->rend()) {
while(is != s->rend()) {
@@ -409,7 +412,8 @@ void LMaster::itemDoubleClicked(QTreeWidgetItem* i)
// Everything OK
else {
if (!pos_editor)
- pos_editor = new PosEdit(view->viewport());
+ ///pos_editor = new PosEdit(view->viewport());
+ pos_editor = new Awl::PosEdit(view->viewport());
pos_editor->setValue(editedItem->tick());
QRect itemRect = view->visualItemRect(editedItem);
itemRect.setX(0);
@@ -524,7 +528,8 @@ void LMaster::returnPressed()
//
else if (editedItem->getType() == LMASTER_SIGEVENT && editorColumn == LMASTER_VAL_COL)
{
- Sig newSig = sig_editor->sig();
+ ///Sig newSig = sig_editor->sig();
+ AL::TimeSignature newSig = sig_editor->sig();
sig_editor->hide();
@@ -593,7 +598,7 @@ LMasterTempoItem::LMasterTempoItem(QTreeWidget* parent, const TEvent* ev)
//QString c1, c2, c3, c4;
int bar, beat;
unsigned tick;
- sigmap.tickValues(t, &bar, &beat, &tick);
+ AL::sigmap.tickValues(t, &bar, &beat, &tick);
c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
double time = double(ev->frame) / double(sampleRate);
@@ -614,14 +619,14 @@ LMasterTempoItem::LMasterTempoItem(QTreeWidget* parent, const TEvent* ev)
// LMasterSigEventItem
//! Initializes a ListView item with a SigEvent
//---------------------------------------------------------
-LMasterSigEventItem::LMasterSigEventItem(QTreeWidget* parent, const SigEvent* ev)
+LMasterSigEventItem::LMasterSigEventItem(QTreeWidget* parent, const AL::SigEvent* ev)
: LMasterLViewItem(parent)
{
sigEvent = ev;
unsigned t = ev->tick;
int bar, beat;
unsigned tick;
- sigmap.tickValues(t, &bar, &beat, &tick);
+ AL::sigmap.tickValues(t, &bar, &beat, &tick);
c1.sprintf("%04d.%02d.%03d", bar+1, beat+1, tick);
double time = double(tempomap.tick2frame(t)) / double (sampleRate);
@@ -630,7 +635,7 @@ LMasterSigEventItem::LMasterSigEventItem(QTreeWidget* parent, const SigEvent* ev
int msec = int((time - (min*60 + sec)) * 1000.0);
c2.sprintf("%03d:%02d:%03d", min, sec, msec);
c3 = "Timesig";
- c4.sprintf("%d/%d", ev->z, ev->n);
+ c4.sprintf("%d/%d", ev->sig.z, ev->sig.n);
setText(0, c1);
setText(1, c2);
setText(2, c3);
@@ -649,7 +654,7 @@ void LMaster::tempoButtonClicked()
Pos p = Pos(beatString);
p.mbt(&m, &b, &t);
m++; //Next bar
- int newTick = sigmap.bar2tick(m, b, t);
+ int newTick = AL::sigmap.bar2tick(m, b, t);
TEvent* ev = new TEvent(lastTempo->tempo(), newTick);
new LMasterTempoItem(view, ev);
QTreeWidgetItem* newTempoItem = view->topLevelItem(0);
@@ -675,8 +680,8 @@ void LMaster::timeSigButtonClicked()
Pos p = Pos(beatString);
p.mbt(&m, &b, &t);
m++;
- int newTick = sigmap.bar2tick(m, b, t);
- SigEvent* ev = new SigEvent(lastSig->z(), lastSig->n(), newTick);
+ int newTick = AL::sigmap.bar2tick(m, b, t);
+ AL::SigEvent* ev = new AL::SigEvent(AL::TimeSignature(lastSig->z(), lastSig->n()), newTick);
new LMasterSigEventItem(view, ev);
QTreeWidgetItem* newSigItem = view->topLevelItem(0);
//LMasterSigEventItem* newSigItem = new LMasterSigEventItem(view, ev);
diff --git a/muse2/muse/master/lmaster.h b/muse2/muse/master/lmaster.h
index 92c213b0..cdad4c77 100644
--- a/muse2/muse/master/lmaster.h
+++ b/muse2/muse/master/lmaster.h
@@ -12,14 +12,24 @@
#include "noteinfo.h"
#include "cobject.h"
#include "tempo.h"
-#include "sig.h"
+///#include "sig.h"
+//#include "al/sig.h"
#include <QTreeWidgetItem>
+namespace AL {
+ class SigEvent;
+ };
+using AL::SigEvent;
+
+namespace Awl {
+ class PosEdit;
+ class SigEdit;
+ };
+using Awl::PosEdit;
+using Awl::SigEdit;
+
class QLineEdit;
-class SigEvent;
-class PosEdit;
-class SigEdit;
enum LMASTER_LVTYPE
{
@@ -74,8 +84,8 @@ class LMasterSigEventItem : public LMasterLViewItem {
virtual LMASTER_LVTYPE getType() { return LMASTER_SIGEVENT; }
const SigEvent* getEvent() { return sigEvent; }
virtual unsigned tick() { return sigEvent->tick; }
- int z() { return sigEvent->z; }
- int n() { return sigEvent->n; }
+ int z() { return sigEvent->sig.z; }
+ int n() { return sigEvent->sig.n; }
};
diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp
index 2736808e..d4fd3e0d 100644
--- a/muse2/muse/master/masteredit.cpp
+++ b/muse2/muse/master/masteredit.cpp
@@ -5,6 +5,8 @@
// (C) Copyright 1999 Werner Schweer (ws@seh.de)
//=========================================================
+#include "awl/sigedit.h"
+
#include "masteredit.h"
#include "mtscale.h"
#include "hitscale.h"
@@ -18,7 +20,7 @@
#include "xml.h"
#include "lcombo.h"
#include "doublelabel.h"
-#include "sigedit.h"
+///#include "sigedit.h"
#include "globals.h"
#include <values.h>
@@ -55,9 +57,9 @@ void MasterEdit::songChanged(int type)
}
if (type & SC_SIG) {
int z, n;
- sigmap.timesig(song->cpos(), z, n);
+ AL::sigmap.timesig(song->cpos(), z, n);
curSig->blockSignals(true);
- curSig->setValue(Sig(z, n));
+ curSig->setValue(AL::TimeSignature(z, n));
curSig->blockSignals(false);
sign->redraw();
}
@@ -131,12 +133,14 @@ MasterEdit::MasterEdit()
info->addWidget(new QLabel(tr("CurPos ")));
curTempo = new TempoEdit(0);
curSig = new SigEdit(0);
- curSig->setValue(Sig(4, 4));
+ curSig->setValue(AL::TimeSignature(4, 4));
curTempo->setToolTip(tr("tempo at current position"));
curSig->setToolTip(tr("time signature at current position"));
info->addWidget(curTempo);
info->addWidget(curSig);
- connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int)));
+ ///connect(curSig, SIGNAL(valueChanged(int,int)), song, SLOT(setSig(int,int)));
+ connect(curSig, SIGNAL(valueChanged(const AL::TimeSignature&)), song, SLOT(setSig(const AL::TimeSignature&)));
+
///connect(curTempo, SIGNAL(valueChanged(double)), song, SLOT(setTempo(double)));
connect(curTempo, SIGNAL(tempoChanged(double)), song, SLOT(setTempo(double)));
@@ -354,12 +358,12 @@ void MasterEdit::posChanged(int idx, unsigned val, bool)
if (idx == 0) {
int z, n;
int tempo = tempomap.tempo(val);
- sigmap.timesig(val, z, n);
+ AL::sigmap.timesig(val, z, n);
curTempo->blockSignals(true);
curSig->blockSignals(true);
curTempo->setValue(double(60000000.0/tempo));
- curSig->setValue(Sig(z, n));
+ curSig->setValue(AL::TimeSignature(z, n));
curTempo->blockSignals(false);
curSig->blockSignals(false);
diff --git a/muse2/muse/master/masteredit.h b/muse2/muse/master/masteredit.h
index 9fa3bd6d..af43c7b0 100644
--- a/muse2/muse/master/masteredit.h
+++ b/muse2/muse/master/masteredit.h
@@ -12,6 +12,11 @@
#include "noteinfo.h"
#include "cobject.h"
+namespace Awl {
+ class SigEdit;
+ };
+using Awl::SigEdit;
+
class QCloseEvent;
class QToolBar;
class QToolButton;
@@ -23,7 +28,6 @@ class SigScale;
class HitScale;
class TScale;
class TempoEdit;
-class SigEdit;
class LabelCombo;
class PosLabel;
class TempoLabel;
diff --git a/muse2/muse/midi.cpp b/muse2/muse/midi.cpp
index efabfe95..c1a24c8e 100644
--- a/muse2/muse/midi.cpp
+++ b/muse2/muse/midi.cpp
@@ -442,7 +442,8 @@ void buildMidiEventList(EventList* del, const MPEventList* el, MidiTrack* track,
for (int i = 0; i < n; i++)
timesig_n *= 2;
int ltick = CALC_TICK(tick);//(tick * config.division + div/2) / div;
- sigmap.add(ltick, timesig_z, timesig_n);
+ ///sigmap.add(ltick, timesig_z, timesig_n);
+ AL::sigmap.add(ltick, AL::TimeSignature(timesig_z, timesig_n));
}
break;
case 0x59: // Key Signature
@@ -1405,7 +1406,8 @@ void Audio::processMidi()
bool isMeasure = false;
while (midiClick < nextTickPos) {
if (isPlaying()) {
- sigmap.tickValues(midiClick, &bar, &beat, &tick);
+ ///sigmap.tickValues(midiClick, &bar, &beat, &tick);
+ AL::sigmap.tickValues(midiClick, &bar, &beat, &tick);
isMeasure = beat == 0;
}
else if (state == PRECOUNT) {
@@ -1455,7 +1457,8 @@ void Audio::processMidi()
}
if (isPlaying())
- midiClick = sigmap.bar2tick(bar, beat+1, 0);
+ ///midiClick = sigmap.bar2tick(bar, beat+1, 0);
+ midiClick = AL::sigmap.bar2tick(bar, beat+1, 0);
else if (state == PRECOUNT) {
midiClick += ticksBeat;
if (clickno)
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 100f4c5d..d8845db7 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -478,9 +478,9 @@ void DrumEdit::updateHScrollRange()
int s, e;
canvas->range(&s, &e);
// Show one more measure.
- e += sigmap.ticksMeasure(e);
+ e += AL::sigmap.ticksMeasure(e);
// Show another quarter measure due to imprecise drawing at canvas end point.
- e += sigmap.ticksMeasure(e) / 4;
+ e += AL::sigmap.ticksMeasure(e) / 4;
// Compensate for drum list, splitter handle, and vscroll widths.
e += canvas->rmapxDev(dlist->width() + split2->handleWidth() - vscroll->width());
int s1, e1;
diff --git a/muse2/muse/midiedit/ecanvas.cpp b/muse2/muse/midiedit/ecanvas.cpp
index bb99035d..85801336 100644
--- a/muse2/muse/midiedit/ecanvas.cpp
+++ b/muse2/muse/midiedit/ecanvas.cpp
@@ -55,8 +55,10 @@ QString EventCanvas::getCaption() const
{
int bar1, bar2, xx;
unsigned x;
- sigmap.tickValues(curPart->tick(), &bar1, &xx, &x);
- sigmap.tickValues(curPart->tick() + curPart->lenTick(), &bar2, &xx, &x);
+ ///sigmap.tickValues(curPart->tick(), &bar1, &xx, &x);
+ AL::sigmap.tickValues(curPart->tick(), &bar1, &xx, &x);
+ ///sigmap.tickValues(curPart->tick() + curPart->lenTick(), &bar2, &xx, &x);
+ AL::sigmap.tickValues(curPart->tick() + curPart->lenTick(), &bar2, &xx, &x);
return QString("MusE: Part <") + curPart->name()
+ QString("> %1-%2").arg(bar1+1).arg(bar2+1);
diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp
index fa51b792..191d0db4 100644
--- a/muse2/muse/midiedit/pianoroll.cpp
+++ b/muse2/muse/midiedit/pianoroll.cpp
@@ -487,9 +487,9 @@ void PianoRoll::updateHScrollRange()
int s, e;
canvas->range(&s, &e);
// Show one more measure.
- e += sigmap.ticksMeasure(e);
+ e += AL::sigmap.ticksMeasure(e);
// Show another quarter measure due to imprecise drawing at canvas end point.
- e += sigmap.ticksMeasure(e) / 4;
+ e += AL::sigmap.ticksMeasure(e) / 4;
// Compensate for the fixed piano and vscroll widths.
e += canvas->rmapxDev(pianoWidth - vscroll->width());
int s1, e1;
diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp
index 38544f97..d5d9786c 100644
--- a/muse2/muse/midiedit/prcanvas.cpp
+++ b/muse2/muse/midiedit/prcanvas.cpp
@@ -790,16 +790,16 @@ void drawTickRaster(QPainter& p, int x, int y, int w, int h, int raster)
{
int bar1, bar2, beat;
unsigned tick;
- sigmap.tickValues(x, &bar1, &beat, &tick);
- sigmap.tickValues(x+w, &bar2, &beat, &tick);
+ AL::sigmap.tickValues(x, &bar1, &beat, &tick);
+ AL::sigmap.tickValues(x+w, &bar2, &beat, &tick);
++bar2;
int y2 = y + h;
for (int bar = bar1; bar < bar2; ++bar) {
- unsigned x = sigmap.bar2tick(bar, 0, 0);
+ unsigned x = AL::sigmap.bar2tick(bar, 0, 0);
p.setPen(Qt::black);
p.drawLine(x, y, x, y2);
int z, n;
- sigmap.timesig(x, z, n);
+ AL::sigmap.timesig(x, z, n);
///int q = p.xForm(QPoint(raster, 0)).x() - p.xForm(QPoint(0, 0)).x();
int q = p.combinedTransform().map(QPoint(raster, 0)).x() - p.combinedTransform().map(QPoint(0, 0)).x();
int qq = raster;
@@ -816,7 +816,7 @@ void drawTickRaster(QPainter& p, int x, int y, int w, int h, int raster)
p.setPen(Qt::lightGray);
if (raster>=4) {
int xx = x + qq;
- int xxx = sigmap.bar2tick(bar, z, 0);
+ int xxx = AL::sigmap.bar2tick(bar, z, 0);
while (xx <= xxx) {
p.drawLine(xx, y, xx, y2);
xx += qq;
@@ -829,7 +829,7 @@ void drawTickRaster(QPainter& p, int x, int y, int w, int h, int raster)
// }
p.setPen(Qt::gray);
for (int beat = 1; beat < z; beat++) {
- int xx = sigmap.bar2tick(bar, beat, 0);
+ int xx = AL::sigmap.bar2tick(bar, beat, 0);
p.drawLine(xx, y, xx, y2);
}
@@ -1231,12 +1231,12 @@ void PianoCanvas::quantize(int strength, int limit, bool quantLen)
int tick2 = tick + len;
// quant start position
- int diff = sigmap.raster(tick, editor->quant()) - tick;
+ int diff = AL::sigmap.raster(tick, editor->quant()) - tick;
if (abs(diff) > limit)
tick += ((diff * strength) / 100);
// quant len
- diff = sigmap.raster(tick2, editor->quant()) - tick2;
+ diff = AL::sigmap.raster(tick2, editor->quant()) - tick2;
if (quantLen && (abs(diff) > limit))
len += ((diff * strength) / 100);
diff --git a/muse2/muse/midieditor.h b/muse2/muse/midieditor.h
index ee98239c..9a9ab437 100644
--- a/muse2/muse/midieditor.h
+++ b/muse2/muse/midieditor.h
@@ -8,7 +8,8 @@
#ifndef __MIDIEDITOR_H__
#define __MIDIEDITOR_H__
-#include "sig.h"
+///#include "sig.h"
+#include "al/sig.h"
#include "cobject.h"
//#include <QGridLayout>
@@ -66,10 +67,14 @@ class MidiEditor : public TopWin {
~MidiEditor();
int quantVal(int v) const;
- int rasterStep(unsigned tick) const { return sigmap.rasterStep(tick, _raster); }
- unsigned rasterVal(unsigned v) const { return sigmap.raster(v, _raster); }
- unsigned rasterVal1(unsigned v) const { return sigmap.raster1(v, _raster); }
- unsigned rasterVal2(unsigned v) const { return sigmap.raster2(v, _raster); }
+ ///int rasterStep(unsigned tick) const { return sigmap.rasterStep(tick, _raster); }
+ ///unsigned rasterVal(unsigned v) const { return sigmap.raster(v, _raster); }
+ ///unsigned rasterVal1(unsigned v) const { return sigmap.raster1(v, _raster); }
+ ///unsigned rasterVal2(unsigned v) const { return sigmap.raster2(v, _raster); }
+ int rasterStep(unsigned tick) const { return AL::sigmap.rasterStep(tick, _raster); }
+ unsigned rasterVal(unsigned v) const { return AL::sigmap.raster(v, _raster); }
+ unsigned rasterVal1(unsigned v) const { return AL::sigmap.raster1(v, _raster); }
+ unsigned rasterVal2(unsigned v) const { return AL::sigmap.raster2(v, _raster); }
int quant() const { return _quant; }
void setQuant(int val) { _quant = val; }
int raster() const { return _raster; }
diff --git a/muse2/muse/miditransform.cpp b/muse2/muse/miditransform.cpp
index 6593e826..7a32282b 100644
--- a/muse2/muse/miditransform.cpp
+++ b/muse2/muse/miditransform.cpp
@@ -703,7 +703,7 @@ void MidiTransformerDialog::processEvent(Event& event, MidiPart* part, MidiPart*
case Quantize:
{
int tick = event.tick();
- int rt = sigmap.raster(tick, data->cmt->quantVal) - tick;
+ int rt = AL::sigmap.raster(tick, data->cmt->quantVal) - tick;
if (tick != rt) {
// Indicate do clone parts.
removePortCtrlEvents(event, part, true);
@@ -854,7 +854,7 @@ bool MidiTransformerDialog::isSelected(Event& event, MidiPart*)
}
int bar, beat;
unsigned tick;
- sigmap.tickValues(event.tick(), &bar, &beat, &tick);
+ AL::sigmap.tickValues(event.tick(), &bar, &beat, &tick);
int beat1 = cmt->selRangeA / 1000;
unsigned tick1 = cmt->selRangeA % 1000;
int beat2 = cmt->selRangeB / 1000;
diff --git a/muse2/muse/pos.cpp b/muse2/muse/pos.cpp
index aa9538ca..15327af8 100644
--- a/muse2/muse/pos.cpp
+++ b/muse2/muse/pos.cpp
@@ -12,7 +12,8 @@
#include "xml.h"
#include "tempo.h"
#include "globals.h"
-#include "sig.h"
+///#include "sig.h"
+#include "al/sig.h"
extern int mtcType;
@@ -53,14 +54,14 @@ Pos::Pos(const QString& s)
{
int m, b, t;
sscanf(s.latin1(), "%04d.%02d.%03d", &m, &b, &t);
- _tick = sigmap.bar2tick(m, b, t);
+ _tick = AL::sigmap.bar2tick(m, b, t);
_type = TICKS;
sn = -1;
}
Pos::Pos(int measure, int beat, int tick)
{
- _tick = sigmap.bar2tick(measure, beat, tick);
+ _tick = AL::sigmap.bar2tick(measure, beat, tick);
_type = TICKS;
sn = -1;
}
@@ -516,7 +517,7 @@ void PosLen::setPos(const Pos& pos)
void Pos::mbt(int* bar, int* beat, int* tk) const
{
- sigmap.tickValues(tick(), bar, beat, (unsigned*)tk);
+ AL::sigmap.tickValues(tick(), bar, beat, (unsigned*)tk);
}
//---------------------------------------------------------
diff --git a/muse2/muse/seqmsg.cpp b/muse2/muse/seqmsg.cpp
index 83161996..2def4078 100644
--- a/muse2/muse/seqmsg.cpp
+++ b/muse2/muse/seqmsg.cpp
@@ -14,7 +14,8 @@
#include "app.h"
#include "amixer.h"
#include "tempo.h"
-#include "sig.h"
+///#include "sig.h"
+#include "al/sig.h"
#include "audio.h"
#include "mididev.h"
#include "audiodev.h"
diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp
index a4c638a1..c956f1d6 100644
--- a/muse2/muse/song.cpp
+++ b/muse2/muse/song.cpp
@@ -39,7 +39,8 @@
#include "midictrl.h"
#include "menutitleitem.h"
#include "midi.h"
-#include "sig.h"
+///#include "sig.h"
+#include "al/sig.h"
#include <sys/wait.h>
extern void clearMidiTransforms();
@@ -130,6 +131,13 @@ void Song::setSig(int z, int n)
}
}
+void Song::setSig(const AL::TimeSignature& sig)
+ {
+ if (_masterFlag) {
+ audio->msgAddSig(pos[0].tick(), sig.z, sig.n);
+ }
+ }
+
//---------------------------------------------------------
// addNewTrack
// Called from GUI context
@@ -739,9 +747,9 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
//startTick = roundDownBar(startTick);
//endTick = roundUpBar(endTick);
// Round the start down using the Arranger part snap raster value.
- startTick = sigmap.raster1(startTick, recRaster());
+ startTick = AL::sigmap.raster1(startTick, recRaster());
// Round the end up using the Arranger part snap raster value.
- endTick = sigmap.raster2(endTick, recRaster());
+ endTick = AL::sigmap.raster2(endTick, recRaster());
part->setTick(startTick);
part->setLenTick(endTick - startTick);
@@ -776,7 +784,7 @@ void Song::cmdAddRecordedEvents(MidiTrack* mt, EventList* events, unsigned start
// Added by Tim. p3.3.8
// Round the end up (again) using the Arranger part snap raster value.
- endTick = sigmap.raster2(endTick, recRaster());
+ endTick = AL::sigmap.raster2(endTick, recRaster());
// Remove all of the part's port controller values. Indicate do not do clone parts.
removePortCtrlEvents(part, false);
@@ -1375,7 +1383,7 @@ void Song::setChannelMute(int channel, bool val)
void Song::initLen()
{
- _len = sigmap.bar2tick(40, 0, 0); // default song len
+ _len = AL::sigmap.bar2tick(40, 0, 0); // default song len
for (iTrack t = _tracks.begin(); t != _tracks.end(); ++t) {
MidiTrack* track = dynamic_cast<MidiTrack*>(*t);
if (track == 0)
@@ -1407,9 +1415,9 @@ int Song::roundUpBar(int t) const
{
int bar, beat;
unsigned tick;
- sigmap.tickValues(t, &bar, &beat, &tick);
+ AL::sigmap.tickValues(t, &bar, &beat, &tick);
if (beat || tick)
- return sigmap.bar2tick(bar+1, 0, 0);
+ return AL::sigmap.bar2tick(bar+1, 0, 0);
return t;
}
@@ -1421,9 +1429,9 @@ int Song::roundUpBeat(int t) const
{
int bar, beat;
unsigned tick;
- sigmap.tickValues(t, &bar, &beat, &tick);
+ AL::sigmap.tickValues(t, &bar, &beat, &tick);
if (tick)
- return sigmap.bar2tick(bar, beat+1, 0);
+ return AL::sigmap.bar2tick(bar, beat+1, 0);
return t;
}
@@ -1435,8 +1443,8 @@ int Song::roundDownBar(int t) const
{
int bar, beat;
unsigned tick;
- sigmap.tickValues(t, &bar, &beat, &tick);
- return sigmap.bar2tick(bar, 0, 0);
+ AL::sigmap.tickValues(t, &bar, &beat, &tick);
+ return AL::sigmap.bar2tick(bar, 0, 0);
}
//---------------------------------------------------------
@@ -1446,7 +1454,7 @@ int Song::roundDownBar(int t) const
void Song::dumpMaster()
{
tempomap.dump();
- sigmap.dump();
+ AL::sigmap.dump();
}
//---------------------------------------------------------
@@ -1850,13 +1858,13 @@ void Song::processMsg(AudioMsg* msg)
case SEQM_ADD_SIG:
undoOp(UndoOp::AddSig, msg->a, msg->b, msg->c);
- sigmap.add(msg->a, msg->b, msg->c);
+ AL::sigmap.add(msg->a, AL::TimeSignature(msg->b, msg->c));
updateFlags = SC_SIG;
break;
case SEQM_REMOVE_SIG:
undoOp(UndoOp::DeleteSig, msg->a, msg->b, msg->c);
- sigmap.del(msg->a);
+ AL::sigmap.del(msg->a);
updateFlags = SC_SIG;
break;
@@ -2010,7 +2018,7 @@ void Song::clear(bool signal)
while (loop);
tempomap.clear();
- sigmap.clear();
+ AL::sigmap.clear();
undoList->clearDelete();
redoList->clear();
_markerList->clear();
@@ -2095,7 +2103,7 @@ void Song::cleanupForQuit()
_synthIs.clearDelete(); // each ~SynthI() -> deactivate3() -> ~SynthIF()
tempomap.clear();
- sigmap.clear();
+ AL::sigmap.clear();
if(debugMsg)
printf("deleting undoList, clearing redoList\n");
@@ -3518,10 +3526,10 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo
MidiPart *part = (MidiPart*)(i->second);
int partStart = part->endTick()-part->lenTick();
int z, n;
- sigmap.timesig(0, z, n);
+ AL::sigmap.timesig(0, z, n);
fprintf(fp, "TIMESIG %d %d\n", z, n);
fprintf(fp, "PART %d %d\n", partStart, part->lenTick());
- fprintf(fp, "BEATLEN %d\n", sigmap.ticksBeat(0));
+ fprintf(fp, "BEATLEN %d\n", AL::sigmap.ticksBeat(0));
fprintf(fp, "QUANTLEN %d\n", quant);
//for (iCItem i = items.begin(); i != items.end(); ++i) {
diff --git a/muse2/muse/song.h b/muse2/muse/song.h
index 3e53afbc..e5f854b0 100644
--- a/muse2/muse/song.h
+++ b/muse2/muse/song.h
@@ -20,7 +20,8 @@
#include "pos.h"
#include "globaldefs.h"
#include "tempo.h"
-#include "sig.h"
+///#include "sig.h"
+#include "al/sig.h"
#include "undo.h"
#include "track.h"
@@ -370,6 +371,7 @@ class Song : public QObject {
void setTempo(int t);
void setSig(int a, int b);
+ void setSig(const AL::TimeSignature&);
void setTempo(double tempo) { setTempo(int(60000000.0/tempo)); }
void setMasterFlag(bool flag);
diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp
index 0dbd246a..a95b92a2 100644
--- a/muse2/muse/songfile.cpp
+++ b/muse2/muse/songfile.cpp
@@ -1247,7 +1247,8 @@ void Song::read(Xml& xml)
tempomap.read(xml);
}
else if (tag == "siglist")
- sigmap.read(xml);
+ ///sigmap.read(xml);
+ AL::sigmap.read(xml);
else if (tag == "miditrack") {
MidiTrack* track = new MidiTrack();
track->read(xml);
@@ -1469,7 +1470,8 @@ void Song::write(int level, Xml& xml) const
}
tempomap.write(level, xml);
- sigmap.write(level, xml);
+ ///sigmap.write(level, xml);
+ AL::sigmap.write(level, xml);
_markerList->write(level, xml);
writeDrumMap(level, xml, false);
diff --git a/muse2/muse/transport.cpp b/muse2/muse/transport.cpp
index 48e5175d..0bcf1962 100644
--- a/muse2/muse/transport.cpp
+++ b/muse2/muse/transport.cpp
@@ -21,13 +21,15 @@
#include <QVBoxLayout>
#include <QBoxLayout>
+#include "awl/posedit.h"
+
#include "song.h"
#include "transport.h"
#include "doublelabel.h"
#include "siglabel.h"
#include "globals.h"
#include "icons.h"
-#include "posedit.h"
+///#include "posedit.h"
#include "sync.h"
#include "shortcuts.h"
#include "gconfig.h"
@@ -151,7 +153,8 @@ TempoSig::TempoSig(QWidget* parent)
l3->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
connect(l1, SIGNAL(valueChanged(double,int)), SLOT(setTempo(double)));
- connect(l2, SIGNAL(valueChanged(int,int)), SIGNAL(sigChanged(int,int)));
+ ///connect(l2, SIGNAL(valueChanged(int,int)), SIGNAL(sigChanged(int,int)));
+ connect(l2, SIGNAL(valueChanged(const AL::TimeSignature&)), SIGNAL(sigChanged(const AL::TimeSignature&)));
connect(muse, SIGNAL(configChanged()), SLOT(configChanged()));
this->setLayout(vb1);
@@ -314,7 +317,8 @@ Transport::Transport(QWidget*, const char* name)
marken->setSpacing(0);
marken->setContentsMargins(0, 0, 0, 0);
- tl1 = new PosEdit(0);
+ ///tl1 = new PosEdit(0);
+ tl1 = new Awl::PosEdit(0);
tl1->setMinimumSize(105,0);
tl1->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
marken->addWidget(tl1);
@@ -324,7 +328,8 @@ Transport::Transport(QWidget*, const char* name)
l5->setAlignment(Qt::AlignCenter);
marken->addWidget(l5);
- tl2 = new PosEdit(0);
+ ///tl2 = new PosEdit(0);
+ tl2 = new Awl::PosEdit(0);
tl2->setMinimumSize(105,0);
tl2->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed));
marken->addWidget(tl2);
@@ -347,8 +352,10 @@ Transport::Transport(QWidget*, const char* name)
QHBoxLayout *hbox1 = new QHBoxLayout;
hbox1->setContentsMargins(0, 0, 0, 0);
- time1 = new PosEdit(0);
- time2 = new PosEdit(0);
+ ///time1 = new PosEdit(0);
+ time1 = new Awl::PosEdit(0);
+ ///time2 = new PosEdit(0);
+ time2 = new Awl::PosEdit(0);
time2->setSmpte(true);
time1->setMinimumSize(105,0);
time2->setMinimumSize(105,0);
@@ -474,7 +481,8 @@ Transport::Transport(QWidget*, const char* name)
connect(slider,SIGNAL(valueChanged(int)), SLOT(cposChanged(int)));
connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool)));
connect(tempo, SIGNAL(tempoChanged(int)), song, SLOT(setTempo(int)));
- connect(tempo, SIGNAL(sigChanged(int, int)), song, SLOT(setSig(int, int)));
+ ///connect(tempo, SIGNAL(sigChanged(int, int)), song, SLOT(setSig(int, int)));
+ connect(tempo, SIGNAL(sigChanged(const AL::TimeSignature&)), song, SLOT(setSig(const AL::TimeSignature&)));
connect(song, SIGNAL(playChanged(bool)), SLOT(setPlay(bool)));
connect(song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int)));
connect(muse, SIGNAL(configChanged()), SLOT(configChanged()));
@@ -548,7 +556,8 @@ void Transport::setPos(int idx, unsigned v, bool)
setTempo(tempomap.tempo(v));
{
int z, n;
- sigmap.timesig(v, z, n);
+ ///sigmap.timesig(v, z, n);
+ AL::sigmap.timesig(v, z, n);
setTimesig(z, n);
}
break;
@@ -688,7 +697,8 @@ void Transport::songChanged(int flags)
}
if (flags & SC_SIG) {
int z, n;
- sigmap.timesig(cpos, z, n);
+ ///sigmap.timesig(cpos, z, n);
+ AL::sigmap.timesig(cpos, z, n);
setTimesig(z, n);
}
if (flags & SC_MASTER)
diff --git a/muse2/muse/transport.h b/muse2/muse/transport.h
index 4e60e476..2c2f980e 100644
--- a/muse2/muse/transport.h
+++ b/muse2/muse/transport.h
@@ -9,12 +9,19 @@
#ifndef __TRANSPORT_H__
#define __TRANSPORT_H__
+#include "al/sig.h"
+
#include <QMouseEvent>
#include <QLabel>
+namespace Awl {
+ class PosEdit;
+ };
+
+using Awl::PosEdit;
+
class QToolButton;
class QHBoxLayout;
-class PosEdit;
class QSlider;
class DoubleLabel;
class SigLabel;
@@ -41,7 +48,7 @@ class TempoSig : public QWidget {
signals:
void tempoChanged(int);
- void sigChanged(int, int);
+ void sigChanged(const AL::TimeSignature&);
public:
TempoSig(QWidget* parent=0);
@@ -73,6 +80,7 @@ class Transport : public QWidget
PosEdit* tl2; // right mark
PosEdit* time1; // tick time
PosEdit* time2; // SMPTE
+
QSlider* slider;
TempoSig* tempo;
QHBoxLayout* tb;
diff --git a/muse2/muse/undo.cpp b/muse2/muse/undo.cpp
index ba020d2f..a3bd68f8 100644
--- a/muse2/muse/undo.cpp
+++ b/muse2/muse/undo.cpp
@@ -6,6 +6,9 @@
// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
//=========================================================
+///#include "sig.h"
+#include "al/sig.h" // Tim.
+
#include "undo.h"
#include "song.h"
#include "globals.h"
@@ -420,11 +423,13 @@ void Song::doUndo2()
updateFlags |= SC_TEMPO;
break;
case UndoOp::AddSig:
- sigmap.del(i->a);
+ ///sigmap.del(i->a);
+ AL::sigmap.del(i->a);
updateFlags |= SC_SIG;
break;
case UndoOp::DeleteSig:
- sigmap.add(i->a, i->b, i->c);
+ ///sigmap.add(i->a, i->b, i->c);
+ AL::sigmap.add(i->a, AL::TimeSignature(i->b, i->c));
updateFlags |= SC_SIG;
break;
case UndoOp::ModifyClip:
@@ -646,11 +651,13 @@ void Song::doRedo2()
updateFlags |= SC_TEMPO;
break;
case UndoOp::AddSig:
- sigmap.add(i->a, i->b, i->c);
+ ///sigmap.add(i->a, i->b, i->c);
+ AL::sigmap.add(i->a, AL::TimeSignature(i->b, i->c));
updateFlags |= SC_SIG;
break;
case UndoOp::DeleteSig:
- sigmap.del(i->a);
+ ///sigmap.del(i->a);
+ AL::sigmap.del(i->a);
updateFlags |= SC_SIG;
break;
case UndoOp::ModifyClip:
diff --git a/muse2/muse/wave.cpp b/muse2/muse/wave.cpp
index b74858dd..71537735 100644
--- a/muse2/muse/wave.cpp
+++ b/muse2/muse/wave.cpp
@@ -24,7 +24,8 @@
#include "globals.h"
#include "event.h"
#include "audio.h"
-#include "sig.h"
+///#include "sig.h"
+#include "al/sig.h"
//#define WAVE_DEBUG
//#define WAVE_DEBUG_PRC
@@ -1076,9 +1077,9 @@ void Song::cmdAddRecordedWave(WaveTrack* track, Pos s, Pos e)
return;
}
// Round the start down using the Arranger part snap raster value.
- unsigned startTick = sigmap.raster1(s.tick(), song->recRaster());
+ unsigned startTick = AL::sigmap.raster1(s.tick(), song->recRaster());
// Round the end up using the Arranger part snap raster value.
- unsigned endTick = sigmap.raster2(e.tick(), song->recRaster());
+ unsigned endTick = AL::sigmap.raster2(e.tick(), song->recRaster());
f->update();
diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp
index 338d702c..62e7d6f1 100644
--- a/muse2/muse/waveedit/waveedit.cpp
+++ b/muse2/muse/waveedit/waveedit.cpp
@@ -254,9 +254,9 @@ void WaveEdit::updateHScrollRange()
int s, e;
wview->range(&s, &e);
// Show one more measure.
- e += sigmap.ticksMeasure(e);
+ e += AL::sigmap.ticksMeasure(e);
// Show another quarter measure due to imprecise drawing at canvas end point.
- e += sigmap.ticksMeasure(e) / 4;
+ e += AL::sigmap.ticksMeasure(e) / 4;
// Compensate for the vscroll width.
//e += wview->rmapxDev(-vscroll->width());
int s1, e1;
diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt
index ca1df66a..9394627c 100644
--- a/muse2/muse/widgets/CMakeLists.txt
+++ b/muse2/muse/widgets/CMakeLists.txt
@@ -114,12 +114,12 @@ QT4_WRAP_CPP (widget_mocs
gatetime.h
velocity.h
metronome.h
- posedit.h
+ # posedit.h
pitchedit.h
pitchlabel.h
poslabel.h
filedialog.h
- sigedit.h
+ # sigedit.h
shortcutconfig.h
shortcutcapturedialog.h
combobox.h
@@ -217,12 +217,13 @@ add_library ( widgets STATIC
gatetime.cpp
velocity.cpp
metronome.cpp
- posedit.cpp section.h
+ # posedit.cpp
+ section.h
pitchedit.cpp
pitchlabel.cpp
poslabel.cpp
filedialog.cpp
- sigedit.cpp
+ # sigedit.cpp
shortcutconfig.cpp
shortcutcapturedialog.cpp
combobox.cpp
diff --git a/muse2/muse/widgets/bigtime.cpp b/muse2/muse/widgets/bigtime.cpp
index 0c88f045..73c113d2 100644
--- a/muse2/muse/widgets/bigtime.cpp
+++ b/muse2/muse/widgets/bigtime.cpp
@@ -207,7 +207,7 @@ bool BigTime::setString(unsigned v)
unsigned absFrame = tempomap.tick2frame(v);
int bar, beat;
unsigned tick;
- sigmap.tickValues(v, &bar, &beat, &tick);
+ AL::sigmap.tickValues(v, &bar, &beat, &tick);
double time = double(absFrame)/double(sampleRate);
//int hour = int(time) / 3600;
//int min = (int(time) / 60) % 60;
diff --git a/muse2/muse/widgets/cliplisteditorbase.ui b/muse2/muse/widgets/cliplisteditorbase.ui
index 5c4806c2..cb0532b0 100644
--- a/muse2/muse/widgets/cliplisteditorbase.ui
+++ b/muse2/muse/widgets/cliplisteditorbase.ui
@@ -111,7 +111,7 @@
</widget>
</item>
<item>
- <widget class="PosEdit" name="start">
+ <widget class="Awl::PosEdit" name="start">
<property name="smpte">
<bool>true</bool>
</property>
@@ -128,7 +128,7 @@
</widget>
</item>
<item>
- <widget class="PosEdit" name="len">
+ <widget class="Awl::PosEdit" name="len">
<property name="smpte">
<bool>true</bool>
</property>
@@ -156,8 +156,13 @@
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+ <customwidget>
+ <class>Awl::PosEdit</class>
+ <extends>QWidget</extends>
+ <header>awl/posedit.h</header>
+ <container>0</container>
+ </customwidget>
+ </customwidgets>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
- <includes>
- <include location="local">posedit.h</include>
- </includes>
</ui>
diff --git a/muse2/muse/widgets/editnotedialogbase.ui b/muse2/muse/widgets/editnotedialogbase.ui
index 79c449fe..491a10db 100644
--- a/muse2/muse/widgets/editnotedialogbase.ui
+++ b/muse2/muse/widgets/editnotedialogbase.ui
@@ -129,7 +129,7 @@
</widget>
</item>
<item row="0" column="1">
- <widget class="PosEdit" name="epos" native="true"/>
+ <widget class="Awl::PosEdit" name="epos"/>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="il1">
@@ -164,9 +164,10 @@
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
- <class>PosEdit</class>
+ <class>Awl::PosEdit</class>
<extends>QWidget</extends>
- <header>posedit.h</header>
+ <header>awl/posedit.h</header>
+ <container>0</container>
</customwidget>
<customwidget>
<class>PitchEdit</class>
@@ -183,7 +184,6 @@
<tabstop>buttonCancel</tabstop>
</tabstops>
<includes>
- <include location="local">posedit.h</include>
<include location="local">pitchedit.h</include>
</includes>
<resources/>
diff --git a/muse2/muse/widgets/editsysexdialogbase.ui b/muse2/muse/widgets/editsysexdialogbase.ui
index 6e9aef27..adf5b186 100644
--- a/muse2/muse/widgets/editsysexdialogbase.ui
+++ b/muse2/muse/widgets/editsysexdialogbase.ui
@@ -42,7 +42,7 @@
</widget>
</item>
<item>
- <widget class="PosEdit" name="epos" native="true"/>
+ <widget class="Awl::PosEdit" name="epos"/>
</item>
<item>
<spacer name="Spacer2">
@@ -152,14 +152,12 @@
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
- <class>PosEdit</class>
+ <class>Awl::PosEdit</class>
<extends>QWidget</extends>
- <header>posedit.h</header>
+ <header>awl/posedit.h</header>
+ <container>0</container>
</customwidget>
</customwidgets>
- <includes>
- <include location="local">posedit.h</include>
- </includes>
<resources/>
<connections>
<connection>
diff --git a/muse2/muse/widgets/hitscale.cpp b/muse2/muse/widgets/hitscale.cpp
index 2d7c5267..aa3838fe 100644
--- a/muse2/muse/widgets/hitscale.cpp
+++ b/muse2/muse/widgets/hitscale.cpp
@@ -70,7 +70,7 @@ void HitScale::viewMouseReleaseEvent(QMouseEvent*)
void HitScale::viewMouseMoveEvent(QMouseEvent* event)
{
- int x = sigmap.raster(event->x(), *raster);
+ int x = AL::sigmap.raster(event->x(), *raster);
emit timeChanged(x);
int i;
switch (button) {
diff --git a/muse2/muse/widgets/mtscale.cpp b/muse2/muse/widgets/mtscale.cpp
index 425c8bf1..0472384c 100644
--- a/muse2/muse/widgets/mtscale.cpp
+++ b/muse2/muse/widgets/mtscale.cpp
@@ -152,7 +152,7 @@ void MTScale::viewMouseMoveEvent(QMouseEvent* event)
int x = event->x();
if (waveMode)
x = tempomap.frame2tick(x);
- x = sigmap.raster(x, *raster);
+ x = AL::sigmap.raster(x, *raster);
if (x < 0)
x = 0;
//printf("MTScale::viewMouseMoveEvent\n");
@@ -344,22 +344,22 @@ void MTScale::pdraw(QPainter& p, const QRect& r)
if (waveMode) {
ctick = tempomap.frame2tick(mapxDev(x));
- sigmap.tickValues(ctick, &bar1, &beat, &tick);
- sigmap.tickValues(tempomap.frame2tick(mapxDev(x+w)),
+ AL::sigmap.tickValues(ctick, &bar1, &beat, &tick);
+ AL::sigmap.tickValues(tempomap.frame2tick(mapxDev(x+w)),
&bar2, &beat, &tick);
}
else {
ctick = mapxDev(x);
- sigmap.tickValues(ctick, &bar1, &beat, &tick);
- sigmap.tickValues(mapxDev(x+w), &bar2, &beat, &tick);
+ AL::sigmap.tickValues(ctick, &bar1, &beat, &tick);
+ AL::sigmap.tickValues(mapxDev(x+w), &bar2, &beat, &tick);
}
//printf("bar %d %d-%d=%d\n", bar, ntick, stick, ntick-stick);
- int stick = sigmap.bar2tick(bar1, 0, 0);
+ int stick = AL::sigmap.bar2tick(bar1, 0, 0);
int ntick;
for (int bar = bar1; bar <= bar2; bar++, stick = ntick) {
- ntick = sigmap.bar2tick(bar+1, 0, 0);
+ ntick = AL::sigmap.bar2tick(bar+1, 0, 0);
int tpix, a, b=0;
if (waveMode) {
a = tempomap.tick2frame(ntick);
@@ -395,9 +395,9 @@ void MTScale::pdraw(QPainter& p, const QRect& r)
}
else {
int z, n;
- sigmap.timesig(stick, z, n);
+ AL::sigmap.timesig(stick, z, n);
for (int beat = 0; beat < z; beat++) {
- int xx = sigmap.bar2tick(bar, beat, 0);
+ int xx = AL::sigmap.bar2tick(bar, beat, 0);
if (waveMode)
xx = tempomap.tick2frame(xx);
int xp = mapx(xx);
diff --git a/muse2/muse/widgets/noteinfo.cpp b/muse2/muse/widgets/noteinfo.cpp
index 91e63df9..2bc17783 100644
--- a/muse2/muse/widgets/noteinfo.cpp
+++ b/muse2/muse/widgets/noteinfo.cpp
@@ -10,9 +10,13 @@
#include "noteinfo.h"
#include <QLayout>
#include <QLabel>
+
+#include "awl/posedit.h"
+//#include "awl/pitchedit.h"
+
#include "song.h"
#include "globals.h"
-#include "posedit.h"
+///#include "posedit.h"
#include "pitchedit.h"
//---------------------------------------------------
@@ -32,8 +36,12 @@ NoteInfo::NoteInfo(QWidget* parent)
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
label->setIndent(3);
addWidget(label);
+
//selTime = new PosEdit(this, "Start");
- selTime = new PosEdit(0, "Start");
+ ///selTime = new PosEdit(0, "Start");
+ selTime = new Awl::PosEdit;
+ selTime->setObjectName("Start");
+
addWidget(selTime);
//label = new QLabel(tr("Len"), this, "Len");
diff --git a/muse2/muse/widgets/noteinfo.h b/muse2/muse/widgets/noteinfo.h
index 9607dfc1..ae32bf8d 100644
--- a/muse2/muse/widgets/noteinfo.h
+++ b/muse2/muse/widgets/noteinfo.h
@@ -10,7 +10,12 @@
//#include <q3toolbar.h>
#include <QToolBar>
-class PosEdit;
+namespace Awl {
+ class PosEdit;
+ //class PitchEdit;
+ };
+
+///class PosEdit;
class QSpinBox;
class PitchEdit;
//class QMainWindow;
@@ -22,7 +27,8 @@ class Pos;
//---------------------------------------------------------
class NoteInfo : public QToolBar {
- PosEdit* selTime;
+ ///PosEdit* selTime;
+ Awl::PosEdit* selTime;
QSpinBox* selLen;
PitchEdit* selPitch;
QSpinBox* selVelOn;
diff --git a/muse2/muse/widgets/poslabel.cpp b/muse2/muse/widgets/poslabel.cpp
index feb1486b..4ab7724c 100644
--- a/muse2/muse/widgets/poslabel.cpp
+++ b/muse2/muse/widgets/poslabel.cpp
@@ -13,7 +13,8 @@
#include <QLabel>
#include "poslabel.h"
-#include "sig.h"
+///#include "sig.h"
+#include "al/sig.h"
#include "tempo.h"
#include "globals.h"
@@ -89,7 +90,7 @@ void PosLabel::updateValue()
else {
int bar, beat;
unsigned tick;
- sigmap.tickValues(_tickValue, &bar, &beat, &tick);
+ AL::sigmap.tickValues(_tickValue, &bar, &beat, &tick);
//s.sprintf("%04d.%02d.%03ud", bar+1, beat+1, tick);
s.sprintf("%04d.%02d.%03u", bar+1, beat+1, tick);
}
diff --git a/muse2/muse/widgets/sigedit.cpp b/muse2/muse/widgets/sigedit.cpp
index 9af1d7eb..79cf7885 100644
--- a/muse2/muse/widgets/sigedit.cpp
+++ b/muse2/muse/widgets/sigedit.cpp
@@ -20,7 +20,8 @@
#include <QStyle>
#include <QTimerEvent>
-#include "sig.h"
+///#include "sig.h"
+#include "al/sig.h"
#include "sigedit.h"
#include "spinbox.h"
diff --git a/muse2/muse/widgets/siglabel.cpp b/muse2/muse/widgets/siglabel.cpp
index 54338ab6..47fcd2f8 100644
--- a/muse2/muse/widgets/siglabel.cpp
+++ b/muse2/muse/widgets/siglabel.cpp
@@ -16,7 +16,6 @@
#define TIMER4 50
#include "globals.h"
-//Added by qt3to4:
#include <QMouseEvent>
#include <QWheelEvent>
#include <QLabel>
@@ -26,12 +25,20 @@
// edit Signature Values (4/4)
//---------------------------------------------------------
-SigLabel::SigLabel(int a, int b, QWidget* parent) : QLabel(parent)
+SigLabel::SigLabel(int z, int n, QWidget* parent) : QLabel(parent)
{
z = n = 0;
setFocusPolicy(Qt::NoFocus);
setAlignment(Qt::AlignCenter);
- setValue(a, b);
+ setValue(z, n);
+ }
+
+SigLabel::SigLabel(const AL::TimeSignature& sig, QWidget* parent) : QLabel(parent)
+ {
+ z = n = 0;
+ setFocusPolicy(Qt::NoFocus);
+ setAlignment(Qt::AlignCenter);
+ setValue(sig.z, sig.n);
}
//---------------------------------------------------------
@@ -58,7 +65,7 @@ void SigLabel::mousePressEvent(QMouseEvent* event)
}
if ((zz != z) || (nn != n)) {
setValue(zz, nn);
- emit valueChanged(zz, nn);
+ emit valueChanged(AL::TimeSignature(zz, nn));
}
}
@@ -122,7 +129,7 @@ void SigLabel::wheelEvent(QWheelEvent* event)
incValue(zaehler, inc, zz, nn);
if ((zz != z) || (nn != n)) {
setValue(zz, nn);
- emit valueChanged(zz, nn);
+ emit valueChanged(AL::TimeSignature(zz, nn));
}
}
diff --git a/muse2/muse/widgets/siglabel.h b/muse2/muse/widgets/siglabel.h
index 4f93a7b8..2131d593 100644
--- a/muse2/muse/widgets/siglabel.h
+++ b/muse2/muse/widgets/siglabel.h
@@ -8,8 +8,9 @@
#ifndef __SIGLABEL_H__
#define __SIGLABEL_H__
-#include <qlabel.h>
-//Added by qt3to4:
+#include <al/sig.h>
+
+#include <QLabel>
#include <QWheelEvent>
#include <QMouseEvent>
@@ -26,16 +27,19 @@ class SigLabel : public QLabel {
protected:
int z, n;
-
+
signals:
- void valueChanged(int, int);
+ void valueChanged(const AL::TimeSignature&);
public slots:
virtual void setValue(int, int);
+ virtual void setValue(const AL::TimeSignature& sig) { setValue(sig.z, sig.n); }
public:
SigLabel(int z, int n, QWidget*);
+ SigLabel(const AL::TimeSignature&, QWidget*);
void value(int& a, int& b) const { a = z; b = n; }
+ AL::TimeSignature value() const { return AL::TimeSignature(z, n); }
void setFrame(bool);
};
#endif
diff --git a/muse2/muse/widgets/sigscale.cpp b/muse2/muse/widgets/sigscale.cpp
index 2735d8d2..bbc6cf85 100644
--- a/muse2/muse/widgets/sigscale.cpp
+++ b/muse2/muse/widgets/sigscale.cpp
@@ -13,6 +13,8 @@
#include <QEvent>
#include <QMouseEvent>
+#include "al/sig.h" // Tim.
+
#include "globals.h"
#include "midieditor.h"
#include "sigscale.h"
@@ -76,7 +78,7 @@ void SigScale::viewMouseReleaseEvent(QMouseEvent*)
void SigScale::viewMouseMoveEvent(QMouseEvent* event)
{
- int x = sigmap.raster(event->x(), *raster);
+ int x = AL::sigmap.raster(event->x(), *raster);
emit timeChanged(x);
int i;
switch (button) {
@@ -118,8 +120,10 @@ void SigScale::pdraw(QPainter& p, const QRect& r)
if (x < 0)
x = 0;
p.setFont(config.fonts[3]);
- for (ciSigEvent si = sigmap.begin(); si != sigmap.end(); ++si) {
- SigEvent* e = si->second;
+ ///for (ciSigEvent si = sigmap.begin(); si != sigmap.end(); ++si) {
+ for (AL::ciSigEvent si = AL::sigmap.begin(); si != AL::sigmap.end(); ++si) {
+ ///SigEvent* e = si->second;
+ AL::SigEvent* e = si->second;
int xp = mapx(e->tick);
if (xp > x+w)
break;
@@ -128,7 +132,7 @@ void SigScale::pdraw(QPainter& p, const QRect& r)
p.drawLine(xp, 0, xp, h/2);
p.drawLine(xp, h/2, xp+5, h/2);
QString s;
- s.sprintf("%d/%d", e->z, e->n);
+ s.sprintf("%d/%d", e->sig.z, e->sig.n);
p.drawText(xp+8, h-6, s);
}
diff --git a/muse2/muse/widgets/spinbox.cpp b/muse2/muse/widgets/spinbox.cpp
index aa536809..ee585da7 100644
--- a/muse2/muse/widgets/spinbox.cpp
+++ b/muse2/muse/widgets/spinbox.cpp
@@ -5,10 +5,8 @@
// (C) Copyright 2001 Werner Schweer (ws@seh.de)
//=========================================================
-#include <QEvent>
#include <QKeyEvent>
-#include <QMouseEvent>
-
+#include <QEvent>
#include "spinbox.h"
//---------------------------------------------------------
@@ -27,52 +25,8 @@ SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent)
setRange(minValue, maxValue);
setSingleStep(step);
_clearFocus = true;
- upEnabled = StepUpEnabled;
- downEnabled = StepDownEnabled;
-}
-
-QAbstractSpinBox::StepEnabled SpinBox::stepEnabled() const
-{
- return upEnabled | downEnabled;
}
-void SpinBox::setStepEnabled(bool up, bool down)
-{
- upEnabled = up ? StepUpEnabled : StepNone;
- downEnabled = down ? StepDownEnabled : StepNone;
-}
-
-int SpinBox::arrowWidth() const
-{
- QStyleOptionSpinBox styleOpt;
- styleOpt.initFrom(this);
- QRect upArrowRect = QApplication::style()->subControlRect(QStyle::CC_SpinBox, &styleOpt, QStyle::SC_SpinBoxUp, this);
- return upArrowRect.width();
-}
-
-void SpinBox::setEditor(QLineEdit* ed)
-{
- setLineEdit(ed);
-}
-
-void SpinBox::mousePressEvent ( QMouseEvent * event )
-{
- // FIXME: I couldn't find a way to access the arrow buttons directly. Hence I am using a QRect::contains method.
- // Unfortunately this is not 100% accurate with the Oxygen style; one needs to push to the right hand side of the
- // buttons. But it works perfect with the QtCurve style - Orcan
- QStyleOptionSpinBox styleOpt;
- styleOpt.initFrom(this);
- QRect upArrowRect = QApplication::style()->subControlRect(QStyle::CC_SpinBox, &styleOpt, QStyle::SC_SpinBoxUp, this);
- QRect downArrowRect = QApplication::style()->subControlRect(QStyle::CC_SpinBox, &styleOpt, QStyle::SC_SpinBoxDown, this);
-
- if (upArrowRect.contains(event->pos()))
- emit(stepUpPressed());
- else if (downArrowRect.contains(event->pos()))
- emit(stepDownPressed());
- QSpinBox::mousePressEvent(event);
-}
-
-
bool SpinBox::eventFilter(QObject* o, QEvent* ev)
{
// if (o != (QObject*)editor()) ddskrjo can't find editor()
diff --git a/muse2/muse/widgets/spinbox.h b/muse2/muse/widgets/spinbox.h
index c40b97cf..43ff85be 100644
--- a/muse2/muse/widgets/spinbox.h
+++ b/muse2/muse/widgets/spinbox.h
@@ -13,10 +13,7 @@
#define __SPINBOX_H__
#include <QSpinBox>
-
-class QEvent;
-class QLineEdit;
-class QMouseEvent;
+#include <QEvent>
//---------------------------------------------------------
// SpinBox
@@ -26,29 +23,20 @@ class SpinBox : public QSpinBox {
Q_OBJECT
bool _clearFocus;
- StepEnabled upEnabled;
- StepEnabled downEnabled;
protected:
bool eventFilter(QObject* obj, QEvent* ev);
- virtual void mousePressEvent ( QMouseEvent * event );
- virtual StepEnabled stepEnabled() const;
-
+
public slots:
virtual void stepUp();
virtual void stepDown();
signals:
void doubleClicked();
- void stepDownPressed();
- void stepUpPressed();
public:
SpinBox(QWidget* parent=0);
SpinBox(int minValue, int maxValue, int step = 1, QWidget* parent=0);
- void setStepEnabled(bool up, bool down);
- int arrowWidth() const;
- void setEditor(QLineEdit* ed);
};
#endif