0001 function project_mgr_contextmenu_open(data, show_context_menu)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 if ~exist('data', 'var')
0018 error('data is a required parameter.');
0019 end
0020 if ~exist('show_context_menu', 'var')
0021 show_context_menu = true;
0022 end
0023
0024
0025
0026
0027 H = data.H;
0028
0029
0030 selected_line_no = get(H.history_listbox, 'Value');
0031 max_line_no = length(get(H.history_listbox, 'String'));
0032
0033
0034 uimenues = get(H.history_context_menu, 'Children');
0035 set(uimenues, 'Visible', 'off');
0036
0037
0038 if max_line_no == 0
0039 set(H.history_context_menu, 'Visible', 'off');
0040 return;
0041 end
0042
0043
0044
0045
0046
0047
0048 set(H.submenu_launch_application, 'Visible', 'on');
0049 set(H.submenu_export_script, 'Visible', 'on');
0050
0051
0052 [parm, parm_type] = project_file_mgr('get_parameter', selected_line_no);
0053 func_type = vb_judge_function_name(parm, parm_type);
0054
0055 switch(func_type)
0056 case {'vb_job_brain'}
0057 set(H.submenu_job_view_cortex, 'Visible', 'on');
0058 set(H.submenu_job_edit_area, 'Visible', 'on');
0059 set(H.submenu_job_edit_act, 'Visible', 'on');
0060
0061 case {'vb_job_fmri'}
0062 set(H.submenu_job_view_cortex, 'Visible', 'on');
0063 set(H.submenu_job_edit_area, 'Visible', 'on');
0064 set(H.submenu_job_edit_act, 'Visible', 'on');
0065
0066 case {'vb_job_meg'}
0067 set(H.submenu_job_plot_meg, 'Visible', 'on');
0068 case {'vb_job_head_3shell'}
0069 set(H.submenu_view_head, 'Visible', 'on');
0070 case {'vb_job_current'}
0071 set(H.submenu_job_plot_currentmap, 'Visible', 'on');
0072 end
0073
0074 org_units = get(H.history_listbox, 'Units');
0075 set(H.history_listbox, 'Units', 'pixels');
0076 Pos = get(H.history_listbox, 'Position');
0077 set(H.history_listbox, 'Units', org_units);
0078
0079 pos = [Pos(1)+Pos(3), Pos(2)+Pos(4)];
0080 set(H.history_context_menu, 'Position', pos);
0081
0082 current_figure = get(0, 'CurrentFigure');
0083 if ~isempty(current_figure) && ...
0084 ishandle(current_figure) && ...
0085 current_figure == data.H.figure
0086 if show_context_menu
0087 set(H.history_context_menu, 'Visible', 'on');
0088 else
0089 set(H.history_context_menu, 'Visible', 'off');
0090 end
0091 end
0092 drawnow;