Home > vbmeg > 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" and "Export as M-file" is always enable.
0048 set(H.submenu_launch_application, 'Visible', 'on');
0049 set(H.submenu_export_script,      'Visible', 'on');
0050 
0051 % enable menu for each parameter type
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 %        set(H.submenu_job_select_area, 'Visible', 'on');
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 %        set(H.submenu_job_select_area, 'Visible', 'on');
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;

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005