function [] = offsets(pCallbacks) %OFFSETDETAILS Creates the offset details window % Detailed explanation goes here global artoaGui artoaWorkspace; %% Initialize required variables windowTitle = [ 'ARTOA4 - Float ' num2str(artoaWorkspace.float.floatname) ' - Offsets' ]; availableCallbacks = { ... 'CloseRequestFcn', ... 'tableSoundsourceOffsetsSelect', ... 'tableSoundsourceOffsetsEdit', ... 'buttonCalculateOffsets', ... 'checkboxUseOffsets', ... 'checkboxFixedSoundspeed', ... 'inputSoundspeed', ... 'buttonCopyFromOptimum', ... 'buttonCopyFromMeasured', ... 'buttonUndoLastCopy' ... }; for i = 1:length(availableCallbacks) % check if a callback is undefined if ~isfield(pCallbacks, availableCallbacks{i}) pCallbacks.(availableCallbacks{i}) = @(~, ~) false; end end %% Initialize offset details gui artoaGui.figures.editOffsets = figure( ... 'Name', windowTitle, ... 'NumberTitle', 'off', ... 'MenuBar','none', ... 'Units', 'characters' ... ); % adjust width artoaGui.figures.editOffsets.Position(3) = 120; artoaGui.editOffsets = struct(); set( ... artoaGui.figures.editOffsets, ... 'CloseRequestFcn', ... @artoa.controller.edit.offsets.close ... ); %% Setup position variables left = 0.03; fullwidth = 1 - (2 * left); %% Initialize offset table artoaGui.editOffsets.tableSoundsourceOffsets = uitable( ... artoaGui.figures.editOffsets, ... 'Units', 'normalized', ... 'Position', [left, 0.45, fullwidth, 0.5], ... 'ColumnEditable', true, ... 'CellSelectionCallback', pCallbacks.tableSoundsourceOffsetsSelect, ... 'CellEditCallback', pCallbacks.tableSoundsourceOffsetsEdit ... ); %% Optimum offsets frame artoaGui.editOffsets.frameOptimumOffsets = uipanel( ... 'Parent', artoaGui.figures.editOffsets, ... 'Title', 'Offset controls', ... 'Units', 'normalized', ... 'BackgroundColor', 'white', ... 'Position', [left .05 fullwidth/2 .35] ... ); %% Setup calculate offsets button artoaGui.editOffsets.buttonCalculateOffsets = uicontrol( ... 'Parent', artoaGui.editOffsets.frameOptimumOffsets, ... 'String', 'Calculate offsets', ... 'Style', 'PushButton', ... 'FontSize', 8, ... 'Units', 'normalized', ... 'Position', [.65 .1 .25 .2], ... 'CallBack', pCallbacks.buttonCalculateOffsets ... ); artoaGui.editOffsets.checkboxUseOffsets = uicontrol( ... 'Parent', artoaGui.editOffsets.frameOptimumOffsets, ... 'String', 'Use offsets', ... 'Style', 'checkbox', ... 'FontSize', 8, ... 'Units', 'normalized', ... 'Position', [left .75 fullwidth/2 .2], ... 'CallBack', pCallbacks.checkboxUseOffsets ... ); artoaGui.editOffsets.buttonCopyFromMeasured = uicontrol( ... 'Parent', artoaGui.editOffsets.frameOptimumOffsets, ... 'String', 'Copy Measured to Empirical', ... 'Style', 'PushButton', ... 'FontSize', 8, ... 'Units', 'normalized', ... 'Position', [left .5 fullwidth/2 .2], ... 'CallBack', pCallbacks.buttonCopyFromMeasured ... ); artoaGui.editOffsets.buttonCopyFromOptimum = uicontrol( ... 'Parent', artoaGui.editOffsets.frameOptimumOffsets, ... 'String', 'Copy Optimum to Empirical', ... 'Style', 'PushButton', ... 'FontSize', 8, ... 'Units', 'normalized', ... 'Position', [left .275 fullwidth/2 .2], ... 'CallBack', pCallbacks.buttonCopyFromOptimum ... ); artoaGui.editOffsets.buttonUndoLastCopy = uicontrol( ... 'Parent', artoaGui.editOffsets.frameOptimumOffsets, ... 'String', 'Undo last copy', ... 'Style', 'PushButton', ... 'FontSize', 8, ... 'Units', 'normalized', ... 'Position', [left .05 fullwidth/2 .2], ... 'CallBack', pCallbacks.buttonUndoLastCopy ... ); %% Soundspeed frame artoaGui.editOffsets.frameSoundspeed = uipanel( ... 'Parent', artoaGui.figures.editOffsets, ... 'Title', 'Soundspeed settings', ... 'Units', 'normalized', ... 'BackgroundColor', 'white', ... 'Position', [(2*left + fullwidth/2) .05 fullwidth/4 .35] ... ); artoaGui.editOffsets.checkboxFixedSoundspeed = uicontrol( ... 'Parent', artoaGui.editOffsets.frameSoundspeed, ... 'String', 'Use fixed soundspeed', ... 'Style', 'checkbox', ... 'FontSize', 8, ... 'Units', 'normalized', ... 'Position', [left .05 fullwidth .2], ... 'CallBack', pCallbacks.checkboxFixedSoundspeed ... ); artoaGui.editOffsets.textSoundspeed = uicontrol( ... 'Parent', artoaGui.editOffsets.frameSoundspeed, ... 'String', 'Fixed soundspeed [m/s]', ... 'Style', 'text', ... 'FontSize', 8, ... 'Units', 'normalized', ... 'Position', [left .3 (fullwidth/3*2 - 2*left) .2], ... 'CallBack', '' ... ); artoaGui.editOffsets.inputSoundspeed = uicontrol( ... 'Parent', artoaGui.editOffsets.frameSoundspeed, ... 'String', '0', ... 'Style', 'edit', ... 'FontSize', 8, ... 'Units', 'normalized', ... 'Position', [(fullwidth/3)*2 .3 fullwidth/3 .2], ... 'CallBack', pCallbacks.inputSoundspeed ... ); artoaGui.editOffsets.textOptimumSoundspeedLabel = uicontrol( ... 'Parent', artoaGui.editOffsets.frameSoundspeed, ... 'String', 'Optimum soundspeed [m/s]', ... 'Style', 'text', ... 'FontSize', 8, ... 'Units', 'normalized', ... 'Position', [left .55 (fullwidth/3*2 - 2*left) .2], ... 'CallBack', '' ... ); artoaGui.editOffsets.textOptimumSoundspeedValue = uicontrol( ... 'Parent', artoaGui.editOffsets.frameSoundspeed, ... 'String', 'NaN', ... 'Style', 'text', ... 'FontSize', 8, ... 'Units', 'normalized', ... 'Position', [(fullwidth/3)*2 .55 fullwidth/3 .2], ... 'CallBack', '' ... ); end