Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
escape-strings.ui: Add proof of concept ui for escape-strings.
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Doug Coleman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
! Copyright (C) 2019 Doug Coleman. | ||
! See http://factorcode.org/license.txt for BSD license. | ||
USING: accessors documents escape-strings io kernel sequences ui | ||
ui.gadgets ui.gadgets.editors ui.gadgets.tracks ui.gestures ; | ||
IN: escape-strings.ui | ||
|
||
TUPLE: escape-string-editor < source-editor ; | ||
|
||
: <escape-string-editor> ( -- editor ) | ||
escape-string-editor new-editor ; inline | ||
|
||
M: escape-string-editor handle-gesture | ||
[ call-next-method ] 2keep | ||
nip parent>> children>> first3 | ||
[ model>> doc-string ] 2dip | ||
[ drop [ number-escape-string ] dip model>> set-doc-string ] | ||
[ nip [ escape-string ] dip model>> set-doc-string ] 3bi ; | ||
: run-escape-string-editor ( -- ) | ||
[ | ||
vertical <track> | ||
! { 450 500 } >>pref-dim | ||
{ 450 500 } >>dim | ||
|
||
<escape-string-editor> | ||
! { 450 500 } >>pref-dim | ||
{ 450 500 } >>dim | ||
1/3 track-add | ||
|
||
<escape-string-editor> | ||
{ 900 1000 } >>pref-dim | ||
1/3 track-add | ||
|
||
<escape-string-editor> | ||
{ 900 1000 } >>pref-dim | ||
1/3 track-add | ||
|
||
"escape-string editor" open-window | ||
] with-ui ; | ||
|
||
MAIN: run-escape-string-editor |