mirror of
https://github.com/unclebob/more-speech.git
synced 2024-09-30 02:21:02 +00:00
Eliminate 'unused local variable' warnings by prefixing those variables with an underscore.
This commit is contained in:
parent
8e196c3983
commit
519038ceed
@ -1,7 +1,6 @@
|
||||
(ns more-speech.text-spec
|
||||
(:require [speclj.core :refer :all]
|
||||
[more-speech.ui.cursor :refer :all]
|
||||
[quil.core :as q]))
|
||||
[more-speech.ui.cursor :refer :all]))
|
||||
|
||||
(describe "Text Utilities"
|
||||
(context "nil->blank"
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
(defrecord mock-graphic [x y which time]
|
||||
g/graphics
|
||||
(get-mouse [graphics] [x y which])
|
||||
(get-time [graphics] time))
|
||||
(get-mouse [_graphics] [x y which])
|
||||
(get-time [_graphics] time))
|
||||
|
||||
(defn- left-up [button state]
|
||||
(assoc-in state (concat (:path button) [:left-came-up]) true))
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
(defrecord mock-graphics []
|
||||
g/graphics
|
||||
(line-height [graphics]
|
||||
(line-height [_graphics]
|
||||
20)
|
||||
)
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
(ns more-speech.ui.widget-spec
|
||||
(:require [speclj.core :refer :all]
|
||||
[more-speech.ui.application :refer [map->application]]
|
||||
[more-speech.ui.graphics :as g]
|
||||
[more-speech.ui.widget :refer :all]))
|
||||
|
||||
(defrecord child []
|
||||
widget
|
||||
(setup-widget [widget state]
|
||||
(setup-widget [widget _state]
|
||||
(assoc widget :setup true)))
|
||||
|
||||
(defrecord child-with-child []
|
||||
widget
|
||||
(setup-widget [widget state]
|
||||
(setup-widget [widget _state]
|
||||
(assoc widget :child (->child))))
|
||||
|
||||
(defn- f [widget state] (assoc-in state (concat (:path widget) [:did-f]) true))
|
||||
@ -101,7 +100,7 @@
|
||||
|
||||
(defrecord mock-widget [x y w h]
|
||||
widget
|
||||
(setup-widget [widget state]
|
||||
(setup-widget [widget _state]
|
||||
widget))
|
||||
|
||||
(describe "mouse operations"
|
||||
|
@ -22,10 +22,10 @@
|
||||
(declare process-text-event)
|
||||
|
||||
(defn process-event [{:keys [application] :as state} event]
|
||||
(let [{:keys [articles nicknames]} application
|
||||
(let [{:keys [_articles nicknames]} application
|
||||
name-of (fn [pubkey] (get nicknames pubkey pubkey))
|
||||
[name subscription-id inner-event :as decoded-msg] event
|
||||
{:strs [id pubkey created_at kind tags content sig]} inner-event]
|
||||
[_name _subscription-id inner-event :as _decoded-msg] event
|
||||
{:strs [_id pubkey created_at kind _tags content _sig]} inner-event]
|
||||
(condp = kind
|
||||
0 (let [pubkey (hex-string->num pubkey)
|
||||
name (get (json/read-str content) "name" "tilt")]
|
||||
@ -47,7 +47,7 @@
|
||||
(defn process-tags [tags]
|
||||
(map process-tag tags))
|
||||
|
||||
(defn process-references [state {:keys [id tags] :as event}]
|
||||
(defn process-references [state {:keys [id tags] :as _event}]
|
||||
(let [e-tags (filter #(= :e (first %)) tags)
|
||||
refs (map second e-tags)]
|
||||
(loop [refs refs
|
||||
|
@ -50,13 +50,13 @@
|
||||
widget
|
||||
(setup-widget [widget state]
|
||||
(setup-application widget path state))
|
||||
(update-widget [widget state]
|
||||
(update-widget [_widget state]
|
||||
state)
|
||||
(draw-widget [application state]
|
||||
(draw-child-widgets application state))
|
||||
)
|
||||
|
||||
(defn- setup-application [application path state]
|
||||
(defn- setup-application [application _path _state]
|
||||
(let [graphics (:graphics application)
|
||||
bold (get-in graphics [:fonts :bold])]
|
||||
(g/text-font graphics bold)
|
||||
|
@ -31,7 +31,7 @@
|
||||
(draw-widget [widget state]
|
||||
(draw-article-window state widget)))
|
||||
|
||||
(defn setup-article-window [widget state]
|
||||
(defn setup-article-window [widget _state]
|
||||
(let [{:keys [x y w h]} widget
|
||||
dim config/header-frame-dimensions
|
||||
frame-path (concat (:path widget) [:header-frame])
|
||||
@ -135,5 +135,5 @@
|
||||
(defn- lock-thumb [widget state]
|
||||
(app/lock-mouse state widget))
|
||||
|
||||
(defn- unlock-thumb [widget state]
|
||||
(defn- unlock-thumb [_widget state]
|
||||
(app/unlock-mouse state))
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
(defrecord author-window [x y w h fonts]
|
||||
widget
|
||||
(setup-widget [widget state]
|
||||
(setup-widget [widget _state]
|
||||
widget)
|
||||
(update-widget [widget state]
|
||||
(update-widget [_widget state]
|
||||
state)
|
||||
(draw-widget [widget state]
|
||||
(draw-author-window (:application state) widget))
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
(defrecord button [x y h w button-state left-up]
|
||||
w/widget
|
||||
(setup-widget [widget state]
|
||||
(setup-widget [widget _state]
|
||||
widget)
|
||||
(update-widget [widget state]
|
||||
(update-button widget state))
|
||||
|
@ -19,14 +19,14 @@
|
||||
(defrecord cursor [graphics x y l-margin]
|
||||
Cursor
|
||||
|
||||
(set-x [c x]
|
||||
(assoc c :x x))
|
||||
(set-x [c new-x]
|
||||
(assoc c :x new-x))
|
||||
|
||||
(set-y [c y]
|
||||
(assoc c :y y))
|
||||
(set-y [c new-y]
|
||||
(assoc c :y new-y))
|
||||
|
||||
(set-xy [c x y]
|
||||
(assoc c :x x :y y))
|
||||
(set-xy [c new-x new-y]
|
||||
(assoc c :x new-x :y new-y))
|
||||
|
||||
(set-pos [c pos]
|
||||
(set-x c (g/pos-width graphics pos)))
|
||||
|
@ -32,47 +32,47 @@
|
||||
|
||||
(defrecord quil-graphics [fonts]
|
||||
graphics
|
||||
(screen-height [graphics]
|
||||
(screen-height [_graphics]
|
||||
(q/screen-height))
|
||||
(screen-width [graphics]
|
||||
(screen-width [_graphics]
|
||||
(q/screen-width))
|
||||
(text-align [graphics alignment]
|
||||
(text-align [_graphics alignment]
|
||||
(apply q/text-align alignment))
|
||||
(text-color [graphics color]
|
||||
(text-color [_graphics color]
|
||||
(apply q/fill color))
|
||||
(stroke [graphics color]
|
||||
(stroke [_graphics color]
|
||||
(apply q/stroke color))
|
||||
(stroke-weight [graphics weight]
|
||||
(stroke-weight [_graphics weight]
|
||||
(q/stroke-weight weight))
|
||||
(fill [graphics color]
|
||||
(fill [_graphics color]
|
||||
(apply q/fill color))
|
||||
(no-fill [graphics]
|
||||
(no-fill [_graphics]
|
||||
(q/no-fill))
|
||||
(rect [graphics rect]
|
||||
(rect [_graphics rect]
|
||||
(apply q/rect rect))
|
||||
(line [graphics line]
|
||||
(line [_graphics line]
|
||||
(apply q/line line))
|
||||
(polygon [graphics points]
|
||||
(polygon [_graphics points]
|
||||
(draw-polygon points))
|
||||
(with-translation [graphics translation f]
|
||||
(q/with-translation translation (f graphics)))
|
||||
(text-font [graphics font]
|
||||
(text-font [_graphics font]
|
||||
(q/text-font font))
|
||||
(line-height [graphics]
|
||||
(line-height [_graphics]
|
||||
(+ (q/text-ascent) (q/text-descent)))
|
||||
(pos-width [graphics pos]
|
||||
(pos-width [_graphics pos]
|
||||
(let [s (apply str (repeat pos "X"))]
|
||||
(q/text-width s)))
|
||||
(text-width [graphics s]
|
||||
(text-width [_graphics s]
|
||||
(q/text-width s))
|
||||
(text [graphics text-spec]
|
||||
(text [_graphics text-spec]
|
||||
(apply q/text text-spec))
|
||||
(get-mouse [graphics]
|
||||
(get-mouse [_graphics]
|
||||
(let [x (q/mouse-x)
|
||||
y (q/mouse-y)
|
||||
which (if (q/mouse-pressed?) (q/mouse-button) nil)]
|
||||
[x y which]))
|
||||
(get-time [graphics]
|
||||
(get-time [_graphics]
|
||||
(System/currentTimeMillis))
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user