Changeset 674 for trunk/src/set_object.m
- Timestamp:
- Aug 23, 2013, 2:56:17 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_object.m
r667 r674 93 93 ZBounds=0; %default 94 94 end 95 set(h Object,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function (allow action on uvmat when set_object is in front)95 set(handles.Coord,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function (allow action on uvmat when set_object is in front) 96 96 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function 97 97 set(hObject,'DeleteFcn',{@closefcn}) … … 722 722 % add lines if multi line input needed 723 723 case{'points','polyline','polygon'} 724 Input=str2num(eventdata.EditData);%pasted input 724 725 Coord=get(handles.Coord,'Data'); 725 if ~isnan(Coord(end,1)) 726 if isequal(size(Coord,2),3) 727 %Coord=[Coord;{[]} {[]} {[]}];%add a line for edition (3D case) 728 Coord=[Coord;NaN NaN NaN]; %add a line for edition (3D case) 726 iline=eventdata.Indices(1);% selected line number 727 if size(Coord,1)<iline+numel(Input) 728 Coord=[Coord ; zeros(iline+numel(Input)-size(Coord,1),size(Coord,2))];% append zeros to fit the new column 729 end 730 Coord(iline:iline+numel(Input)-1,eventdata.Indices(2))=Input'; 731 set(handles.Coord,'Data',Coord) 732 end 733 734 % --- Executes when selected cell(s) is changed in ListCoord. 735 function Coord_CellSelectionCallback(hObject, eventdata, handles) 736 737 if ~isempty(eventdata.Indices) 738 iline=eventdata.Indices(1);% selected line number 739 set(handles.Coord,'UserData',iline) 740 end 741 742 %------------------------------------------------------------------------ 743 % --- 'key_press_fcn:' function activated when a key is pressed on the keyboard 744 %------------------------------------------------------------------------ 745 function key_press_fcn(hObject,eventdata,handles) 746 747 xx=double(get(handles.set_object,'CurrentCharacter')); %get the keyboard character 748 if ismember(xx,[8 127 31])%backspace or delete, or downward 749 Coord=get(handles.Coord,'Data'); 750 iline=get(handles.Coord,'UserData'); 751 if isequal(xx, 31) 752 if isequal(iline,size(Coord,1))% arrow downward 753 Coord=[Coord;zeros(1,size(Coord,2))]; 754 end 729 755 else 730 Coord=[Coord;NaN NaN]; %add a line for edition (2D case)756 Coord(iline,:)=[];% suppress the current line 731 757 end 732 set(handles.Coord,'Data',Coord) 733 end 734 end 735 736 758 set(handles.Coord,'Data',Coord); 759 end 737 760 738 761 function num_Angle_3_Callback(hObject, eventdata, handles)
Note: See TracChangeset
for help on using the changeset viewer.