Changeset 1078 for trunk/src/mouse_down.m
- Timestamp:
- Mar 30, 2020, 3:48:19 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mouse_down.m
r1072 r1078 390 390 IndexObj=IndexObj+1;%start new object 391 391 ObjectData.Coord=[]; 392 ObjectName New=ObjectData.Name;393 if isempty(ObjectName New)394 ObjectName New=ObjectData.Type;392 ObjectName=ObjectData.Name; 393 if isempty(ObjectName) 394 ObjectName=ObjectData.Type; 395 395 end 396 396 % add an index to the object name if the proposed name already exists 397 vers=0;% index of the name397 %vers=0;% index of the name 398 398 ListObject=get(hhuvmat.ListObject,'String'); 399 detectname=1; 400 while ~isempty(detectname) 401 detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list 402 if detectname% if the object name already exists 403 indstr=regexp(ObjectNameNew,'\D'); 404 if indstr(end)<length(ObjectNameNew) %object name ends by a number 405 vers=str2double(ObjectNameNew(indstr(end)+1:end))+1; 406 ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)]; 407 else 408 vers=vers+1; 409 ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)]; 410 end 411 end 412 end 413 ObjectName=ObjectNameNew; 399 ObjectName=rename_indexing(ObjectName,ListObject);% add an index or upgrade it if the object naem already exists 414 400 set(sethandles.Name,'String',ObjectName)% display the default name in set_object 415 401 ListObject=[ListObject;{ObjectName}];
Note: See TracChangeset
for help on using the changeset viewer.