Home > functions > gui > project_mgr_dir > project_mgr_contextmenu_open.m

project_mgr_contextmenu_open

PURPOSE ^

open context menu by right click.

SYNOPSIS ^

function project_mgr_contextmenu_open(data, show_context_menu)

DESCRIPTION ^

 open context menu by right click.
 [USAGE]
    project_mgr_contextmenu_open(data[,show_context_menu]);
 [IN]
                 data : project_mgr data
    show_context_menu : show context menu
 [OUT]
    none

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function project_mgr_contextmenu_open(data, show_context_menu)
0002 % open context menu by right click.
0003 % [USAGE]
0004 %    project_mgr_contextmenu_open(data[,show_context_menu]);
0005 % [IN]
0006 %                 data : project_mgr data
0007 %    show_context_menu : show context menu
0008 % [OUT]
0009 %    none
0010 %
0011 % Copyright (C) 2011, ATR All Rights Reserved.
0012 % License : New BSD License(see VBMEG_LICENSE.txt)
0013 
0014 %
0015 % --- Previous check
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 % --- Main Procedure
0026 %
0027 H = data.H; % component handles
0028 
0029 % get history listbox selected line
0030 selected_line_no = get(H.history_listbox, 'Value');
0031 max_line_no = length(get(H.history_listbox, 'String'));
0032 
0033 % default : all menues are not enable.
0034 uimenues = get(H.history_context_menu, 'Children');
0035 set(uimenues, 'Visible', 'off');
0036 
0037 % project is not loaded.
0038 if max_line_no == 0
0039     set(H.history_context_menu, 'Visible', 'off');
0040     return;
0041 end
0042 
0043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0044 % Set menu for each parameter type
0045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0046 
0047 % "open"  is always enable.
0048 set(H.submenu_launch_application, 'Visible', 'on');
0049 
0050 % enable menu for each parameter type
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;

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005