% setup_display

clf reset, whitebg(gcf,[0 0 0])
set(gcf,'Backingstore','off')
 
axis([1 N 0 1.1])
hold on
set(gca,'Position',[0.1 0.2 0.8 0.7])
set(gca,'Drawmode','fast')
set(gca,'ButtonDownFcn','clickhandler')
xlabel('Use the mouse to supply external input')
if strcmp(computer,'PCWIN')
    ermode = 'normal';
else
    ermode = 'background';
end

h_bump = plot(zeros(N,1),'yo', ...
        'EraseMode',ermode,'ButtonDownFcn','clickhandler');
h_inhib = plot([0 N/20],[0 0],'c', ...
        'EraseMode','background','ButtonDownFcn','clickhandler');
h_inp = plot(zeros(N,1),'r','LineWidth',2,...
        'EraseMode','background','ButtonDownFcn','clickhandler');
h_title = title('');
 
bias_slider = uicontrol('Style','Slider','Tag','Bias', ...
  'Position', [90 30 150 16], 'Value', 0.5, ...
  'SliderStep', [0.0125 0.025], ...
  'CallBack','Bias = update_slider(gcbo,bias_text, -4,  4,  0.01,  ''Bias: %5.2f'');');

bias_text = uicontrol('Style','Text','Position',[250 30 80 16], ...
                      'String','No Bias');
 
noise_slider = uicontrol('Style','Slider','Tag','Noise', ...
  'Position', [90 10 150 16], 'Value', 0.0, ...
  'SliderStep', [0.0125 0.025], ...
  'CallBack','Noise = update_slider(gcbo,noise_text,0, 4, 0.1, ''Noise: %4.1f'');');

noise_text = uicontrol('Style','Text','Position',[250 10 80 16], ...
                       'String','No Noise');
 
run_button = uicontrol('Style','PushButton','Position',[15 30 40 18], ...
        'BackgroundColor',[.2 .8 .2],'String','Run', ...
        'CallBack','run_flag = Inf; bump_mainloop');
 
step_button = uicontrol('Style','PushButton','Position',[15 10 40 18], ...
        'BackgroundColor',[.5 .5 1],'String','Step', ...
        'CallBack','run_flag = 1; bump_mainloop; update_title');
 
mode_menu = uicontrol('Style','Popup','Position',[350 15 90 28], ...
    'String',{'SemiLinear','Tanh'}, 'Value',1, ...
    'BackgroundColor',[0.8 0.4 0.2], ...
    'CallBack','if get(gcbo,''Value'')==1,params_semilinear, else params_tanh, end');

hold_pushbutton = uicontrol('Style','Checkbox', ...
        'Position',[450 19 90 20], 'String', 'Input Hold');

drawnow
