Skip to content

Commit

Permalink
new shortcut to interpret small pieces of code
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Gabriel Alzate Romero committed Nov 15, 2010
1 parent d54da22 commit 95716c2
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions startup.scd
Original file line number Diff line number Diff line change
Expand Up @@ -156,33 +156,48 @@ SCMenuItem(menuLayout, "Layout > LC")
})
.setShortCut("p", true, true);

SCMenuItem(menuTools, "Interpret All")
.action_({
var selectionStart = Document.current.selectionStart;
var selectionSize = Document.current.selectionSize;
Document.current.balanceParens(inf).selectedString.interpret;
Document.current.selectRange(selectionStart, selectionSize);
})
.setShortCut("x", true, true);

SCMenuItem(menuTools, "Balance All")
.action_({
Document.current.balanceParens(inf);
})
.setShortCut("x", false, true);

SCMenuSeparator(menuTools, 5); // add a separator
SCMenuSeparator(menuTools, 9); // add a separator

SCMenuItem(menuTools, "Search Documentation")
.action_({
var w = Window.new(" ??? ", Rect(500, 500, 150, 30), false).front;
TextField(w, Rect(10, 5, 130, 16))
.focus(true)
.action_({arg view;
.action_({ |view|
view.string.openHelpFile;
w.close;
});
})
.setShortCut("o", true, false);

SCMenuItem(menuTools, "Interpret All")
SCMenuItem(menuTools, "Interpret Box")
.action_({
var selectionStart = Document.current.selectionStart;
var selectionSize = Document.current.selectionSize;
Document.current.balanceParens(inf).selectedString.interpret;
Document.current.selectRange(selectionStart, selectionSize);
var w = Window.new(">>> interpret <<<", Rect(500, 500, 300, 30), false).front;
TextField(w, Rect(10, 5, 280, 16))
.focus(true)
.action_({ |view|
view.string.interpret;
w.close;
});
})
.setShortCut("x", true, true);
.setShortCut("i", true, false);

SCMenuItem(menuTools, "Balance All")
.action_({
Document.current.balanceParens(inf);
})
.setShortCut("x", false, true);

////////////////SERVERS///////////////////////////
s = Server.default;
Expand Down

0 comments on commit 95716c2

Please sign in to comment.