Skip to content

Commit

Permalink
adjust the get-guidance dialog to have the more modern racket logo
Browse files Browse the repository at this point in the history
  • Loading branch information
rfindler committed Oct 5, 2020
1 parent beb2c01 commit 9cb6f43
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
3 changes: 2 additions & 1 deletion drracket/drracket/private/drracket-normal.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@
(format "DrRacket ~a" (version))
700
#:allow-funny? #t
#:frame-icon todays-icon)
#:frame-icon (and (equal? (system-type) 'unix)
(get-todays-icon)))

(when (getenv "PLTDRBREAK")
(printf "PLTDRBREAK: creating break frame\n") (flush-output)
Expand Down
33 changes: 18 additions & 15 deletions drracket/drracket/private/frame-icon.rkt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#lang racket/base
(require racket/class racket/draw (for-syntax racket/base racket/match racket/string xml))
(provide todays-icon
(provide get-todays-icon
mb-scale-factor mb-main-drawing
mb-flat-width mb-flat-height
mb-plain-width mb-plain-height)
Expand Down Expand Up @@ -136,17 +136,20 @@
(define mb-flat-width (inexact->exact (ceiling (* mb-plain-width mb-scale-factor))))
(define mb-flat-height (inexact->exact (ceiling (* mb-plain-height mb-scale-factor))))

(define todays-icon
(and (eq? (system-type) 'unix)
(let ()
(define bmp (make-object bitmap% mb-flat-width mb-flat-height #f #t))
(define dc (make-object bitmap-dc% bmp))
(send dc set-smoothing 'smoothed)
(send dc set-pen "black" 1 'transparent)
(send dc set-brush "white" 'solid)
;; draw white background circle to give color to lambda portion
(send dc draw-ellipse 2 2 (- mb-flat-width 4) (- mb-flat-height 4))
(send dc set-scale mb-scale-factor mb-scale-factor)
(mb-main-drawing dc)
(send dc set-bitmap #f)
bmp)))
(define todays-icon #f)

(define (get-todays-icon)
(unless todays-icon
(define bmp (make-object bitmap% mb-flat-width mb-flat-height #f #t))
(define dc (make-object bitmap-dc% bmp))
(send dc set-smoothing 'smoothed)
(send dc set-pen "black" 1 'transparent)
(send dc set-brush "white" 'solid)
;; draw white background circle to give color to lambda portion
(send dc draw-ellipse 2 2 (- mb-flat-width 4) (- mb-flat-height 4))
(send dc set-scale mb-scale-factor mb-scale-factor)
(mb-main-drawing dc)
(send dc set-bitmap #f)
(set! todays-icon bmp))
todays-icon)

14 changes: 10 additions & 4 deletions drracket/drracket/private/language-configuration.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
drracket/private/drsig
"tooltip.rkt"
"local-member-names.rkt"
"frame-icon.rkt"
string-constants
framework
framework/private/srcloc-panel
Expand Down Expand Up @@ -2358,7 +2359,8 @@
(parent racketeer-panel)
(label (string-constant racketeer?)))
(new canvas-message%
[label (read-bitmap (collection-file-path "plt-logo-red-shiny.png" "icons"))]
[label (get-todays-icon)]
[label-scale 2/3]
[parent racketeer-panel]
[callback (λ () (change-current-lang-to
(λ (x) (is-a? x drracket:module-language:module-language<%>))))])
Expand Down Expand Up @@ -2416,6 +2418,7 @@
(define canvas-message%
(class canvas%
(init-field label
[label-scale 1]
[font (get-font)]
[callback void]
[color #f])
Expand Down Expand Up @@ -2443,7 +2446,10 @@
(send dc set-font old-font)
(send dc set-text-foreground old-tf)]
[(is-a? label bitmap%)
(send dc draw-bitmap label 0 0)]))
(define-values (x-scale y-scale) (send dc get-scale))
(send dc set-scale label-scale label-scale)
(send dc draw-bitmap label 0 0)
(send dc set-scale x-scale y-scale)]))

(super-new [stretchable-width #f]
[stretchable-height #f]
Expand All @@ -2456,8 +2462,8 @@
(min-width (inexact->exact (ceiling w)))
(min-height (inexact->exact (ceiling h)))]
[(is-a? label bitmap%)
(min-width (inexact->exact (ceiling (send label get-width))))
(min-height (inexact->exact (ceiling (send label get-height))))])))
(min-width (inexact->exact (ceiling (* label-scale (send label get-width)))))
(min-height (inexact->exact (ceiling (* label-scale (send label get-height)))))])))

(define (question/answer line1 line2 icon-lst)
(display-two-line-choice
Expand Down

0 comments on commit 9cb6f43

Please sign in to comment.