0001 function [property_list] = job_plot_cmap_setting_dlg(properties, mode)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051 if ~exist('properties', 'var')
0052 error('properties is a required parameter.');
0053 end
0054 if ~exist('mode', 'var')
0055 mode = 1;
0056 end
0057
0058
0059
0060
0061 fig = openfig(mfilename);
0062 H = guihandles(fig);
0063 property_list = [];
0064
0065
0066
0067 job_plot_cmap_setting_dlg_callback(H,...
0068 H.data_file_current_radiobutton);
0069
0070
0071 desc = vb_define_description_table;
0072 setappdata(H.brain_file_text, 'description', ...
0073 vb_table_query_value(desc, 'brain_file'));
0074 setappdata(H.area_file_text, 'description', ...
0075 vb_table_query_value(desc, 'area_file'));
0076 setappdata(H.act_file_text, 'description', ...
0077 vb_table_query_value(desc, 'act_file'));
0078 setappdata(H.current_file_text, 'description', ...
0079 vb_table_query_value(desc, 'current_file'));
0080 setappdata(H.load_mode_text, 'description', ...
0081 vb_table_query_value(desc, 'current_load_mode'));
0082 setappdata(H.tf_file_text, 'description', ...
0083 vb_table_query_value(desc, 'tf_file'));
0084
0085
0086 file_on_app = 0;
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097 keys = vb_table_get_keys(properties);
0098 for k=1:length(keys)
0099 prop = keys{k};
0100 val = vb_table_query_value(properties, keys{k});
0101 flag = vb_table_query_update_flag(properties, keys{k});
0102
0103 switch(prop)
0104 case 'brain_file'
0105 str = get(H.brain_file_text, 'String');
0106 set(H.brain_file_text, 'String', ['*', str]);
0107 job_plot_cmap_setting_dlg_set_file(H, val, 'brain_file');
0108 set(H.brain_file_update_checkbox, 'Value', flag);
0109 if exist(val, 'file') == 2 && flag == 0
0110 file_on_app = bitset(file_on_app, 1);
0111 end
0112 case 'area_file'
0113 if bitget(mode, 2)
0114 str = get(H.area_file_text, 'String');
0115 set(H.area_file_text, 'String', ['*', str]);
0116 end
0117 job_plot_cmap_setting_dlg_set_file(H, val, 'area_file');
0118 set(H.area_file_update_checkbox, 'Value', flag);
0119 if exist(val, 'file') == 2 && flag == 0
0120 file_on_app = bitset(file_on_app, 2);
0121 end
0122 case 'act_file'
0123 if bitget(mode, 3)
0124 str = get(H.act_file_text, 'String');
0125 set(H.act_file_text, 'String', ['*', str]);
0126 end
0127 job_plot_cmap_setting_dlg_set_file(H, val, 'act_file');
0128 set(H.act_file_update_checkbox, 'Value', flag);
0129 if exist(val, 'file') == 2 && flag == 0
0130 file_on_app = bitset(file_on_app, 3);
0131 end
0132 case 'current_file'
0133 if bitget(mode, 1)
0134 str = get(H.current_file_text, 'String');
0135 set(H.current_file_text, 'String', ['*', str]);
0136 end
0137 job_plot_cmap_setting_dlg_callback(H,...
0138 H.data_file_current_radiobutton);
0139 set(H.current_file_edit, 'String', val);
0140
0141
0142 cur_mode = vb_table_query_value(properties, 'current_load_mode');
0143 if isempty(cur_mode)
0144 cur_mode = 'ave';
0145 end
0146
0147 cur_trial = vb_table_query_value(properties, 'current_trial');
0148 if isempty(cur_trial)
0149 cur_trial = 1;
0150 end
0151 job_plot_cmap_setting_dlg_set_current_file(H, val, cur_mode, cur_trial);
0152
0153
0154 set(H.current_file_update_checkbox, 'Value', flag);
0155
0156 if exist(val, 'file') == 2 && flag == 0
0157 file_on_app = bitset(file_on_app, 4);
0158 end
0159 case 'current_load_mode'
0160
0161 case 'current_trial'
0162
0163 case 'tf_file'
0164 if bitget(mode, 1)
0165 str = get(H.tf_file_text, 'String');
0166 set(H.tf_file_text, 'String', ['*', str]);
0167 end
0168 if ~isempty(val)
0169 job_plot_cmap_setting_dlg_callback(H,...
0170 H.data_file_tf_radiobutton);
0171 end
0172 job_plot_cmap_setting_dlg_set_file(H, val, 'tf_file');
0173 set(H.tf_file_update_checkbox, 'Value', flag);
0174
0175 if exist(val, 'file') == 2 && flag == 0
0176 file_on_app = bitset(file_on_app, 5);
0177 end
0178 otherwise
0179 delete(fig);
0180 error('unknown property : %s', prop);
0181 end
0182 end
0183
0184
0185
0186 private_data = struct;
0187 private_data.mode = mode;
0188 private_data.file_on_app = file_on_app;
0189 private_data.input_properties = properties;
0190
0191 guidata(fig, private_data);
0192 ret = job_plot_cmap_setting_dlg_is_requirement_filled(fig);
0193 if ret
0194 set(H.ok_push, 'Enable', 'on');
0195 else
0196 set(H.ok_push, 'Enable', 'off');
0197 end
0198
0199
0200
0201
0202 set(fig, 'WindowStyle', 'modal');
0203 waitfor(fig, 'Visible', 'off');
0204
0205 if ~ishandle(fig)
0206
0207
0208 return;
0209 end
0210
0211
0212
0213
0214 if ishandle(fig)
0215 props = {'brain_file', 'area_file', 'act_file', 'current_file', 'tf_file'};
0216
0217 for k=1:length(props)
0218
0219 cmd_get_file = ['get(H.' props{k}, '_edit, ''String'');'];
0220
0221 cmd_get_update = ['get(H.', props{k}, '_update_checkbox, ''Value'');'];
0222
0223 key = props{k};
0224 value = eval(cmd_get_file);
0225 update_flag = eval(cmd_get_update);
0226
0227 record = vb_key_value_pair(key, value);
0228 record.update_flag = update_flag;
0229
0230 property_list = vb_table_insert(property_list, record);
0231 end
0232 if get(H.data_file_current_radiobutton, 'Value')
0233
0234 property_list = vb_table_delete(property_list, 'tf_file');
0235
0236 if(get(H.current_file_mode_average_radiobutton, 'Value'))
0237 load_mode = 'ave';
0238 else
0239 load_mode = 'raw';
0240 end
0241 key = 'current_load_mode';
0242 value = load_mode;
0243 update_flag = false;
0244
0245 record = vb_key_value_pair(key, value);
0246 record.update_flag = update_flag;
0247 property_list = vb_table_insert(property_list, record);
0248
0249 key = 'current_trial';
0250 value = 1;
0251 update_flag = false;
0252 if strcmp(load_mode, 'raw')
0253 value = str2double(...
0254 get(H.current_file_mode_raw_edit, 'String'));
0255 end
0256 record = vb_key_value_pair(key, value);
0257 record.update_flag = update_flag;
0258 property_list = vb_table_insert(property_list, record);
0259 else
0260
0261 property_list = vb_table_delete(property_list, 'current_file');
0262 end
0263 delete(fig);
0264 end