adjust x position when finding editor locations

This commit is contained in:
Jon Rafkind 2010-11-05 15:09:30 -06:00
parent a39645ff7a
commit a698d89a75

View File

@ -3714,7 +3714,6 @@ designates the character that triggers autocompletion
(inherit get-visible-line-range
get-visible-position-range
last-line
find-position
line-location
line-paragraph
line-start-position
@ -3816,8 +3815,6 @@ designates the character that triggers autocompletion
[else (/ (- a c) (- 2 a c))]))
(define lightness (/ (+ a c) 2))
(values hue saturation lightness))
;; it would be better to convert RGB to HSL and change the
;; L (lightness) parameter
(define-values (hue saturation lightness)
(rgb->hsl (send color red)
(send color green)
@ -3860,6 +3857,11 @@ designates the character that triggers autocompletion
(define (draw-separator dc top bottom dy x)
(send dc draw-line x (+ dy top) x (+ dy bottom)))
(define line-numbers-space 0)
(define/override (find-position x y . args)
;; adjust x position to account for line numbers
(super find-position (- x line-numbers-space) y . args))
(define (draw-line-numbers dc left top right bottom dx dy)
(setup-dc dc)
(define start-line (box 0))
@ -3919,6 +3921,7 @@ designates the character that triggers autocompletion
(send copy subtract clipped)
(send dc set-clipping-region copy)
(send dc set-origin (+ x (text-width dc (number-space+1))) y)
(set! line-numbers-space (text-width dc (number-space+1)))
)
(begin
;; rest the origin and draw the line numbers