tree_project_frame: in the wxFileSystemWatcherEvent event avoid adding the project
filename in tree list, because it is always the root item. (The previous code was not taking into account the tree list root item) Fixes #4460 https://gitlab.com/kicad/code/kicad/issues/4460
This commit is contained in:
parent
92ce7caf9a
commit
44ea281210
|
@ -1044,12 +1044,21 @@ void TREE_PROJECT_FRAME::OnFileSystemEvent( wxFileSystemWatcherEvent& event )
|
|||
kid = m_TreeProject->GetNextChild( root_id, cookie );
|
||||
}
|
||||
|
||||
// Add the new item only if it is not the current project file (root item).
|
||||
// Remember: this code is called by a wxFileSystemWatcherEvent event, and not always
|
||||
// called after an actual file rename, and the cleanup code does not explore the
|
||||
// root item, because it cannot be renamed by the user.
|
||||
TREEPROJECT_ITEM* rootData = GetItemIdData( root_id );
|
||||
|
||||
if( newfn != rootData->GetFileName() )
|
||||
{
|
||||
wxTreeItemId newroot_id = findSubdirTreeItem( newdir );
|
||||
wxTreeItemId newitem = AddItemToTreeProject( newfn, newroot_id );
|
||||
|
||||
// If the item exists, select it
|
||||
if( newitem.IsOk() )
|
||||
m_TreeProject->SelectItem( newitem );
|
||||
}
|
||||
|
||||
m_isRenaming = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue