[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src core/ViewPort.cpp sheetcanvas/Audi...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src core/ViewPort.cpp sheetcanvas/Audi... |
Date: |
Mon, 19 Jan 2009 21:07:19 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 09/01/19 21:07:19
Modified files:
src/core : ViewPort.cpp
src/sheetcanvas: AudioClipView.cpp AudioClipView.h
ClipsViewPort.cpp CurveView.cpp
PluginChainView.cpp SheetWidget.cpp
TimeLineViewPort.cpp TimeLineViewPort.h
Log message:
* Fix painting problems that show up when using Qt >= 4.4
* Fixed audioclip outline painting, where sometimes the right edge
wasn't painted properly
* AudioClip title area is painted on a pixmap now, to avoid painting
text during clip move, it's using the elidedText function now to reduce space
usage when a file with very large name is displayed.
* some cleanups
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ViewPort.cpp?cvsroot=traverso&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/AudioClipView.cpp?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/AudioClipView.h?cvsroot=traverso&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/ClipsViewPort.cpp?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/CurveView.cpp?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/PluginChainView.cpp?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/SheetWidget.cpp?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/TimeLineViewPort.cpp?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/sheetcanvas/TimeLineViewPort.h?cvsroot=traverso&r1=1.1&r2=1.2
Patches:
Index: core/ViewPort.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/ViewPort.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- core/ViewPort.cpp 2 Aug 2008 15:55:23 -0000 1.36
+++ core/ViewPort.cpp 19 Jan 2009 21:07:19 -0000 1.37
@@ -94,13 +94,9 @@
setFrameStyle(QFrame::NoFrame);
setAlignment(Qt::AlignLeft | Qt::AlignTop);
-#if QT_VERSION >= 0x040300
-#if !defined (Q_WS_WIN)
setOptimizationFlag(DontAdjustForAntialiasing);
-#endif
setOptimizationFlag(DontSavePainterState);
setOptimizationFlag(DontClipPainter);
-#endif
m_holdcursor = new HoldCursor(this);
scene->addItem(m_holdcursor);
Index: sheetcanvas/AudioClipView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/AudioClipView.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- sheetcanvas/AudioClipView.cpp 29 Dec 2008 20:49:01 -0000 1.10
+++ sheetcanvas/AudioClipView.cpp 19 Jan 2009 21:07:19 -0000 1.11
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2005-2007 Remon Sijrier
+Copyright (C) 2005-2009 Remon Sijrier
This file is part of Traverso
@@ -68,11 +68,6 @@
m_sv = sv;
m_sheet = m_clip->get_sheet();
- m_clipInfo = new QGraphicsSimpleTextItem(this);
- m_clipInfo->setFlag(QGraphicsItem::ItemIgnoresTransformations);
- m_clipInfo->setPos(1, 0);
- m_clipInfo->setCursor(themer()->get_cursor("AudioClip"));
-
load_theme_data();
create_brushes();
create_clipinfo_string();
@@ -110,7 +105,6 @@
}
// setFlags(ItemIsSelectable | ItemIsMovable);
- setFlag(QGraphicsItem::ItemClipsChildrenToShape);
setAcceptsHoverEvents(true);
setCursor(themer()->get_cursor("AudioClip"));
}
@@ -209,7 +203,12 @@
// Draw the contour
painter->setPen(themer()->get_color("AudioClip:contour"));
- QRectF rect(0.5, 0.5, m_boundingRect.width() - 1, m_height - 1);
+ int adjust = 0;
+ float round = (m_boundingRect.width() - int(m_boundingRect.width()));
+ if (round < 0.5) {
+ adjust = 1;
+ }
+ QRect rect(0, 0, m_boundingRect.width() - adjust, m_height - 1);
painter->drawRect(rect);
// Paint a pixmap if the clip is locked
@@ -629,6 +628,9 @@
{
// fill info area bg
p->fillRect(xstart, 1, pixelcount, m_infoAreaHeight,
themer()->get_color("AudioClip:clipinfobackground:inactive"));
+ if (m_height >= m_mimimumheightforinfoarea) {
+ p->drawPixmap(7, 1, m_clipInfo);
+ }
}
void AudioClipView::create_brushes()
@@ -786,14 +788,25 @@
{
PENTER;
QString sclipGain = "Gain: "+
coefficient_to_dbstring(m_clip->get_gain());
- m_clipinfoString = m_clip->get_name() + " " + sclipGain + " " +
QString::number(m_clip->get_rate()) + " Hz";
- m_clipInfo->setText(m_clipinfoString);
+
+ QFont font = themer()->get_font("AudioClip:fontscale:title");
+ QFontMetrics fm(font);
+
+ m_clipinfoString = fm.elidedText(m_clip->get_name(), Qt::ElideMiddle,
150)
+ + " " + sclipGain + " " +
QString::number(m_clip->get_rate()) + " Hz";
+
+ int clipInfoWidth = fm.boundingRect(m_clipinfoString).width();
+
+ m_clipInfo = QPixmap(clipInfoWidth, m_infoAreaHeight);
+ m_clipInfo.fill(Qt::transparent);
+
+ QPainter painter(&m_clipInfo);
+ painter.setFont(font);
+ painter.drawText(m_clipInfo.rect(), m_clipinfoString);
}
void AudioClipView::update_progress_info( int progress )
{
-// if (progress > m_progress) {
-// }
m_progress = progress;
update(10, 0, 150, m_height);
}
@@ -810,9 +823,6 @@
FadeView* view = new FadeView(m_sv, this, fade);
m_fadeViews.append(view);
connect(view, SIGNAL(fadeModified()), m_sv,
SLOT(stop_follow_play_head()));
-#if QT_VERSION < 0x040300
- scene()->addItem(view);
-#endif
}
void AudioClipView::remove_fadeview( FadeCurve * fade )
@@ -837,11 +847,6 @@
m_boundingRect = QRectF(0, 0, (m_clip->get_length() /
m_sv->timeref_scalefactor), m_height);
update_start_pos();
ViewItem::calculate_bounding_rect();
-
- foreach(PainterPathCache* cache, m_pathCache) {
- cache->xstart = -1;
- cache->length = -1;
- }
}
@@ -854,11 +859,6 @@
{
m_height = height;
create_brushes();
- if (m_height < m_mimimumheightforinfoarea) {
- m_clipInfo->hide();
- } else {
- m_clipInfo->show();
- }
}
int AudioClipView::get_childview_y_offset() const
@@ -869,7 +869,7 @@
void AudioClipView::update_start_pos()
{
// printf("AudioClipView::update_start_pos()\n");
- setPos(m_clip->get_track_start_location() / m_sv->timeref_scalefactor,
m_tv->get_childview_y_offset());
+ setPos(qRound(m_clip->get_track_start_location() /
m_sv->timeref_scalefactor), m_tv->get_childview_y_offset());
}
Command * AudioClipView::fade_range()
@@ -941,7 +941,6 @@
minINFLineColor = themer()->get_color("AudioClip:channelseperator");
m_paintWithOutline = config().get_property("Themer",
"paintwavewithoutline", true).toBool();
m_drawDbGrid = config().get_property("Themer", "drawdbgrid",
false).toBool();
- m_clipInfo->setFont(themer()->get_font("AudioClip:fontscale:title"));
calculate_bounding_rect();
}
@@ -952,7 +951,6 @@
if (ie().is_holding()) {
return;
}
-
update(m_boundingRect);
}
Index: sheetcanvas/AudioClipView.h
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/AudioClipView.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- sheetcanvas/AudioClipView.h 29 Dec 2008 20:49:01 -0000 1.5
+++ sheetcanvas/AudioClipView.h 19 Jan 2009 21:07:19 -0000 1.6
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2005-2007 Remon Sijrier
+Copyright (C) 2005-2009 Remon Sijrier
This file is part of Traverso
@@ -27,6 +27,7 @@
#include <QList>
#include <QTimer>
#include <QPolygonF>
+#include <QPixmap>
class AudioClip;
class Sheet;
@@ -36,7 +37,6 @@
class TrackView;
class FadeView;
class Peak;
-class QGraphicsSimpleTextItem;
class AudioClipView : public ViewItem
@@ -76,18 +76,7 @@
Sheet* m_sheet;
CurveView* curveView;
QPolygonF m_polygon;
- QGraphicsSimpleTextItem* m_clipInfo;
-
-
- struct PainterPathCache {
- QPainterPath pathtop;
- QPainterPath pathbottom;
- int xstart;
- int length;
- };
-
- QList<PainterPathCache* > m_pathCache;
-
+ QPixmap m_clipInfo;
QTimer m_recordingTimer;
float m_progress;
Index: sheetcanvas/ClipsViewPort.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/ClipsViewPort.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- sheetcanvas/ClipsViewPort.cpp 29 Jan 2008 10:23:11 -0000 1.2
+++ sheetcanvas/ClipsViewPort.cpp 19 Jan 2009 21:07:19 -0000 1.3
@@ -44,7 +44,6 @@
ClipsViewPort::ClipsViewPort(QGraphicsScene* scene, SheetWidget* sw)
: ViewPort(scene, sw)
{
-
m_sw = sw;
viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
Index: sheetcanvas/CurveView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/CurveView.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- sheetcanvas/CurveView.cpp 21 Jan 2008 16:17:28 -0000 1.1
+++ sheetcanvas/CurveView.cpp 19 Jan 2009 21:07:19 -0000 1.2
@@ -346,9 +346,6 @@
void CurveView::add_curvenode_view(CurveNode* node)
{
CurveNodeView* nodeview = new CurveNodeView(m_sv, this, node,
m_guicurve);
-#if QT_VERSION < 0x040300
- m_sv->scene()->addItem(nodeview);
-#endif
m_nodeViews.append(nodeview);
AddRemove* cmd = (AddRemove*) m_guicurve->add_node(nodeview, false);
Index: sheetcanvas/PluginChainView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/PluginChainView.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- sheetcanvas/PluginChainView.cpp 21 Jan 2008 16:17:29 -0000 1.1
+++ sheetcanvas/PluginChainView.cpp 19 Jan 2009 21:07:19 -0000 1.2
@@ -54,9 +54,6 @@
m_sv = sv;
calculate_bounding_rect();
-#if QT_VERSION < 0x040300
- parent->scene()->addItem(this);
-#endif
foreach(Plugin* plugin, chain->get_plugin_list()) {
add_new_pluginview(plugin);
@@ -79,9 +76,6 @@
void PluginChainView::add_new_pluginview( Plugin * plugin )
{
PluginView* view = new PluginView(this, m_pluginchain, plugin,
m_pluginViews.size());
-#if QT_VERSION < 0x040300
- scene()->addItem(view);
-#endif
int x = 6;
foreach(PluginView* view, m_pluginViews) {
Index: sheetcanvas/SheetWidget.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/SheetWidget.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- sheetcanvas/SheetWidget.cpp 21 Jan 2008 16:17:30 -0000 1.1
+++ sheetcanvas/SheetWidget.cpp 19 Jan 2009 21:07:19 -0000 1.2
@@ -110,9 +110,6 @@
scene->addItem(this);
m_gainview = new SheetPanelGain(this, m_sheet);
m_gainview->setPos(10, 16);
-#if QT_VERSION < 0x040300
- scene->addItem(m_gainview);
-#endif
m_boundingRect = QRectF(0, 0, 200, TIMELINE_HEIGHT);
}
@@ -247,14 +244,7 @@
SheetWidget::~ SheetWidget()
{
- if (!m_sheet) {
- return;
- }
- delete m_trackPanel;
- delete m_clipsViewPort;
- delete m_timeLine;
- delete m_sheetPanelVP;
- delete m_scene;
+PENTERDES;
}
Index: sheetcanvas/TimeLineViewPort.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/TimeLineViewPort.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- sheetcanvas/TimeLineViewPort.cpp 21 Jan 2008 16:17:30 -0000 1.1
+++ sheetcanvas/TimeLineViewPort.cpp 19 Jan 2009 21:07:19 -0000 1.2
@@ -40,6 +40,11 @@
m_timeLineView = 0;
}
+TimeLineViewPort::~ TimeLineViewPort()
+{
+PENTERDES;
+}
+
void TimeLineViewPort::wheelEvent ( QWheelEvent * e )
{
@@ -78,4 +83,3 @@
//eof
-
Index: sheetcanvas/TimeLineViewPort.h
===================================================================
RCS file: /sources/traverso/traverso/src/sheetcanvas/TimeLineViewPort.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- sheetcanvas/TimeLineViewPort.h 21 Jan 2008 16:17:30 -0000 1.1
+++ sheetcanvas/TimeLineViewPort.h 19 Jan 2009 21:07:19 -0000 1.2
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- $Id: TimeLineViewPort.h,v 1.1 2008/01/21 16:17:30 r_sijrier Exp $
+ $Id: TimeLineViewPort.h,v 1.2 2009/01/19 21:07:19 r_sijrier Exp $
*/
#ifndef TIME_LINE_VIEW_PORT_H
@@ -35,7 +35,7 @@
{
public:
TimeLineViewPort(QGraphicsScene* scene, SheetWidget* sw);
- ~TimeLineViewPort() {};
+ ~TimeLineViewPort();
void set_sheetview(SheetView* view);
void scale_factor_changed();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src core/ViewPort.cpp sheetcanvas/Audi...,
Remon Sijrier <=