<commit_before>#lang racket/base

#|
   Copyright 2016-2017 <NAME>

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
|#

(provide camera-icon
         camera-button)
(require racket/class
         racket/draw
         racket/path
         racket/gui/base
         images/icons/style
         mrlib/switchable-button
         racket/list)

(define height (toolbar-icon-height))
(define width (* height 2))
(define lens-dim 2/3)
(define camera (make-object bitmap% width height #f #t))

(define dc (make-object bitmap-dc% camera))
(send dc set-pen
      (new pen% [width 0] [color (icon-color->outline-color run-icon-color)]))
(send dc set-brush
      (new brush% [color run-icon-color]))

(define path (new dc-path%))
(send path move-to 0             0)
(send path line-to 0             height)
(send path line-to (* width lens-dim) height)
(send path line-to (* width lens-dim) (* height 3/4))
(send path line-to width         (* height 9/10))
(send path line-to width         (* height 1/10))
(send path line-to (* width lens-dim) (* height 1/4))
(send path line-to (* width lens-dim) 0)
(send path line-to 0             0)
(send dc draw-path path)

(define camera-icon
  (bitmap-render-icon camera))

(define camera-button
  (list
   "Preview Video"
   camera-icon
   (λ (drr-frame)
     (define t (send drr-frame get-definitions-text))
     (define vid-port (open-input-text-editor t 0 'end (λ (s) s) t #t))
     (define program (parameterize ([read-accept-lang #t]
                                    [read-accept-reader #t])
                       (read vid-port)))
     (parameterize ([current-namespace (make-gui-namespace)])
       (define mod-name (second program))
       (eval `(current-directory ,(let ([v (send t get-filename)])
                                      (if v
                                          (path-only v)                                     
                                      (current-directory)))))
       (eval program)
       (eval `(require ',mod-name))
       (eval '(require video/player))
       (eval '(void (preview vid)))))
   #f))

(require video/base)<commit_msg>Woops, missed one.<commit_after>#lang racket/base

#|
   Copyright 2016-2017 <NAME>

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
|#

(provide camera-icon
         camera-button)
(require racket/class
         racket/draw
         racket/path
         racket/gui/base
         images/icons/style
         mrlib/switchable-button
         racket/list
         "../base.rkt")

(define height (toolbar-icon-height))
(define width (* height 2))
(define lens-dim 2/3)
(define camera (make-object bitmap% width height #f #t))

(define dc (make-object bitmap-dc% camera))
(send dc set-pen
      (new pen% [width 0] [color (icon-color->outline-color run-icon-color)]))
(send dc set-brush
      (new brush% [color run-icon-color]))

(define path (new dc-path%))
(send path move-to 0             0)
(send path line-to 0             height)
(send path line-to (* width lens-dim) height)
(send path line-to (* width lens-dim) (* height 3/4))
(send path line-to width         (* height 9/10))
(send path line-to width         (* height 1/10))
(send path line-to (* width lens-dim) (* height 1/4))
(send path line-to (* width lens-dim) 0)
(send path line-to 0             0)
(send dc draw-path path)

(define camera-icon
  (bitmap-render-icon camera))

(define camera-button
  (list
   "Preview Video"
   camera-icon
   (λ (drr-frame)
     (define t (send drr-frame get-definitions-text))
     (define vid-port (open-input-text-editor t 0 'end (λ (s) s) t #t))
     (define program (parameterize ([read-accept-lang #t]
                                    [read-accept-reader #t])
                       (read vid-port)))
     (parameterize ([current-namespace (make-gui-namespace)])
       (define mod-name (second program))
       (eval `(current-directory ,(let ([v (send t get-filename)])
                                      (if v
                                          (path-only v)                                     
                                      (current-directory)))))
       (eval program)
       (eval `(require ',mod-name))
       (eval '(require video/player))
       (eval '(void (preview vid)))))
   #f))
{'fraction_non_alphanumeric': 0.11732163296451736, 'fraction_numerical': 0.01259061426936284, 'mean_word_length': 2.1320191158900834, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4866793', 'n_tokens_mistral': 1575, 'n_tokens_neox': 1506, 'n_words': 532}