summaryrefslogtreecommitdiff
path: root/muse2/muse/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'muse2/muse/widgets')
-rw-r--r--muse2/muse/widgets/bigtime.cpp1
-rw-r--r--muse2/muse/widgets/canvas.cpp5
-rw-r--r--muse2/muse/widgets/canvas.h1
-rw-r--r--muse2/muse/widgets/citem.h5
-rw-r--r--muse2/muse/widgets/knob.cpp3
-rw-r--r--muse2/muse/widgets/knob.h4
-rw-r--r--muse2/muse/widgets/meter.cpp586
-rw-r--r--muse2/muse/widgets/meter.h13
-rw-r--r--muse2/muse/widgets/mtrackinfo.cpp70
-rw-r--r--muse2/muse/widgets/mtrackinfo.h6
-rw-r--r--muse2/muse/widgets/posedit.cpp13
-rw-r--r--muse2/muse/widgets/posedit.h4
-rw-r--r--muse2/muse/widgets/scrollscale.cpp6
-rw-r--r--muse2/muse/widgets/sigedit.cpp15
-rw-r--r--muse2/muse/widgets/sigedit.h4
-rw-r--r--muse2/muse/widgets/siglabel.cpp6
-rw-r--r--muse2/muse/widgets/slider.cpp2
-rw-r--r--muse2/muse/widgets/slider.h4
-rw-r--r--muse2/muse/widgets/swidget.cpp3
-rw-r--r--muse2/muse/widgets/tools.cpp2
-rw-r--r--muse2/muse/widgets/utils.cpp5
-rw-r--r--muse2/muse/widgets/verticalmeter.cpp3
-rw-r--r--muse2/muse/widgets/verticalmeter.h4
-rw-r--r--muse2/muse/widgets/view.cpp3
-rw-r--r--muse2/muse/widgets/visibletracks.cpp2
25 files changed, 357 insertions, 413 deletions
diff --git a/muse2/muse/widgets/bigtime.cpp b/muse2/muse/widgets/bigtime.cpp
index 572710e2..f4162041 100644
--- a/muse2/muse/widgets/bigtime.cpp
+++ b/muse2/muse/widgets/bigtime.cpp
@@ -334,6 +334,7 @@ void BigTime::setPos(int idx, unsigned v, bool)
void BigTime::resizeEvent(QResizeEvent *ev)
{
+ QWidget::resizeEvent(ev);
dwin->resize(ev->size());
QFont f = dwin->font();
QFontMetrics fm(f);
diff --git a/muse2/muse/widgets/canvas.cpp b/muse2/muse/widgets/canvas.cpp
index c498bfd1..811561e3 100644
--- a/muse2/muse/widgets/canvas.cpp
+++ b/muse2/muse/widgets/canvas.cpp
@@ -82,6 +82,11 @@ Canvas::Canvas(QWidget* parent, int sx, int sy, const char* name)
connect(song, SIGNAL(posChanged(int, unsigned, bool)), this, SLOT(setPos(int, unsigned, bool)));
}
+Canvas::~Canvas()
+{
+ items.clearDelete();
+}
+
//---------------------------------------------------------
// setPos
// set one of three markers
diff --git a/muse2/muse/widgets/canvas.h b/muse2/muse/widgets/canvas.h
index 553ef407..954b865d 100644
--- a/muse2/muse/widgets/canvas.h
+++ b/muse2/muse/widgets/canvas.h
@@ -190,6 +190,7 @@ class Canvas : public View {
void horizontalZoomOut();
public:
Canvas(QWidget* parent, int sx, int sy, const char* name = 0);
+ virtual ~Canvas();
bool isSingleSelection();
int selectionSize();
Tool tool() const { return _tool; }
diff --git a/muse2/muse/widgets/citem.h b/muse2/muse/widgets/citem.h
index bdeca213..e2ddd8a0 100644
--- a/muse2/muse/widgets/citem.h
+++ b/muse2/muse/widgets/citem.h
@@ -101,6 +101,11 @@ class CItemList: public std::multimap<int, CItem*, std::less<int> > {
public:
void add(CItem*);
CItem* find(const QPoint& pos) const;
+ void clearDelete() {
+ for (iCItem i = begin(); i != end(); ++i)
+ delete i->second;
+ clear();
+ }
};
} // namespace MusEWidget
diff --git a/muse2/muse/widgets/knob.cpp b/muse2/muse/widgets/knob.cpp
index 9bc63b33..ac035065 100644
--- a/muse2/muse/widgets/knob.cpp
+++ b/muse2/muse/widgets/knob.cpp
@@ -327,8 +327,9 @@ void Knob::rangeChange()
// resizeEvent
//---------------------------------------------------------
-void Knob::resizeEvent(QResizeEvent *)
+void Knob::resizeEvent(QResizeEvent* ev)
{
+ MusEWidget::SliderBase::resizeEvent(ev);
int width, width_2;
const QRect& r = rect();
diff --git a/muse2/muse/widgets/knob.h b/muse2/muse/widgets/knob.h
index a629f158..257ff0c7 100644
--- a/muse2/muse/widgets/knob.h
+++ b/muse2/muse/widgets/knob.h
@@ -78,8 +78,8 @@ class Knob : public SliderBase, public ScaleIf
void drawKnob(QPainter *p, const QRect &r);
void drawMarker(QPainter *p, double arc, const QColor &c);
- void paintEvent(QPaintEvent *);
- void resizeEvent(QResizeEvent *e);
+ virtual void paintEvent(QPaintEvent *);
+ virtual void resizeEvent(QResizeEvent *e);
double getValue(const QPoint &p);
void getScrollMode( QPoint &p, const Qt::MouseButton &button, int &scrollMode, int &direction );
void scaleChange() { repaint(); }
diff --git a/muse2/muse/widgets/meter.cpp b/muse2/muse/widgets/meter.cpp
index 50d265b5..590e7f65 100644
--- a/muse2/muse/widgets/meter.cpp
+++ b/muse2/muse/widgets/meter.cpp
@@ -35,8 +35,8 @@
#include "gconfig.h"
#include "fastlog.h"
-// Uncomment to use the new meters. Warning: They are currently very time-consuming and unoptimized.
-#define _USE_NEW_METERS 1
+// Just an experiment. Some undesirable effects, see below...
+//#define _USE_CLIPPER 1
namespace MusEWidget {
@@ -50,18 +50,17 @@ Meter::Meter(QWidget* parent, MeterType type)
setBackgroundRole(QPalette::NoRole);
setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_StaticContents);
- // This is absolutely required for speed! Otherwise painfully slow because we get
- // full rect paint events even on small scrolls! See help on QPainter::scroll().
- // Commented out for now. Orcan 20110911
- #ifndef _USE_NEW_METERS
+ // This is absolutely required for speed! Otherwise painfully slow because of full background
+ // filling, even when requesting small udpdates! Background is drawn by us. (Just small corners.)
setAttribute(Qt::WA_OpaquePaintEvent);
- #endif
//setFrameStyle(QFrame::Raised | QFrame::StyledPanel);
mtype = type;
overflow = false;
cur_yv = -1; // Flag as -1 to initialize in paint.
last_yv = 0;
+ cur_ymax = 0;
+ last_ymax = 0;
val = 0.0;
maxVal = 0.0;
minScale = mtype == DBMeter ? MusEConfig::config.minMeter : 0.0; // min value in dB or int
@@ -154,46 +153,51 @@ void Meter::setVal(double v, double max, bool ovl)
}
}
+ double range = maxScale - minScale;
+ int fw = frameWidth();
+ int w = width() - 2*fw;
+ int h = height() - 2*fw;
+ QRect udRect;
+ bool udPeak = false;
+
if(maxVal != max)
{
maxVal = max;
+ if(mtype == DBMeter)
+ cur_ymax = maxVal == 0 ? fw : int(((maxScale - (fast_log10(maxVal) * 20.0)) * h)/range);
+ else
+ cur_ymax = maxVal == 0 ? fw : int(((maxScale - maxVal) * h)/range);
+ if(cur_ymax > h) cur_ymax = h;
+ // Not using regions. Just lump them together.
+ udRect = QRect(fw, last_ymax, w, 1) | QRect(fw, cur_ymax, w, 1);
+ //printf("Meter::setVal peak cur_ymax:%d last_ymax:%d\n", cur_ymax, last_ymax);
+ last_ymax = cur_ymax;
ud = true;
+ udPeak = true;
}
if(ud)
{
- #ifdef _USE_NEW_METERS
- update();
-
- #else
- double range = maxScale - minScale;
- int fw = frameWidth();
- int w = width() - 2*fw;
- int h = height() - 2*fw;
-
if(mtype == DBMeter)
cur_yv = val == 0 ? h : int(((maxScale - (fast_log10(val) * 20.0)) * h)/range);
else
cur_yv = val == 0 ? h : int(((maxScale - val) * h)/range);
-
if(cur_yv > h) cur_yv = h;
-
+
+ //printf("Meter::setVal cur_yv:%d last_yv:%d\n", cur_yv, last_yv);
int y1, y2;
- if(last_yv < cur_yv)
- {
- y1 = last_yv;
- y2 = cur_yv;
- }
- else
- {
- y1 = cur_yv;
- y2 = last_yv;
- }
+ if(last_yv < cur_yv) { y1 = last_yv; y2 = cur_yv; } else { y1 = cur_yv; y2 = last_yv; }
last_yv = cur_yv;
- update(fw, y1, w, y2);
- #endif
+
+ if(udPeak)
+ update(udRect | QRect(fw, y1, w, y2 - y1 + 1));
+ //repaint(udRect | QRect(fw, y1, w, y2 - y1 + 1));
+ else
+ update(QRect(fw, y1, w, y2 - y1 + 1));
+ //repaint(QRect(fw, y1, w, y2 - y1 + 1));
}
}
+
//---------------------------------------------------------
// resetPeaks
// reset peak and overflow indicator
@@ -203,6 +207,7 @@ void Meter::resetPeaks()
{
maxVal = val;
overflow = val > 0.0;
+ cur_yv = -1; // Force re-initialization.
update();
}
@@ -224,69 +229,91 @@ void Meter::setRange(double min, double max)
void Meter::paintEvent(QPaintEvent* ev)
{
- // TODO: Could make better use of event rectangle, for speed.
-
QPainter p(this);
- #ifdef _USE_NEW_METERS
p.setRenderHint(QPainter::Antialiasing);
- #endif
-
+
double range = maxScale - minScale;
-
int fw = frameWidth();
int w = width() - 2*fw;
int h = height() - 2*fw;
-
const QRect& rect = ev->rect();
//printf("Meter::paintEvent rx:%d ry:%d rw:%d rh:%d w:%d h:%d\n", rect.x(), rect.y(), rect.width(), rect.height(), w, h);
- //p.setClipRect(rect); // Nope, didn't help (I think it's already clipped. So check why we bother to do it in View).
+
+ QPainterPath drawingPath, updatePath, finalPath, cornerPath;
+ //bool updFull = false;
// Initialize. Can't do in ctor, must be done after layouts have been done. Most reliable to do it here.
- #ifndef _USE_NEW_METERS
if(cur_yv == -1)
- #endif
{
if(mtype == DBMeter)
+ {
cur_yv = val == 0 ? h : int(((maxScale - (fast_log10(val) * 20.0)) * h)/range);
+ cur_ymax = maxVal == 0 ? fw : int(((maxScale - (fast_log10(maxVal) * 20.0)) * h)/range);
+ }
else
+ {
cur_yv = val == 0 ? h : int(((maxScale - val) * h)/range);
+ cur_ymax = maxVal == 0 ? fw : int(((maxScale - maxVal) * h)/range);
+ }
if(cur_yv > h) cur_yv = h;
- //last_yv = cur_yv;
+ last_yv = cur_yv;
+ if(cur_ymax > h) cur_ymax = h;
+ last_ymax = cur_ymax;
+ //updFull = true;
+ updatePath.addRect(fw, fw, w, h); // Update the whole thing
}
+ else
+ updatePath.addRect(rect.x(), rect.y(), rect.width(), rect.height()); // Update only the requested rectangle
+
+ drawingPath.addRoundedRect(fw, fw, w, h, xrad, yrad); // The actual desired shape of the meter
+ finalPath = drawingPath & updatePath;
+
+ // Draw corners as normal background colour.
+ cornerPath = updatePath - finalPath; // Elegantly simple. Path subtraction! Wee...
+ if(!cornerPath.isEmpty())
+ p.fillPath(cornerPath, palette().window());
+
+#ifdef _USE_CLIPPER
+ p.setClipPath(finalPath); // Meh, nice but not so good. Clips at edge so antialising has no effect! Can it be done ?
+#endif
// Draw the red, green, and yellow sections.
- drawVU(p, rect, cur_yv);
+ drawVU(p, rect, finalPath, cur_yv);
// Draw the peak white line.
- int ymax;
- if(mtype == DBMeter)
- ymax = maxVal == 0 ? 0 : int(((maxScale - (fast_log10(maxVal) * 20.0)) * h)/range);
- else
- ymax = maxVal == 0 ? 0 : int(((maxScale - maxVal) * h)/range);
- if(ymax >= rect.y() && ymax < rect.height())
+ //if(updFull || (cur_ymax >= rect.y() && cur_ymax < rect.height()))
{
- p.setPen(peak_color);
- p.drawLine(0, ymax, w, ymax);
+ p.setRenderHint(QPainter::Antialiasing, false); // No antialiasing. Makes the line fuzzy, double height, or not visible at all.
+
+ //p.setPen(peak_color);
+ //p.drawLine(fw, cur_ymax, w, cur_ymax); // Undesirable. Draws outside the top rounded corners.
+ //
+ //QPainterPath path; path.moveTo(fw, cur_ymax); path.lineTo(w, cur_ymax); // ? Didn't work. No line at all.
+ //p.drawPath(path & finalPath);
+ QPainterPath path; path.addRect(fw, cur_ymax, w, 1); path &= finalPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(peak_color));
}
- #ifdef _USE_NEW_METERS
// Draw the transparent layer on top of everything to give a 3d look
- QPainterPath round_path = MusEUtil::roundedPath(0, 0, w, h,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight | MusEUtil::LowerLeft | MusEUtil::LowerRight ) );
- maskGrad.setStart(QPointF(0, 0));
- maskGrad.setFinalStop(QPointF(w, 0));
- p.fillPath(round_path, QBrush(maskGrad));
- #endif
+ p.setRenderHint(QPainter::Antialiasing);
+ maskGrad.setStart(QPointF(fw, fw));
+ maskGrad.setFinalStop(QPointF(w, fw));
+#ifdef _USE_CLIPPER
+ p.fillRect(rect, QBrush(maskGrad));
+#else
+ //QPainterPath path; path.addRect(fw, fw, w);
+ //p.fillPath(finalPath & path, QBrush(maskGrad));
+ p.fillPath(finalPath, QBrush(maskGrad));
+#endif
}
-
//---------------------------------------------------------
// drawVU
//---------------------------------------------------------
-void Meter::drawVU(QPainter& p, const QRect& rect, int yv)
+void Meter::drawVU(QPainter& p, const QRect& rect, const QPainterPath& drawPath, int yv)
{
int fw = frameWidth();
int w = width() - 2*fw;
@@ -295,370 +322,219 @@ void Meter::drawVU(QPainter& p, const QRect& rect, int yv)
// Test OK. We are passed small rectangles on small value changes.
//printf("Meter::drawVU rx:%d ry:%d rw:%d rh:%d w:%d h:%d\n", rect.x(), rect.y(), rect.width(), rect.height(), w, h);
- #ifdef _USE_NEW_METERS
-
- if(mtype == DBMeter)
- {
- double range = maxScale - minScale;
- int y1 = int((maxScale - redScale) * h / range);
- int y2 = int((maxScale - yellowScale) * h / range);
-
- darkGradGreen.setStart(QPointF(0, y2));
- darkGradGreen.setFinalStop(QPointF(0, h));
- darkGradYellow.setStart(QPointF(0, y1));
- darkGradYellow.setFinalStop(QPointF(0, y2));
- darkGradRed.setStart(QPointF(0, 0));
- darkGradRed.setFinalStop(QPointF(0, y1));
-
- lightGradGreen.setStart(QPointF(0, y2));
- lightGradGreen.setFinalStop(QPointF(0, h));
- lightGradYellow.setStart(QPointF(0, y1));
- lightGradYellow.setFinalStop(QPointF(0, y2));
- lightGradRed.setStart(QPointF(0, 0));
- lightGradRed.setFinalStop(QPointF(0, y1));
-
- QPainterPath p_top = MusEUtil::roundedPath(0, 0, w, y1,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) );
-
- QPainterPath p_bottom = MusEUtil::roundedPath(0, y2, w, h-y2,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) );
-
- if(yv < y1)
- {
-
- QPainterPath p_dark_red = MusEUtil::roundedPath(0, 0, w, yv,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) );
-
- p_top = p_top.subtracted(p_dark_red);
-
- // Red section:
- p.fillPath(p_dark_red, QBrush(darkGradRed)); // dark red
- p.fillPath(p_top, QBrush(lightGradRed)); // light red
-
- // Yellow section:
- p.fillRect(0, y1, w, y2-y1, QBrush(lightGradYellow)); // light yellow
-
- // Green section:
- p.fillPath(p_bottom, QBrush(lightGradGreen)); // light green
- }
- else
- if(yv < y2)
- {
- // Red section:
- p.fillPath(p_top, QBrush(darkGradRed)); // dark red
-
- // Yellow section:
- p.fillRect(0, y1, w, yv-y1, QBrush(darkGradYellow)); // dark yellow
- p.fillRect(0, yv, w, y2-yv, QBrush(lightGradYellow)); // light yellow
-
- // Green section:
- p.fillPath(p_bottom, QBrush(lightGradGreen)); // light green
- }
- else
- //if(yv <= y3)
- {
- QPainterPath p_light_green = MusEUtil::roundedPath(0, yv, w, h-yv,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) );
- p_bottom = p_bottom.subtracted(p_light_green);
-
- // Red section:
- p.fillPath(p_top, QBrush(darkGradRed)); // dark red
-
- // Yellow section:
- p.fillRect(0, y1, w, y2-y1, QBrush(darkGradYellow)); // dark yellow
-
- // Green section:
- p.fillPath(p_bottom, QBrush(darkGradGreen)); // dark green
- p.fillPath(p_light_green, QBrush(lightGradGreen)); // light green
- }
-
- p.fillRect(0,y1, w, 1, separator_color);
- p.fillRect(0,y2, w, 1, separator_color);
-
- }
- else
- {
- darkGradGreen.setStart(QPointF(0, 0));
- darkGradGreen.setFinalStop(QPointF(0, h));
-
- lightGradGreen.setStart(QPointF(0, 0));
- lightGradGreen.setFinalStop(QPointF(0, h));
-
- // We need to draw the meter in two parts. The cutoff for upper rectangle can be
- // anywhere between yrad and h-yrad. Without loss of generality we pick the lower limit.
- int cut = yrad;
-
- QPainterPath p_top = MusEUtil::roundedPath(0, 0, w, cut,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) );
-
- QPainterPath p_bottom = MusEUtil::roundedPath(0, cut, w, h-cut,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) );
-
- if(yv < cut)
- {
-
- QPainterPath p_dark = MusEUtil::roundedPath(0, 0, w, yv,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) );
-
- p_top = p_top.subtracted(p_dark);
-
- // top section:
- p.fillPath(p_dark, QBrush(darkGradGreen)); // dark green
- p.fillPath(p_top, QBrush(lightGradGreen)); // light green
-
- // bottom section:
- p.fillPath(p_bottom, QBrush(lightGradGreen)); // light green
- }
- else
- {
- QPainterPath p_light = MusEUtil::roundedPath(0, yv, w, h-yv,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) );
- p_bottom = p_bottom.subtracted(p_light);
-
- // top section:
- p.fillPath(p_top, QBrush(darkGradGreen)); // dark green
-
- // bottom section:
- p.fillPath(p_bottom, QBrush(darkGradGreen)); // dark green
- p.fillPath(p_light, QBrush(lightGradGreen)); // light green
- }
-
- }
-
- /* WIP...
- // TODO: Instead of drawing the whole area, make this respect the requested drawing rectangle, for speed...
- // Done. But not correct yet. And could possibly simplify the whole drawing some more...
QRect pr(0, 0, w, 0);
- QPainterPath rectp;
- rectp.addRect(rect.x(), rect.y(), rect.width(), rect.height());
- if(mtype == DBMeter)
+ if(mtype == DBMeter) // Meter type is dB...
{
double range = maxScale - minScale;
int y1 = int((maxScale - redScale) * h / range);
int y2 = int((maxScale - yellowScale) * h / range);
- darkGradGreen.setStart(QPointF(0, y2));
- darkGradGreen.setFinalStop(QPointF(0, h));
- darkGradYellow.setStart(QPointF(0, y1));
- darkGradYellow.setFinalStop(QPointF(0, y2));
- darkGradRed.setStart(QPointF(0, 0));
- darkGradRed.setFinalStop(QPointF(0, y1));
-
- lightGradGreen.setStart(QPointF(0, y2));
- lightGradGreen.setFinalStop(QPointF(0, h));
- lightGradYellow.setStart(QPointF(0, y1));
- lightGradYellow.setFinalStop(QPointF(0, y2));
- lightGradRed.setStart(QPointF(0, 0));
- lightGradRed.setFinalStop(QPointF(0, y1));
-
- QPainterPath p_top = MusEUtil::roundedPath(0, 0, w, y1,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) );
-
- QPainterPath p_bottom = MusEUtil::roundedPath(0, y2, w, h-y2,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) );
-
+ darkGradGreen.setStart(QPointF(fw, y2));
+ darkGradGreen.setFinalStop(QPointF(fw, h));
+ darkGradYellow.setStart(QPointF(fw, y1));
+ darkGradYellow.setFinalStop(QPointF(fw, y2));
+ darkGradRed.setStart(QPointF(fw, fw));
+ darkGradRed.setFinalStop(QPointF(fw, y1));
+
+ lightGradGreen.setStart(QPointF(fw, y2));
+ lightGradGreen.setFinalStop(QPointF(fw, h));
+ lightGradYellow.setStart(QPointF(fw, y1));
+ lightGradYellow.setFinalStop(QPointF(fw, y2));
+ lightGradRed.setStart(QPointF(fw, fw));
+ lightGradRed.setFinalStop(QPointF(fw, y1));
+
+#ifdef _USE_CLIPPER
if(yv < y1)
{
-
- QPainterPath p_dark_red = MusEUtil::roundedPath(0, 0, w, yv,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) );
-
- p_top = p_top.subtracted(p_dark_red);
-
// Red section:
- p.fillPath(p_dark_red & rectp, QBrush(darkGradRed)); // dark red
- p.fillPath(p_top & rectp, QBrush(lightGradRed)); // light red
-
+ pr.setTop(fw); pr.setHeight(yv);
+ p.fillRect(pr, QBrush(darkGradRed)); // dark red
+ pr.setTop(yv); pr.setHeight(y1-yv);
+ p.fillRect(pr & rect, QBrush(lightGradRed)); // light red
+
// Yellow section:
pr.setTop(y1); pr.setHeight(y2-y1);
- p.fillRect(pr & rect, QBrush(lightGradYellow)); // light yellow
-
+ p.fillRect(pr & rect, QBrush(lightGradYellow)); // light yellow
+
// Green section:
- p.fillPath(p_bottom & rectp, QBrush(lightGradGreen)); // light green
+ pr.setTop(y2); pr.setHeight(h-y2);
+ p.fillRect(pr & rect, QBrush(lightGradGreen)); // light green
}
else
if(yv < y2)
{
// Red section:
- p.fillPath(p_top & rectp, QBrush(darkGradRed)); // dark red
-
+ pr.setTop(fw); pr.setHeight(y1);
+ p.fillRect(pr & rect, QBrush(darkGradRed)); // dark red
+
// Yellow section:
pr.setTop(y1); pr.setHeight(yv-y1);
- p.fillRect(pr & rect, QBrush(darkGradYellow)); // dark yellow
+ p.fillRect(pr & rect, QBrush(darkGradYellow)); // dark yellow
pr.setTop(yv); pr.setHeight(y2-yv);
- p.fillRect(pr & rect, QBrush(lightGradYellow)); // light yellow
-
+ p.fillRect(pr & rect, QBrush(lightGradYellow)); // light yellow
+
// Green section:
- p.fillPath(p_bottom & rectp, QBrush(lightGradGreen)); // light green
+ pr.setTop(y2); pr.setHeight(h-y2);
+ p.fillRect(pr & rect, QBrush(lightGradGreen)); // light green
}
else
//if(yv <= y3)
{
- QPainterPath p_light_green = MusEUtil::roundedPath(0, yv, w, h-yv,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) );
- p_bottom = p_bottom.subtracted(p_light_green);
-
// Red section:
- p.fillPath(p_top & rectp, QBrush(darkGradRed)); // dark red
-
+ pr.setTop(fw); pr.setHeight(y1);
+ p.fillRect(pr & rect, QBrush(darkGradRed)); // dark red
+
// Yellow section:
pr.setTop(y1); pr.setHeight(y2-y1);
- p.fillRect(pr & rect, QBrush(darkGradYellow)); // dark yellow
-
+ p.fillRect(pr & rect, QBrush(darkGradYellow)); // dark yellow
+
// Green section:
- p.fillPath(p_bottom & rectp, QBrush(darkGradGreen)); // dark green
- p.fillPath(p_light_green & rectp, QBrush(lightGradGreen)); // light green
+ pr.setTop(y2); pr.setHeight(yv-y2);
+ p.fillRect(pr & rect, QBrush(darkGradGreen)); // dark green
+ pr.setTop(yv); pr.setHeight(h-yv);
+ p.fillRect(pr & rect, QBrush(lightGradGreen)); // light green
}
-
- pr.setTop(y1); pr.setHeight(1);
- p.fillRect(pr & rect, separator_color);
- pr.setTop(y2); //pr.setHeight(1);
- p.fillRect(pr & rect, separator_color);
-
}
- else
+ else // Meter type is linear...
{
- darkGradGreen.setStart(QPointF(0, 0));
- darkGradGreen.setFinalStop(QPointF(0, h));
-
- lightGradGreen.setStart(QPointF(0, 0));
- lightGradGreen.setFinalStop(QPointF(0, h));
-
- // We need to draw the meter in two parts. The cutoff for upper rectangle can be
- // anywhere between yrad and h-yrad. Without loss of generality we pick the lower limit.
- int cut = yrad;
-
- QPainterPath p_top = MusEUtil::roundedPath(0, 0, w, cut,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) );
-
- QPainterPath p_bottom = MusEUtil::roundedPath(0, cut, w, h-cut,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) );
-
- if(yv < cut)
- {
-
- QPainterPath p_dark = MusEUtil::roundedPath(0, 0, w, yv,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::UpperLeft | MusEUtil::UpperRight ) );
-
- p_top = p_top.subtracted(p_dark);
-
- // top section:
- p.fillPath(p_dark & rectp, QBrush(darkGradGreen)); // dark green
- p.fillPath(p_top & rectp, QBrush(lightGradGreen)); // light green
-
- // bottom section:
- p.fillPath(p_bottom & rectp, QBrush(lightGradGreen)); // light green
- }
- else
- {
- QPainterPath p_light = MusEUtil::roundedPath(0, yv, w, h-yv,
- xrad, yrad,
- (MusEUtil::Corner) (MusEUtil::LowerLeft | MusEUtil::LowerRight ) );
- p_bottom = p_bottom.subtracted(p_light);
-
- // top section:
- p.fillPath(p_top & rectp, QBrush(darkGradGreen)); // dark green
+ pr.setTop(fw); pr.setHeight(yv);
+ p.fillRect(pr & rect, QBrush(darkGradGreen)); // dark green
+ pr.setTop(yv); pr.setHeight(h-yv);
+ p.fillRect(pr & rect, QBrush(lightGradGreen)); // light green
+ }
- // bottom section:
- p.fillPath(p_bottom & rectp, QBrush(darkGradGreen)); // dark green
- p.fillPath(p_light & rectp, QBrush(lightGradGreen)); // light green
- }
+#else // NOT _USE_CLIPPER
- }
- */
-
- #else
-
- QRect pr(0, 0, w, 0);
- if(mtype == DBMeter)
- {
- double range = maxScale - minScale;
- int y1 = int((maxScale - redScale) * h / range);
- int y2 = int((maxScale - yellowScale) * h / range);
-
if(yv < y1)
{
// Red section:
- pr.setTop(0); pr.setHeight(yv);
- p.fillRect(pr & rect, QBrush(0x8e0000)); // dark red
- pr.setTop(yv); pr.setHeight(y1-yv);
- p.fillRect(pr & rect, QBrush(0xff0000)); // light red
+ {
+ QPainterPath path; path.addRect(fw, fw, w, yv); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(darkGradRed)); // dark red
+ }
+ {
+ QPainterPath path; path.addRect(fw, yv, w, y1-yv); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(lightGradRed)); // light red
+ }
// Yellow section:
- pr.setTop(y1); pr.setHeight(y2-y1);
- p.fillRect(pr & rect, QBrush(0xffff00)); // light yellow
+ {
+ QPainterPath path; path.addRect(fw, y1, w, y2-y1); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(lightGradYellow)); // light yellow
+ }
// Green section:
- pr.setTop(y2); pr.setHeight(h-y2);
- p.fillRect(pr & rect, QBrush(0x00ff00)); // light green
+ {
+ QPainterPath path; path.addRect(fw, y2, w, h-y2); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(lightGradGreen)); // light green
+ }
}
else
if(yv < y2)
{
// Red section:
- pr.setTop(0); pr.setHeight(y1);
- p.fillRect(pr & rect, QBrush(0x8e0000)); // dark red
+ {
+ QPainterPath path; path.addRect(fw, fw, w, y1); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(darkGradRed)); // dark red
+ }
// Yellow section:
- pr.setTop(y1); pr.setHeight(yv-y1);
- p.fillRect(pr & rect, QBrush(0x8e8e00)); // dark yellow
- pr.setTop(yv); pr.setHeight(y2-yv);
- p.fillRect(pr & rect, QBrush(0xffff00)); // light yellow
+ {
+ QPainterPath path; path.addRect(fw, y1, w, yv-y1); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(darkGradYellow)); // dark yellow
+ }
+ {
+ QPainterPath path; path.addRect(fw, yv, w, y2-yv); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(lightGradYellow)); // light yellow
+ }
// Green section:
- pr.setTop(y2); pr.setHeight(h-y2);
- p.fillRect(pr & rect, QBrush(0x00ff00)); // light green
+ {
+ QPainterPath path; path.addRect(fw, y2, w, h-y2); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(lightGradGreen)); // light green
+ }
}
else
//if(yv <= y3)
{
// Red section:
- pr.setTop(0); pr.setHeight(y1);
- p.fillRect(pr & rect, QBrush(0x8e0000)); // dark red
+ {
+ QPainterPath path; path.addRect(fw, fw, w, y1); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(darkGradRed)); // dark red
+ }
// Yellow section:
- pr.setTop(y1); pr.setHeight(y2-y1);
- p.fillRect(pr & rect, QBrush(0x8e8e00)); // dark yellow
+ {
+ QPainterPath path; path.addRect(fw, y1, w, y2-y1); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(darkGradYellow)); // dark yellow
+ }
// Green section:
- pr.setTop(y2); pr.setHeight(yv-y2);
- p.fillRect(pr & rect, QBrush(0x007000)); // dark green
- pr.setTop(yv); pr.setHeight(h-yv);
- p.fillRect(pr & rect, QBrush(0x00ff00)); // light green
+ {
+ QPainterPath path; path.addRect(fw, y2, w, yv-y2); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(darkGradGreen)); // dark green
+ }
+ {
+ QPainterPath path; path.addRect(fw, yv, w, h-yv); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(lightGradGreen)); // light green
+ }
}
+
+ // Separators:
+ {
+ QRect r(0, y1, w, 1); r &= rect;
+ if(!r.isNull())
+ p.fillRect(r, separator_color);
+ }
+ {
+ QRect r(0, y2, w, 1); r &= rect;
+ if(!r.isNull())
+ p.fillRect(r, separator_color);
+ }
}
- else
+ else // Meter type is linear...
{
- pr.setTop(0); pr.setHeight(yv);
- p.fillRect(pr & rect, QBrush(0x007000)); // dark green
- pr.setTop(yv); pr.setHeight(h-yv);
- p.fillRect(pr & rect, QBrush(0x00ff00)); // light green
- }
-
- #endif
+ darkGradGreen.setStart(QPointF(fw, fw));
+ darkGradGreen.setFinalStop(QPointF(fw, h));
+
+ lightGradGreen.setStart(QPointF(fw, fw));
+ lightGradGreen.setFinalStop(QPointF(fw, h));
+
+ {
+ QPainterPath path; path.addRect(fw, fw, w, yv); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(darkGradGreen)); // dark green
+ }
+ {
+ QPainterPath path; path.addRect(fw, yv, w, h-yv); path &= drawPath;
+ if(!path.isEmpty())
+ p.fillPath(path, QBrush(lightGradGreen)); // light green
+ }
+ }
+
+#endif // NOT _USE_CLIPPER
+
}
//---------------------------------------------------------
// resizeEvent
//---------------------------------------------------------
-void Meter::resizeEvent(QResizeEvent* /*ev*/)
+void Meter::resizeEvent(QResizeEvent* ev)
{
+ QFrame::resizeEvent(ev);
cur_yv = -1; // Force re-initialization.
}
diff --git a/muse2/muse/widgets/meter.h b/muse2/muse/widgets/meter.h
index ba816319..1de3841f 100644
--- a/muse2/muse/widgets/meter.h
+++ b/muse2/muse/widgets/meter.h
@@ -32,6 +32,7 @@
class QResizeEvent;
class QMouseEvent;
class QPainter;
+class QPainterPath;
namespace MusEWidget {
@@ -75,6 +76,10 @@ class Meter : public QFrame {
QColor peak_color;
int xrad, yrad;
+ virtual void resizeEvent(QResizeEvent*);
+ virtual void paintEvent(QPaintEvent*);
+ virtual void mousePressEvent(QMouseEvent*);
+
private:
MeterType mtype;
bool overflow;
@@ -82,13 +87,9 @@ class Meter : public QFrame {
double maxVal;
double minScale, maxScale;
int yellowScale, redScale;
- int cur_yv, last_yv;
+ int cur_yv, last_yv, cur_ymax, last_ymax;
- void drawVU(QPainter& p, const QRect&, int);
-
- void paintEvent(QPaintEvent*);
- void resizeEvent(QResizeEvent*);
- void mousePressEvent(QMouseEvent*);
+ void drawVU(QPainter& p, const QRect&, const QPainterPath&, int);
public slots:
void resetPeaks();
diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp
index e4c4e217..56429879 100644
--- a/muse2/muse/widgets/mtrackinfo.cpp
+++ b/muse2/muse/widgets/mtrackinfo.cpp
@@ -2,6 +2,7 @@
// MusE
// Linux Music Editor
// (C) Copyright 2010 Werner Schweer and others (ws@seh.de)
+// (C) Copyright 2011 Tim E. Real (terminator356 on sourceforge)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -21,6 +22,9 @@
#include <QTimer>
#include <QMessageBox>
+#include <QLinearGradient>
+#include <QPalette>
+#include <QColor>
#include <math.h>
#include <string.h>
@@ -60,8 +64,10 @@ void MidiTrackInfo::setTrack(Track* t)
if(!t->isMidiTrack())
return;
selected = t;
+
+ trackNameLabel->setObjectName(selected->cname());
- QPalette pal;
+ /*QPalette pal;
if(selected->type() == Track::DRUM) {
pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.drumTrackLabelBg);
iOutputChannel->setEnabled(false);
@@ -69,7 +75,8 @@ void MidiTrackInfo::setTrack(Track* t)
pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.midiTrackLabelBg);
iOutputChannel->setEnabled(true);
}
- trackNameLabel->setPalette(pal);
+ trackNameLabel->setPalette(pal); */
+ //setLabelText();
updateTrackInfo(-1);
}
@@ -97,10 +104,7 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent
//iChanDetectLabel->setPixmap(*darkgreendotIcon);
iChanDetectLabel->setPixmap(*darkRedLedIcon);
- QIcon recEchoIconSet;
- recEchoIconSet.addPixmap(*midiThruOnIcon, QIcon::Normal, QIcon::On);
- recEchoIconSet.addPixmap(*midiThruOffIcon, QIcon::Normal, QIcon::Off);
- recEchoButton->setIcon(recEchoIconSet);
+ recEchoButton->setIcon((selected && ((MidiTrack*)selected)->recEcho()) ? QIcon(*midiThruOnIcon) : QIcon(*midiThruOffIcon));
recEchoButton->setIconSize(midiThruOnIcon->size());
// MusE-2: AlignCenter and WordBreak are set in the ui(3) file, but not supported by QLabel. Turn them on here.
@@ -114,14 +118,26 @@ MidiTrackInfo::MidiTrackInfo(QWidget* parent, Track* sel_track) : QWidget(parent
if(selected)
{
trackNameLabel->setObjectName(selected->cname());
- QPalette pal;
+
+ /*QPalette pal;
+ QColor c;
//pal.setColor(trackNameLabel->backgroundRole(), QColor(0, 160, 255)); // Med blue
if(selected->type() == Track::DRUM)
- pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.drumTrackLabelBg);
+ c = MusEConfig::config.drumTrackLabelBg;
else
- pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.midiTrackLabelBg);
- trackNameLabel->setPalette(pal);
- }
+ c = MusEConfig::config.midiTrackLabelBg;
+
+ QLinearGradient gradient(trackNameLabel->geometry().topLeft(), trackNameLabel->geometry().bottomLeft());
+ //gradient.setColorAt(0, c.darker());
+ //gradient.setColorAt(0, c);
+ //gradient.setColorAt(1, c.darker());
+ gradient.setColorAt(0, c.lighter());
+ gradient.setColorAt(1, c);
+ //palette.setBrush(QPalette::Button, gradient);
+ //palette.setBrush(QPalette::Window, gradient);
+ pal.setBrush(trackNameLabel->backgroundRole(), gradient);
+ trackNameLabel->setPalette(pal); */
+ }
//else
//{
// pal.setColor(trackNameLabel->backgroundRole(), MusEConfig::config.midiTrackLabelBg);
@@ -543,6 +559,28 @@ void MidiTrackInfo::setLabelText()
trackNameLabel->setText(track->name());
else
trackNameLabel->setText(QString());
+
+ if(track)
+ {
+ QPalette pal;
+ QColor c;
+ //pal.setColor(trackNameLabel->backgroundRole(), QColor(0, 160, 255)); // Med blue
+ if(track->type() == Track::DRUM)
+ c = MusEConfig::config.drumTrackLabelBg;
+ else
+ c = MusEConfig::config.midiTrackLabelBg;
+
+ QLinearGradient gradient(trackNameLabel->geometry().topLeft(), trackNameLabel->geometry().bottomLeft());
+ //gradient.setColorAt(0, c.darker());
+ //gradient.setColorAt(0, c);
+ //gradient.setColorAt(1, c.darker());
+ gradient.setColorAt(0, c.lighter());
+ gradient.setColorAt(1, c);
+ //palette.setBrush(QPalette::Button, gradient);
+ //palette.setBrush(QPalette::Window, gradient);
+ pal.setBrush(trackNameLabel->backgroundRole(), gradient);
+ trackNameLabel->setPalette(pal);
+ }
}
//---------------------------------------------------------
@@ -1340,6 +1378,8 @@ void MidiTrackInfo::updateTrackInfo(int flags)
recEchoButton->setChecked(track->recEcho());
recEchoButton->blockSignals(false);
}
+ recEchoButton->setIcon(track->recEcho() ? QIcon(*midiThruOnIcon) : QIcon(*midiThruOffIcon));
+ //recEchoButton->setIconSize(midiThruOnIcon->size());
}
int outChannel = track->outChannel();
@@ -1566,4 +1606,12 @@ void MidiTrackInfo::recordClicked()
}
}
+void MidiTrackInfo::resizeEvent(QResizeEvent* ev)
+{
+ //printf("MidiTrackInfo::resizeEvent\n");
+ QWidget::resizeEvent(ev);
+ setLabelText();
+ setLabelFont();
+}
+
} // namespace MusEWidget
diff --git a/muse2/muse/widgets/mtrackinfo.h b/muse2/muse/widgets/mtrackinfo.h
index 42be1f58..42bcb2bf 100644
--- a/muse2/muse/widgets/mtrackinfo.h
+++ b/muse2/muse/widgets/mtrackinfo.h
@@ -2,6 +2,7 @@
// MusE
// Linux Music Editor
// (C) Copyright 2010 Werner Schweer and others (ws@seh.de)
+// (C) Copyright 2011 Tim E. Real (terminator356 on sourceforge)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -40,7 +41,10 @@ class MidiTrackInfo : public QWidget, public Ui::MidiTrackInfoBase
int program, pan, volume;
int heartBeatCounter;
- private slots:
+ protected:
+ virtual void resizeEvent(QResizeEvent*);
+
+ private slots:
void iOutputChannelChanged(int);
void iOutputPortChanged(int);
void iProgHBankChanged();
diff --git a/muse2/muse/widgets/posedit.cpp b/muse2/muse/widgets/posedit.cpp
index 0e031c38..772d434a 100644
--- a/muse2/muse/widgets/posedit.cpp
+++ b/muse2/muse/widgets/posedit.cpp
@@ -77,11 +77,11 @@ class PosEditor : public QLineEdit
protected:
void init();
- bool event(QEvent *e);
- void resizeEvent(QResizeEvent*);
- void paintEvent(QPaintEvent*);
- void mousePressEvent(QMouseEvent *e);
- void keyPressEvent(QKeyEvent * event );
+ virtual bool event(QEvent *e);
+ virtual void resizeEvent(QResizeEvent*);
+ virtual void paintEvent(QPaintEvent*);
+ virtual void mousePressEvent(QMouseEvent *e);
+ virtual void keyPressEvent(QKeyEvent * event );
void applyFocusSelection() {}
public:
@@ -817,8 +817,9 @@ void PosEdit::removeLastNumber(int secNo)
// resizeEvent
//---------------------------------------------------------
-void PosEdit::resizeEvent(QResizeEvent *)
+void PosEdit::resizeEvent(QResizeEvent* ev)
{
+ QWidget::resizeEvent(ev);
controls->resize(width(), height());
}
diff --git a/muse2/muse/widgets/posedit.h b/muse2/muse/widgets/posedit.h
index 3224a3a6..5f763f51 100644
--- a/muse2/muse/widgets/posedit.h
+++ b/muse2/muse/widgets/posedit.h
@@ -74,9 +74,9 @@ class PosEdit : public QWidget
void returnPressed();
protected:
- bool event(QEvent *e );
+ virtual bool event(QEvent *e );
void timerEvent(QTimerEvent* e);
- void resizeEvent(QResizeEvent*);
+ virtual void resizeEvent(QResizeEvent*);
QString sectionFormattedText(int sec);
void addNumber(int sec, int num);
void removeLastNumber(int sec);
diff --git a/muse2/muse/widgets/scrollscale.cpp b/muse2/muse/widgets/scrollscale.cpp
index 21ed10b6..572a1d86 100644
--- a/muse2/muse/widgets/scrollscale.cpp
+++ b/muse2/muse/widgets/scrollscale.cpp
@@ -197,9 +197,10 @@ void ScrollScale::setPosNoLimit ( unsigned pos )
// resizeEvent
//---------------------------------------------------------
-void ScrollScale::resizeEvent ( QResizeEvent* )
+void ScrollScale::resizeEvent ( QResizeEvent* ev)
{
- setScale ( scale->value() );
+ QWidget::resizeEvent(ev);
+ setScale ( scale->value() );
}
//---------------------------------------------------------
@@ -223,6 +224,7 @@ ScrollScale::ScrollScale ( int s1, int s2, int cs, int max_, Qt::Orientation o,
down = 0;
logbase = bas;
invers = inv;
+ scaleVal = 0;
double min, max;
if ( scaleMin < 0 )
diff --git a/muse2/muse/widgets/sigedit.cpp b/muse2/muse/widgets/sigedit.cpp
index c2c5a842..a952cfef 100644
--- a/muse2/muse/widgets/sigedit.cpp
+++ b/muse2/muse/widgets/sigedit.cpp
@@ -103,11 +103,11 @@ class SigEditor : public QLineEdit
protected:
void init();
- bool event(QEvent *e);
- void resizeEvent(QResizeEvent*);
- void paintEvent(QPaintEvent*);
- void mousePressEvent(QMouseEvent *e);
- void keyPressEvent(QKeyEvent * event );
+ virtual bool event(QEvent *e);
+ virtual void resizeEvent(QResizeEvent*);
+ virtual void paintEvent(QPaintEvent*);
+ virtual void mousePressEvent(QMouseEvent *e);
+ virtual void keyPressEvent(QKeyEvent * event );
void applyFocusSelection() {}
public:
@@ -699,9 +699,10 @@ void SigEdit::removeLastNumber(int secNo)
// resizeEvent
//---------------------------------------------------------
-void SigEdit::resizeEvent(QResizeEvent *)
+void SigEdit::resizeEvent(QResizeEvent* ev)
{
- controls->resize(width(), height());
+ QWidget::resizeEvent(ev);
+ controls->resize(width(), height());
}
//---------------------------------------------------------
diff --git a/muse2/muse/widgets/sigedit.h b/muse2/muse/widgets/sigedit.h
index 3b1ca635..05684db1 100644
--- a/muse2/muse/widgets/sigedit.h
+++ b/muse2/muse/widgets/sigedit.h
@@ -72,9 +72,9 @@ class SigEdit : public QWidget
void returnPressed();
protected:
- bool event(QEvent *e );
+ virtual bool event(QEvent *e );
void timerEvent(QTimerEvent* e);
- void resizeEvent(QResizeEvent*);
+ virtual void resizeEvent(QResizeEvent*);
QString sectionFormattedText(int sec);
void addNumber(int sec, int num);
void removeLastNumber(int sec);
diff --git a/muse2/muse/widgets/siglabel.cpp b/muse2/muse/widgets/siglabel.cpp
index 9916bd0a..f571c2f1 100644
--- a/muse2/muse/widgets/siglabel.cpp
+++ b/muse2/muse/widgets/siglabel.cpp
@@ -43,12 +43,12 @@ namespace MusEWidget {
// edit Signature Values (4/4)
//---------------------------------------------------------
-SigLabel::SigLabel(int z, int n, QWidget* parent) : QLabel(parent)
+SigLabel::SigLabel(int zz, int nn, QWidget* parent) : QLabel(parent)
{
- z = n = 0;
+ z = n = 0;
setFocusPolicy(Qt::NoFocus);
setAlignment(Qt::AlignCenter);
- setValue(z, n);
+ setValue(zz, nn);
}
SigLabel::SigLabel(const AL::TimeSignature& sig, QWidget* parent) : QLabel(parent)
diff --git a/muse2/muse/widgets/slider.cpp b/muse2/muse/widgets/slider.cpp
index 593b3df6..863933d2 100644
--- a/muse2/muse/widgets/slider.cpp
+++ b/muse2/muse/widgets/slider.cpp
@@ -580,7 +580,7 @@ void Slider::paintEvent(QPaintEvent* /*ev*/)
void Slider::resizeEvent(QResizeEvent *e)
{
-
+ MusEWidget::SliderBase::resizeEvent(e);
d_resized = TRUE;
QSize s = e->size();
/* Scale is not supported
diff --git a/muse2/muse/widgets/slider.h b/muse2/muse/widgets/slider.h
index 5a2bff71..b1281da0 100644
--- a/muse2/muse/widgets/slider.h
+++ b/muse2/muse/widgets/slider.h
@@ -79,8 +79,8 @@ class Slider : public SliderBase, public ScaleIf
virtual void drawSlider (QPainter *p, const QRect &r);
double getValue(const QPoint &p);
void getScrollMode( QPoint &p, const Qt::MouseButton &button, int &scrollMode, int &direction);
- void resizeEvent(QResizeEvent *e);
- void paintEvent (QPaintEvent *e);
+ virtual void resizeEvent(QResizeEvent *e);
+ virtual void paintEvent (QPaintEvent *e);
void valueChange();
void rangeChange();
void scaleChange();
diff --git a/muse2/muse/widgets/swidget.cpp b/muse2/muse/widgets/swidget.cpp
index f8461977..51796781 100644
--- a/muse2/muse/widgets/swidget.cpp
+++ b/muse2/muse/widgets/swidget.cpp
@@ -32,7 +32,8 @@ namespace MusEWidget {
void SWidget::resizeEvent(QResizeEvent* ev)
{
- emit heightChanged(ev->size().height());
+ QWidget::resizeEvent(ev);
+ emit heightChanged(ev->size().height());
}
} // namespace MusEWidget
diff --git a/muse2/muse/widgets/tools.cpp b/muse2/muse/widgets/tools.cpp
index ccd0f89b..113de6c4 100644
--- a/muse2/muse/widgets/tools.cpp
+++ b/muse2/muse/widgets/tools.cpp
@@ -129,7 +129,7 @@ void EditToolBar::toolChanged(QAction* action)
EditToolBar::~EditToolBar()
{
- delete actions;
+ delete [] actions;
}
//---------------------------------------------------------
diff --git a/muse2/muse/widgets/utils.cpp b/muse2/muse/widgets/utils.cpp
index c900f3b6..41c5a180 100644
--- a/muse2/muse/widgets/utils.cpp
+++ b/muse2/muse/widgets/utils.cpp
@@ -167,7 +167,6 @@ QString bitmap2String(int bm)
//---------------------------------------------------------
// u32bitmap2String
//---------------------------------------------------------
-// Added by Tim. p3.3.8
QString u32bitmap2String(unsigned int bm)
{
@@ -274,7 +273,6 @@ int string2bitmap(const QString& str)
//---------------------------------------------------------
// string2u32bitmap
//---------------------------------------------------------
-// Added by Tim. p3.3.8
unsigned int string2u32bitmap(const QString& str)
{
@@ -343,7 +341,6 @@ unsigned int string2u32bitmap(const QString& str)
// ignoreWidth: Set if dealing with a vertically constrained widget - one which is free to resize horizontally.
// ignoreHeight: Set if dealing with a horizontally constrained widget - one which is free to resize vertically.
//---------------------------------------------------------
-// Added by Tim. p3.3.8
bool autoAdjustFontSize(QFrame* w, const QString& s, bool ignoreWidth, bool ignoreHeight, int max, int min)
{
@@ -373,12 +370,10 @@ bool autoAdjustFontSize(QFrame* w, const QString& s, bool ignoreWidth, bool igno
if((ignoreWidth || (r.width() <= (cr.width() - extra))) && (ignoreHeight || (r.height() <= cr.height())))
break;
}
- // Added by Tim. p3.3.9
//printf("autoAdjustFontSize: ptsz:%d widget:%s before setFont x:%d y:%d w:%d h:%d\n", fnt.pointSize(), w->name(), w->x(), w->y(), w->width(), w->height());
// Here we will always have a font ranging from min to max point size.
w->setFont(fnt);
- // Added by Tim. p3.3.9
//printf("autoAdjustFontSize: ptsz:%d widget:%s x:%d y:%d w:%d h:%d frame w:%d rw:%d rh:%d\n", fnt.pointSize(), w->name(), w->x(), w->y(), w->width(), w->height(), w->frameWidth(), cr.width(), cr.height());
// Force minimum height. Use the expected height for the highest given point size.
diff --git a/muse2/muse/widgets/verticalmeter.cpp b/muse2/muse/widgets/verticalmeter.cpp
index 74b4b695..4553b156 100644
--- a/muse2/muse/widgets/verticalmeter.cpp
+++ b/muse2/muse/widgets/verticalmeter.cpp
@@ -333,8 +333,9 @@ void VerticalMeter::drawVU(QPainter& p, int w, int h, int xv)
// resizeEvent
//---------------------------------------------------------
-void VerticalMeter::resizeEvent(QResizeEvent* /*ev*/)
+void VerticalMeter::resizeEvent(QResizeEvent* ev)
{
+ MusEWidget::Meter::resizeEvent(ev);
}
} // namespace MusEWidget
diff --git a/muse2/muse/widgets/verticalmeter.h b/muse2/muse/widgets/verticalmeter.h
index d6bee245..024ecc10 100644
--- a/muse2/muse/widgets/verticalmeter.h
+++ b/muse2/muse/widgets/verticalmeter.h
@@ -47,8 +47,8 @@ class VerticalMeter : public Meter {
void drawVU(QPainter& p, int, int, int);
- void paintEvent(QPaintEvent*);
- void resizeEvent(QResizeEvent*);
+ virtual void paintEvent(QPaintEvent*);
+ virtual void resizeEvent(QResizeEvent*);
public slots:
void resetPeaks();
diff --git a/muse2/muse/widgets/view.cpp b/muse2/muse/widgets/view.cpp
index 9be66ed5..8a9d82b4 100644
--- a/muse2/muse/widgets/view.cpp
+++ b/muse2/muse/widgets/view.cpp
@@ -290,8 +290,9 @@ void View::setYPos(int y)
// resizeEvent
//---------------------------------------------------------
-void View::resizeEvent(QResizeEvent* /*ev*/)
+void View::resizeEvent(QResizeEvent* ev)
{
+ QWidget::resizeEvent(ev);
#ifdef VIEW_USE_DOUBLE_BUFFERING
//pm.resize(ev->size());
//printf("View::resizeEvent width:%d height:%d\n",
diff --git a/muse2/muse/widgets/visibletracks.cpp b/muse2/muse/widgets/visibletracks.cpp
index 1b549975..7e56bb36 100644
--- a/muse2/muse/widgets/visibletracks.cpp
+++ b/muse2/muse/widgets/visibletracks.cpp
@@ -139,7 +139,7 @@ void VisibleTracks::visibilityChanged(QAction* action)
VisibleTracks::~VisibleTracks()
{
- delete actions;
+ delete [] actions;
}
} // namespace MusEWidget