* viewer :
- No more flickering. Was due to a one pixel moving of a two pixel periodic pattern, which obviously result in a complete pattern inversion. Now shift by two pixels, hoping there is no "3 pixels periodic" patterns... - As a side effect, it introduce a "multiplicator effect" on mouse movement, but it could be useful (avoid big displacement of the mouse).
This commit is contained in:
parent
9d48b67296
commit
8d46981a42
|
@ -2,11 +2,12 @@ include(${QT_USE_FILE})
|
||||||
|
|
||||||
include_directories(${HURRICANE_SOURCE_DIR}/src/hurricane)
|
include_directories(${HURRICANE_SOURCE_DIR}/src/hurricane)
|
||||||
|
|
||||||
set(includes ScreenUtilities.h DisplayStyle.h ScreenLayer.h LayersList.h CellWidget.h CellViewer.h)
|
set(includes ScreenUtilities.h DisplayStyle.h)
|
||||||
|
set(mocincludes ScreenLayer.h LayersList.h CellWidget.h CellViewer.h)
|
||||||
set(exports CellViewer.h)
|
set(exports CellViewer.h)
|
||||||
set(cpps ScreenUtilities.cpp DisplayStyle.cpp ScreenLayer.cpp LayersList.cpp CellWidget.cpp CellViewer.cpp)
|
set(cpps ScreenUtilities.cpp DisplayStyle.cpp ScreenLayer.cpp LayersList.cpp CellWidget.cpp CellViewer.cpp)
|
||||||
|
|
||||||
QT4_WRAP_CPP(MOC_SRCS ${includes})
|
QT4_WRAP_CPP(MOC_SRCS ${mocincludes})
|
||||||
QT4_ADD_RESOURCES(RCC_SRCS CellViewer.qrc)
|
QT4_ADD_RESOURCES(RCC_SRCS CellViewer.qrc)
|
||||||
|
|
||||||
add_library(hurricaneviewer SHARED ${cpps} ${MOC_SRCS} ${RCC_SRCS})
|
add_library(hurricaneviewer SHARED ${cpps} ${MOC_SRCS} ${RCC_SRCS})
|
||||||
|
|
|
@ -41,6 +41,7 @@ CellViewer::CellViewer ( Cell* cell ) : QMainWindow()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CellViewer::createActions ()
|
void CellViewer::createActions ()
|
||||||
{
|
{
|
||||||
if ( _openAction ) return;
|
if ( _openAction ) return;
|
||||||
|
|
|
@ -50,14 +50,16 @@ CellWidget::CellWidget ( Cell* cell ) : QWidget()
|
||||||
, _mouseGo(false)
|
, _mouseGo(false)
|
||||||
, _openCell(true)
|
, _openCell(true)
|
||||||
, _showBoundaries(true)
|
, _showBoundaries(true)
|
||||||
|
, _redrawRectCount(0)
|
||||||
{
|
{
|
||||||
|
//setBackgroundRole ( QPalette::Dark );
|
||||||
|
//setAutoFillBackground ( false );
|
||||||
setAttribute ( Qt::WA_OpaquePaintEvent );
|
setAttribute ( Qt::WA_OpaquePaintEvent );
|
||||||
setAttribute ( Qt::WA_NoSystemBackground );
|
//setAttribute ( Qt::WA_NoSystemBackground );
|
||||||
setAttribute ( Qt::WA_PaintOnScreen );
|
//setAttribute ( Qt::WA_PaintOnScreen );
|
||||||
setAttribute ( Qt::WA_StaticContents );
|
//setAttribute ( Qt::WA_StaticContents );
|
||||||
setSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
setSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||||
setFocusPolicy ( Qt::StrongFocus );
|
setFocusPolicy ( Qt::StrongFocus );
|
||||||
//setAutoFillBackground ( false );
|
|
||||||
|
|
||||||
// Build ScreenLayer vector here from BasicLayers.
|
// Build ScreenLayer vector here from BasicLayers.
|
||||||
DataBase* database = getDataBase();
|
DataBase* database = getDataBase();
|
||||||
|
@ -118,6 +120,8 @@ void CellWidget::redraw ( QRect redrawArea )
|
||||||
{
|
{
|
||||||
//cerr << "CellWidget::redraw ()" << endl;
|
//cerr << "CellWidget::redraw ()" << endl;
|
||||||
|
|
||||||
|
_redrawRectCount = 0;
|
||||||
|
|
||||||
pushCursor ( Qt::BusyCursor );
|
pushCursor ( Qt::BusyCursor );
|
||||||
|
|
||||||
_painter.begin ( &_drawingBuffer );
|
_painter.begin ( &_drawingBuffer );
|
||||||
|
@ -153,7 +157,8 @@ void CellWidget::redraw ( QRect redrawArea )
|
||||||
update ();
|
update ();
|
||||||
popCursor ();
|
popCursor ();
|
||||||
|
|
||||||
// cerr << "*******************************************************" << endl;
|
cerr << "Redrawed rectangles: " << _redrawRectCount << endl;
|
||||||
|
//cerr << "*******************************************************" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,6 +324,7 @@ void CellWidget::drawContact ( const Contact* contact
|
||||||
|
|
||||||
void CellWidget::drawBox ( const Box& box )
|
void CellWidget::drawBox ( const Box& box )
|
||||||
{
|
{
|
||||||
|
_redrawRectCount++;
|
||||||
_painter.drawRect ( getScreenRect(box) );
|
_painter.drawRect ( getScreenRect(box) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +338,7 @@ void CellWidget::drawLine ( const Point& p1, const Point& p2 )
|
||||||
void CellWidget::goLeft ( int dx )
|
void CellWidget::goLeft ( int dx )
|
||||||
{
|
{
|
||||||
if ( !dx ) dx = geometry().size().width() / 4;
|
if ( !dx ) dx = geometry().size().width() / 4;
|
||||||
if ( _offsetVA.rx() - dx >= 0 ) {
|
if ( _offsetVA.rx() - dx >= 0 ) {
|
||||||
_offsetVA.rx() -= dx;
|
_offsetVA.rx() -= dx;
|
||||||
update ();
|
update ();
|
||||||
} else {
|
} else {
|
||||||
|
@ -347,7 +353,7 @@ void CellWidget::goRight ( int dx )
|
||||||
|
|
||||||
//cerr << "CellWidget::goRight() - dx: " << dx << " (offset: " << _offsetVA.rx() << ")" << endl;
|
//cerr << "CellWidget::goRight() - dx: " << dx << " (offset: " << _offsetVA.rx() << ")" << endl;
|
||||||
|
|
||||||
if ( _offsetVA.rx() + dx < 2*_stripWidth ) {
|
if ( _offsetVA.rx() + dx < 2*_stripWidth ) {
|
||||||
_offsetVA.rx() += dx;
|
_offsetVA.rx() += dx;
|
||||||
update ();
|
update ();
|
||||||
} else {
|
} else {
|
||||||
|
@ -359,7 +365,7 @@ void CellWidget::goRight ( int dx )
|
||||||
void CellWidget::goUp ( int dy )
|
void CellWidget::goUp ( int dy )
|
||||||
{
|
{
|
||||||
if ( !dy ) dy = geometry().size().height() / 4;
|
if ( !dy ) dy = geometry().size().height() / 4;
|
||||||
if ( _offsetVA.ry() - dy >= 0 ) {
|
if ( _offsetVA.ry() - dy >= 0 ) {
|
||||||
_offsetVA.ry() -= dy;
|
_offsetVA.ry() -= dy;
|
||||||
update ();
|
update ();
|
||||||
} else {
|
} else {
|
||||||
|
@ -371,7 +377,7 @@ void CellWidget::goUp ( int dy )
|
||||||
void CellWidget::goDown ( int dy )
|
void CellWidget::goDown ( int dy )
|
||||||
{
|
{
|
||||||
if ( !dy ) dy = geometry().size().height() / 4;
|
if ( !dy ) dy = geometry().size().height() / 4;
|
||||||
if ( _offsetVA.ry() + dy < 2*_stripWidth ) {
|
if ( _offsetVA.ry() + dy < 2*_stripWidth ) {
|
||||||
_offsetVA.ry() += dy;
|
_offsetVA.ry() += dy;
|
||||||
update ();
|
update ();
|
||||||
} else {
|
} else {
|
||||||
|
@ -637,11 +643,13 @@ void CellWidget::mouseMoveEvent ( QMouseEvent* event )
|
||||||
|
|
||||||
if ( _mouseGo ) {
|
if ( _mouseGo ) {
|
||||||
int dx = event->x() - _lastMousePosition.x();
|
int dx = event->x() - _lastMousePosition.x();
|
||||||
|
dx <<= 1;
|
||||||
//cerr << "dX (px): " << dx << " _offsetVA.rx() " << _offsetVA.rx() << endl;
|
//cerr << "dX (px): " << dx << " _offsetVA.rx() " << _offsetVA.rx() << endl;
|
||||||
if ( dx > 0 ) goLeft ( dx );
|
if ( dx > 0 ) goLeft ( dx );
|
||||||
if ( dx < 0 ) goRight ( -dx );
|
if ( dx < 0 ) goRight ( -dx );
|
||||||
|
|
||||||
int dy = event->y() - _lastMousePosition.y();
|
int dy = event->y() - _lastMousePosition.y();
|
||||||
|
dy <<= 1;
|
||||||
//cerr << "dY (px): " << dy << " _offsetVA.ry() " << _offsetVA.ry() << endl;
|
//cerr << "dY (px): " << dy << " _offsetVA.ry() " << _offsetVA.ry() << endl;
|
||||||
if ( dy > 0 ) goUp ( dy );
|
if ( dy > 0 ) goUp ( dy );
|
||||||
if ( dy < 0 ) goDown ( -dy );
|
if ( dy < 0 ) goDown ( -dy );
|
||||||
|
|
|
@ -71,6 +71,7 @@ namespace Hurricane {
|
||||||
bool _mouseGo;
|
bool _mouseGo;
|
||||||
bool _openCell;
|
bool _openCell;
|
||||||
bool _showBoundaries;
|
bool _showBoundaries;
|
||||||
|
size_t _redrawRectCount;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CellWidget ( Cell* cell );
|
CellWidget ( Cell* cell );
|
||||||
|
|
Loading…
Reference in New Issue