comparison view/View.cpp @ 244:5105be027d8e

* Fix #1707650 refreshes not happening
author Chris Cannam
date Fri, 27 Apr 2007 14:35:04 +0000
parents 90122740323f
children 28c8e8e3c537
comparison
equal deleted inserted replaced
243:92dc881926da 244:5105be027d8e
413 413
414 int 414 int
415 View::getZoomLevel() const 415 View::getZoomLevel() const
416 { 416 {
417 #ifdef DEBUG_VIEW_WIDGET_PAINT 417 #ifdef DEBUG_VIEW_WIDGET_PAINT
418 std::cout << "zoom level: " << m_zoomLevel << std::endl; 418 // std::cout << "zoom level: " << m_zoomLevel << std::endl;
419 #endif 419 #endif
420 return m_zoomLevel; 420 return m_zoomLevel;
421 } 421 }
422 422
423 void 423 void
886 } 886 }
887 887
888 void 888 void
889 View::viewZoomLevelChanged(View *p, unsigned long z, bool locked) 889 View::viewZoomLevelChanged(View *p, unsigned long z, bool locked)
890 { 890 {
891 #ifdef DEBUG_VIEW_WIDGET_PAINT
892 std::cerr << "View[" << this << "]: viewZoomLevelChanged(" << p << ", " << z << ", " << locked << ")" << std::endl;
893 #endif
891 if (m_followZoom && p != this && locked) { 894 if (m_followZoom && p != this && locked) {
892 setZoomLevel(z); 895 setZoomLevel(z);
893 } 896 }
894 } 897 }
895 898
1270 m_cache = 0; 1273 m_cache = 0;
1271 m_selectionCached = false; 1274 m_selectionCached = false;
1272 } 1275 }
1273 1276
1274 if (!scrollables.empty()) { 1277 if (!scrollables.empty()) {
1278
1279 #ifdef DEBUG_VIEW_WIDGET_PAINT
1280 std::cerr << "View(" << this << "): cache " << m_cache << ", cache zoom "
1281 << m_cacheZoomLevel << ", zoom " << m_zoomLevel << std::endl;
1282 #endif
1283
1275 if (!m_cache || 1284 if (!m_cache ||
1276 m_cacheZoomLevel != m_zoomLevel || 1285 m_cacheZoomLevel != m_zoomLevel ||
1277 width() != m_cache->width() || 1286 width() != m_cache->width() ||
1278 height() != m_cache->height()) { 1287 height() != m_cache->height()) {
1279 1288
1280 // cache is not valid 1289 // cache is not valid
1281 1290
1282 if (cacheRect.width() < width()/10) { 1291 if (cacheRect.width() < width()/10) {
1292 delete m_cache;
1293 m_cache = 0;
1283 #ifdef DEBUG_VIEW_WIDGET_PAINT 1294 #ifdef DEBUG_VIEW_WIDGET_PAINT
1284 std::cerr << "View(" << this << ")::paintEvent: small repaint, not bothering to recreate cache" << std::endl; 1295 std::cerr << "View(" << this << ")::paintEvent: small repaint, not bothering to recreate cache" << std::endl;
1285 #endif 1296 #endif
1286 } else { 1297 } else {
1287 delete m_cache; 1298 delete m_cache;