Ignore:
Timestamp:
Feb 16, 2014, 5:35:45 PM (10 years ago)
Author:
sommeria
Message:

various improvements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/keyboard_callback.m

    r681 r710  
    55xx=double(get(hObject,'CurrentCharacter')); %get the keyboard character
    66if ~isempty(xx)
    7 switch xx
    8     case {29,28,30,31}    %arrows for displacement
    9         AxeData=get(cur_axes,'UserData');
    10         if isfield(AxeData,'ZoomAxes')&&ishandle(AxeData.ZoomAxes)
    11            cur_axes=AxeData.ZoomAxes;% move the field of the zoom sub-plot instead of the main axes  if it exsits
    12            axes(cur_axes)
    13         end
    14         if ~isempty(cur_axes)
    15             xlimit=get(cur_axes,'XLim');
    16             ylimit=get(cur_axes,'Ylim');
    17             dx=(xlimit(2)-xlimit(1))/10;
    18             dy=(ylimit(2)-ylimit(1))/10;
    19             if isequal(xx,29)%move arrow right
    20                 xlimit=xlimit+dx;
    21             elseif isequal(xx,28)%move arrow left
    22                 xlimit=xlimit-dx;
    23             elseif isequal(xx,30)%move arrow up
    24                 ylimit=ylimit+dy;
    25             elseif isequal(xx,31)%move arrow down
    26                 ylimit=ylimit-dy;
     7    switch xx
     8        case {29,28,30,31}    %arrows for displacement
     9            AxeData=get(cur_axes,'UserData');
     10            if isfield(AxeData,'ZoomAxes')&&ishandle(AxeData.ZoomAxes)
     11                cur_axes=AxeData.ZoomAxes;% move the field of the zoom sub-plot instead of the main axes  if it exsits
     12                axes(cur_axes)
    2713            end
    28             set(cur_axes,'XLim',xlimit)
    29             set(cur_axes,'YLim',ylimit)
    30             hfig=hObject; %master figure
    31             AxeData=get(cur_axes,'UserData');
    32             if isfield(AxeData,'ParentRect')% update the position of the parent rectangle representing the field
    33                 hparentrect=AxeData.ParentRect;
    34                 rect([1 2])=[xlimit(1) ylimit(1)];
    35                 rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)];
    36                 set(hparentrect,'Position',rect)
    37             elseif isfield(AxeData,'LimEditBox')&& isequal(AxeData.LimEditBox,1)% update display of the GUI containing the axis (uvmat or view_field)
    38                 hh=guidata(hfig);
    39                 if isfield(hh,'num_MinX')
    40                     set(hh.num_MinX,'String',num2str(xlimit(1)))
    41                     set(hh.num_MaxX,'String',num2str(xlimit(2)))
    42                     set(hh.num_MinY,'String',num2str(ylimit(1)))
    43                     set(hh.num_MaxY,'String',num2str(ylimit(2)))
     14            if ~isempty(cur_axes)
     15                xlimit=get(cur_axes,'XLim');
     16                ylimit=get(cur_axes,'Ylim');
     17                dx=(xlimit(2)-xlimit(1))/10;
     18                dy=(ylimit(2)-ylimit(1))/10;
     19                if isequal(xx,29)%move arrow right
     20                    xlimit=xlimit+dx;
     21                elseif isequal(xx,28)%move arrow left
     22                    xlimit=xlimit-dx;
     23                elseif isequal(xx,30)%move arrow up
     24                    ylimit=ylimit+dy;
     25                elseif isequal(xx,31)%move arrow down
     26                    ylimit=ylimit-dy;
     27                end
     28                set(cur_axes,'XLim',xlimit)
     29                set(cur_axes,'YLim',ylimit)
     30                hfig=hObject; %master figure
     31                AxeData=get(cur_axes,'UserData');
     32                if isfield(AxeData,'ParentRect')% update the position of the parent rectangle representing the field
     33                    hparentrect=AxeData.ParentRect;
     34                    rect([1 2])=[xlimit(1) ylimit(1)];
     35                    rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)];
     36                    set(hparentrect,'Position',rect)
     37                elseif isfield(AxeData,'LimEditBox')&& isequal(AxeData.LimEditBox,1)% update display of the GUI containing the axis (uvmat or view_field)
     38                    hh=guidata(hfig);
     39                    if isfield(hh,'num_MinX')
     40                        set(hh.num_MinX,'String',num2str(xlimit(1)))
     41                        set(hh.num_MaxX,'String',num2str(xlimit(2)))
     42                        set(hh.num_MinY,'String',num2str(ylimit(1)))
     43                        set(hh.num_MaxY,'String',num2str(ylimit(2)))
     44                    end
    4445                end
    4546            end
    46         end
    47 %     case {8, 127} %if the delete or suppr key is pressed, delete the current object
    48 %         currentobject=gco;
    49 %         huvmat=findobj(allchild(0),'tag','uvmat');
    50 %         hlist_object=findobj(huvmat,'Tag','list_object_1');
    51 %         ObjIndex=get(hlist_object,'Value');
    52 %         if ObjIndex>1
    53 %             delete_object(ObjIndex)
    54 %         end
    55 %         if ishandle(currentobject)
    56 %             tag=get(currentobject,'Tag');%tag of the current selected object
    57 %             if isequal(tag,'proj_object')
    58 %                 delete_object(currentobject)
    59 %             end
    60 %         end
    61     case 112%  key 'p'
    62         uvmat('runplus_Callback',hObject,eventdata,handleshaxes)
    63     case 109%  key 'm'
    64         uvmat('runmin_Callback',hObject,eventdata,handleshaxes)
    65     otherwise
    66         set(handleshaxes.run0,'BackgroundColor',[1 0 1])%indicat that Run must be activated (todo: rplace by REFRESH)
     47        case 112%  key 'p'
     48            uvmat('runplus_Callback',hObject,eventdata,handleshaxes)
     49        case 109%  key 'm'
     50            uvmat('runmin_Callback',hObject,eventdata,handleshaxes)
     51        otherwise
     52            switch get(gco,'tag')% tag of the current edit box
     53                case {'RootPath', 'SubDir','RootFile','FileExt','RootPath_1', 'SubDir_1','RootFile_1','FileExt_1'}
     54                    set(handleshaxes.REFRESH,'BackgroundColor',[1 0 1])%indicat that REFRESH must be activated (intyroduce the whole series)
     55                otherwise
     56                    set(handleshaxes.run0,'BackgroundColor',[1 0 1])%indicat that run0 must be activated
     57            end
     58    end
    6759end
    68 end
Note: See TracChangeset for help on using the changeset viewer.