function [] = pressure()
%TEMPERATURE Defines the ARTOA4 edit pressure window.

global artoaGui artoaWorkspace;

%% Initialize required variables

windowTitle = [ 'ARTOA4 - Float ' num2str(artoaWorkspace.float.floatname) ' - Pressure' ];


%% Initialize pressure gui

artoaGui.figures.editPressure = figure( ...
    'Name', windowTitle, ...
    'NumberTitle', 'off', ...
    'WindowScrollWheelFcn', @artoa.controller.edit.pressure.onMouseWheelFcn, ...
    'KeyReleaseFcn', @artoa.controller.edit.pressure.onKeyUp, ...
    'KeyPressFcn', @artoa.controller.edit.pressure.onKeyDown ...
);

artoaGui.editPressure = struct();
artoaGui.editPressure.currentInteractionMode = false;
artoaGui.editPressure.keyShiftDown = false;
artoaGui.editPressure.keyControlDown = false;

set( ...
    artoaGui.figures.editPressure, ...
    'CloseRequestFcn', ...
    @artoa.controller.edit.pressure.close ...
);

%% Generate Plot

artoa.controller.edit.updateAvailablePlots();

set(artoaGui.figures.editPressure.CurrentAxes, 'Position', [0.13 0.11 0.706 0.815]);

% create custom axes toolbar
[~, btns] = axtoolbar( ...
    artoaGui.editPressure.axesScatterPressure, ...
    {'datacursor', 'pan', 'zoomin', 'zoomout', 'restoreview'} ...
    );
btns(1).ButtonPushedFcn = @artoa.controller.edit.pressure.restoreView;

%% Generate Controls

left = .85;
width = .14;

%% PICK
pickButtonHeight = .25;

artoaGui.editPressure.frameControlsPick = uipanel( ...
    'Parent', artoaGui.figures.editPressure, ...
    'Title', 'Pick', ...
    'Units', 'normalized', ...
    'BackgroundColor', 'white', ...
    'Position', [left .72 width .2] ...
);

artoaGui.editPressure.buttonPickPolygon = uicontrol( ...
    'Parent', artoaGui.editPressure.frameControlsPick, ...
    'String', 'Polygon', ...
    'Style', 'PushButton', ...
    'FontSize', 8, ...
    'Units', 'normalized', ...
    'Position', [.156 .65 .69 pickButtonHeight], ...
    'CallBack', @artoa.controller.edit.pressure.pickPolygon ...
);

artoaGui.editPressure.buttonPickPoint = uicontrol( ...
    'Parent', artoaGui.editPressure.frameControlsPick, ...
    'String', 'Point', ...
    'Style', 'PushButton', ...
    'FontSize', 8, ...
    'Units', 'normalized', ...
    'Position', [.156 .35 .69 pickButtonHeight], ...
    'CallBack', @artoa.controller.edit.pressure.pickPoint ...
);

artoaGui.editPressure.buttonDropSelection = uicontrol( ...
    'Parent', artoaGui.editPressure.frameControlsPick, ...
    'String', 'Drop', ...
    'Style', 'PushButton', ...
    'FontSize', 8, ...
    'Units', 'normalized', ...
    'Position', [.156 .05 .69 pickButtonHeight], ...
    'CallBack', 'artoa.controller.edit.pressure.dropSelection();' ...
);

%% APPLY
applyButtonHeight = .25;

artoaGui.editPressure.frameControlsApply = uipanel( ...
    'Parent', artoaGui.figures.editPressure, ...
    'Title', 'Apply', ...
    'Units', 'normalized', ...
    'BackgroundColor', 'white', ...
    'Position', [left .5 width .2] ...
);

artoaGui.editPressure.buttonApply = uicontrol( ...
    'Parent', artoaGui.editPressure.frameControlsApply, ...
    'String', 'Selected', ...
    'Style', 'PushButton', ...
    'FontSize', 8, ...
    'Units', 'normalized', ...
    'Position', [.156 .65 .69 applyButtonHeight], ...
    'CallBack', 'artoa.controller.edit.pressure.applyStatusToSelectedPoints(1);' ...
);

artoaGui.editPressure.buttonApplyAllVisible = uicontrol( ...
    'Parent', artoaGui.editPressure.frameControlsApply, ...
    'String', 'All visible', ...
    'Style', 'PushButton', ...
    'FontSize', 8, ...
    'Units', 'normalized', ...
    'Position', [.156 .35 .69 applyButtonHeight], ...
    'CallBack', 'artoa.controller.edit.pressure.applyStatusToAllVisible(1);' ...
);

artoaGui.editPressure.buttonApplyAll = uicontrol( ...
    'Parent', artoaGui.editPressure.frameControlsApply, ...
    'String', 'All', ...
    'Style', 'PushButton', ...
    'FontSize', 8, ...
    'Units', 'normalized', ...
    'Position', [.156 .05 .69 applyButtonHeight], ...
    'CallBack', 'artoa.controller.edit.pressure.applyStatusToAllPoints(1);' ...
);


%% RESET
resetButtonHeight = .25;

artoaGui.editPressure.frameControlsReset = uipanel( ...
    'Parent', artoaGui.figures.editPressure, ...
    'Title', 'Reset', ...
    'Units', 'normalized', ...
    'BackgroundColor', 'white', ...
    'Position', [left .28 width .2] ...
);

artoaGui.editPressure.buttonReset = uicontrol( ...
    'Parent', artoaGui.editPressure.frameControlsReset, ...
    'String', 'Selected', ...
    'Style', 'PushButton', ...
    'FontSize', 8, ...
    'Units', 'normalized', ...
    'Position', [.156 .65 .69 resetButtonHeight], ...
    'CallBack', 'artoa.controller.edit.pressure.applyStatusToSelectedPoints(0);' ...
);

artoaGui.editPressure.buttonResetAllVisible = uicontrol( ...
    'Parent', artoaGui.editPressure.frameControlsReset, ...
    'String', 'All visible', ...
    'Style', 'PushButton', ...
    'FontSize', 8, ...
    'Units', 'normalized', ...
    'Position', [.156 .35 .69 resetButtonHeight], ...
    'CallBack', 'artoa.controller.edit.pressure.applyStatusToAllVisible(0);' ...
);

artoaGui.editPressure.buttonResetAll = uicontrol( ...
    'Parent', artoaGui.editPressure.frameControlsReset, ...
    'String', 'All', ...
    'Style', 'PushButton', ...
    'FontSize', 8, ...
    'Units', 'normalized', ...
    'Position', [.156 .05 .69 resetButtonHeight], ...
    'CallBack', 'artoa.controller.edit.pressure.applyStatusToAllPoints(0);' ...
);

%% DELETE
deleteButtonHeight = .4;

artoaGui.editPressure.frameControlsDelete = uipanel( ...
    'Parent', artoaGui.figures.editPressure, ...
    'Title', 'Delete', ...
    'Units', 'normalized', ...
    'BackgroundColor', 'white', ...
    'Position', [left .11 width .15] ...
);

artoaGui.editPressure.buttonDelete = uicontrol( ...
    'Parent', artoaGui.editPressure.frameControlsDelete, ...
    'String', 'Selected', ...
    'Style', 'PushButton', ...
    'FontSize', 8, ...
    'Units', 'normalized', ...
    'Position', [.156 .3 .69 deleteButtonHeight], ...
    'CallBack', 'artoa.controller.edit.pressure.applyStatusToSelectedPoints(2);' ...
);

end