1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
function PLOT_CONFIG()
{
this.plot_mode = null;
}
function PLOT(plot_sel_id)
{
this.cfg = new PLOT_CONFIG();
this.plotsel = new SELECT(plot_sel_id, plotUpdatePlotMode, this);
this.updater = null;
this.config = null;
}
PLOT.prototype.AttachConfig = function(config) {
this.config = config;
config.Register(this);
}
PLOT.prototype.Init = function(updater, opts) {
if (typeof opts == "undefined") opts = new Object;
this.updater = updater;
opts.reload = true;
opts.confirm = true;
this.Update(opts);
}
PLOT.prototype.SetPlot = function(val) {
this.Update(new Object({ 'plot_mode': val, 'apply': true}));
}
PLOT.prototype.ReadConfig = function(opts) {
if (this.config) {
var opts = new Object(/*{'apply': true}*/);
if (this.config.cfg.plot_mode)
opts.plot_mode = this.config.cfg.plot_mode;
this.Update(opts);
}
}
PLOT.prototype.Update = function(opts) {
if (opts) {
if (opts.reload) {
this.plotsel.Update(adei.GetSelectService("plot_modes"), opts, opts?opts.plot_mode:null);
} else {
if (opts.plot_mode) {
this.UpdatePlotMode(opts.plot_mode, opts);
if (this.plotsel.GetValue() != opts.plot_mode)
this.plotsel.SetValue(opts.plot_mode);
}
}
}
}
PLOT.prototype.UpdatePlotMode = function(val, opts)
{
this.cfg.plot_mode = val;
if ((typeof opts == "undefined")||(opts.apply))
this.Apply(val);
}
PLOT.prototype.Apply = function(plot_mode) {
if (plot_mode)
this.config.SetPlotSettings(plot_mode);
else
this.config.SetPlotSettings(this.cfg.plot_mode);
this.config.Save();
if (this.updater) this.updater.Update();
}
function plotUpdatePlotMode(self, val, opts)
{
return self.UpdatePlotMode(val, opts);
}
|