Skip to content

Commit

Permalink
Fix bug in RenameConfig that deleted preset when old and new names we…
Browse files Browse the repository at this point in the history
…re the same. Remove debugging println

git-svn-id: https://valelab.ucsf.edu/svn/micromanager2/trunk@8994 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd
  • Loading branch information
arthur committed Mar 8, 2012
1 parent 58e3500 commit ac29ed0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
31 changes: 18 additions & 13 deletions MMCore/ConfigGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,23 +219,28 @@ class ConfigGroupCollection {
*/
bool RenameConfig(const char* groupName, const char* oldConfigName, const char* newConfigName)
{
// tolerate empty group names
if (strlen(groupName) == 0)
return true;

std::map<std::string, ConfigGroup>::iterator it = groups_.find(groupName);
if (it == groups_.end())
return false; // group not found
if (it->second.Rename(oldConfigName, newConfigName))
if (0 != strcmp(oldConfigName, newConfigName))
{
// NOTE: changed to not remove empty groups, N.A. 1.31.2006
// check if the config group is empty, and if so remove it
//if (it->second.IsEmpty())
// tolerate empty group names
if (strlen(groupName) == 0)
return true;

std::map<std::string, ConfigGroup>::iterator it = groups_.find(groupName);
if (it == groups_.end())
return false; // group not found
if (it->second.Rename(oldConfigName, newConfigName))
{
// NOTE: changed to not remove empty groups, N.A. 1.31.2006
// check if the config group is empty, and if so remove it
//if (it->second.IsEmpty())
//groups_.erase(it->first);
return true;
}
else
return false; // config not found within a group
} else {
return true;
}
else
return false; // config not found within a group
}

/**
Expand Down
1 change: 0 additions & 1 deletion acqEngine/src/org/micromanager/config_editor.clj
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
(isCellEditable [_ _] true)
(getValueAt [row column] (nth (keys @group-data) row))
(setValueAt [val row column]
(println old-val val row column)
(let [old-val (.getValueAt this row column)]
(core renameConfig (get-selected-group) old-val val)
(update-group-data)))))
Expand Down

0 comments on commit ac29ed0

Please sign in to comment.