comparison m-toolbox/classes/@LTPDAprefs/LTPDAprefs.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 % LTPDAprefs is a graphical user interface for editing LTPDA preferences.
2 %
3 % CALL: LTPDAprefs
4 % LTPDAprefs(h) % build the preference panel in the figure with handle, h.
5 %
6 % LTPDAprefs(cat, property, value) % Set the temporary value of a property
7 %
8 % Category and property names are case sensitive.
9 %
10 % The properties that can be set are
11 %
12 % Category | Property | Description
13 % -------------------------------------------------------------------------
14 % display | verboseLevel | Set the level of terminal output from LTPDA
15 % | | (see "help utils.const.msg" for
16 % | | supported levels).
17 % -------------------------------------------------------------------------
18 % | wrapstrings | Set the point where strings are wrapped in
19 % | | some methods of LTPDA.
20 % -------------------------------------------------------------------------
21 % plot | axesFontSize | Set the font size for new plot axes
22 % -------------------------------------------------------------------------
23 % | axesFontWeight | Set the font weight for new plot axes
24 % -------------------------------------------------------------------------
25 % | axesLineWidth | Set the line width for new plot axes
26 % -------------------------------------------------------------------------
27 % | lineLineWidth | Set the line width for new traces
28 % -------------------------------------------------------------------------
29 % | lineMarkerSize | Set the marker size for new traces
30 % -------------------------------------------------------------------------
31 % | gridStyle | Set the grid line style for new axes
32 % -------------------------------------------------------------------------
33 % | minorGridStyle | Set the minor-grid line style for new axes
34 % -------------------------------------------------------------------------
35 % | legendFontSize | Set the font size for the legend
36 % -------------------------------------------------------------------------
37 % | includeDescription | Set the description of an object to the plot
38 % -------------------------------------------------------------------------
39 % time | timezone | Set the timezone used to display time
40 % | | objects. (>> time.getTimezones)
41 % -------------------------------------------------------------------------
42 % | timeformat | Set the format for displaying time objects
43 % -------------------------------------------------------------------------
44 % misc | default_window | The default spectral window object for
45 % | | use by LTPDA's spectral analysis tools
46 % -------------------------------------------------------------------------
47 %
48 % Example: to set the verbose level of LTPDA from the command-line:
49 %
50 % >> LTPDAprefs('Display', 'verboseLevel', 3)
51 %
52 % The value of all properties in the table can also be retrieved by:
53 %
54 % >> LTPDAprefs.<property_name>
55 %
56 % for example,
57 %
58 % >> vl = LTPDAprefs.verboseLevel;
59 %
60 %
61 % M Hewitson 07-12-08
62 %
63 % $Id: LTPDAprefs.m,v 1.27 2011/04/27 12:45:49 hewitson Exp $
64 %
65 classdef LTPDAprefs < handle
66
67 properties (Constant = true)
68 oldpreffile = fullfile(prefdir, 'ltpda_prefs.xml');
69 preffile = fullfile(prefdir, 'ltpda_prefs2.xml');
70 end
71
72 properties
73 gui = [];
74 end
75
76
77 methods
78 function mainfig = LTPDAprefs(varargin)
79
80 if nargin == 3 && ischar(varargin{1}) && ischar(varargin{2})
81
82 %--- set preference by command-line
83
84 category = lower(varargin{1});
85 property = varargin{2};
86 value = varargin{3};
87
88 LTPDAprefs.setPreference(category, property, value);
89
90 else
91 % -- load GUI
92
93 % get prefs from appdata
94 prefs = getappdata(0, 'LTPDApreferences');
95
96 % make a gui
97 mainfig.gui = javaObjectEDT('mpipeline.ltpdapreferences.LTPDAPrefsGui', [], false, prefs);
98
99 % upload the available window types
100 winTypes = specwin.getTypes;
101 for kk=1:numel(winTypes)
102 javaMethodEDT('addAvailableWindow', mainfig.gui, winTypes{kk});
103 end
104
105 %--- called when window is closed
106 h = handle(mainfig.gui, 'callbackproperties');
107 set(h, 'WindowClosedCallback', {@mainfig.cb_guiClosed});
108
109 %--- Add extension path button
110 h = handle(mainfig.gui.getPrefsTabPane().getExtensionsPanel().getAddPathBtn(), 'callbackproperties');
111 set(h, 'ActionPerformedCallback', {@mainfig.cb_addExtensionPath});
112
113 %--- Remove extension path button
114 h = handle(mainfig.gui.getPrefsTabPane().getExtensionsPanel().getRemovePathBtn(), 'callbackproperties');
115 set(h, 'ActionPerformedCallback', {@mainfig.cb_removeExtensionPath});
116
117 %--- Plot preferences changed
118 h = handle(mainfig.gui.getPrefsTabPane().getPlotPanel(), 'callbackproperties');
119 set(h, 'PropertyChangeCallback', {@mainfig.cb_plotPrefsChanged});
120
121 % Make gui visible
122 mainfig.gui.setVisible(true);
123
124 end
125
126 end % End constructor
127
128 function display(varargin)
129 end
130
131 end % End public methods
132
133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
134 % Methods (static) %
135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
136
137 methods (Static=true)
138
139 %------------ add here the prototypes
140
141 varargout = loadPrefs(varargin)
142 varargout = upgradeFromPlist(varargin)
143 varargout = setApplicationData(varargin)
144
145 %------------ quick accessors for preferences
146
147 % display
148 function val = verboseLevel
149 prefs = LTPDAprefs.getPreferences;
150 val = double(prefs.getDisplayPrefs.getDisplayVerboseLevel);
151 end
152
153 function val = wrapStrings
154 prefs = LTPDAprefs.getPreferences;
155 val = double(prefs.getDisplayPrefs.getDisplayWrapStrings);
156 end
157
158 % plot
159 function val = axesFontSize
160 prefs = LTPDAprefs.getPreferences;
161 val = double(prefs.getPlotPrefs.getPlotDefaultAxesFontSize);
162 end
163
164 function val = axesFontWeight
165 prefs = LTPDAprefs.getPreferences;
166 val = char(prefs.getPlotPrefs.getPlotDefaultAxesFontWeight);
167 end
168
169 function val = axesLineWidth
170 prefs = LTPDAprefs.getPreferences;
171 val = double(prefs.getPlotPrefs.getPlotDefaultAxesLineWidth);
172 end
173
174 function val = lineLineWidth
175 prefs = LTPDAprefs.getPreferences;
176 val = double(prefs.getPlotPrefs.getPlotDefaultLineLineWidth);
177 end
178
179 function val = lineMarkerSize
180 prefs = LTPDAprefs.getPreferences;
181 val = double(prefs.getPlotPrefs.getPlotDefaultLineMarkerSize);
182 end
183
184 function val = gridStyle
185 prefs = LTPDAprefs.getPreferences;
186 val = char(prefs.getPlotPrefs.getPlotDefaultAxesGridLineStyle);
187 end
188
189 function val = minorGridStyle
190 prefs = LTPDAprefs.getPreferences;
191 val = char(prefs.getPlotPrefs.getPlotDefaultAxesMinorGridLineStyle);
192 end
193
194 function val = legendFontSize
195 prefs = LTPDAprefs.getPreferences;
196 val = double(prefs.getPlotPrefs.getPlotDefaultLegendFontSize);
197 end
198
199 function val = includeDescription
200 prefs = LTPDAprefs.getPreferences;
201 val = prefs.getPlotPrefs.getPlotDefaultIncludeDescription().booleanValue();
202 end
203
204 % time
205 function val = timezone
206 prefs = LTPDAprefs.getPreferences;
207 val = char(prefs.getTimePrefs.getTimeTimezone);
208 end
209
210 function val = timeformat
211 prefs = LTPDAprefs.getPreferences;
212 val = char(prefs.getTimePrefs.getTimestringFormat);
213 end
214
215 % misc
216 function val = default_window
217 prefs = LTPDAprefs.getPreferences;
218 val = char(prefs.getMiscPrefs.getDefaultWindow);
219 end
220
221 end
222
223
224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
225 % Methods (static, private) %
226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
227 methods (Access = private, Static=true)
228
229 prefs = getPreferences()
230 setPreference(category, property, value)
231
232 end
233
234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
235 % Methods (private) %
236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
237
238 methods (Access = private)
239
240 cb_guiClosed(varargin)
241 cb_addModelPath(varargin)
242 cb_removeModelPath(varargin)
243 cb_addExtensionPath(varargin)
244 cb_removeExtensionPath(varargin)
245
246 end
247
248 end
249
250 % END