Esempio n. 1
0
void ApiHandler::OnIpcClosed(wxCommandEvent& event) {
	IConnection* conn = (IConnection*)event.GetClientData();
	if (!conn) return;

	// Remove all notifiers from closed connection
	map<unsigned int, IConnection*>::iterator p = m_notifiers.begin();
	while (p != m_notifiers.end()) {
		if (p->second == conn) m_notifiers.erase(p++);
		else ++p;
	}

	boost::ptr_map<IConnection*, ConnectionState>::const_iterator c = m_connStates.find(conn);
	if (c != m_connStates.end()) {
		// If any editors are still in a change group, we have to release them
		const set<int>& editorsInChange = c->second->editorsInChange;
		if (!editorsInChange.empty()) {
			for (set<int>::const_iterator e = editorsInChange.begin(); e != editorsInChange.end(); ++e) {
				EditorCtrl* editor = m_app.GetEditorCtrl(*e);
				if (editor) editor->EndChange();
			}
		}
	}

	// Clear any associated state
	m_connStates.erase(conn);
}
Esempio n. 2
0
void ApiHandler::IpcEditorEndChange(EditorCtrl& editor, IConnection& conn) {
	const int editorId = editor.GetId();

	boost::ptr_map<IConnection*,ConnectionState>::iterator p = m_connStates.find(&conn);
	if (p == m_connStates.end()) return;
	set<int>& editorsInChange = p->second->editorsInChange;
	if (editorsInChange.find(editorId) != editorsInChange.end()) return;
	editorsInChange.erase(editorId);

	editor.EndChange();
}