summaryrefslogtreecommitdiff
path: root/src/www/syntax-editor/editor_menu.js
diff options
context:
space:
mode:
authorjohn.j.camilleri <john.j.camilleri@chalmers.se>2012-12-07 15:32:31 +0000
committerjohn.j.camilleri <john.j.camilleri@chalmers.se>2012-12-07 15:32:31 +0000
commit953b6b573ac9094f2152139ea349c14ef167a638 (patch)
tree66c2b1ae8041e5e9a84786604c9b399edc762440 /src/www/syntax-editor/editor_menu.js
parentc4931fccaf6ae5ed2c6d164f53f13d5d55c76a72 (diff)
Syntax editor: change startcat when wrapping top node
Diffstat (limited to 'src/www/syntax-editor/editor_menu.js')
-rw-r--r--src/www/syntax-editor/editor_menu.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/www/syntax-editor/editor_menu.js b/src/www/syntax-editor/editor_menu.js
index b5ceedd77..2b9ee8d59 100644
--- a/src/www/syntax-editor/editor_menu.js
+++ b/src/www/syntax-editor/editor_menu.js
@@ -109,6 +109,7 @@ function EditorMenu(editor,opts) {
/* --- Register Grammar Manager hooks ----------------------------------- */
this.gm.register_action("onload", bind(this.hook_onload, this));
this.gm.register_action("change_grammar", bind(this.hook_change_grammar, this));
+ this.gm.register_action("change_startcat", bind(this.hook_change_startcat, this));
}
@@ -143,16 +144,11 @@ EditorMenu.prototype.hook_onload=function(dir,grammar_names,dir_count) {
}
// Copied from minibar.js
-EditorMenu.prototype.hook_change_grammar=function() {
+EditorMenu.prototype.hook_change_grammar=function(grammar) {
debug("EditorMenu: change grammar");
var t=this;
- var grammar_url = t.ui.grammar_menu.value;
- t.server.switch_to_other_grammar(grammar_url, function() {
- t.server.grammar_info(function(grammar){
- t.update_startcat_menu(grammar);
- t.update_language_menu(t.ui.to_menu, grammar);
- });
- });
+ t.update_startcat_menu(grammar);
+ t.update_language_menu(t.ui.to_menu, grammar);
}
/* --- Start category menu -------------------------------------------------- */
@@ -171,6 +167,14 @@ EditorMenu.prototype.update_startcat_menu=function(grammar) {
menu.value = grammar.startcat;
}
+// If startcat changed externally, update menu
+EditorMenu.prototype.hook_change_startcat=function(startcat) {
+ debug("EditorMenu: change startcat");
+ var t=this;
+ var menu=this.ui.startcat_menu;
+ menu.value = startcat;
+}
+
/* --- Langugage (to) menu -------------------------------------------------- */
// Called from hook_change_grammar