|
| 1 | +function varargout = lvd_EditActionResetExtremumValueGUI(varargin) |
| 2 | +% LVD_EDITACTIONRESETEXTREMUMVALUEGUI MATLAB code for lvd_EditActionResetExtremumValueGUI.fig |
| 3 | +% LVD_EDITACTIONRESETEXTREMUMVALUEGUI, by itself, creates a new LVD_EDITACTIONRESETEXTREMUMVALUEGUI or raises the existing |
| 4 | +% singleton*. |
| 5 | +% |
| 6 | +% H = LVD_EDITACTIONRESETEXTREMUMVALUEGUI returns the handle to a new LVD_EDITACTIONRESETEXTREMUMVALUEGUI or the handle to |
| 7 | +% the existing singleton*. |
| 8 | +% |
| 9 | +% LVD_EDITACTIONRESETEXTREMUMVALUEGUI('CALLBACK',hObject,eventData,handles,...) calls the local |
| 10 | +% function named CALLBACK in LVD_EDITACTIONRESETEXTREMUMVALUEGUI.M with the given input arguments. |
| 11 | +% |
| 12 | +% LVD_EDITACTIONRESETEXTREMUMVALUEGUI('Property','Value',...) creates a new LVD_EDITACTIONRESETEXTREMUMVALUEGUI or raises the |
| 13 | +% existing singleton*. Starting from the left, property value pairs are |
| 14 | +% applied to the GUI before lvd_EditActionResetExtremumValueGUI_OpeningFcn gets called. An |
| 15 | +% unrecognized property name or invalid value makes property application |
| 16 | +% stop. All inputs are passed to lvd_EditActionResetExtremumValueGUI_OpeningFcn via varargin. |
| 17 | +% |
| 18 | +% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one |
| 19 | +% instance to run (singleton)". |
| 20 | +% |
| 21 | +% See also: GUIDE, GUIDATA, GUIHANDLES |
| 22 | + |
| 23 | +% Edit the above text to modify the response to help lvd_EditActionResetExtremumValueGUI |
| 24 | + |
| 25 | +% Last Modified by GUIDE v2.5 23-Jan-2019 10:00:18 |
| 26 | + |
| 27 | +% Begin initialization code - DO NOT EDIT |
| 28 | +gui_Singleton = 1; |
| 29 | +gui_State = struct('gui_Name', mfilename, ... |
| 30 | + 'gui_Singleton', gui_Singleton, ... |
| 31 | + 'gui_OpeningFcn', @lvd_EditActionResetExtremumValueGUI_OpeningFcn, ... |
| 32 | + 'gui_OutputFcn', @lvd_EditActionResetExtremumValueGUI_OutputFcn, ... |
| 33 | + 'gui_LayoutFcn', [] , ... |
| 34 | + 'gui_Callback', []); |
| 35 | +if nargin && ischar(varargin{1}) |
| 36 | + gui_State.gui_Callback = str2func(varargin{1}); |
| 37 | +end |
| 38 | + |
| 39 | +if nargout |
| 40 | + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
| 41 | +else |
| 42 | + gui_mainfcn(gui_State, varargin{:}); |
| 43 | +end |
| 44 | +% End initialization code - DO NOT EDIT |
| 45 | + |
| 46 | + |
| 47 | +% --- Executes just before lvd_EditActionResetExtremumValueGUI is made visible. |
| 48 | +function lvd_EditActionResetExtremumValueGUI_OpeningFcn(hObject, eventdata, handles, varargin) |
| 49 | + % This function has no output args, see OutputFcn. |
| 50 | + % hObject handle to figure |
| 51 | + % eventdata reserved - to be defined in a future version of MATLAB |
| 52 | + % handles structure with handles and user data (see GUIDATA) |
| 53 | + % varargin command line arguments to lvd_EditActionResetExtremumValueGUI (see VARARGIN) |
| 54 | + |
| 55 | + % Choose default command line output for lvd_EditActionResetExtremumValueGUI |
| 56 | + handles.output = hObject; |
| 57 | + |
| 58 | + action = varargin{1}; |
| 59 | + setappdata(hObject,'action',action); |
| 60 | + |
| 61 | + lv = varargin{2}; |
| 62 | + setappdata(hObject,'lv',lv); |
| 63 | + |
| 64 | + populateGUI(handles, action, lv); |
| 65 | + |
| 66 | + % Update handles structure |
| 67 | + guidata(hObject, handles); |
| 68 | + |
| 69 | + % UIWAIT makes lvd_EditActionResetExtremumValueGUI wait for user response (see UIRESUME) |
| 70 | + uiwait(handles.lvd_EditActionResetExtremumValueGUI); |
| 71 | + |
| 72 | +function populateGUI(handles, action, lv) |
| 73 | + [exListStr, extrema] = lv.getExtremaListBoxStr(); |
| 74 | + if(not(isempty(exListStr))) |
| 75 | + set(handles.refExtremumCombo,'String',exListStr); |
| 76 | + else |
| 77 | + set(handles.refExtremumCombo,'String',' '); |
| 78 | + end |
| 79 | + |
| 80 | + if(not(isempty(action.extremum))) |
| 81 | + ind = find(extrema == action.extremum,1,'first'); |
| 82 | + else |
| 83 | + ind = []; |
| 84 | + end |
| 85 | + |
| 86 | + if(not(isempty(ind))) |
| 87 | + set(handles.refExtremumCombo,'Value',ind); |
| 88 | + end |
| 89 | + |
| 90 | + |
| 91 | +% --- Outputs from this function are returned to the command line. |
| 92 | +function varargout = lvd_EditActionResetExtremumValueGUI_OutputFcn(hObject, eventdata, handles) |
| 93 | +% varargout cell array for returning output args (see VARARGOUT); |
| 94 | +% hObject handle to figure |
| 95 | +% eventdata reserved - to be defined in a future version of MATLAB |
| 96 | +% handles structure with handles and user data (see GUIDATA) |
| 97 | + |
| 98 | +% Get default command line output from handles structure |
| 99 | + if(isempty(handles)) |
| 100 | + varargout{1} = false; |
| 101 | + else |
| 102 | + action = getappdata(hObject,'action'); |
| 103 | + lv = getappdata(hObject,'lv'); |
| 104 | + |
| 105 | + [~, extrema] = lv.getExtremaListBoxStr(); |
| 106 | + if(not(isempty(extrema))) |
| 107 | + ind = get(handles.refExtremumCombo,'Value'); |
| 108 | + action.extremum = extrema(ind); |
| 109 | + end |
| 110 | + |
| 111 | + varargout{1} = true; |
| 112 | + close(handles.lvd_EditActionResetExtremumValueGUI); |
| 113 | + end |
| 114 | + |
| 115 | + |
| 116 | +% --- Executes on button press in saveAndCloseButton. |
| 117 | +function saveAndCloseButton_Callback(hObject, eventdata, handles) |
| 118 | +% hObject handle to saveAndCloseButton (see GCBO) |
| 119 | +% eventdata reserved - to be defined in a future version of MATLAB |
| 120 | +% handles structure with handles and user data (see GUIDATA) |
| 121 | + uiresume(handles.lvd_EditActionResetExtremumValueGUI); |
| 122 | + |
| 123 | +% --- Executes on button press in cancelButton. |
| 124 | +function cancelButton_Callback(hObject, eventdata, handles) |
| 125 | +% hObject handle to cancelButton (see GCBO) |
| 126 | +% eventdata reserved - to be defined in a future version of MATLAB |
| 127 | +% handles structure with handles and user data (see GUIDATA) |
| 128 | + close(handles.lvd_EditActionResetExtremumValueGUI); |
| 129 | + |
| 130 | +% --- Executes on selection change in refExtremumCombo. |
| 131 | +function refExtremumCombo_Callback(hObject, eventdata, handles) |
| 132 | +% hObject handle to refExtremumCombo (see GCBO) |
| 133 | +% eventdata reserved - to be defined in a future version of MATLAB |
| 134 | +% handles structure with handles and user data (see GUIDATA) |
| 135 | + |
| 136 | +% Hints: contents = cellstr(get(hObject,'String')) returns refExtremumCombo contents as cell array |
| 137 | +% contents{get(hObject,'Value')} returns selected item from refExtremumCombo |
| 138 | + |
| 139 | + |
| 140 | +% --- Executes during object creation, after setting all properties. |
| 141 | +function refExtremumCombo_CreateFcn(hObject, eventdata, handles) |
| 142 | +% hObject handle to refExtremumCombo (see GCBO) |
| 143 | +% eventdata reserved - to be defined in a future version of MATLAB |
| 144 | +% handles empty - handles not created until after all CreateFcns called |
| 145 | + |
| 146 | +% Hint: popupmenu controls usually have a white background on Windows. |
| 147 | +% See ISPC and COMPUTER. |
| 148 | +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
| 149 | + set(hObject,'BackgroundColor','white'); |
| 150 | +end |
| 151 | + |
| 152 | + |
| 153 | +% --- Executes on key press with focus on lvd_EditActionResetExtremumValueGUI or any of its controls. |
| 154 | +function lvd_EditActionResetExtremumValueGUI_WindowKeyPressFcn(hObject, eventdata, handles) |
| 155 | +% hObject handle to lvd_EditActionResetExtremumValueGUI (see GCBO) |
| 156 | +% eventdata structure with the following fields (see MATLAB.UI.FIGURE) |
| 157 | +% Key: name of the key that was pressed, in lower case |
| 158 | +% Character: character interpretation of the key(s) that was pressed |
| 159 | +% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed |
| 160 | +% handles structure with handles and user data (see GUIDATA) |
| 161 | + switch(eventdata.Key) |
| 162 | + case 'return' |
| 163 | + saveAndCloseButton_Callback(handles.saveAndCloseButton, [], handles); |
| 164 | + case 'enter' |
| 165 | + saveAndCloseButton_Callback(handles.saveAndCloseButton, [], handles); |
| 166 | + case 'escape' |
| 167 | + close(handles.lvd_EditActionResetExtremumValueGUI); |
| 168 | + end |
0 commit comments