% function inside file menu
%
%--------------------------------------------------------------------

function rri_file_menu(action)

   switch action
      case {'print_fig'}
         printdlg(gcbf);
      case {'export_fig'}
         export_fig;
   end

   return					% rri_plot_eigen_ui


%------------------------------------------------

function export_fig

   curr = pwd;
   if isempty(curr)
      curr = filesep;
   end

   [selected_file, selected_path] = rri_select_file(curr,'Save As');

   if isempty(selected_file) | isempty(selected_path)
      return;
   end

   filename = [selected_path selected_file];

   if(exist(filename,'file')==2)		% file exist

      dlg_title = 'Confirm File Overwrite';
      msg = ['File ',filename,' exist. Are you sure you want to overwrite it?'];
      response = questdlg(msg,dlg_title,'Yes','No','Yes');

      if(strcmp(response,'No'))
         return;
      end

   end

   old_pointer = get(gcbf,'pointer');
   set(gcbf,'pointer','watch');

   saveas(gcbf,filename);

   set(gcbf,'pointer',old_pointer);

   return;					% export_fig

