2015-12-16 18:08:28 +02:00
|
|
|
(ns uxbox.data.workspace
|
|
|
|
(:require [uxbox.rstore :as rs]
|
|
|
|
[uxbox.router :as r]
|
|
|
|
[uxbox.state :as st]
|
|
|
|
[uxbox.schema :as sc]
|
|
|
|
[uxbox.time :as time]
|
|
|
|
[bouncer.validators :as v]))
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Events
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2015-12-17 18:34:15 +02:00
|
|
|
(defn toggle-tool
|
|
|
|
[toolname]
|
2015-12-16 18:08:28 +02:00
|
|
|
(reify
|
|
|
|
rs/UpdateEvent
|
|
|
|
(-apply-update [_ state]
|
2015-12-17 18:34:15 +02:00
|
|
|
(let [key (keyword (str (name toolname) "-enabled"))]
|
|
|
|
(update-in state [:workspace key] (fnil not false))))
|
2015-12-16 18:08:28 +02:00
|
|
|
|
|
|
|
IPrintWithWriter
|
|
|
|
(-pr-writer [mv writer _]
|
2015-12-17 18:34:15 +02:00
|
|
|
(-write writer "#<event:u.s.p/toggle-tool>"))))
|