move old files into a directory for reference
[webos-internals:applications.git] / org.webosinternals.terminal / old / app / controllers / prefs-assistant.js
1 var PrefsAssistant = Class.create( {
2         setup: function() {
3                 this.fontChoices = [
4                         {label: 'Normal', value: 'normal'},
5                         {label: 'Small', value: 'small'}
6                 ];
7                 this.fontModel = {
8                         value: 'small',
9                         disabled: false
10                 };
11                 if (Prefs.fontWidth==8) {
12                         this.fontModel.value = 'normal';
13                 }
14                 else {
15                         this.fontModel.value = 'small';
16                 }
17                 this.controller.setupWidget(
18                         'fontSelector',
19                         {
20                                 label: "Size",
21                                 choices: this.fontChoices,
22                         },
23                         this.fontModel
24                 );
25                 fontSelector = this.controller.get('fontSelector');
26                 Mojo.Event.listen(fontSelector, Mojo.Event.propertyChange, this.updateFont.bind(this))
27
28
29                 this.colorChoices = [
30                         {label: 'Black',   value:0},
31                         {label: 'Red',     value:1},
32                         {label: 'Green',   value:2},
33                         {label: 'Yellow',  value:3},
34                         {label: 'Blue',    value:4},
35                         {label: 'Magenta', value:5},
36                         {label: 'Cyan',    value:6},
37                         {label: 'White',   value:7}
38                         ];
39
40
41                 this.bgColorModel = { value: Prefs.bgColor, disabled: false };
42                 this.controller.setupWidget('bgColorSelector',  { label: "Background", choices: this.colorChoices, }, this.bgColorModel);
43                 bgColorSelector = this.controller.get('bgColorSelector');
44                 Mojo.Event.listen(bgColorSelector, Mojo.Event.propertyChange, this.updateBgColor.bind(this));
45
46                 this.fgColorModel = { value:Prefs.fgColor, disabled: false };
47                 this.controller.setupWidget('fgColorSelector',  { label: "Foreground", choices: this.colorChoices, }, this.fgColorModel);
48                 fgColorSelector = this.controller.get('fgColorSelector');
49                 Mojo.Event.listen(fgColorSelector, Mojo.Event.propertyChange, this.updateFgColor.bind(this));
50         },
51         updateFont: function(event) {
52                 if (this.fontModel.value=='normal') {
53                         Prefs.fontWidth=8;
54                         Prefs.fontHeight=8;
55                 }
56                 else {
57                         Prefs.fontWidth=4;
58                         Prefs.fontHeight=6;
59                 }
60         },
61                 updateBgColor: function(event) {
62                         Prefs.bgColor = this.bgColorModel.value;
63         },
64                 updateFgColor: function(event) {
65                         Prefs.fgColor = this.fgColorModel.value;
66         },
67 });
68