Skip to content

Commit

Permalink
reparintg for 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hmogensen committed Jan 16, 2015
1 parent b7d686a commit c446249
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 80 deletions.
3 changes: 3 additions & 0 deletions panelcomponents/@ChannelOptions/ChannelOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ function nbr_of_channels_callback(obj)
obj.gui.nbr_of_analog_channels = get(obj.ui_nbr_of_channels,'value');
obj.update_nbr_of_analog_axes();
obj.show_panels(false);
if obj.gui.automatic_update_on
obj.panel.update_panel;
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions panelcomponents/@MainChannel/MainChannel.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ function channel_callback(obj)
str = get(obj.ui_channel,'string');
obj.gui.main_channel.signal = obj.gui.sequence.signals.get('tag',str{val});
obj.show_panels(false);
if obj.gui.automatic_update_on
obj.panel.update_panel;
end
end

end
Expand Down
6 changes: 6 additions & 0 deletions panelcomponents/@PanelComponent/PanelComponent.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,11 @@ function show_panels(obj,visible)
children = get(obj.uihandle,'children');
end

function automatic_update(obj)
if obj.gui.automatic_update_on
obj.panel.update_panel;
end
end

end
end
18 changes: 10 additions & 8 deletions panelcomponents/@PlotOptions/PlotOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@

