Permalink
Browse files

remove spell check for now

  • Loading branch information...
1 parent 6561d79 commit 4cd0f7dd04f0000d74914657b93801343ace5ddb @ghostandthemachine committed Aug 20, 2012
View
7,418 img/sketchpad-logo.ai
0 additions, 7,418 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
6 project.clj
@@ -5,14 +5,10 @@
:dependencies [[org.clojure/clojure "1.4.0"]
[seesaw "1.4.2"]
[clooj "0.3.4.2-SNAPSHOT"]
- [rounded-border "0.0.1-SNAPSHOT"]
[rsyntaxtextarea-clojars/rsyntaxtextarea-clojars "0.1.0-SNAPSHOT"]
[language-builder "1.0.0-SNAPSHOT"]
[auto-complete "0.1.0-SNAPSHOT"]
[leiningen "2.0.0-preview7"]
- [timbre "0.5.1-SNAPSHOT"]
[language-support/language-support "0.1.0-SNAPSHOT"]
- [rsta_spellchecker/rsta_spellchecker "0.1.0-SNAPSHOT"]
- [org.apache.commons/commons-io "1.3.2"]
- [quil/quil "1.6.0"]]
+ [rsta_spellchecker/rsta_spellchecker "0.1.0-SNAPSHOT"]]
:jvm-opts ~(if (= (System/getProperty "os.name") "Mac OS X") ["-Xdock:name=SketchPad"] []))
View
19 resources/default.clj
@@ -15,7 +15,7 @@
:font "MENLO-BOLD-12"
:tab-size 2
:hyper-links-enabled false
- :mark-occurences false
+ :mark-occurences true
:mark-occurences-color "#ADA6A9"
:paint-mark-occurences-border false
:matched-bracket-bg-color [80 240 70 50]
@@ -40,7 +40,7 @@
:font "MENLO-BOLD-12"
:tab-size 2
:hyper-links-enabled false
- :mark-occurences false
+ :mark-occurences true
:mark-occurences-color "#ADA6A9"
:paint-mark-occurences-border false
:matched-bracket-bg-color [80 240 70 50]
@@ -81,13 +81,13 @@
{})
(def default-gutter-prefs
- {:border-color [0 0 0 0]
- :bookmarking-enabled false
- :fold-indicator-enabled true ;; not functional until new Clojure Lexxer is integrated
- :line-number-color [143 144 134]
- :line-number-font "MENLO-12-BOLD"
- :line-number-start-index 1
- :active-range-color [50 50 41]})
+ {:border-color [0 0 0 0]
+ :bookmarking-enabled false
+ :fold-indicator-enabled true ;; not functional until new Clojure Lexxer is integrated
+ :line-number-color [143 144 134]
+ :line-number-font "MENLO-12-BOLD"
+ :line-number-start-index 1
+ :active-range-color [50 50 41]})
(def default-sketchpad-prefs
{:show-tabs? true})
@@ -159,3 +159,4 @@
:toggle-bookmark "meta F2"
:prev-occurrence "meta shift K"
:next-occurrence "meta K"})
+
View
9 src/sketchpad/buffer/spell_check.clj
@@ -2,11 +2,12 @@
(:require [sketchpad.config.config :as config])
(:import (org.fife.ui.rsyntaxtextarea.spell SpellingParser)))
-; (defonce dic-resource (clojure.java.io/resource "english_dic.zip"))
+(defonce dic-resource (clojure.java.io/resource "english_dic.zip"))
+; (def dr (clojure.java.io/resource "english_dic.zip"))
-; (println dic-resource)
-; (println (type dic-resource))
-; (println (.getFile dic-resource))
+(println dic-resource)
+(println (type dic-resource))
+(println (.getFile dic-resource))
; (println (clojure.java.io/file dic-resource))
View
29 src/sketchpad/core.clj
@@ -19,6 +19,7 @@
[sketchpad.editor.editor :as sketchpad.editor]
[sketchpad.project.project :as project]
[sketchpad.menu.menu-bar :as menu]
+ [sketchpad.wrapper.rsyntaxtextarea :as rsyntaxtextarea]
[sketchpad.editor.info :as info]
[sketchpad.buffer.action :as buffer.action]
[sketchpad.repl.info :as repl.info]
@@ -34,6 +35,19 @@
false))
true)
+; (defn check-buffers
+; [e]
+; (if (tabs?)
+; (let [response (close-or-save-application-dialogue "Quit Application")]
+; (cond
+; (= response 0)
+; (println 0)
+; (= response 1)
+; (println 1)
+; (= response 2)
+; (println 2)
+; ))))
+
(defn create-app
[]
(let [buffer-info (info/buffer-info)
@@ -47,7 +61,7 @@
file-tree {:type :file-tree
:component (file-tree state/app)}
- repl-tabbed-panel (app.repl/repl-tabbed-panel)
+ repl-tabbed-panel (app.repl/repl-tabbed-panel)
repl-info (repl.info/repl-info)
repl-component (vertical-panel :items[(get-in repl-tabbed-panel [:component :container])
:fill-h
@@ -95,11 +109,12 @@
repl-tabbed-panel
repl-component
main-vertical-split-pane
- top-horizontal-split-panel))
- icon-url (clojure.java.io/resource "sketchpad-lambda-logo.png")
- icon (.createImage (Toolkit/getDefaultToolkit) icon-url)]
- (.setIconImage frame icon)
- (set-osx-icon icon)
+ top-horizontal-split-panel))]
+ (when (rsyntaxtextarea/is-osx?)
+ (let [icon-url (clojure.java.io/resource "sketchpad-lambda-logo.png")
+ icon (.createImage (Toolkit/getDefaultToolkit) icon-url)]
+ (.setIconImage frame icon)
+ (set-osx-icon icon)))
app))
@@ -118,7 +133,7 @@
(seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))))
(defn init-projects []
- (project/add-project "tmp")
+ (project/add-project "sketchpad-tmp")
(doall (map #(project/add-project %) (load-project-set))))
;; startup
View
2 src/sketchpad/editor/buffer.clj
@@ -114,7 +114,7 @@
(defn blank-clj-buffer!
([] (blank-clj-buffer! nil))
([parent-dir]
- (let [buffer (editor.build/scratch-buffer-tab "tmp")]
+ (let [buffer (editor.build/scratch-buffer-tab "sketchpad-tmp")]
(init-buffer-tab-state buffer)
(sketchpad.project/add-buffer-to-app buffer)
(tab/show-buffer buffer))))
View
6 src/sketchpad/editor/build.clj
@@ -15,7 +15,6 @@
[sketchpad.util.utils :as utils]
[sketchpad.project.project :as sketchpad.project]
[sketchpad.editor.component :as editor.component]
- [sketchpad.editor.quil-component :as editor.quil-component]
[sketchpad.editor.info-utils :as editor.info-utils]
[sketchpad.menu.view :as sketchpad.menu.view]
[sketchpad.file.file :as file]))
@@ -92,13 +91,16 @@
tab-state (get buffer-component :state)
uuid (.. UUID randomUUID toString)
buffer { :type :buffer
+
:text-area text-area
:title (:title buffer-component)
:label (:label buffer-component)
- :file (atom nil)
:container container
+ :file (atom nil)
+
:state tab-state
:new-file? (atom true)
+
:component buffer-component
:project project-path
:uuid uuid}]
View
11 src/sketchpad/editor/editor.clj
@@ -4,14 +4,23 @@
[sketchpad.system.desktop])
(:require [sketchpad.editor.ui :as editor.ui]
[sketchpad.tree.popup :as popup]
+ [sketchpad.project.project :as sketchpad.project]
[sketchpad.editor.info-utils :as editor.info-utils]
- [sketchpad.state.state :as state])
+ [sketchpad.state.state :as state]
+ [sketchpad.util.tab :as tab])
(:import (javax.swing UIManager)))
(defn put [laf k v]
(.put laf (str "TabbedPane." k) v))
(defn tab-change-handler [buffer-tabbed-panel]
+
+ ; (listen buffer-tabbed-panel :selection
+ ; (fn [e]
+ ; (let [buffer (tab/current-buffer)]
+ ; (if-let[buffer-project (sketchpad.project/project-by-name (:project buffer))]
+ ; (reset! (:last-active-buffer buffer-project) buffer)))))
+
(listen buffer-tabbed-panel :selection editor.info-utils/update-doc-title-label!)
(listen buffer-tabbed-panel :selection editor.info-utils/update-doc-position-label!))
View
9 src/sketchpad/editor/info_utils.clj
@@ -2,6 +2,7 @@
(:use [seesaw core])
(:require [sketchpad.state.state :as state]
[sketchpad.util.tab :as tab]
+ [sketchpad.tree.utils :as tree.utils]
[sketchpad.state.state :as state]))
(defn format-position-str [line column]
@@ -29,8 +30,12 @@
"Update the currently displayed doc title in the info panel"
[e]
(if (tab/tabs?)
- (config! (:doc-title-label @state/app) :text (tab/title))
- (config! (:doc-title-label @state/app) :text "")))
+ (invoke-later
+ (config! (:doc-title-label @state/app) :text (tab/title))
+ (when @(:file (tab/current-buffer))
+ (tree.utils/set-tree-selection (.getAbsolutePath @(:file (tab/current-buffer))))))
+ (invoke-later
+ (config! (:doc-title-label @state/app) :text ""))))
(defn attach-caret-handler [text-area]
(listen text-area :caret-update update-doc-position-label!))
View
4 src/sketchpad/editor/tab.clj
@@ -55,10 +55,12 @@
(.setFocusable false))
button)))
+
+
(defn button-tab
[buffer]
(let [button (tab-button buffer)
- label (label :text @(:title buffer)
+ label (label :text @(get-in buffer [:component :title])
:foreground (color :white)
:focusable? false
:font (font/font "MENLO-12"))
View
8 src/sketchpad/menu/file.clj
@@ -44,8 +44,9 @@
(do
(when (file/save-file! buffer)
(tab/mark-current-tab-clean!))))
- (when (= @(:title buffer) "project.clj")
- (project/update-lein-project! (project/project-from-buffer buffer))))))
+ (when (= @(get-in buffer [:component :title]) "project.clj")
+ (project/update-lein-project! (project/project-from-buffer buffer)))
+ (tree.utils/update-tree))))
(defn save-as
"Open the save as dialog for the current buffer."
@@ -57,7 +58,8 @@
(when-let[new-file (file/save-file-as!)]
(when @(:new-file? buffer)
(reset! (:new-file? buffer) false)
- (reset! (:title buffer) (.getName new-file)))))))
+ (reset! (:title buffer) (.getName new-file))))
+ (tree.utils/update-tree))))
(defn new-project
"Create a new Leiningen project."
View
2 src/sketchpad/menu/project.clj
@@ -79,5 +79,5 @@
(seesaw/separator)
(seesaw.core/menu-item :text "Clear All Projects"
:mnemonic "C"
- :listen [:action (fn [_] (tree.utils/clear-projects))])]))
+ :listen [:action (fn [_] (clear-projects))])]))
View
40 src/sketchpad/menu/source.clj
@@ -1,10 +1,12 @@
(ns sketchpad.menu.source
- (:require [seesaw.core :as seesaw]
- [seesaw.keystroke :as keystroke]
- [sketchpad.buffer.action :as buffer.action]
- [sketchpad.repl.print :as sketchpad.repl.print]
- [sketchpad.util.tab :as tab]
- [sketchpad.buffer.spell-check :as spell-check]))
+ (:use [clojure.java.shell])
+ (:require [seesaw.core :as seesaw]
+ [seesaw.keystroke :as keystroke]
+ [sketchpad.buffer.action :as buffer.action]
+ [sketchpad.repl.print :as sketchpad.repl.print]
+ [sketchpad.util.tab :as tab]
+ [sketchpad.buffer.spell-check :as spell-check]
+ [sketchpad.state.state :as state]))
@@ -46,6 +48,17 @@
(spell-check/remove-english-spell-checker text-area)
(.repaint text-area)))
+(defn grep-files
+"Grep the current projects or a given path."
+ ([search-term] (:out (apply sh "grep" "-nir" "-I" search-term (keys @(:projects @state/app)))))
+ ([search-term & opts]
+ (:out (apply sh "grep" "-nir" "-I" search-term opts))))
+
+(defn grep-cmd
+"Focus the editor REPL and create a search function."
+([]
+ (sketchpad.repl.print/append-command (str "(grep \"\")") -2)
+ (tab/focus-application-repl)))
(defn make-source-menu-items []
{:search (seesaw.core/menu-item :text "Search..."
@@ -71,7 +84,11 @@
:remove-spell-check (seesaw.core/menu-item :text "Remove Spell Checker"
:mnemonic "S"
:key (keystroke/keystroke "meta alt S")
- :listen [:action (fn [_] (remove-spell-check))])})
+ :listen [:action (fn [_] (remove-spell-check))])
+ :grep (seesaw.core/menu-item :text "Grep project or path..."
+ :mnemonic "G"
+ :key (keystroke/keystroke "meta G")
+ :listen [:action (fn [_] (grep-cmd))])})
(defn make-source-menu
[]
@@ -83,7 +100,10 @@
(menu-items :search-replace)
(menu-items :search-replace-all)
(seesaw.core/separator)
- (menu-items :toggle-comment)
+ (menu-items :grep)
(seesaw.core/separator)
- (menu-items :add-spell-check)
- (menu-items :remove-spell-check)])))
+ (menu-items :toggle-comment)
+ ; (seesaw.core/separator)
+ ; (menu-items :add-spell-check)
+ ; (menu-items :remove-spell-check)
+ ])))
View
2 src/sketchpad/menu/view.clj
@@ -71,7 +71,7 @@
(if (@current-tab-state :clean)
(tab/close-tab) ;; nothing has changed, just close.
(do
- (let [answer (option-windows/close-or-save-current-dialogue @(:title buffer))]
+ (let [answer (option-windows/close-or-save-current-dialogue @(get-in buffer [:component :title]))]
(cond
(= answer 0) ;; answered yes to save
(do
View
4 src/sketchpad/project/form.clj
@@ -15,7 +15,7 @@
(defn project-creation-form
[]
(let [project-path-str (str (.getAbsoluteFile (java.io.File. config/project-path)) "/")
- repo-text-area (rsyntax/text-area :columns 200
+ repo-text-area (rsyntax/text-area :columns 200
:id :project-form-dependencies
:listen [:component-resized re-pack!])
project-title (text :id :project-form-project)
@@ -36,7 +36,7 @@
(config! version-number :text "0.0.1-SNAPSHOT")
(config! project-path :text project-path-str)
(config! project-description :text "FIXME: write")
- (config! repo-text-area :text "[org.clojure/clojure \"1.3.0\"]\n")
+ (config! repo-text-area :text "[org.clojure/clojure \"1.4.0\"]\n")
(.setCaretPosition repo-text-area (.getLastVisibleOffset repo-text-area))
(install-clojars-auto-completions repo-text-area)
form))
View
5 src/sketchpad/project/project.clj
@@ -56,7 +56,9 @@
:id id
:theme theme
; :completion-provider (auto-complete/build-project-completion-provider project-path)
- :repls (atom {})
+ :repls (atom {})
+ :last-focused-repl (atom nil)
+ :last-focused-buffer (atom nil)
:buffers (atom {})})))
(if (lein-project-file? project-path)
(try
@@ -80,6 +82,7 @@
(reset! (:project-set @state/app) (sorted-set)))
(defn clear-projects []
+ (clear-project-set)
(reset! (:projects @state/app) {}))
(defn setup-non-project-map []
View
4 src/sketchpad/repl/app/component.clj
@@ -8,7 +8,8 @@
[sketchpad.config.config :as config.config]
[sketchpad.buffer.action :as buffer.action]
[sketchpad.repl.app.sketchpad-repl :as app.sketchpad-repl])
- (:import (java.util.concurrent LinkedBlockingDeque)
+ (:import (java.util UUID)
+ (java.util.concurrent LinkedBlockingDeque)
(org.fife.ui.rtextarea RTextScrollPane)))
(defn- sketchpad-reader [q prompt exit]
@@ -52,6 +53,7 @@
:component {:container repl-container :text-area text-area :scroller repl-in-scroll-pane}
:title repl-title
:history repl-history
+ :uuid (.. UUID randomUUID toString)
:que repl-que
:tab tab}]
(meta/put-meta! text-area :repl-history repl-history)
View
37 src/sketchpad/repl/app/repl.clj
@@ -20,6 +20,7 @@
(:require [clojure.string :as string]
[sketchpad.rsyntax :as rsyntax]
[clojure.java.io :as io]
+ [sketchpad.project.project :as sketchpad.project]
[sketchpad.config.config :as config]
[sketchpad.buffer.action :as buffer.action]
[sketchpad.editor.ui :as editor.ui]
@@ -32,8 +33,7 @@
[sketchpad.repl.tab :as repl.tab]
[sketchpad.repl.app.component :as repl.app.component]
[leiningen.core.project :as lein])
- (:import
- (java.io.IOException)))
+ (:import (java.io.IOException)))
(use 'clojure.java.javadoc)
@@ -109,7 +109,7 @@
(defn update-repl-history [app]
(swap! (:items repl-history) replace-first
- (get-text-str (app :application-repl))))
+ (get-text-str (app :application-repl))))
(defn scroll-to-last [text-area]
(.scrollRectToVisible text-area
@@ -155,12 +155,28 @@
(attach-action-keys ta-in ["control UP" prev-hist]
["control DOWN" next-hist])))
- (defn attach-tab-change-handler [repl-tabbed-panel]
- (listen repl-tabbed-panel :selection
- (fn [e]
- (let [num-tabs (tab-count repl-tabbed-panel)]
- (if (> 0 num-tabs)
- (swap! state/app assoc :doc-title-atom (current-editor-buffer repl-tabbed-panel)))))))
+(defn update-last-repl
+ [e]
+ (when-let [repl (current-repl)]
+
+ (println "REPL: ")
+ (println repl)
+
+ (let [project (:project repl)]
+
+ (println project)
+
+ ; (reset!
+ ; (:last-focused-repl (sketchpad.project/get-project project)) repl)
+ )))
+
+(defn attach-tab-change-handler [repl-tabbed-panel]
+ (listen repl-tabbed-panel :selection update-last-repl)
+ (listen repl-tabbed-panel :selection
+ (fn [e]
+ (let [num-tabs (tab-count repl-tabbed-panel)]
+ (when (> 0 num-tabs)
+ (swap! state/app assoc :doc-title-atom (current-repl)))))))
(defn init-repl-tabbed-panel [repl-tabbed-panel repl]
(let [text-area (get-in repl [:component :text-area])
@@ -174,7 +190,7 @@
(auto-complete/install-auto-completion text-area)
(config! scroller :background config/app-color)
(config/apply-repl-prefs! text-area)
- (send-to-application-repl text-area "(require 'sketchpad.user)(in-ns 'sketchpad.user)")))
+ (send-to-application-repl text-area "(require 'sketchpad.user)\n(in-ns 'sketchpad.user)")))
(defn repl-tabbed-panel
[]
@@ -192,3 +208,4 @@
:component {:container repl-tabbed-panel}
:application-repl application-repl}))
+
View
2 src/sketchpad/repl/server.clj
@@ -50,8 +50,6 @@
(nrepl.ack/reset-ack-port!)
(let [prepped (promise)
project (:lein-project sketchpad-project)]
- (println "Creating repl server for lein project: ")
- (clojure.pprint/pprint project)
(.start
(Thread.
(bound-fn []
View
22 src/sketchpad/user.clj
@@ -8,13 +8,12 @@
[sketchpad.buffer.action]
[sketchpad.util.brackets]
[sketchpad.system.desktop]
- [sketchpad.auto-complete.template]
- [clojure.java.shell])
+ [sketchpad.auto-complete.template])
(:require [sketchpad.util.tab :as tab]
[sketchpad.wrapper.rsyntaxtextarea :as rsta]
[sketchpad.core :as core]
- ; [sketchpad.buffer.action :as buffer]
[sketchpad.wrapper.gutter :as gutter]
+ [sketchpad.menu.source :as source]
[sketchpad.buffer.search :as search]
[sketchpad.project.project :as project]
[sketchpad.project.form :as project.form]
@@ -313,6 +312,11 @@
[]
(tab/current-buffer))
+(defn current-repl
+"Returns the map of the current project repl if one is open."
+ []
+ (tab/current-repl))
+
(defn current-text-area []
"Returns the current text area."
(get-in (current-buffer) [:component :text-area]))
@@ -395,13 +399,7 @@
cur-token (org.fife.ui.rsyntaxtextarea.RSyntaxUtilities/getTokenAtOffset token dot)]
cur-token))
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; Grep
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
(defn grep
-"Grep a path."
- ([search-term] (grep search-term "projects/"))
- ([search-term path]
- (doall
- (apply println (clojure.string/split (:out (sh "grep" "-nri" search-term path)) #"\n")))))
+"Grep the current projects or a given the given paths."
+ ([search-term] (source/grep-files search-term))
+ ([search-term & args] (source/grep-files search-term args)))
View
8 src/sketchpad/util/option_windows.clj
@@ -15,6 +15,14 @@
JOptionPane/YES_NO_CANCEL_OPTION)]
answer))
+(defn close-or-save-application-dialogue [title]
+ (when-let [answer (JOptionPane/showConfirmDialog
+ nil
+ (str "Do you want to save the open buffers?" title)
+ "Unsaved Changes"
+ JOptionPane/YES_NO_CANCEL_OPTION)]
+ answer))
+
(defn close-repl-dialogue []
(when-let [answer (JOptionPane/showConfirmDialog
nil
View
8 src/sketchpad/util/tab.clj
@@ -279,7 +279,7 @@
(focus (get-in buffer [:component :text-area]))))
(defn add-buffer [buffer]
- (add-tab! @(:title buffer) (:container buffer)))
+ (add-tab! @(get-in buffer [:component :title]) (:container buffer)))
(defn buffer-tab-component! [buffer]
(.setTabComponentAt (get-in (:buffer-tabbed-panel @state/app) [:component :container]) (index-of-buffer buffer) (get-in buffer [:tab :container])))
@@ -319,7 +319,11 @@
(get-meta (current-repl-text-area) :uuid))
(defn current-repl []
- (first (filter #(= (get-repl-uuid) (:uuid %)) (mapcat :repls @(:projects @state/app)))))
+ (mapcat :repls (vals @(:projects @state/app))))
+
+(defn current-repl
+ []
+ (second (mapcat #(deref (:repls %)) (vals @(:projects @state/app)))))
(defn current-buffer
([]

0 comments on commit 4cd0f7d

Please sign in to comment.