Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

refactored L5/slide and reduce calling repaint.

  • Loading branch information...
commit fe86285e8eeffdab39eb8a936364a2bd12835b9d 1 parent f68b67c
@fukamachi authored
Showing with 11 additions and 17 deletions.
  1. +2 −4 src/L5/context.clj
  2. +9 −13 src/L5/slide.clj
View
6 src/L5/context.clj
@@ -17,8 +17,7 @@
(defn dispatch-event [context keyCode]
(let [actions (get @(:actions context) keyCode)]
(when (not (empty? actions))
- (doseq [act actions] (act))
- (.repaint @(:frame context)))))
+ (doseq [act actions] (act)))))
(defn build-context [raw-context-params & slides]
(let [params (merge default raw-context-params)
@@ -84,8 +83,7 @@
(dosync
(ref-set zoom scale)
(ref-set x (/ width-diff 2 scale))
- (ref-set y (/ height-diff 2 scale))))
- (slide/current-slide context)))]
+ (ref-set y (/ height-diff 2 scale))))))]
(doto panel
(.setFocusable true)
(.setForeground (:color context))
View
22 src/L5/slide.clj
@@ -179,27 +179,23 @@
(ref-set y elem-y))))))))
(defn current-slide [context]
- (let [idx @(:current context)]
+ (let [idx @(:current context)
+ slides @(:slides context)]
+ (println
+ (format "%d / %d %s"
+ (+ 1 idx) (count slides) (:body (first (get slides idx)))))
(draw-slide context idx)))
(defn next-slide [context]
(let [slides @(:slides context)
idx (+ @(:current context) 1)]
(when (> (count slides) idx)
- ;; TODO: this indicator is dup with below
- (println
- (format "%d / %d %s"
- (+ 1 idx) (count slides) (:body (first (get slides idx)))))
- (draw-slide context idx)
- (dosync (alter (:current context) inc)))))
+ (dosync (alter (:current context) inc))
+ (current-slide context))))
(defn prev-slide [context]
(let [slides @(:slides context)
idx (- @(:current context) 1)]
(when (>= idx 0)
- ;; TODO: this indicator is dup with above
- (println
- (format "%d / %d %s"
- (+ 1 idx) (count @(:slides context)) (:body (first (get slides idx)))))
- (draw-slide context idx)
- (dosync (alter (:current context) dec)))))
+ (dosync (alter (:current context) dec))
+ (current-slide context))))
Please sign in to comment.
Something went wrong with that request. Please try again.