Browse files

Remove/comment on some heinousness: Earmuffs, refs vs. atoms, dynamic

  • Loading branch information...
1 parent f408778 commit 7ab15b080bc508ab7bbab2cd09f18ef66b393b99 @timmc committed Mar 10, 2012
Showing with 12 additions and 14 deletions.
  1. +12 −14 src/timmcHW3/core.clj
View
26 src/timmcHW3/core.clj
@@ -24,35 +24,33 @@
MouseAdapter MouseEvent MouseMotionAdapter MouseWheelListener])
(:gen-class))
-(def ^{:doc "Collection of GUI components." :dynamic true}
+;; A lot of these should be atoms, and the earmuffs are also kind of
+;; inappropriate.
+(def ^{:doc "Collection of GUI components."}
*gui* (ref nil))
-(def ^{:doc "The viewpoint's state." :dynamic true}
+(def ^{:doc "The viewpoint's state."}
*view* (ref nil))
-(def ^{:doc "Tool and activity state." :dynamic true}
+(def ^{:doc "Tool and activity state."}
*state* (ref nil))
-(def ^{:doc "User data that needs undo/redo." :dynamic true}
+(def ^{:doc "User data that needs undo/redo."}
*udata* (ref nil))
-(def ^{:doc "Undo/redo buffers." :dynamic true}
+(def ^{:doc "Undo/redo buffers."}
*history* (ref nil))
-(def ^{:doc "State dirtiness cascade." :dynamic true}
- *cascade* (ref nil))
+(def ^{:doc "State dirtiness cascade."}
+ cascade (atom nil))
(defn dirty!
"Mark one or more pieces of state as dirty."
[& kws]
- (dosync
- (alter *cascade* (partial reduce dirt/dirty) kws)
- nil))
+ (apply swap! cascade dirt/dirty kws))
(defn clean!
"Clean up state and re-display where necessary."
([& kws]
(apply dirty! kws)
(clean!))
([]
- (dosync
- (alter *cascade* dirt/clean :all)
- nil)))
+ (swap! cascade dirt/clean :all)))
;;;; Mode accessors
@@ -577,7 +575,7 @@
:view-minspect default-view-minspect
:view-rot default-view-rot}))
(ref-set *udata* (udata/create))
- (ref-set *cascade* (make-cascade))
+ (reset! cascade (make-cascade))
(ref-set *history* (hist/create @*udata*)))
(clean!)
(enliven! *gui*)

0 comments on commit 7ab15b0

Please sign in to comment.