summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2012-07-07 20:57:23 +0000
committerRobert Jonsson <spamatica@gmail.com>2012-07-07 20:57:23 +0000
commitcb8157ddafc3753b1e79d33495d5a4fdca7c735b (patch)
tree6ef210bc7651cc5909620df8c549734cb645a5fb /muse2/muse
parent00079cfa009028c807a2086417eef7110c9adf77 (diff)
see ChangeLog
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/arranger/arranger.cpp4
-rw-r--r--muse2/muse/liste/listedit.cpp2
-rw-r--r--muse2/muse/midiedit/drumedit.cpp4
-rw-r--r--muse2/muse/midiedit/pianoroll.cpp2
-rw-r--r--muse2/muse/midieditor.cpp2
-rw-r--r--muse2/muse/waveedit/waveedit.cpp4
-rw-r--r--muse2/muse/widgets/scrollscale.cpp28
-rw-r--r--muse2/muse/widgets/scrollscale.h1
-rw-r--r--muse2/muse/widgets/view.cpp1
9 files changed, 26 insertions, 22 deletions
diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp
index 8d786311..000faf91 100644
--- a/muse2/muse/arranger/arranger.cpp
+++ b/muse2/muse/arranger/arranger.cpp
@@ -447,7 +447,7 @@ Arranger::Arranger(ArrangerView* parent, const char* name)
//---------------------------------------------------
int offset = AL::sigmap.ticksMeasure(0);
- hscroll = new ScrollScale(-1000, -10, xscale, MusEGlobal::song->len(), Qt::Horizontal, editor, -offset);
+ hscroll = new ScrollScale(-2000, -5, xscale, MusEGlobal::song->len(), Qt::Horizontal, editor, -offset);
hscroll->setFocusPolicy(Qt::NoFocus);
ib->setFixedHeight(hscroll->sizeHint().height());
@@ -1255,7 +1255,7 @@ void Arranger::horizontalZoomIn()
{
int mag = hscroll->mag();
int zoomlvl = ScrollScale::getQuickZoomLevel(mag);
- if (zoomlvl < 23)
+ if (zoomlvl < MusEGui::ScrollScale::zoomLevels-1)
zoomlvl++;
int newmag = ScrollScale::convertQuickZoomLevelToMag(zoomlvl);
diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp
index 0f6fd137..2747de85 100644
--- a/muse2/muse/liste/listedit.cpp
+++ b/muse2/muse/liste/listedit.cpp
@@ -611,7 +611,7 @@ ListEdit::ListEdit(MusECore::PartList* pl)
initShortcuts();
- setWindowTitle("MusE: List Editor");
+ setWindowTitle(tr("MusE: List Editor"));
finalizeInit();
}
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 9c559fcd..358e9197 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -423,7 +423,7 @@ DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, un
QToolBar* cursorToolbar = addToolBar(tr("cursor tools"));
cursorToolbar->setObjectName("cursor");
- QLabel *stepStr = new QLabel("Cursor step:");
+ QLabel *stepStr = new QLabel(tr("Cursor step:"));
cursorToolbar->addWidget(stepStr);
stepLenWidget = new QComboBox();
stepLenWidget->setToolTip(tr("Set step size for cursor edit"));
@@ -1412,7 +1412,7 @@ void DrumEdit::keyPressEvent(QKeyEvent* event)
else if (key == shortcuts[SHRT_ZOOM_IN].key) {
int mag = hscroll->mag();
int zoomlvl = MusEGui::ScrollScale::getQuickZoomLevel(mag);
- if (zoomlvl < 23)
+ if (zoomlvl < MusEGui::ScrollScale::zoomLevels-1)
zoomlvl++;
int newmag = MusEGui::ScrollScale::convertQuickZoomLevelToMag(zoomlvl);
diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp
index 951fcbf2..d53867bd 100644
--- a/muse2/muse/midiedit/pianoroll.cpp
+++ b/muse2/muse/midiedit/pianoroll.cpp
@@ -1098,7 +1098,7 @@ void PianoRoll::keyPressEvent(QKeyEvent* event)
else if (key == shortcuts[SHRT_ZOOM_IN].key) {
int mag = hscroll->mag();
int zoomlvl = MusEGui::ScrollScale::getQuickZoomLevel(mag);
- if (zoomlvl < 23)
+ if (zoomlvl < MusEGui::ScrollScale::zoomLevels-1)
zoomlvl++;
int newmag = MusEGui::ScrollScale::convertQuickZoomLevelToMag(zoomlvl);
diff --git a/muse2/muse/midieditor.cpp b/muse2/muse/midieditor.cpp
index 4418813f..86a5044a 100644
--- a/muse2/muse/midieditor.cpp
+++ b/muse2/muse/midieditor.cpp
@@ -261,7 +261,7 @@ void MidiEditor::horizontalZoomIn()
{
int mag = hscroll->mag();
int zoomlvl = MusEGui::ScrollScale::getQuickZoomLevel(mag);
- if (zoomlvl < 23)
+ if (zoomlvl < MusEGui::ScrollScale::zoomLevels-1)
zoomlvl++;
int newmag = MusEGui::ScrollScale::convertQuickZoomLevelToMag(zoomlvl);
diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp
index dd7c4524..1504958a 100644
--- a/muse2/muse/waveedit/waveedit.cpp
+++ b/muse2/muse/waveedit/waveedit.cpp
@@ -221,7 +221,7 @@ WaveEdit::WaveEdit(MusECore::PartList* pl)
xscale = -8000;
}
- hscroll = new ScrollScale(1, -32768, xscale, 10000, Qt::Horizontal, mainw, 0, true, 10000.0);
+ hscroll = new ScrollScale(-32768, 1, xscale, 10000, Qt::Horizontal, mainw, 0, false, 10000.0);
view = new WaveView(this, mainw, xscale, yscale);
wview = view; // HACK!
@@ -510,7 +510,7 @@ void WaveEdit::horizontalZoomIn()
{
int mag = hscroll->mag();
int zoomlvl = ScrollScale::getQuickZoomLevel(mag);
- if (zoomlvl < 23)
+ if (zoomlvl < MusEGui::ScrollScale::zoomLevels-1)
zoomlvl++;
int newmag = ScrollScale::convertQuickZoomLevelToMag(zoomlvl);
diff --git a/muse2/muse/widgets/scrollscale.cpp b/muse2/muse/widgets/scrollscale.cpp
index 4f3f4771..eb03b2a4 100644
--- a/muse2/muse/widgets/scrollscale.cpp
+++ b/muse2/muse/widgets/scrollscale.cpp
@@ -39,14 +39,14 @@ namespace MusEGui {
//---------------------------------------------------------
// setScale
-// "val" - slider value in range 0-1024
+// "val" - slider value in range 0-convertQuickZoomLevelToMag(zoomLevels-1)
//---------------------------------------------------------
void ScrollScale::setScale ( int val )
{
int off = offset();
if ( invers )
- val = 1024 - val;
+ val = convertQuickZoomLevelToMag(zoomLevels-1) - val;
double min, max;
if ( scaleMin < 0 )
min = 1.0/ ( -scaleMin );
@@ -59,7 +59,7 @@ void ScrollScale::setScale ( int val )
max = double ( scaleMax );
double diff = max-min;
- double fkt = double ( val ) /1024.0;
+ double fkt = double ( val ) /double(convertQuickZoomLevelToMag(zoomLevels-1));
double v = ( pow ( logbase, fkt )-1 ) / ( logbase-1 );
double scale;
if ( invers )
@@ -90,7 +90,7 @@ void ScrollScale::setScale ( int val )
scale = scaleMin;
}
#endif
-
+// printf("scaleMin %d scaleMax %d val=%d emit scaleVal=%d\n", scaleMin, scaleMax, val, scaleVal);
emit scaleChanged ( scaleVal );
if ( !noScale )
setRange ( minVal, maxVal );
@@ -219,7 +219,7 @@ ScrollScale::ScrollScale ( int s1, int s2, int cs, int max_, Qt::Orientation o,
scaleMin = s1;
scaleMax = s2;
minVal = min_;
- maxVal = max_;
+ maxVal = max_;
up = 0;
down = 0;
logbase = bas;
@@ -247,8 +247,8 @@ ScrollScale::ScrollScale ( int s1, int s2, int cs, int max_, Qt::Orientation o,
int delta = 256;
for ( int i = 0; i < 8; ++i )
{
- int tryVal = invers ? 1025 - cur : cur;
- double fkt = double ( tryVal ) /1024.0;
+ int tryVal = invers ? convertQuickZoomLevelToMag(zoomLevels-1)+1 - cur : cur;
+ double fkt = double ( tryVal ) /double(convertQuickZoomLevelToMag(zoomLevels-1));
double v = ( pow ( logbase, fkt )-1 ) / ( logbase-1 );
double scale = invers ? ( max - v * diff ) : ( min + v * diff );
if ( scale == cmag ) // not very likely
@@ -256,7 +256,7 @@ ScrollScale::ScrollScale ( int s1, int s2, int cs, int max_, Qt::Orientation o,
//printf("iteration %d invers:%d soll %f(cur:%d) - ist %f\n", i, invers, scale, cur, cmag);
int dd = invers ? -delta : delta;
cur += ( scale < cmag ) ? dd : -dd;
- delta/=2;
+ delta/=2;
}
scale = new QSlider (o);
@@ -264,7 +264,7 @@ ScrollScale::ScrollScale ( int s1, int s2, int cs, int max_, Qt::Orientation o,
// It messes up tabbing, and really should have a shortcut instead.
scale->setFocusPolicy(Qt::NoFocus);
scale->setMinimum(0);
- scale->setMaximum(1024);
+ scale->setMaximum(convertQuickZoomLevelToMag(zoomLevels-1));
scale->setPageStep(1);
scale->setValue(cur);
@@ -504,7 +504,7 @@ int ScrollScale::getQuickZoomLevel(int mag)
if (mag == 0)
return 0;
- for (int i=0; i<24; i++) {
+ for (int i=0; i<zoomLevels-1; i++) {
int val1 = ScrollScale::convertQuickZoomLevelToMag(i);
int val2 = ScrollScale::convertQuickZoomLevelToMag(i + 1);
if (mag > val1 && mag <= val2)
@@ -521,9 +521,11 @@ int ScrollScale::getQuickZoomLevel(int mag)
*/
int ScrollScale::convertQuickZoomLevelToMag(int zoomlevel)
{
- int vals[] = { 0, 1, 15, 30, 46, 62, 80, 99, 119, 140, 163,
- 187, 214, 242, 274, 308, 346, 388, 436, 491, 555, 631,
- 726, 849, 1024 };
+ int vals[] = {
+ 0, 1, 15, 30, 46, 62, 80, 99, 119, 140,
+ 163, 187, 214, 242, 274, 308, 346, 388, 436, 491,
+ 555, 631, 726, 849, 1024, 1200, 1400, 1500, 1800,
+ 2100, 2500 };
return vals[zoomlevel];
}
diff --git a/muse2/muse/widgets/scrollscale.h b/muse2/muse/widgets/scrollscale.h
index 2c7ea0ef..a6f18886 100644
--- a/muse2/muse/widgets/scrollscale.h
+++ b/muse2/muse/widgets/scrollscale.h
@@ -97,6 +97,7 @@ class ScrollScale : public QWidget {
int pos2offset(int pos);
static int getQuickZoomLevel(int mag);
static int convertQuickZoomLevelToMag(int zoomlvl);
+ const static int zoomLevels = 31;
};
} // namespace MusEGui
diff --git a/muse2/muse/widgets/view.cpp b/muse2/muse/widgets/view.cpp
index fb53be46..60056848 100644
--- a/muse2/muse/widgets/view.cpp
+++ b/muse2/muse/widgets/view.cpp
@@ -513,6 +513,7 @@ void View::pdraw(QPainter& p, const QRect& r)
int y = r.y();
int w = r.width();
int h = r.height();
+ printf("xmag=%d\n",xmag);
if (xmag <= 0) {
// TODO These adjustments are required, otherwise gaps. Tried, unable to remove them for now. p4.0.30
x -= 1;