+#define ID_NEW_WINDOW 10000
+#define ID_DEF_ROTATE_LEFT_KEY 10001
+#define ID_DEF_ROTATE_RIGHT_KEY 10002
+
+//////////////////////////////////////////////////////////////////////////////////
+// Control to get a keycode
+
+class CScanTextCtrl : public wxTextCtrl
+{
+public:
+ CScanTextCtrl( wxWindow* parent, wxWindowID id, int code,
+ const wxPoint& pos, const wxSize& size );
+
+ void OnChar( wxKeyEvent& event ) { } /* do nothing */
+ void OnKeyDown(wxKeyEvent& event);
+
+private:
+// any class wishing to process wxWindows events must use this macro
+ DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE( CScanTextCtrl, wxTextCtrl )
+ EVT_CHAR( CScanTextCtrl::OnChar )
+ EVT_KEY_DOWN( CScanTextCtrl::OnKeyDown )
+END_EVENT_TABLE()
+
+CScanTextCtrl::CScanTextCtrl( wxWindow* parent, wxWindowID id, int code,
+ const wxPoint& pos, const wxSize& size )
+ : wxTextCtrl( parent, id, "", pos, size )
+{
+ wxString buf;
+ buf.Printf( "0x%04x", code );
+ SetValue( buf );
+}
+void CScanTextCtrl::OnKeyDown( wxKeyEvent& event )
+{
+ #ifdef __WXDEBUG__
+ wxLogTrace(wxTraceMessages, "[EVT_KEYDOWN]: Key = %04x, time = %d\n", event.KeyCode(),
+ event.m_timeStamp );
+ #endif // __WXDEBUG__
+
+ wxString buf;
+ buf.Printf( "0x%04x", event.KeyCode() );
+ SetValue( buf );
+}
+
+///////////////////////////////////////////////////////////
+// Dialog for defining a keypress
+
+class CMenuKeyDialog : public wxDialog
+{
+public:
+ CMenuKeyDialog( wxWindow* parent, wxWindowID id, const int code, const wxString &descr,
+ const wxString& title );
+ int GetValue();
+
+private:
+ CScanTextCtrl *m_ScanCode;
+ wxTextCtrl *m_Description;
+
+// any class wishing to process wxWindows events must use this macro
+ DECLARE_EVENT_TABLE()
+};
+
+BEGIN_EVENT_TABLE( CMenuKeyDialog, wxDialog )
+//
+END_EVENT_TABLE()
+
+CMenuKeyDialog::CMenuKeyDialog( wxWindow* parent, wxWindowID id, const int code,
+ const wxString &descr, const wxString& title )
+ : wxDialog( parent, id, title, wxPoint(-1, -1), wxSize(96*2,76*2) )
+{
+ new wxStaticText( this, -1, "Scancode", wxPoint(4*2,3*2), wxSize(31*2,12*2) );
+ m_ScanCode = new CScanTextCtrl( this, -1, code, wxPoint(37*2,6*2), wxSize(53*2,14*2) );
+
+ new wxStaticText( this, -1, "Description", wxPoint(4*2,24*2), wxSize(32*2,12*2) );
+ m_Description = new wxTextCtrl( this, -1, descr, wxPoint(37*2,27*2), wxSize(53*2,14*2) );
+
+ new wxButton( this, wxID_OK, "Ok", wxPoint(20*2,50*2), wxSize(20*2,13*2) );
+ new wxButton( this, wxID_CANCEL, "Cancel", wxPoint(44*2,50*2), wxSize(25*2,13*2) );
+}
+int CMenuKeyDialog::GetValue()
+{
+ int code;
+ wxString buf = m_ScanCode->GetValue();
+ #ifdef __WXDEBUG__
+ wxLogTrace(wxTraceMessages, buf.c_str() );
+ #endif // __WXDEBUG__
+ sscanf( buf.c_str(), "%i", &code );
+ return( code );
+}
+