function keyPressCallback(obj, eventdata, mfn)
global theVars;
in = get(obj,'CurrentCharacter');
switch (in)
case 'a' %Adjacency
if(theVars(mfn).clickBehaviorChar ~= 'a')
theVars(mfn).clickBehaviorChar = 'a';
allBackOn(mfn);
updateClickTypeInfo(mfn);
if(theVars(mfn).clickLevelNum==1)
msg = 'Click to expand the graph around any verb by one more level';
else
msg = sprintf('Click to expand the graph around any verb to exactly %d levels\n',theVars(mfn).clickLevelNum);
end;
writeUserMessage(mfn,{msg});
else
msg = sprintf('already in ADJACENCY mode, level %d\n', ...
theVars(mfn).clickLevelNum);
writeUserMessage(mfn,{msg});
end;
case 's' %Similarity
if(theVars(mfn).clickBehaviorChar ~= 's')
theVars(mfn).clickBehaviorChar = 's';
allBackOn(mfn);
updateClickTypeInfo(mfn);
msg = 'Click repeatedly on a single verb to see the next most similar verb';
writeUserMessage(mfn,{msg});
else
writeUserMessage(mfn,{'already in similarity mode'});
end;
case {'1','2','3','4','5','6','7','8','9'} %NOT zero!
if(theVars(mfn).clickBehaviorChar == 'a')
theVars(mfn).clickLevelNum = str2num(in);
updateClickTypeInfo(mfn);
if(theVars(mfn).clickLevelNum==1)
msg = 'Click to expand the graph around any verb by one more level';
else
msg = sprintf('Click to expand the graph around any verb to exactly %d levels\n',theVars(mfn).clickLevelNum);
end;
writeUserMessage(mfn,{msg});
end;
case 'o' %reset: turn all axes on
allBackOn(mfn);
case 'n' %toggle name lable visibility
if(strcmp(get(theVars(mfn).nameHandles(1),'Visible'),'on'))
set(theVars(mfn).nameHandles,'Visible','off');
else
set(theVars(mfn).nameHandles,'Visible','on');
end;
case 'x' %eXpand
makeNewWindowWithVisible(mfn);
case 't' %launch ParameterExplorer window
makeThresholdTester(mfn);
case 'v' %View new data set: dialog to create a new connection map
%diagram based on a different data set
additionalDataDialog(mfn);
case 'f' %Find: enter element by name to get its coordinates (will
%automatically toggle 'c'
findElementWindow(mfn);
case 'c' %show/hide coords
isVisible = get(theVars(mfn).theAxesHandles(1).coordsText,'Visible');
if(strcmp(isVisible,'on'))
set([theVars(mfn).theAxesHandles.coordsText],'Visible','off');
else
set([theVars(mfn).theAxesHandles.coordsText],'Visible','on');
end;
case 'N' %nametype toggle
if(strcmp(get(theVars(mfn).nameHandles(1),'String'), ...
theVars(mfn).targets{1}))
%convert back to regular names
set(theVars(mfn).nameHandles,{'String'},theVars(mfn).names);
else
%show targets as names
set(theVars(mfn).nameHandles,{'String'},theVars(mfn).targets);
end;
otherwise
%unsupported key press, do nothing
end;