Mercurial > hg > ltpda
comparison m-toolbox/classes/@LTPDAprefs/setPreference.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % SETPREFERENCE A static method which sets a new value to the specified preference. | |
2 % | |
3 % Call: LTPDAprefs.setPreference(category, property, value) | |
4 % | |
5 % Parameters: | |
6 % category - Category of the preference | |
7 % property - Property of the preference | |
8 % value - new value | |
9 % | |
10 % Version: | |
11 % $Id: setPreference.m,v 1.4 2011/04/09 17:04:22 hewitson Exp $ | |
12 % | |
13 | |
14 function setPreference(category, property, value) | |
15 prefs = getappdata(0, 'LTPDApreferences'); | |
16 if isempty(prefs) | |
17 error('### No LTPDA Preferences found in memory. Please run ltpda_startup.'); | |
18 end | |
19 | |
20 switch category | |
21 | |
22 case 'display' | |
23 cprefs = prefs.getDisplayPrefs; | |
24 switch property | |
25 case 'verboseLevel' | |
26 cprefs.setDisplayVerboseLevel(java.lang.Integer(value)); | |
27 displayValueSet(category, property, double(cprefs.getDisplayVerboseLevel)); | |
28 case 'wrapstrings' | |
29 cprefs.setDisplayWrapStrings(java.lang.Integer(value)); | |
30 displayValueSet(category, property, double(cprefs.getDisplayWrapStrings)); | |
31 otherwise | |
32 help LTPDAprefs | |
33 error('Unknown property [%s] for category [%s]', property, category); | |
34 end | |
35 | |
36 case 'plot' | |
37 pprefs = prefs.getPlotPrefs; | |
38 switch property | |
39 case 'axesFontSize' | |
40 pprefs.setPlotDefaultAxesFontSize(java.lang.Integer(value)); | |
41 displayValueSet(category, property, double(pprefs.getPlotDefaultAxesFontSize)); | |
42 case 'axesFontWeight' | |
43 pprefs.setPlotDefaultAxesFontWeight(value); | |
44 displayValueSet(category, property, char(pprefs.getPlotDefaultAxesFontWeight)); | |
45 case 'axesLineWidth' | |
46 pprefs.setPlotDefaultAxesLineWidth(java.lang.Integer(value)); | |
47 displayValueSet(category, property, double(pprefs.getPlotDefaultAxesLineWidth)); | |
48 case 'lineLineWidth' | |
49 pprefs.setPlotDefaultLineLineWidth(java.lang.Integer(value)); | |
50 displayValueSet(category, property, double(pprefs.getPlotDefaultLineLineWidth)); | |
51 case 'lineMarkerSize' | |
52 pprefs.setPlotDefaultLineMarkerSize(java.lang.Integer(value)); | |
53 displayValueSet(category, property, double(pprefs.getPlotDefaultLineMarkerSize)); | |
54 case 'gridStyle' | |
55 pprefs.setPlotDefaultAxesGridLineStyle(value); | |
56 displayValueSet(category, property, char(pprefs.getPlotDefaultAxesGridLineStyle)); | |
57 case 'minorGridStyle' | |
58 pprefs.setPlotDefaultAxesMinorGridLineStyle(value); | |
59 displayValueSet(category, property, char(pprefs.getPlotDefaultAxesMinorGridLineStyle)); | |
60 case 'legendFontSize' | |
61 pprefs.setPlotDefaultLegendFontSize(java.lang.Integer(value)); | |
62 displayValueSet(category, property, char(pprefs.getPlotDefaultLegendFontSize)); | |
63 case 'includeDescription' | |
64 pprefs.setPlotDefaultIncludeDescription(java.lang.Boolean(value)); | |
65 displayValueSet(category, property, char(pprefs.getPlotDefaultIncludeDescription)); | |
66 otherwise | |
67 help LTPDAprefs | |
68 error('Unknown property [%s] for category [%s]', property, category); | |
69 end | |
70 | |
71 | |
72 case 'time' | |
73 tprefs = prefs.getTimePrefs; | |
74 switch property | |
75 case 'timezone' | |
76 tprefs.setTimeTimezone(value); | |
77 displayValueSet(category, property, char(tprefs.getTimeTimezone)); | |
78 case 'timeformat' | |
79 tprefs.setTimestringFormat(value); | |
80 displayValueSet(category, property, char(tprefs.getTimestringFormat)); | |
81 otherwise | |
82 help LTPDAprefs | |
83 error('Unknown property [%s] for category [%s]', property, category); | |
84 end | |
85 | |
86 case 'misc' | |
87 mprefs = prefs.getMiscPrefs; | |
88 switch property | |
89 case 'default_window' | |
90 mprefs.setDefaultWindow(value); | |
91 displayValueSet(category, property, char(mprefs.getDefaultWindow)); | |
92 otherwise | |
93 help LTPDAprefs | |
94 error('Unknown property [%s] for category [%s]', property, category); | |
95 end | |
96 | |
97 otherwise | |
98 help LTPDAprefs | |
99 error('Unknown preference category %s', category) | |
100 end | |
101 | |
102 function displayValueSet(category, property, value) | |
103 if ischar(value) | |
104 fprintf('* set %s/%s to [%s]\n', category, property, value); | |
105 else | |
106 fprintf('* set %s/%s to [%d]\n', category, property, value); | |
107 end | |
108 end | |
109 | |
110 end |