-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add universe-inset parameter #237
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,14 @@ | |
|
||
(provide (all-defined-out)) | ||
|
||
(define INSET 5) ;; the space around the image in the canvas | ||
(define universe-inset ;; the space around the image in the canvas | ||
(make-parameter | ||
5 | ||
(λ (v) | ||
(unless (and (integer? v) | ||
(<= 0 v 1000)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
(Very minor: this is a |
||
(raise-argument-error 'universe-inset "an integer between 0 and 1000 (inclusive)" v)) | ||
v))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whatever you really choose for an |
||
(define RATE 1/30) ;; the clock tick rate | ||
(define TRIES 3) ;; how many times should register try to connect to the server | ||
(define PAUSE 1/2) ;; # secs to wait between attempts to connect to server | ||
|
@@ -53,8 +60,8 @@ | |
;; MouseEvent% -> [List Nat Nat MouseEventType] | ||
;; turn a mouse event into its pieces | ||
(define (mouse-event->parts e) | ||
(define x (- (send e get-x) INSET)) | ||
(define y (- (send e get-y) INSET)) | ||
(define x (- (send e get-x) (universe-inset))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
(define y (- (send e get-y) (universe-inset))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
(values x y | ||
(cond [(send e button-down?) "button-down"] | ||
[(send e button-up?) "button-up"] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,6 +220,7 @@ | |
(define/pubment (create-frame/universe) | ||
(define play-back:cust (make-custodian)) | ||
|
||
(define inset (universe-inset)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
(define frame-x 2) | ||
(define frame-y 2) | ||
|
||
|
@@ -256,10 +257,10 @@ | |
(stretchable-width #f) | ||
(stretchable-height #f) | ||
(style '(no-hscroll no-vscroll)) | ||
(horizontal-inset INSET) | ||
(vertical-inset INSET))) | ||
(send editor-canvas min-client-width (sub1 (+ width INSET INSET))) | ||
(send editor-canvas min-client-height (sub1 (+ height INSET INSET))) | ||
(horizontal-inset inset) | ||
(vertical-inset inset))) | ||
(send editor-canvas min-client-width (sub1 (+ width inset inset))) | ||
(send editor-canvas min-client-height (sub1 (+ height inset inset))) | ||
(set!-values (enable-images-button disable-images-button) | ||
(inner (values void void) create-frame/universe frame play-back:cust)) | ||
(send editor-canvas focus) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the named constant instead of
1000
.