0001 function this = set(this, varargin)
0002
0003
0004
0005
0006
0007
0008 property_argin = varargin;
0009 while length(property_argin) >= 2,
0010 prop = property_argin{1};
0011 val = property_argin{2};
0012 property_argin = property_argin(3:end);
0013
0014 if isfield( this.public, lower(prop) )
0015 [val, errmsg] = feval( sprintf('set_%s', lower(prop)), prop, val );
0016
0017 if ~isempty(errmsg)
0018 error( errmsg );
0019 else
0020 this.public = setfield(this.public, lower(prop), val);
0021 end
0022 else
0023 error( sprintf('Invalid properties: ''%s''', prop) )
0024 end
0025 end
0026
0027
0028 function [filter_str, errmsg] = set_filter_str(prop, val)
0029
0030 errmsg = [];
0031 filter_str = [];
0032 if ~ischar(val)
0033 errmsg = sprintf('''%s'':Value must be char array.', prop);
0034 else
0035 filter_str = val;
0036 end
0037
0038
0039 function [save_mode, errmsg] = set_save_mode(prop, val)
0040
0041
0042
0043 save_mode = [];
0044 errmsg = [];
0045 if exist('true','builtin')
0046 if val == true val = 1;
0047 elseif val == false val = 0;
0048 end
0049 end
0050 if isnumeric(val)
0051 if val save_mode = 1;
0052 else save_mode = 0;
0053 end
0054 else errmsg = sprintf('''%s'':Value must be numeric.',prop);
0055 end
0056
0057
0058 function [dialog_title, errmsg] = set_dialog_title(prop, val)
0059
0060
0061
0062 dialog_title = [];
0063 errmsg = [];
0064
0065 if ~ischar(val)
0066 errmsg = sprintf('''%s'':Value must be char array.', prop);
0067 else
0068 dialog_title = val;
0069 end
0070
0071
0072 function [file_extensions, errmsg] = set_file_extensions(prop, val)
0073
0074
0075
0076 file_extensions = [];
0077 errmsg = [];
0078 if ~iscell(val)
0079 errmsg = sprintf('''%s'':Value must be cell array.',prop);
0080 else
0081 for ii=1:length(val)
0082 if ~isstr(val{ii})
0083 errmsg = sprintf('''%s'':Value must be string.(val{%d})',prop, ii);
0084 end
0085 end
0086 file_extensions = val;
0087 end
0088
0089
0090
0091 function [current_dir, errmsg] = set_current_dir(prop, val)
0092
0093
0094
0095 current_dir = [];
0096 errmsg = [];
0097
0098 if ~isstr(val)
0099 errmsg = sprintf('''%s'':Value must be string.',prop);
0100 else current_dir = val;
0101 end
0102
0103
0104
0105 function [hist_dir, errmsg] = set_hist_dir(prop, val)
0106
0107
0108
0109 hist_dir = [];
0110 errmsg = [];
0111 if ~iscell(val)
0112 errmsg = sprintf('''%s'':Value must be cell array.',prop);
0113 else
0114 for ii=1:length(val)
0115 if ~isstr(val{ii})
0116 errmsg = sprintf('''%s'':Value must be string.(val{%d})',prop, ii);
0117 end
0118 end
0119 hist_dir = val;
0120 end
0121
0122
0123
0124 function [dialog_color, errmsg] = set_dialog_color(prop, val)
0125 [dialog_color, errmsg] = set_gui_color(prop, val);
0126
0127
0128
0129 function [bgcol_panel, errmsg] = set_bgcol_panel(prop, val)
0130 [bgcol_panel, errmsg] = set_gui_color(prop, val);
0131
0132
0133
0134 function [fgcol_panel, errmsg] = set_fgcol_panel(prop, val)
0135 [fgcol_panel, errmsg] = set_gui_color(prop, val);
0136
0137
0138
0139 function [fgcol_text, errmsg] = set_fgcol_text(prop, val)
0140 [fgcol_text, errmsg] = set_gui_color(prop, val);
0141
0142
0143
0144 function [bgcol_popup, errmsg] = set_bgcol_popup(prop, val)
0145 [bgcol_popup, errmsg] = set_gui_color(prop, val);
0146
0147
0148
0149 function [fgcol_popup, errmsg] = set_fgcol_popup(prop, val)
0150 [fgcol_popup, errmsg] = set_gui_color(prop, val);
0151
0152
0153
0154 function [bgcol_listbox, errmsg] = set_bgcol_listbox(prop, val)
0155 [bgcol_listbox, errmsg] = set_gui_color(prop, val);
0156
0157
0158
0159 function [fgcol_listbox, errmsg] = set_fgcol_listbox(prop, val)
0160 [fgcol_listbox, errmsg] = set_gui_color(prop, val);
0161
0162
0163
0164 function [bgcol_edit, errmsg] = set_bgcol_edit(prop, val)
0165 [bgcol_edit, errmsg] = set_gui_color(prop, val);
0166
0167
0168
0169 function [fgcol_edit, errmsg] = set_fgcol_edit(prop, val)
0170 [fgcol_edit, errmsg] = set_gui_color(prop, val);
0171
0172
0173
0174 function [bgcol_push, errmsg] = set_bgcol_push(prop, val)
0175 [bgcol_push, errmsg] = set_gui_color(prop, val);
0176
0177
0178
0179 function [fgcol_push, errmsg] = set_fgcol_push(prop, val)
0180 [fgcol_push, errmsg] = set_gui_color(prop, val);
0181
0182
0183
0184 function [col, errmsg] = set_gui_color(prop, val)
0185
0186
0187
0188 col = [];
0189 errmsg = [];
0190
0191 if ~isnumeric(val) | ~length(val) == 3
0192 errmsg = sprintf('''%s'':value must be a 3 element numeric vector.',prop);
0193 elseif min(val)<0.0 & min(val)>1.0
0194 errmsg = sprintf('''%s'':value out of range 0.0 <= value <= 1.0.',prop);
0195 else
0196 col = val;
0197 end
0198