Mercurial > hg > ltpda
view m-toolbox/m/gui/gltpda/g_editValueCallback.m @ 27:29276498ebdb database-connection-manager
Remove LTPDARepositoryManager implementation
* * *
Remove GUI helper
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
function g_editValueCallback(hObject, varargin) global params paramEnabled expandedEdit = 0; if numel(get(hObject,'UserData'))>1 hObject = get(hObject,'UserData'); orighObject = hObject(2); hObject = hObject(1); expandedEdit = 1; else orighObject = hObject; end currParamIndex = get(hObject,'UserData'); newValue = get(hObject,'String'); if isempty(newValue), set(orighObject,'String',num2str(params.params(currParamIndex).val)); return; end if strcmp(newValue(1),''''), paramType = 'char'; newValue(1) = []; newValue(end) = []; for j = numel(newValue)-1:-1:2 if strcmp(newValue(j),'''') && (~strcmp(newValue(j-1),'''') && ~strcmp(newValue(j+1),'''')) newValue = [newValue(1:j),'''',newValue(j+1:end)]; end end elseif ~strcmp(newValue(1),'{'), paramType = 'double'; else paramType = 'double'; end switch paramType case 'double' try newValue = evalin('base',newValue); if isnumeric(newValue) set(orighObject,'String',mat2str(newValue)) else params = pset(params,params.params(currParamIndex).key,newValue); paramcommand = BuildParamCommand(params); for kk=1:length(selBlocks) set_param(selBlocks(kk),'Description',paramcommand); end AnnotationUpdate(params); buildplistFigureParam([],[],get(findobj('Tag','paramsPage'),'UserData')) return end catch oldValue = params.params(currParamIndex).val; if ~isa(oldValue,'char'), mat2str(oldValue); end set(orighObject,'String',oldValue) return end case 'char' params = pset(params,params.params(currParamIndex).key,newValue); end if expandedEdit, paramEnabled(currParamIndex) = 1; end params = pset(params,params.params(currParamIndex).key,newValue); if isempty(findobj('Tag','parampanelFigure')) set(findobj('Tag','apply'),'Enable','on'); set(findobj('Tag','undo'),'Enable','on'); else paramEnabled(currParamIndex) = 1; g_ApplyButtonCallback(); end end