diff options
Diffstat (limited to 'js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js')
-rw-r--r-- | js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js new file mode 100644 index 00000000..07561580 --- /dev/null +++ b/js/code-editor/ui/code-editor-view-options.reel/code-editor-view-options.js | |||
@@ -0,0 +1,90 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | //////////////////////////////////////////////////////////////////////// | ||
8 | // | ||
9 | var Montage = require("montage/core/core").Montage, | ||
10 | Component = require("montage/ui/component").Component; | ||
11 | |||
12 | var CodeEditorViewOptions = exports.CodeEditorViewOptions = Montage.create(Component, { | ||
13 | hasReel: { | ||
14 | value: true | ||
15 | }, | ||
16 | |||
17 | prepareForDraw: { | ||
18 | value: function() { | ||
19 | Object.defineBinding(this.codeCompleteCheck , "checked", { | ||
20 | boundObject: this.application.ninja.codeEditorController, | ||
21 | boundObjectPropertyPath: "automaticCodeComplete", | ||
22 | oneway : false | ||
23 | }); | ||
24 | |||
25 | Object.defineBinding(this.zoomHottext , "value", { | ||
26 | boundObject: this.application.ninja.codeEditorController, | ||
27 | boundObjectPropertyPath: "zoomFactor", | ||
28 | oneway : false | ||
29 | }); | ||
30 | |||
31 | } | ||
32 | }, | ||
33 | |||
34 | willDraw: { | ||
35 | enumerable: false, | ||
36 | value: function() {} | ||
37 | }, | ||
38 | draw: { | ||
39 | enumerable: false, | ||
40 | value: function() {} | ||
41 | }, | ||
42 | didDraw: { | ||
43 | enumerable: false, | ||
44 | value: function() { | ||
45 | //this.format.addEventListener("click", this.handleFormat.bind(this), false); | ||
46 | this.comment.addEventListener("click", this.handleComment.bind(this), false); | ||
47 | this.uncomment.addEventListener("click", this.handleUncomment.bind(this), false); | ||
48 | this.themeSelect.addEventListener("change", this.handleThemeSelection.bind(this), false); | ||
49 | this.shortKeys.addEventListener("click", this.handleShortKeys.bind(this), false); | ||
50 | } | ||
51 | }, | ||
52 | |||
53 | handleFormat:{ | ||
54 | value: function(evt){ | ||
55 | this.application.ninja.codeEditorController.autoFormatSelection(); | ||
56 | } | ||
57 | }, | ||
58 | handleComment:{ | ||
59 | value: function(evt){ | ||
60 | this.application.ninja.codeEditorController.commentSelection(true); | ||
61 | } | ||
62 | }, | ||
63 | |||
64 | handleUncomment:{ | ||
65 | value: function(evt){ | ||
66 | this.application.ninja.codeEditorController.commentSelection(false); | ||
67 | } | ||
68 | }, | ||
69 | |||
70 | handleThemeSelection:{ | ||
71 | value: function(evt){ | ||
72 | this.application.ninja.codeEditorController.editorTheme = this.themeSelect.options[this.themeSelect.selectedIndex].value; | ||
73 | this.application.ninja.codeEditorController.handleThemeSelection(); | ||
74 | } | ||
75 | }, | ||
76 | |||
77 | handleShortKeys:{ | ||
78 | value:function(evt){ | ||
79 | var list = this.shortKeys.querySelector(".list"); | ||
80 | if(list && list.classList.contains("hide")){ | ||
81 | list.classList.remove("hide"); | ||
82 | list.classList.add("show"); | ||
83 | }else if(list && list.classList.contains("show")){ | ||
84 | list.classList.remove("show"); | ||
85 | list.classList.add("hide"); | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | |||
90 | }); \ No newline at end of file | ||