function wdetail(vysH, info,cesta,fs,handles)
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Decription: Creates a visual interface to fully or selectively play a portion of a wave file.
%             
%             This script will load a wave  file (mono or stereo)
%             and creates a figure with a plotting of the wave data. 
%             If the wave file has more than one channel then separate 
%             figures for each channel will be created. Each figure is      
%             created with additional toolbar buttons for playing the wave
%             data 'fully' or a 'selected region' in the respective channel.
%             
%             In addition it shows how to create toolbar buttons.
%
%
% Usage: 1. Type "pw" on the command line with no argument, or
%           Type pw('wavefile.wav') with wave filename as an argument
%           -  After loading a wave file a figure will be created with 
%              a plot of the wave file (for each channel).
%        2. To play the whole wave just click ">>" on the toolbar of the figure
%        3. To play a selected region just click "|>>|" on the toolbar
%           after selecting a region to play
%
%           - To select a region, do the following 
%                  First make sure the +/- zoom buttons are off (not depressed) on the toolbar]
%
%              (i)  left click   : to define the starting of the selection
%                                        (shown as solid  vertical red line)
%              (ii) right click  : to define the end of the selection region
%                                        (shown as dotted vertical red line)
%
% Author: Laine Berhane Kahsay
%         March 2005, Uni-Ulm
%
% To get this help: > help pw
%
% originál získán z webu
% http://www.mathworks.com/matlabcentral/fileexchange/7408

delkaS=120;%(s)      delka zpracovavaneho useku v (s) default 2min
% konfigurace % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
if exist('conf.xls','file')==2
    st=konfigurace('global');
    for k=1:length(st)
        switch st(k).name
            case('delkaS')
                delkaS=st(k).cislo*60;
        end
    end
% else
%     set(handles.text1,'String','Probíhá analýza, použita standardní konfigurace')
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

% save roots ShowHiddenHandles status
RootSHH = get(0, 'ShowHiddenHandles');
%
% create a figure for the channel
   
    load('wicons.mat');
    fig=figure;
    % make all figure visible
    h.fig = fig;
    % set figure properties
    set(fig, 'WindowButtonDownFcn', 'wmouseclickext( guidata(gcbo) )', ...
             'KeyPressFcn', 'return', ...
             'UserData', [0 0], ...
             'NumberTitle', 'off', ...
             'Name', ['Zobrazení vybraných výsledků']);

    % get handle of toolbar
    set(0, 'showhiddenhandles', 'on');
    ut = findobj(fig,'type','uitoolbar');
    set(0, 'showhiddenhandles', RootSHH);
    % modify toolbar
%     uipushtool('cdata',Ico.PlayAll, 'parent', ut,'clickedcallback','wplaysoundext(guidata(gcbo), 1)', 'tooltipstring','play all'); 
    uipushtool('cdata',Ico.PlaySel, 'parent', ut,'clickedcallback','wplaysoundext(guidata(gcbo))', 'tooltipstring','Přehraj úsek'); 
    
    % plot wave data

    
    % compute  time scale
if sum(info)==0
        % initialize two (left and right) vertical lines for selective playing 
    h.v1 = plot(NaN, NaN, 'r');
    h.v2 = plot(NaN, NaN, 'r--');
    h.vp = plot(NaN, NaN, 'r-.'); 
    
    part=round(get(handles.slider1, 'Value'));
    [x fs]=readwav(cesta,'s',delkaS*fs,delkaS*fs*(part-1));
    ns=length(x);
    t =([1:ns]/fs);
    h.p2=plot(t, x(:), 'b');
    % find absolute maximum :- used to define 'YLim'
    amax = max(abs(x(:)));
    hold on;
    grid on;
         title('Vstupní signál')
        xlabel('{{\itt}} (m) \rightarrow')
        ylabel('{{\itA}} (-) \rightarrow')
