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
0050
0051 [parm, parm_type] = project_file_mgr('get_parameter', selected_line_no);
0052 func_type = vb_judge_function_name(parm, parm_type);
0053
0054 switch(func_type)
0055 case {'vb_job_brain'}
0056 set(H.submenu_job_view_cortex, 'Visible', 'on');
0057 set(H.submenu_job_edit_area, 'Visible', 'on');
0058 set(H.submenu_job_edit_act, 'Visible', 'on');
0059 set(H.submenu_job_select_area, 'Visible', 'on');
0060 case {'vb_job_fmri'}
0061 set(H.submenu_job_view_cortex, 'Visible', 'on');
0062 set(H.submenu_job_edit_area, 'Visible', 'on');
0063 set(H.submenu_job_edit_act, 'Visible', 'on');
0064 set(H.submenu_job_select_area, 'Visible', 'on');
0065 case {'vb_job_meg'}
0066 set(H.submenu_job_plot_meg, 'Visible', 'on');
0067 case {'vb_job_current'}
0068 set(H.submenu_job_plot_currentmap, 'Visible', 'on');
0069 end
0070
0071 org_units = get(H.history_listbox, 'Units');
0072 set(H.history_listbox, 'Units', 'pixels');
0073 Pos = get(H.history_listbox, 'Position');
0074 set(H.history_listbox, 'Units', org_units);
0075
0076 pos = [Pos(1)+Pos(3), Pos(2)+Pos(4)];
0077 set(H.history_context_menu, 'Position', pos);
0078
0079 current_figure = get(0, 'CurrentFigure');
0080 if ~isempty(current_figure) && ...
0081 ishandle(current_figure) && ...
0082 current_figure == data.H.figure
0083 if show_context_menu
0084 set(H.history_context_menu, 'Visible', 'on');
0085 else
0086 set(H.history_context_menu, 'Visible', 'off');
0087 end
0088 end
0089 drawnow;