Browse Source

Remove key event listeners from `ProjectionEditor`

master
Krisjanis Rijnieks 9 years ago
parent
commit
9947c8b58d
  1. 59
      src/UserInterface/ProjectionEditor.cpp
  2. 4
      src/UserInterface/ProjectionEditor.h

59
src/UserInterface/ProjectionEditor.cpp

@ -36,27 +36,14 @@ void ProjectionEditor::unregisterMouseEvents(){
&ProjectionEditor::mouseDragged); &ProjectionEditor::mouseDragged);
} }
void ProjectionEditor::registerKeyEvents(){
ofAddListener(ofEvents().keyPressed, this, &ProjectionEditor::keyPressed);
ofAddListener(ofEvents().keyReleased, this, &ProjectionEditor::keyReleased);
}
void ProjectionEditor::unregisterKeyEvents(){
ofRemoveListener(ofEvents().keyPressed, this, &ProjectionEditor::keyPressed);
ofRemoveListener(ofEvents().keyReleased, this,
&ProjectionEditor::keyReleased);
}
void ProjectionEditor::enable(){ void ProjectionEditor::enable(){
registerAppEvents(); registerAppEvents();
registerMouseEvents(); registerMouseEvents();
registerKeyEvents();
} }
void ProjectionEditor::disable(){ void ProjectionEditor::disable(){
unregisterAppEvents(); unregisterAppEvents();
unregisterMouseEvents(); unregisterMouseEvents();
unregisterKeyEvents();
} }
void ProjectionEditor::update(ofEventArgs & args){ void ProjectionEditor::update(ofEventArgs & args){
@ -123,52 +110,6 @@ void ProjectionEditor::mouseDragged(ofMouseEventArgs & args){
} }
} }
void ProjectionEditor::keyPressed(ofKeyEventArgs & args){
/*
int key = args.key;
float moveStep;
if(bShiftKeyDown){
moveStep = 10.0f;
}else{
moveStep = 0.5f;
}
switch(key){
case OF_KEY_LEFT:
moveSelection(ofVec2f(-moveStep, 0.0f));
break;
case OF_KEY_RIGHT:
moveSelection(ofVec2f(moveStep, 0.0f));
break;
case OF_KEY_UP:
moveSelection(ofVec2f(0.0f, -moveStep));
break;
case OF_KEY_DOWN:
moveSelection(ofVec2f(0.0f, moveStep));
break;
case OF_KEY_SHIFT:
bShiftKeyDown = true;
break;
}
*/
}
void ProjectionEditor::keyReleased(ofKeyEventArgs & args){
/*
int key = args.key;
switch(key){
case OF_KEY_SHIFT:
bShiftKeyDown = false;
break;
}
*/
}
void ProjectionEditor::gotMessage(ofMessage & msg){ void ProjectionEditor::gotMessage(ofMessage & msg){
if(msg.message == "surfaceSelected"){ if(msg.message == "surfaceSelected"){
// refresh gui // refresh gui

4
src/UserInterface/ProjectionEditor.h

@ -16,8 +16,6 @@ class ProjectionEditor {
void unregisterAppEvents(); void unregisterAppEvents();
void registerMouseEvents(); void registerMouseEvents();
void unregisterMouseEvents(); void unregisterMouseEvents();
void registerKeyEvents();
void unregisterKeyEvents();
void enable(); void enable();
void disable(); void disable();
@ -25,8 +23,6 @@ class ProjectionEditor {
void update(ofEventArgs & args); void update(ofEventArgs & args);
void draw(); void draw();
void mouseDragged(ofMouseEventArgs & args); void mouseDragged(ofMouseEventArgs & args);
void keyPressed(ofKeyEventArgs & args);
void keyReleased(ofKeyEventArgs & args);
void gotMessage(ofMessage & msg); void gotMessage(ofMessage & msg);
void setSurfaceManager(SurfaceManager * newSurfaceManager); void setSurfaceManager(SurfaceManager * newSurfaceManager);
void clearJoints(); void clearJoints();

Loading…
Cancel
Save