show_window

PURPOSE ^

SYNOPSIS ^

function show_window(cell_list,fig_number,title_figure,x_size,y_size,gap_x,font_name,font_size)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function show_window(cell_list,fig_number,title_figure,x_size,y_size,gap_x,font_name,font_size)
0002 
0003 
0004 if ~exist('cell_list'),
0005     error('No description of the functions');
0006 end;
0007 
0008 if ~exist('fig_number'),
0009     fig_number = 1;
0010 end;
0011 if ~exist('title_figure'),
0012     title_figure = '';
0013 end;
0014 if ~exist('x_size'),
0015     x_size = 85;
0016 end;
0017 if ~exist('y_size'),
0018     y_size = 14;
0019 end;
0020 if ~exist('gap_x'),
0021     gap_x = 0;
0022 end;
0023 if ~exist('font_name'),
0024     font_name = 'clean';
0025 end;
0026 if ~exist('font_size'),
0027     font_size = 8;
0028 end;
0029 
0030 figure(fig_number); clf;
0031 % set to points before getting position
0032 set(fig_number,'Units','Points');
0033 pos = get(fig_number,'Position');
0034 
0035 [n_row,n_col] = size(cell_list);
0036 
0037 fig_size_x = x_size*n_col+(n_col+1)*gap_x;
0038 fig_size_y = y_size*n_row+(n_row+1)*gap_x;
0039 
0040 pos(1)=pos(1)+round(pos(3)/2)-round(fig_size_x/2);
0041 pos(2)=pos(2)+round(pos(4)/2)-round(fig_size_y/2);
0042 
0043 set(fig_number,'Units','points', ...
0044     'BackingStore','off', ...
0045     'Color',[0.8 0.8 0.8], ...
0046     'MenuBar','none', ...
0047     'Resize','off', ...
0048     'Name',title_figure, ...
0049 'Position',[pos(1) pos(2) fig_size_x fig_size_y], ...
0050 'NumberTitle','off'); %,'WindowButtonMotionFcn',['figure(' num2str(fig_number) ');']);
0051 
0052 h_mat = zeros(n_row,n_col);
0053 
0054 posx = zeros(n_row,n_col);
0055 posy = zeros(n_row,n_col);
0056 
0057 for i=n_row:-1:1,
0058    for j = n_col:-1:1,
0059       posx(i,j) = gap_x+(j-1)*(x_size+gap_x);
0060       posy(i,j) = fig_size_y - i*(gap_x+y_size);
0061    end;
0062 end;
0063 
0064 for i=n_row:-1:1,
0065     for j = n_col:-1:1,
0066         if ~isempty(cell_list{i,j}),
0067             if ~isempty(cell_list{i,j}{1}) & ~isempty(cell_list{i,j}{2}),
0068                 h_mat(i,j) = uicontrol('Parent',fig_number, ...
0069                     'Units','points', ...
0070                     'Callback',cell_list{i,j}{2}, ...
0071                     'ListboxTop',0, ...
0072                     'Position',[posx(i,j)  posy(i,j)  x_size   y_size], ...
0073                     'String',cell_list{i,j}{1}, ...
0074                     'fontsize',font_size,...
0075                     'fontname',font_name,...
0076                     'Tag','Pushbutton1');
0077             end;
0078         end;
0079     end;
0080 end;
0081 
0082 %------ END PROTECTED REGION ----------------%

Generated on Thu 08-Apr-2010 14:35:09 by m2html © 2005