 
 (ns mathom.toolbar)
 
-(def tool (atom {:selected nil}))
+(def tool (atom {}))
 
 (defn clean
   []

  [d]
  (clojure.string/join " "
                       (for [[k v] d]
                         (str (name k) "=\"" v "\""))))


(defn h

(defn render
  [statedb]
  (let [states (:states statedb)
        active (:active_state statedb)
        prev (if (> active 0) true false)
        next (if (= active (count states)) true false)]
    (set-content (:bar @tool)
                 (h "div" {} [(h "h1" {} ["Mathom Toolbar"])
                              (h "button"
                                 {:id       "mathom_toolbar_prev"
                                  :class "pure-button"
                                  :disabled (not prev)}
                                 ["Previous state"])
                              (h "button"
                                 {:id       "mathom_toolbar_next"
                                  :class "pure-button"
                                  :disabled (not next)}
                                 ["Next state"])
                              (h "span"
                                 {:id "mathom_toolbar_states"}
                                 ["Saved states: " (count states)
