Skip to content

Commit 41cc178

Browse files
committed
Added an Add Note to Experiment menu item to the Document menu
1 parent fd6e6a0 commit 41cc178

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/main/matlab/+symphonyui/+ui/+presenters/MainPresenter.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ function bind(obj)
8383
obj.addListener(v, 'AddSource', @obj.onViewSelectedAddSource);
8484
obj.addListener(v, 'BeginEpochGroup', @obj.onViewSelectedBeginEpochGroup);
8585
obj.addListener(v, 'EndEpochGroup', @obj.onViewSelectedEndEpochGroup);
86+
obj.addListener(v, 'AddNoteToExperiment', @obj.onViewSelectedAddNoteToExperiment);
8687
obj.addListener(v, 'SelectedProtocol', @obj.onViewSelectedProtocol);
8788
obj.addListener(v, 'SetProtocolProperty', @obj.onViewSetProtocolProperty);
8889
obj.addListener(v, 'MinimizeProtocolPreview', @obj.onViewSelectedMinimizeProtocolPreview);
@@ -238,6 +239,13 @@ function onViewSelectedEndEpochGroup(obj, ~, ~)
238239
function onServiceEndedEpochGroup(obj, ~, ~)
239240
obj.updateStateOfControls();
240241
end
242+
243+
function onViewSelectedAddNoteToExperiment(obj, ~, ~)
244+
experiment = obj.documentationService.getExperiment();
245+
experimentSet = symphonyui.core.persistent.collections.EntitySet(experiment);
246+
presenter = symphonyui.ui.presenters.AddNotePresenter(experimentSet);
247+
presenter.goWaitStop();
248+
end
241249

242250
function onServiceDeletedEntity(obj, ~, ~)
243251
obj.updateStateOfControls();
@@ -460,6 +468,7 @@ function updateStateOfControls(obj)
460468
enableAddSource = hasOpenFile && isStopped;
461469
enableBeginEpochGroup = hasSource && isStopped;
462470
enableEndEpochGroup = hasEpochGroup && isStopped;
471+
enableAddNoteToExperiment = hasOpenFile && isStopped;
463472
enableSelectProtocol = hasAvailableProtocol && isStopped;
464473
enableProtocolProperties = isStopped;
465474
enableViewOnly = isValid && (isViewingPaused || isStopped);
@@ -483,6 +492,7 @@ function updateStateOfControls(obj)
483492
obj.view.enableAddSource(enableAddSource);
484493
obj.view.enableBeginEpochGroup(enableBeginEpochGroup);
485494
obj.view.enableEndEpochGroup(enableEndEpochGroup);
495+
obj.view.enableAddNoteToExperiment(enableAddNoteToExperiment);
486496
obj.view.enableSelectProtocol(enableSelectProtocol);
487497
obj.view.enableProtocolProperties(enableProtocolProperties);
488498
obj.view.enableViewOnly(enableViewOnly);

src/main/matlab/+symphonyui/+ui/+views/MainView.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
AddSource
99
BeginEpochGroup
1010
EndEpochGroup
11+
AddNoteToExperiment
1112
SelectedProtocol
1213
SetProtocolProperty
1314
MinimizeProtocolPreview
@@ -84,6 +85,11 @@ function createUi(obj)
8485
obj.documentMenu.endEpochGroup = uimenu(obj.documentMenu.root, ...
8586
'Label', 'End Epoch Group', ...
8687
'Callback', @(h,d)notify(obj, 'EndEpochGroup'));
88+
obj.documentMenu.addNoteToExperiment = uimenu(obj.documentMenu.root, ...
89+
'Label', 'Add Note to Experiment...', ...
90+
'Accelerator', 'N', ...
91+
'Separator', 'on', ...
92+
'Callback', @(h,d)notify(obj, 'AddNoteToExperiment'));
8793

8894
% Acquire menu.
8995
obj.acquireMenu.root = uimenu(obj.figureHandle, ...
@@ -268,6 +274,10 @@ function enableBeginEpochGroup(obj, tf)
268274
function enableEndEpochGroup(obj, tf)
269275
set(obj.documentMenu.endEpochGroup, 'Enable', appbox.onOff(tf));
270276
end
277+
278+
function enableAddNoteToExperiment(obj, tf)
279+
set(obj.documentMenu.addNoteToExperiment, 'Enable', appbox.onOff(tf));
280+
end
271281

272282
function enableSelectProtocol(obj, tf)
273283
set(obj.protocolPopupMenu, 'Enable', appbox.onOff(tf));

0 commit comments

Comments
 (0)