From 2a1dde5c5cd4b87b71a930b7cb29b1ddb8717972 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sat, 22 Dec 2018 07:57:56 -0800 Subject: [PATCH] ctm rename --- pitfall/pitfall/annotations.rkt | 2 +- pitfall/pitfall/document.rkt | 4 ++-- pitfall/pitfall/vector.rkt | 19 ++++++++++--------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/pitfall/pitfall/annotations.rkt b/pitfall/pitfall/annotations.rkt index fc743d39..90212221 100644 --- a/pitfall/pitfall/annotations.rkt +++ b/pitfall/pitfall/annotations.rkt @@ -58,7 +58,7 @@ (let ([y2 y1] [y1 (+ y1 h)] [x2 (+ x1 w)]) - (match-define (list m0 m1 m2 m3 m4 m5) (· this _ctm)) + (match-define (list m0 m1 m2 m3 m4 m5) (· this @ctm)) (let* ([x1 (+ (* x1 m0) (* y1 m2) m4)] [y1 (+ (* x1 m1) (* y1 m3) m5)] [x2 (+ (* x2 m0) (* y2 m2) m4)] diff --git a/pitfall/pitfall/document.rkt b/pitfall/pitfall/document.rkt index 6c96e7ba..9031bd24 100644 --- a/pitfall/pitfall/document.rkt +++ b/pitfall/pitfall/document.rkt @@ -38,7 +38,7 @@ ;; initialize mixins (send this initVector) - (inherit-field _ctm) + (inherit-field @ctm) (send this initFonts) (inherit-field @font-families) (send this initText) @@ -70,7 +70,7 @@ (set! @y (margin-right (get-field margins (page)))) ;; flip PDF coordinate system so that the origin is in ;; the top left rather than the bottom left - (set! _ctm default-ctm-value) + (set! @ctm default-ctm-value) (send this transform 1 0 0 -1 0 (get-field height (page))) this) diff --git a/pitfall/pitfall/vector.rkt b/pitfall/pitfall/vector.rkt index 50378897..cdd4546d 100644 --- a/pitfall/pitfall/vector.rkt +++ b/pitfall/pitfall/vector.rkt @@ -11,11 +11,13 @@ "path.rkt") (provide vector-mixin default-ctm-value) +(define default-ctm-value '(1 0 0 1 0 0)) + (define (vector-mixin [% mixin-tester%]) (class % (super-new) - (field [_ctm default-ctm-value] - [_ctmStack null]) + (field [@ctm default-ctm-value] + [@ctm-stack null]) (as-methods initVector save @@ -45,25 +47,24 @@ scale))) -(define default-ctm-value '(1 0 0 1 0 0)) (define/contract (initVector this) (->m void?) - (set-field! _ctm this default-ctm-value) - (set-field! _ctmStack this null)) + (set-field! @ctm this default-ctm-value) + (set-field! @ctm-stack this null)) (define/contract (save this) (->m object?) - (push-field! _ctmStack this (· this _ctm)) + (push-field! @ctm-stack this (· this @ctm)) (send this addContent "q")) (define/contract (restore this) (->m object?) - (set-field! _ctm this (if (pair? (· this _ctmStack)) - (pop-field! _ctmStack this) + (set-field! @ctm this (if (pair? (· this @ctm-stack)) + (pop-field! @ctm-stack this) default-ctm-value)) (send this addContent "Q")) @@ -228,7 +229,7 @@ (define/contract (transform this scaleX shearY shearX scaleY mdx mdy) (number? number? number? number? number? number? . ->m . object?) (define new-ctm (list scaleX shearY shearX scaleY mdx mdy)) - (set-field! _ctm this (combine-transforms (· this _ctm) new-ctm)) + (set-field! @ctm this (combine-transforms (· this @ctm) new-ctm)) (send this addContent (make-transform-string new-ctm)))