| 103 | } |
| 104 | |
| 105 | int FilterEvent( wxEvent &event ) override |
| 106 | { |
| 107 | using namespace Journal::Events; |
| 108 | |
| 109 | // Record something only if we are recording events, this is a menu |
| 110 | // event, there is an outstanding popup menu, and that or a descendant |
| 111 | // is the event object |
| 112 | auto pObj = event.GetEventObject(); |
| 113 | if (!(IsWatching() && |
| 114 | event.GetEventType() == wxEVT_MENU && |
| 115 | !sMenuStack.empty() && |
| 116 | ContainsMenu( sMenuStack.back(), pObj ) )) |
| 117 | return Event_Skip; |
| 118 | |
| 119 | // Find a path identifying the object |
| 120 | auto pPath = FindPathName( *static_cast<wxMenu*>(pObj), event.GetId() ); |
| 121 | if ( !pPath ) { |
| 122 | FailedEventSerialization(); |
| 123 | return Event_Skip; |
| 124 | } |
| 125 | |
| 126 | // Write a representation to the journal. |
| 127 | // Write names, not numerical ids, so the journal is not |
| 128 | // fragile if the assignment of ids to commands changes. |
| 129 | pPath->insert( pPath->begin(), JournalCode ); |
| 130 | Journal::Output( *pPath ); |
| 131 | sHandledEvent = true; |
| 132 | |
| 133 | return Event_Skip; |
| 134 | } |
| 135 | }; |
| 136 | |
| 137 | void Watch() |
nothing calls this directly
no test coverage detected