[11] | 1 | %'keyboard_callback:' function activated when a key is pressed on the keyboard |
---|
| 2 | %----------------------------------- |
---|
[809] | 3 | |
---|
| 4 | %======================================================================= |
---|
[1107] | 5 | % Copyright 2008-2022, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France |
---|
[809] | 6 | % http://www.legi.grenoble-inp.fr |
---|
| 7 | % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr |
---|
| 8 | % |
---|
| 9 | % This file is part of the toolbox UVMAT. |
---|
| 10 | % |
---|
| 11 | % UVMAT is free software; you can redistribute it and/or modify |
---|
| 12 | % it under the terms of the GNU General Public License as published |
---|
| 13 | % by the Free Software Foundation; either version 2 of the license, |
---|
| 14 | % or (at your option) any later version. |
---|
| 15 | % |
---|
| 16 | % UVMAT is distributed in the hope that it will be useful, |
---|
| 17 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 18 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 19 | % GNU General Public License (see LICENSE.txt) for more details. |
---|
| 20 | %======================================================================= |
---|
| 21 | |
---|
[11] | 22 | function keyboard_callback(hObject,eventdata,handleshaxes) |
---|
[192] | 23 | cur_axes=get(hObject,'CurrentAxes');%current plotting axes of the figure with handle hObject |
---|
[11] | 24 | xx=double(get(hObject,'CurrentCharacter')); %get the keyboard character |
---|
[681] | 25 | if ~isempty(xx) |
---|
[710] | 26 | switch xx |
---|
| 27 | case {29,28,30,31} %arrows for displacement |
---|
| 28 | AxeData=get(cur_axes,'UserData'); |
---|
| 29 | if isfield(AxeData,'ZoomAxes')&&ishandle(AxeData.ZoomAxes) |
---|
| 30 | cur_axes=AxeData.ZoomAxes;% move the field of the zoom sub-plot instead of the main axes if it exsits |
---|
| 31 | axes(cur_axes) |
---|
[192] | 32 | end |
---|
[710] | 33 | if ~isempty(cur_axes) |
---|
| 34 | xlimit=get(cur_axes,'XLim'); |
---|
| 35 | ylimit=get(cur_axes,'Ylim'); |
---|
| 36 | dx=(xlimit(2)-xlimit(1))/10; |
---|
| 37 | dy=(ylimit(2)-ylimit(1))/10; |
---|
| 38 | if isequal(xx,29)%move arrow right |
---|
| 39 | xlimit=xlimit+dx; |
---|
| 40 | elseif isequal(xx,28)%move arrow left |
---|
| 41 | xlimit=xlimit-dx; |
---|
| 42 | elseif isequal(xx,30)%move arrow up |
---|
| 43 | ylimit=ylimit+dy; |
---|
| 44 | elseif isequal(xx,31)%move arrow down |
---|
| 45 | ylimit=ylimit-dy; |
---|
[192] | 46 | end |
---|
[710] | 47 | set(cur_axes,'XLim',xlimit) |
---|
| 48 | set(cur_axes,'YLim',ylimit) |
---|
| 49 | hfig=hObject; %master figure |
---|
| 50 | AxeData=get(cur_axes,'UserData'); |
---|
| 51 | if isfield(AxeData,'ParentRect')% update the position of the parent rectangle representing the field |
---|
| 52 | hparentrect=AxeData.ParentRect; |
---|
| 53 | rect([1 2])=[xlimit(1) ylimit(1)]; |
---|
| 54 | rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)]; |
---|
| 55 | set(hparentrect,'Position',rect) |
---|
| 56 | elseif isfield(AxeData,'LimEditBox')&& isequal(AxeData.LimEditBox,1)% update display of the GUI containing the axis (uvmat or view_field) |
---|
| 57 | hh=guidata(hfig); |
---|
| 58 | if isfield(hh,'num_MinX') |
---|
| 59 | set(hh.num_MinX,'String',num2str(xlimit(1))) |
---|
| 60 | set(hh.num_MaxX,'String',num2str(xlimit(2))) |
---|
| 61 | set(hh.num_MinY,'String',num2str(ylimit(1))) |
---|
| 62 | set(hh.num_MaxY,'String',num2str(ylimit(2))) |
---|
| 63 | end |
---|
| 64 | end |
---|
[192] | 65 | end |
---|
[710] | 66 | case 112% key 'p' |
---|
[880] | 67 | huvmat=findobj(allchild(0),'Tag','uvmat'); |
---|
| 68 | if ~isempty(huvmat) |
---|
| 69 | hhuvmat=guidata(huvmat); |
---|
| 70 | uvmat('runplus_Callback',hObject,eventdata,hhuvmat) |
---|
| 71 | end |
---|
[710] | 72 | case 109% key 'm' |
---|
[880] | 73 | huvmat=findobj(allchild(0),'Tag','uvmat'); |
---|
| 74 | if ~isempty(huvmat) |
---|
| 75 | hhuvmat=guidata(huvmat); |
---|
[710] | 76 | uvmat('runmin_Callback',hObject,eventdata,handleshaxes) |
---|
[880] | 77 | end |
---|
[710] | 78 | otherwise |
---|
[726] | 79 | if ischar(get(gco,'Tag')) |
---|
[764] | 80 | switch get(gco,'tag')% tag of the current edit box |
---|
| 81 | case {'RootPath', 'SubDir','RootFile','FileExt','RootPath_1', 'SubDir_1','RootFile_1','FileExt_1'} |
---|
| 82 | set(handleshaxes.InputFileREFRESH,'BackgroundColor',[1 0 1])%indicat that REFRESH must be activated (introduce the whole series) |
---|
| 83 | case 'num_IndexIncrement'% no action |
---|
| 84 | otherwise |
---|
| 85 | if isfield(handleshaxes,'REFRESH') |
---|
| 86 | set(handleshaxes.REFRESH,'BackgroundColor',[1 0 1])%indicat that run0 must be activated |
---|
| 87 | if isfield(handleshaxes,'movie_pair')% stop movie pair in uvmat |
---|
| 88 | set(handleshaxes.movie_pair,'value',0); |
---|
| 89 | set(handleshaxes.movie_pair,'BusyAction','Cancel')%stop movie pair if button is 'off' |
---|
| 90 | set(handleshaxes.i2,'String','')% the second i index display is suppressed |
---|
| 91 | set(handleshaxes.j2,'String','')% the second j index display is suppressed |
---|
| 92 | set(handleshaxes.Dt_txt,'String','')% the time interval indication is suppressed |
---|
| 93 | end |
---|
| 94 | elseif strcmp(get(gco,'Type'),'uicontrol') |
---|
| 95 | set(gco,'BackgroundColor',[1 0 1])%indicate that the edition must be validated by carriage return |
---|
| 96 | end |
---|
| 97 | end |
---|
[710] | 98 | end |
---|
| 99 | end |
---|
[11] | 100 | end |
---|