]> gitweb.factorcode.org Git - factor.git/commitdiff
editors: Add a MAIN-WINDOW: to editors to easily reload editors.
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 12 Jul 2018 02:41:46 +0000 (21:41 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 12 Jul 2018 02:41:46 +0000 (21:41 -0500)
basis/editors/editors.factor

index 5efafdbb7e4d3e17126ff10b143cd70fca0ebb0a..741357a2a6587512c14633b14e11ef93ebc2f10f 100644 (file)
@@ -1,9 +1,11 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors assocs calendar continuations debugger
-definitions io io.launcher io.pathnames kernel namespaces
+definitions fry io io.launcher io.pathnames kernel namespaces
 prettyprint sequences source-files.errors splitting strings
-threads tools.crossref vocabs vocabs.files vocabs.hierarchy
+threads tools.crossref ui ui.gadgets ui.gadgets.borders
+ui.gadgets.buttons ui.gadgets.packs ui.gadgets.scrollers
+ui.tools.listener vocabs vocabs.files vocabs.hierarchy
 vocabs.loader vocabs.metadata words ;
 IN: editors
 
@@ -126,3 +128,13 @@ M: word edit-tests vocabulary>> edit-tests ;
 
 : edit-summary ( vocab -- )
     dup vocab-summary-path vocab-append-path 1 edit-location ;
+
+: <reload-editor-button> ( editor -- button )
+    dup '[ drop [ _ reload ] \ run call-listener ] <border-button> ;
+
+: <editor-reloader> ( -- gadget )
+    <filled-pile> { 2 2 } >>gap available-editors
+    [ <reload-editor-button> add-gadget ] each ;
+
+MAIN-WINDOW: editor-window { { title "Editors" } }
+    <editor-reloader> { 2 2 } <border> <scroller> >>gadgets ;