diff options
author | Tim E. Real <termtech@rogers.com> | 2013-01-26 01:15:35 +0000 |
---|---|---|
committer | Tim E. Real <termtech@rogers.com> | 2013-01-26 01:15:35 +0000 |
commit | 5fb1cdfe5bdd48406e58441b354fc87d3d3c582e (patch) | |
tree | 8a2defe11002fe54b9d8da10d86a8689787676ae /muse2/muse/midieditor.cpp | |
parent | 488e311fb446d129aff962106aead79fa96a849c (diff) |
Feature/fix: Zoom at cursor! Zoom now zooms about cursor.
Diffstat (limited to 'muse2/muse/midieditor.cpp')
-rw-r--r-- | muse2/muse/midieditor.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/muse2/muse/midieditor.cpp b/muse2/muse/midieditor.cpp index c00a7049..50cc6003 100644 --- a/muse2/muse/midieditor.cpp +++ b/muse2/muse/midieditor.cpp @@ -245,30 +245,22 @@ void MidiEditor::setCurCanvasPart(MusECore::Part* part) canvas->setCurrentPart(part); } -void MidiEditor::horizontalZoomIn() +void MidiEditor::horizontalZoom(bool zoom_in, int pos_offset) { int mag = hscroll->mag(); int zoomlvl = MusEGui::ScrollScale::getQuickZoomLevel(mag); - if (zoomlvl < MusEGui::ScrollScale::zoomLevels-1) + if(zoom_in) + { + if (zoomlvl < MusEGui::ScrollScale::zoomLevels-1) zoomlvl++; - - int newmag = MusEGui::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); - - hscroll->setMag(newmag); - -} - -void MidiEditor::horizontalZoomOut() -{ - int mag = hscroll->mag(); - int zoomlvl = MusEGui::ScrollScale::getQuickZoomLevel(mag); - if (zoomlvl > 1) + } + else + { + if (zoomlvl > 1) zoomlvl--; - + } int newmag = MusEGui::ScrollScale::convertQuickZoomLevelToMag(zoomlvl); - - hscroll->setMag(newmag); - + hscroll->setMag(newmag, pos_offset); } void MidiEditor::addNewParts(const std::map< MusECore::Part*, std::set<MusECore::Part*> >& param) |