wpfullsi.m
上传用户:haiyisale
上传日期:2013-01-09
资源大小:3246k
文件大小:7k
源码类别:

波变换

开发平台:

Matlab

  1. function wpfullsi(option,win_wptool,in3,in4,in5,in6,in7);
  2. %WPFULLSI Manage full size for axes.
  3. %   WPFULLSI(OPTION,WIN_WPTOOL,IN3,IN4,IN5,IN6,IN7)
  4. %   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96.
  5. %   Last Revision: 08-Jun-1999.
  6. %   Copyright 1995-2002 The MathWorks, Inc.
  7. % $Revision: 1.11 $
  8. if strcmp(option,'squish')
  9.     % in3 = lst_handles
  10.     % in4 = text handle
  11.     % in5 = 'beg or 'end'
  12.     % in6 = num full
  13.     % in7 optional (redraw xlab)
  14.     %-----------------------------
  15.     WP_Axe_Cfs = in3(1);
  16.     WP_Axe_Col = in3(2);
  17.     usr = get(in4,'Userdata');
  18.     if in5=='beg'
  19.         old_pos = usr(1,:);
  20.         new_pos = usr(2,:);
  21.         if in6==4
  22.             pos1 = get(WP_Axe_Cfs,'Position');
  23.             pos2 = get(WP_Axe_Col,'Position');
  24.             old_pos = [pos1(1) pos2(2) pos1(3) pos1(2)-pos2(2)+pos1(4)];
  25.             dx = pos1(1)-pos2(1);
  26.             dw = pos1(3)-pos2(3);
  27.             dy = (pos1(2)-pos2(2)-pos2(4))/2;
  28.             if abs(dx)>eps
  29.                 set(WP_Axe_Col,'Position',pos2+[dx 0 dw 0]);
  30.             end
  31.             set(WP_Axe_Cfs,'Position',pos1+[0 -dy 0 dy]);
  32.             delta = [dx dy dw 0];
  33.             set(in4,'Userdata',[old_pos;new_pos;delta]);
  34.         end
  35.     else
  36.         new_pos = usr(1,:);
  37.         old_pos = usr(2,:);
  38.     end
  39.     pos = new_pos(3:4)./old_pos(3:4);
  40.     pos = [new_pos(1:2)-old_pos(1:2).*pos pos];
  41.     for k=1:length(in3)
  42.         p = get(in3(k),'position');
  43.         p(1:2) = p(1:2).*pos(3:4)+pos(1:2);
  44.         p(3:4) = p(3:4).*pos(3:4);
  45.         set(in3(k),'position',p);
  46.     end
  47.     if (in6==4) & (in5=='end')
  48.         delta = usr(3,:);
  49.         dx = delta(1); dy = delta(2); dw = delta(3);
  50.         if abs(dx)>eps
  51.              set(WP_Axe_Col,'Position',get(WP_Axe_Col,'Position')-[dx 0 dw 0]);
  52.         end
  53.         set(WP_Axe_Cfs,'Position',get(WP_Axe_Cfs,'Position')+[0 dy 0 -dy]);                    
  54.     end
  55.     if nargin==7
  56.         if (in6==4) | (in5=='end')
  57.             xlab   = get(WP_Axe_Cfs,'xlabel');
  58.             strlab = get(xlab,'String');
  59.             wsetxlab(WP_Axe_Cfs,strlab);
  60.             xlab   = get(WP_Axe_Col,'xlabel');
  61.             strlab = get(xlab,'String');
  62.             wsetxlab(WP_Axe_Col,strlab);
  63.         end
  64.     end
  65.     return
  66. end
  67. % MemBloc2 of stored values.
  68. %---------------------------
  69. n_wp_utils = 'WP_Utils';
  70. ind_tree_lin  = 1;
  71. ind_tree_txt  = 2;
  72. ind_type_txt  = 3;
  73. ind_sel_nodes = 4;
  74. ind_gra_area  = 5;
  75. ind_nb_colors = 6;
  76. nb2_stored    = 6;
  77. % Tag property of objects.
  78. %-------------------------
  79. tag_txt_full  = 'Txt_Full';
  80. tag_pus_full  = ['Pus_Full.1';'Pus_Full.2';'Pus_Full.3';'Pus_Full.4'];
  81. tag_axe_t_lin = 'Axe_TreeLines';
  82. tag_axe_sig   = 'Axe_Sig';
  83. tag_axe_pack  = 'Axe_Pack';
  84. tag_axe_cfs   = 'Axe_Cfs';
  85. tag_axe_col   = 'Axe_Col';
  86. tag_sli_size  = 'Sli_Size';
  87. tag_sli_pos   = 'Sli_Pos';
  88. children    = get(win_wptool,'Children');
  89. axe_handles = findobj(children,'flat','type','axes');
  90. uic_handles = findobj(children,'flat','type','uicontrol');
  91. pus_handles = findobj(uic_handles,'style','pushbutton');
  92. for k =1:size(tag_pus_full,1)
  93.     pus_full(k) = (findobj(uic_handles,'Tag',tag_pus_full(k,:)))';
  94. end
  95. txt_full    = findobj(uic_handles,'style','text','Tag',tag_txt_full);
  96. WP_Axe_Tree = findobj(axe_handles,'flat','Tag',tag_axe_t_lin);
  97. WP_Axe_Sig  = findobj(axe_handles,'flat','Tag',tag_axe_sig);
  98. WP_Axe_Pack = findobj(axe_handles,'flat','Tag',tag_axe_pack);
  99. WP_Axe_Cfs  = findobj(axe_handles,'flat','Tag',tag_axe_cfs);
  100. WP_Axe_Col  = findobj(axe_handles,'flat','Tag',tag_axe_col);
  101. Sli_Pos     = findobj(uic_handles,'Tag',tag_sli_pos);
  102. Sli_Size    = findobj(uic_handles,'Tag',tag_sli_size);
  103. lst_handles = [WP_Axe_Cfs,WP_Axe_Col,WP_Axe_Tree,...
  104.                WP_Axe_Pack,WP_Axe_Sig,Sli_Pos,Sli_Size];
  105. switch option
  106.     case 'full'
  107.         % in3 = btn number. 
  108.         %------------------
  109.         Def_TxtBkColor = mextglob('get','Def_TxtBkColor');
  110.         mx = 0.06; my =0.06;
  111.         pos_gra = wmemtool('rmb',win_wptool,n_wp_utils,ind_gra_area);
  112.         pos_gra(1:2) = pos_gra(1:2)+[mx my];
  113.         pos_gra(3:4) = pos_gra(3:4)-2*[mx my];
  114.         % Test begin or end.
  115.         %-------------------
  116.         num = in3;
  117.         btn = pus_full(num);
  118.         act = get(btn,'Userdata');
  119.         if act==0
  120.             % begin full size
  121.             %----------------
  122.             col = get(btn,'Backgroundcolor');
  123.             old_num = 0;
  124.             for k=1:length(pus_full)
  125.                 act_old = get(pus_full(k),'Userdata');
  126.                 if act_old==1
  127.                     old_num = k;
  128.                     set(pus_full(k),...
  129.                         'Backgroundcolor',col,...
  130.                         'String',sprintf('%.0f',k),...
  131.                         'Userdata',0);
  132.                     break;
  133.                 end
  134.             end
  135.             set(btn,'Backgroundcolor',Def_TxtBkColor,      ...
  136.                     'String',['end ' sprintf('%.0f',num)], ...
  137.                     'Userdata',1);
  138.             if old_num~=0;
  139.                pos_param = get(txt_full,'Userdata');
  140.                wpfullsi('squish',win_wptool,lst_handles,txt_full,'end',old_num);
  141.             end
  142.             delta = zeros(1,4);
  143.             switch num
  144.                 case 1 , pos = get(WP_Axe_Tree,'Position');
  145.                 case 2 , pos = get(WP_Axe_Pack,'Position');
  146.                 case 3 , pos = get(WP_Axe_Sig,'Position');
  147.                 case 4 , pos = get(WP_Axe_Cfs,'Position');
  148.             end
  149.             if num==1 , vis = 'on'; else , vis = 'off'; end
  150.             set([Sli_Pos Sli_Size],'Visible','on');
  151.             set(txt_full,'Userdata',[pos;pos_gra;delta]);
  152.             wpfullsi('squish',win_wptool,lst_handles,txt_full,'beg',num,'xlab');
  153.         else
  154.             % end full size.
  155.             %---------------
  156.             col = get(pus_full(5-num),'Backgroundcolor');
  157.             set(btn,'Backgroundcolor',col,...
  158.                     'String',sprintf('%.0f',num),...
  159.                     'Userdata',0);
  160.             wpfullsi('squish',win_wptool,lst_handles,txt_full,'end',num,'xlab');
  161.             set([Sli_Pos Sli_Size],'Visible','on');
  162.         end
  163.     case 'clean'
  164.         for k=1:length(pus_full)
  165.             act_old = get(pus_full(k),'Userdata');
  166.             if act_old==1
  167.                 col = get(pus_full(5-k),'Backgroundcolor');
  168.                 old_num = k;
  169.                 set(pus_full(k),...
  170.                     'Backgroundcolor',col,...
  171.                     'String',sprintf('%.0f',k),...
  172.                     'Userdata',0);
  173.                 wpfullsi('squish',win_wptool,lst_handles,txt_full,'end',k);
  174.                 set([Sli_Pos Sli_Size],'Visible','on');  
  175.                 break;
  176.             end
  177.         end
  178. end