Ignore:
Timestamp:
Mar 30, 2020, 3:48:19 PM (4 years ago)
Author:
sommeria
Message:

various updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_down.m

    r1072 r1078  
    390390        IndexObj=IndexObj+1;%start new object
    391391        ObjectData.Coord=[];
    392         ObjectNameNew=ObjectData.Name;
    393         if isempty(ObjectNameNew)
    394             ObjectNameNew=ObjectData.Type;
     392        ObjectName=ObjectData.Name;
     393        if isempty(ObjectName)
     394            ObjectName=ObjectData.Type;
    395395        end
    396396        % add an index to the object name if the proposed name already exists
    397         vers=0;% index of the name
     397        %vers=0;% index of the name
    398398        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
    414400        set(sethandles.Name,'String',ObjectName)% display the default name in set_object
    415401        ListObject=[ListObject;{ObjectName}];
Note: See TracChangeset for help on using the changeset viewer.