function populate(obj,mgr)
mgr.newline(20);
obj.ui_plot_raw = mgr.add(sc_ctrl('checkbox','Plot raw data',@plot_raw_callback,...
obj.ui_plot_raw = mgr.add(sc_ctrl('checkbox','Plot raw data',@(~,~) plot_raw_callback(obj),...
'value',obj.gui.main_channel.plot_raw),200);
mgr.newline(5);
mgr.newline(20);
obj.ui_plot_waveforms = mgr.add(sc_ctrl('checkbox','Plot waveforms',@plot_waveforms_callback,...
obj.ui_plot_waveforms = mgr.add(sc_ctrl('checkbox','Plot waveforms',@(~,~) plot_waveforms_callback(obj),...
'value',obj.gui.main_channel.plot_waveforms),200);
mgr.newline(5);

function plot_raw_callback(~,~)
obj.gui.main_channel.plot_raw = get(obj.ui_plot_raw,'value');
obj.show_panels(false);
function plot_raw_callback(objh)
objh.gui.main_channel.plot_raw = get(objh.ui_plot_raw,'value');
objh.show_panels(false);
objh.automatic_update();
end

function plot_waveforms_callback(~,~)
obj.gui.main_channel.plot_waveforms = get(obj.ui_plot_waveforms,'value');
obj.show_panels(false);
function plot_waveforms_callback(objh)
objh.gui.main_channel.plot_waveforms = get(objh.ui_plot_waveforms,'value');
objh.show_panels(false);
objh.automatic_update();
end
end
end
Expand Down
30 changes: 12 additions & 18 deletions panelcomponents/@SubChannels/SubChannels.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,24 @@ function populate(obj,mgr)
end

function initialize(obj)
% if isempty(obj.gui.sequence)
% set(obj.panel,'visible','off');
% else
str = obj.gui.sequence.signals.values('tag');
for k=1:obj.ui_extra_channels.n
signal = obj.gui.analog_ch.get(k+1).signal;
if isempty(signal)
str = obj.gui.sequence.signals.values('tag');
for k=1:obj.ui_extra_channels.n
signal = obj.gui.analog_ch.get(k+1).signal;
if isempty(signal)
val = k+1;
else
ind = find(cellfun(@(x) strcmp(x,signal.tag), str));
if isempty(ind)
val = k+1;
else
ind = find(cellfun(@(x) strcmp(x,signal.tag), str));
if isempty(ind)
val = k+1;
else
val = ind;
end
val = ind;
end
set(obj.ui_extra_channels.get(k),'string',str,'value',val,...
'visible','on');
end
% end

set(obj.ui_extra_channels.get(k),'string',str,'value',val,...
'visible','on');
end
end


function updated = update(obj)
updated = true;
signals = obj.gui.sequence.signals;%.values('tag');
Expand Down
6 changes: 6 additions & 0 deletions panelcomponents/@TriggerSelection/TriggerSelection.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,19 @@ function triggerparent_callback(obj)
str = get(obj.ui_triggerparent,'string');
obj.gui.triggerparent = obj.gui.triggerparents.get('tag',str{val});
obj.show_panels(false);
if obj.gui.automatic_update_on
obj.panel.update_panel;
end
end

function trigger_callback(obj)
val = get(obj.ui_trigger,'value');
str = get(obj.ui_trigger,'string');
obj.gui.trigger = obj.gui.triggers.get('tag',str{val});
obj.show_panels(false);
if obj.gui.automatic_update_on
obj.panel.update_panel;
end
end

function triggerparent_listener(obj)
Expand Down
35 changes: 20 additions & 15 deletions panelcomponents/@WaveformSelection/WaveformSelection.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function populate(obj,mgr)
mgr.newline(20);
obj.ui_nbr_of_spikes = mgr.add(sc_ctrl('text',[]),200);
mgr.newline(20);
mgr.add(sc_ctrl('pushbutton','New waveform',@add_waveform_callback),100);
obj.ui_remove = mgr.add(sc_ctrl('pushbutton','Remove waveform',@remove_waveform_callback),100);
mgr.add(sc_ctrl('pushbutton','New waveform',@(~,~) add_waveform_callback(obj)),100);
obj.ui_remove = mgr.add(sc_ctrl('pushbutton','Remove waveform',@(~,~) remove_waveform_callback(obj)),100);
mgr.newline(20)
mgr.add(sc_ctrl('pushbutton','Export waveform',@(~,~) obj.export_waveform()),100);
mgr.newline(20)
Expand All @@ -28,25 +28,27 @@ function populate(obj,mgr)

sc_addlistener(obj.gui,'waveform',@(~,~) obj.waveform_listener,obj.uihandle);

function add_waveform_callback(~,~)
obj.gui.create_new_waveform;
obj.show_panels(false);
function add_waveform_callback(objh)
objh.gui.create_new_waveform;
objh.show_panels(false);
objh.automatic_update();
end

function remove_waveform_callback(~,~)
if isempty(obj.gui.waveform)
function remove_waveform_callback(objh)
if isempty(objh.gui.waveform)
msgbox('No waveform selected. Cannot remove');
else
answer = questdlg(sprintf('Are you sure you want to remove all thresholds belonging to waveform %s?',...
obj.gui.waveform.tag));
objh.gui.waveform.tag));
if strcmp(answer,'Yes')
prev_index = obj.gui.panels.indexof(obj.panel)-1;
prev_panel = obj.gui.panels.get(prev_index);
obj.gui.disable_panels(prev_panel);
obj.gui.main_signal.waveforms.remove(obj.gui.waveform);
obj.gui.main_channel.signal = obj.gui.main_signal;
obj.gui.has_unsaved_changes = true;
obj.show_panels(false);
prev_index = objh.gui.panels.indexof(objh.panel)-1;
prev_panel = objh.gui.panels.get(prev_index);
objh.gui.disable_panels(prev_panel);
objh.gui.main_signal.waveforms.remove(objh.gui.waveform);
objh.gui.main_channel.signal = objh.gui.main_signal;
objh.gui.has_unsaved_changes = true;
objh.show_panels(false);
objh.automatic_update();
end
end
end
Expand Down Expand Up @@ -88,6 +90,7 @@ function waveform_callback(obj)
obj.gui.waveform = obj.gui.main_signal.waveforms.get('tag',str{val});
if obj.gui.main_channel.plot_raw
obj.show_panels(false);
objh.automatic_update();
end
end
function export_waveform(obj)
Expand Down Expand Up @@ -130,12 +133,14 @@ function update_all_waveforms(obj)
obj.gui.has_unsaved_changes = true;
obj.gui.main_channel.signal.recalculate_all_waveforms();
obj.gui.lock_screen(false);
obj.automatic_update();
end
function update_current_waveform(obj)
obj.gui.lock_screen(true,'Recalculating curret waveform, might take a minute...');
obj.gui.has_unsaved_changes = true;
obj.gui.main_channel.signal.recalculate_waveform(obj.gui.waveform);
obj.gui.lock_screen(false);
obj.automatic_update();
end
end
end
19 changes: 19 additions & 0 deletions panelcomponents/AutomaticUpdate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
classdef AutomaticUpdate < PanelComponent
properties
ui_automatic_update
end
methods
function obj = AutomaticUpdate(panel)
obj@PanelComponent(panel);
end
function populate(obj,mgr)
mgr.newline(20);
obj.ui_automatic_update = mgr.add(sc_ctrl('checkbox',...
'Automatic update',@(~,~) obj.automatic_update_callback()),200);
set(obj.ui_automatic_update,'Value',obj.gui.automatic_update_on);
end
function automatic_update_callback(obj)
obj.gui.automatic_update_on = get(obj.ui_automatic_update,'Value');
end
end
end
18 changes: 12 additions & 6 deletions panelcomponents/ExperimentOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function populate(obj, mgr)
sc_addlistener(obj.gui,'experiment',@(src,ext) obj.experiment_listener,obj.uihandle);
sc_addlistener(obj.gui,'file',@(src,ext) obj.file_listener,obj.uihandle);
sc_addlistener(obj.gui,'sequence',@(src,ext) obj.sequence_listener,obj.uihandle);

end

function initialize(obj)
Expand All @@ -48,13 +48,13 @@ function experiment_listener(obj,~,~)
set(obj.ui_experiment,'string',[],'visible','off');
end
end

function file_listener(obj,~,~)
if ~isempty(obj.gui.file)
str = obj.gui.experiment.values('tag');
val = find(cellfun(@(x) strcmp(x,obj.gui.file.tag),str));
set(obj.ui_file,'string',str,'value',val,'visible','on');
else
else
set(obj.ui_file,'visible','off');
end
end
Expand All @@ -64,7 +64,7 @@ function sequence_listener(obj,~,~)
str = obj.gui.file.values('tag');
val = find(cellfun(@(x) strcmp(x,obj.gui.sequence.tag),str));
set(obj.ui_sequence,'string',str,'value',val,'visible','on');
else
else
set(obj.ui_sequence,'visible','off');
end
end
Expand All @@ -74,14 +74,20 @@ function file_callback(obj)
val = get(obj.ui_file,'value');
obj.gui.set_file(obj.gui.experiment.get('tag',str{val}));
obj.show_panels(false);
if obj.gui.automatic_update_on
obj.panel.update_panel;
end
end

function sequence_callback(obj)
function sequence_callback(obj)
str = get(obj.ui_sequence,'string');
val = get(obj.ui_sequence,'value');
obj.gui.set_sequence(obj.gui.file.get('tag',str{val}));
obj.show_panels(false);
if obj.gui.automatic_update_on
obj.panel.update_panel;
end
end

end

end
30 changes: 11 additions & 19 deletions panelcomponents/SpikeRemovalSelection.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ function tstart_callback(obj)
set(obj.ui_tstart,'string',obj.gui.rmwf.tstart);
else
obj.gui.rmwf.tstart = val;
% obj.gui.has_unsaved_changes = true;
obj.update_spike_removal_callback();
end
end
Expand All @@ -92,7 +91,6 @@ function tstop_callback(obj)
set(obj.ui_tstop,'string',obj.gui.rmwf.tstop);
else
obj.gui.rmwf.tstop = val;
% obj.gui.has_unsaved_changes = true;
obj.update_spike_removal_callback();
end
end
Expand Down Expand Up @@ -121,21 +119,17 @@ function import_trg_callback(obj)
end
function add_rmwf(obj,trg,width,apply_calibration)
list = obj.gui.main_signal.remove_waveforms;
% str = list.values('tag');
% if sc_contains(str,sprintf('#%s',trg.tag));
% msgbox('Waveform with same name already in list. (Possible cause: You must not give a waveform the same name as a trigger)');
% else
obj.gui.lock_screen(true,'Wait, calibrating waveform position...');
obj.gui.has_unsaved_changes = true;
obj.gui.main_channel.load_data();
obj.show_panels(false);
rmwf = ScRemoveWaveform(obj.gui.main_signal,trg,width,apply_calibration,obj.sequence.tmin,floor(obj.sequence.tmax));
rmwf.calibrate(obj.gui.main_channel.v);
list.add(rmwf);
obj.gui.rmwf = rmwf;
obj.gui.has_unsaved_changes = true;
obj.gui.lock_screen(false);
% end
obj.gui.lock_screen(true,'Wait, calibrating waveform position...');
obj.gui.has_unsaved_changes = true;
obj.gui.main_channel.load_data();
obj.show_panels(false);
rmwf = ScRemoveWaveform(obj.gui.main_signal,trg,width,apply_calibration,obj.sequence.tmin,floor(obj.sequence.tmax));
rmwf.calibrate(obj.gui.main_channel.v);
list.add(rmwf);
obj.gui.rmwf = rmwf;
obj.gui.has_unsaved_changes = true;
obj.gui.lock_screen(false);
obj.automatic_update();

end
function delete_spike_removal_callback(obj)
Expand All @@ -144,8 +138,6 @@ function delete_spike_removal_callback(obj)
msgbox('Cannot remove. List is empty.')
else
val = get(obj.ui_list,'value');
% str = get(obj.ui_list,'string');
% list.remove('tag',str{val});
rmwf = list.get(val);
obj.gui.main_signal.remove_waveforms.remove(rmwf);
list = obj.gui.main_signal.get_rmwfs(obj.sequence.tmin,obj.sequence.tmax);
Expand Down
2 changes: 1 addition & 1 deletion panels/@InfoPanel/InfoPanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ function layout(obj)
end

function setup_components(obj)
obj.gui_components.add(AutomaticUpdate(obj));
obj.gui_components.add(SaveLoadButton(obj));
obj.gui_components.add(ExperimentOptions(obj));
obj.gui_components.add(SequenceOptions(obj));
obj.gui_components.add(SequenceTextBox(obj));
obj.gui_components.add(FileCommentTextBox(obj));

obj.gui_components.add(ChannelOptions(obj));
setup_components@UpdatablePanel(obj);
end
Expand Down
6 changes: 3 additions & 3 deletions sc_config.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
D:\MATLAB
D:\Spike2\BNNR140319\
BNNR_sc.mat
D:\MATLAB\sc_mat filer\
D:\Spike2\strt141103
strt_sc.mat
4 changes: 3 additions & 1 deletion viewers/@SequenceViewer/SequenceViewer.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end
methods (Static)
function str = version_str()
str = '>1.1.1';
str = '1.1.2';
end
end
properties (SetObservable)
Expand Down Expand Up @@ -64,6 +64,8 @@
pan_on = 0

debug_indent = 0

automatic_update_on = true
end

properties
Expand Down
Loading

0 comments on commit c446249

Please sign in to comment.