else
    cislo_plotu=1;
    pocet=sum(info)+1;
    subplot(pocet,1,cislo_plotu)
    cislo_plotu=cislo_plotu+1;
    % initialize two (left and right) vertical lines for selective playing
    hold on 
        part=round(get(handles.slider1, 'Value'));
        [x,fs]=readwav(cesta,'s',delkaS*fs,delkaS*fs*(part-1));
        ns=length(x);
        t = linspace(delkaS*(part-1)/60,(delkaS*fs*(part-1)+ns)/60/fs,ns);
        h.p2=plot(t, x(:), 'b');
   
        grid on;
        h.v1 = plot(NaN, NaN, 'r','LineWidth',2);
        h.v2 = plot(NaN, NaN, 'r--','LineWidth',2);
        h.vp = plot(NaN, NaN, 'r-.','LineWidth',2);    
        xmax=max(t);
        xmin=min(t);
        set(gca,'XLim',[xmin xmax]);      
        title('Vstupní signál')
        xlabel('{{\itt}} (m) \rightarrow')
        ylabel('{{\itA}} (-) \rightarrow')
        
    if get(handles.checkbox5,'Value')==1  %urceni poradi vykreslovani
        subplot(pocet,1,cislo_plotu);
        cislo_plotu=cislo_plotu+1;
        bar(vysH(part).hymna(2,:),vysH(part).hymna(1,:))   
%         xmax=max(vysH(part).hymna(2,:)/60);
%         xmin=min(vysH(part).hymna(2,:)/60);
        set(gca,'XLim',[xmin xmax]);
        
        title('Detekce hymny')
        xlabel('{{\itt}} (m) \rightarrow')
        ylabel('{{\itH}} (-) \rightarrow')
        grid on
%         subplot(pocet,1,1)
%         set(gca,'XLim',[xmin xmax]);    
        
    end
    if get(handles.checkbox6,'Value')==1
        subplot(pocet,1,cislo_plotu);
        cislo_plotu=cislo_plotu+1;
        f_okam(vysH(part).F0,1,0,handles)
%         xmax=max(vysH(part).F0(2,:)/60);
%         xmin=min(vysH(part).F0(2,:)/60);
        set(gca,'XLim',[xmin xmax]);
        
        title('Odhad základního tónu komentátora')
        xlabel('{{\itt}} (m) \rightarrow')
        ylabel('{{\itF}_0} (Hz) \rightarrow')
%         subplot(pocet,1,1)   %dodatecne urceni mezi prvniho grafu 
%         set(gca,'XLim',[xmin xmax]);
        grid on
               
    end
    
    if get(handles.checkbox7,'Value')==1
        subplot(pocet,1,cislo_plotu);
        cislo_plotu=cislo_plotu+1;
        bar(vysH(part).time/60,vysH(part).res,'k');
%         xmax=max(vysH(part).time)/60;
%         xmin=min(vysH(part).time)/60;
        set(gca,'XLim',[xmin xmax]);
        
        title('Detekce hvizdu')
        xlabel('{{\itt}} (m) \rightarrow')
        ylabel('{{\itP}} (-) \rightarrow')
        grid on
    end
    if get(handles.checkbox8,'Value')==1
        subplot(pocet,1,cislo_plotu);
        cislo_plotu=cislo_plotu+1;
        
        plot(vysH(part).F0(2,:)/60,vysH(part).E);
%         xmax=max(vysH(part).F0(2,:)/60);
%         xmin=min(vysH(part).F0(2,:)/60);
        set(gca,'XLim',[xmin xmax]);
        title('Energie')
        xlabel('{{\itt}} (m) \rightarrow')
        ylabel('{{\itE}} (-) \rightarrow')
        grid on      
    end
end
    
    % save "wave data" in handle
    h.x = x(:);
    h.fs = fs;
    h.bps = 16;
    h.ns = ns;
    h.part=part;
    h.delkaS=delkaS;
    
    % save handle in figure
    guidata(fig, h);