Author: derek Date: Sun Jun 15 19:28:22 2008 New Revision: 421 Modified: sofaswitch/trunk/callflow/src/callflow.cpp sofaswitch/trunk/callflow/src/callflow.h sofaswitch/trunk/callflow/src/canvas.cpp sofaswitch/trunk/callflow/src/canvas.h Log: Try (unsuccessfully) to get the editor to respond to keypresses. This USED to work. Now, the thing is a bit broken. Sigh Modified: sofaswitch/trunk/callflow/src/callflow.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/callflow.cpp (original) +++ sofaswitch/trunk/callflow/src/callflow.cpp Sun Jun 15 19:28:22 2008 @@ -116,6 +116,7 @@ EVT_MENU ( wxH_FILESAVE__AS, MyFrame::OnFileSave__As) EVT_MENU ( wxH_HELPABOUT, MyFrame::OnHelpAbout) EVT_MENU ( wxH_HELPMANUAL, MyFrame::OnHelpManual) + EVT_CHAR_HOOK(MyFrame::OnKeyDown) EVT_CLOSE(MyFrame::OnClose) END_EVENT_TABLE() @@ -227,7 +228,10 @@ SetSize(1100, 700); } - +void MyFrame::OnKeyDown(wxKeyEvent & event) +{ + canvas->OnKeyDown(event); +} void MyFrame::OnClose (wxCloseEvent& event) { Modified: sofaswitch/trunk/callflow/src/callflow.h ============================================================================== --- sofaswitch/trunk/callflow/src/callflow.h (original) +++ sofaswitch/trunk/callflow/src/callflow.h Sun Jun 15 19:28:22 2008 @@ -82,6 +82,10 @@ /**Destructor */ ~MyFrame (); + + /**Process event - character read from the keyboard when the key + is pressed */ + void OnKeyDown(wxKeyEvent & event); /**Called in response to a shutdown command issued from somewhere */ void OnClose (wxCloseEvent& event); Modified: sofaswitch/trunk/callflow/src/canvas.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/canvas.cpp (original) +++ sofaswitch/trunk/callflow/src/canvas.cpp Sun Jun 15 19:28:22 2008 @@ -38,7 +38,7 @@ EVT_PAINT (MyCanvas::OnPaint) EVT_ENTER_WINDOW (MyCanvas::OnMouseEnter) EVT_LEAVE_WINDOW (MyCanvas::OnMouseLeave) - EVT_CHAR (MyCanvas::OnChar) + EVT_CHAR_HOOK (MyCanvas::OnKeyDown) EVT_TIMER (TimerId, MyCanvas::OnProgressTimer) END_EVENT_TABLE () @@ -429,12 +429,13 @@ } void -MyCanvas::OnChar (wxKeyEvent & event) +MyCanvas::OnKeyDown (wxKeyEvent & event) { wxString key; bool changedScreen = false; - long keycode = event.GetKeyCode (); + long keycode = event.GetKeyCode(); + std::cerr << " have a key, " << keycode << std::endl; if (keycode == WXK_DELETE) { RemoveSelectedShapes (); Modified: sofaswitch/trunk/callflow/src/canvas.h ============================================================================== --- sofaswitch/trunk/callflow/src/canvas.h (original) +++ sofaswitch/trunk/callflow/src/canvas.h Sun Jun 15 19:28:22 2008 @@ -25,8 +25,9 @@ /**Destroy this canvas, which is called by the system on close down */ ~MyCanvas (); - /**Process event - character read from the keyboard */ - void OnChar(wxKeyEvent& event); + /**Process event - character read from the keyboard when the key + is pressed */ + void OnKeyDown(wxKeyEvent & event); /**Process event - left mouse button has been pressed */ void OnLeftDown (wxMouseEvent & event);