         param  (scaled-param-map state r y-val)]
     {:row r :col c :r-size r-size :c-size c-size :y-val y-val :param param}))
 
-(defn- on-grid-clicked [state e]
+(defn- on-grid-clicked
+  [state e]
   (let [{:keys [row col param]} (parse-grid-click state e)
         new-state (cond (.isControlDown e) (delete-entry state row col)
                         (.isAltDown e)     (update-entry state row col param)


(def ^{:private true} NEW_ENTRY {:on true})

(defn- toggle-playing [state]
  (update-in state [:playing?] not))

(defn- get-entry [state row col]
  (get-in state [:rows row :value col]))

(defn- set-entry [state row col v]
  (if (< row (count (:rows state)))
    (assoc-in state [:rows row :value col] v)
    state))

(defn- update-entry [state row col v]
  (if (< row (count (:rows state)))
    (update-in state [:rows row :value col] merge NEW_ENTRY v)
    state))

(defn- mute-entry [state row col]
  (update-in state [:rows row :value col]
             (fn [v]
               (if (associative? v)
                 (assoc-in v [:on] false)
                 v))))

(defn- toggle-entry [state row col]
  (update-in state [:rows row :value col]
             (fn [v]
               (if (associative? v)
                 (update-in v [:on] not)
                 NEW_ENTRY))))

(defn- delete-entry [state row col]
  (set-entry state row col false))

(defn- get-row-param

        [seesaw.mig :only [mig-panel]])
  (:require [seesaw.bind :as bind]))

(defn- make-initial-state
  [metro steps instruments init-vals]
  {:playing?  false
   :metronome metro
   :steps     steps
