Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 150:6e8bce502be3
* Avoid crash when zooming-to-fit a very short file! (Of course, we
can't actually make a very short file zoom to fit as we don't permit
close enough zoom resolution, but best not to crash, hey?)
author | Chris Cannam |
---|---|
date | Fri, 12 Dec 2008 16:03:37 +0000 |
parents | 7dca51571320 |
children | 6f1e64670451 |
comparison
equal
deleted
inserted
replaced
149:b774a451b093 | 150:6e8bce502be3 |
---|---|
1785 if (pixels > sw * 2) pixels -= sw * 2; | 1785 if (pixels > sw * 2) pixels -= sw * 2; |
1786 else pixels = 1; | 1786 else pixels = 1; |
1787 if (pixels > 4) pixels -= 4; | 1787 if (pixels > 4) pixels -= 4; |
1788 | 1788 |
1789 size_t zoomLevel = (end - start) / pixels; | 1789 size_t zoomLevel = (end - start) / pixels; |
1790 if (zoomLevel < 1) zoomLevel = 1; | |
1790 | 1791 |
1791 currentPane->setZoomLevel(zoomLevel); | 1792 currentPane->setZoomLevel(zoomLevel); |
1792 currentPane->setCentreFrame((start + end) / 2); | 1793 currentPane->setCentreFrame((start + end) / 2); |
1793 } | 1794 } |
1794 | 1795 |