diff options
author | nyamatongwe <unknown> | 2011-02-07 13:54:07 +1100 |
---|---|---|
committer | nyamatongwe <unknown> | 2011-02-07 13:54:07 +1100 |
commit | 5350f8da7e73f683380fec5db5d6ebacf6b95511 (patch) | |
tree | 73e459dd94e115cd0ab514a6735c4330d4f565f9 /cocoa/ScintillaCocoa.mm | |
parent | 4d6720ee3d75e3e8ab186d610b879018a3a6114c (diff) | |
download | scintilla-mirror-5350f8da7e73f683380fec5db5d6ebacf6b95511.tar.gz |
Merged in current scintilla-cocoa from bzr.
Diffstat (limited to 'cocoa/ScintillaCocoa.mm')
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 823bcfd3f..08c827b38 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -220,7 +220,8 @@ ScintillaCocoa::~ScintillaCocoa() void ScintillaCocoa::Initialise() { static bool initedLexers = false; - if (!initedLexers) { + if (!initedLexers) + { initedLexers = true; Scintilla_LinkLexers(); } @@ -1105,25 +1106,29 @@ void ScintillaCocoa::DoScroll(float position, NSScrollerPart part, bool horizont } else { - // VerticalScrolling is by line. - int topLine = (int) (position * MaxScrollPos()); - int page = LinesOnScreen(); + // VerticalScrolling is by line. If the user is scrolling using the knob we can directly + // set the new scroll position. Otherwise we have to compute it first. + if (part == NSScrollerKnob) + ScrollTo(position * MaxScrollPos(), false); + else + { switch (part) { case NSScrollerDecrementLine: - topLine--; + ScrollTo(topLine - 1, true); break; case NSScrollerDecrementPage: - topLine -= page; + ScrollTo(topLine - LinesOnScreen(), true); break; case NSScrollerIncrementLine: - topLine++; + ScrollTo(topLine + 1, true); break; case NSScrollerIncrementPage: - topLine += page; + ScrollTo(topLine + LinesOnScreen(), true); break; }; - ScrollTo(topLine, true); + + } } } @@ -1232,7 +1237,7 @@ void ScintillaCocoa::IdleTimerFired() /** * Main entry point for drawing the control. * - * @param rect The area to paint, given in the sender's coordinate. + * @param rect The area to paint, given in the sender's coordinate system. * @param gc The context we can use to paint. */ void ScintillaCocoa::Draw(NSRect rect, CGContextRef gc) |