wxWebViewLoadEvent::wxWebViewLoadEvent(wxWindow* win) { SetEventType( wxEVT_WEBVIEW_LOAD); SetEventObject( win ); if (win) SetId(win->GetId()); }
//clicks and mice player related void ADA2UE4Creature::OnClick(UPrimitiveComponent* HitComp, FKey ButtonClicked) { if (GetGameMode() == EGameMode::GM_COMBAT || IsObjectHostile(this, GetHero())) { #ifdef DEBUG LogWarning("player attacks " + this->GetName()); #endif // DEBUG } else if (GetGameMode() == EGameMode::GM_EXPLORE && CONVERSATION != 0) { #ifdef DEBUG LogWarning("clicked on " + this->GetName() + " with conv ID " + IntToString(CONVERSATION) + " | time for GM_CONVERSATION"); #endif // DEBUG FGameEvent ev = FGameEvent(EVENT_TYPE_CONVERSATION); ev = SetEventObject(ev, this); SignalEvent(GetHero(), ev); } #ifdef DEBUG else LogError("unknown click action with game mode " + IntToString(static_cast<uint8>(GetGameMode()))); #endif // DEBUG }
wxWebViewReceivedTitleEvent::wxWebViewReceivedTitleEvent(wxWindow* win) { SetEventType(wxEVT_WEBVIEW_RECEIVED_TITLE); SetEventObject(win); if (win) SetId(win->GetId()); }
wxWebViewConsoleMessageEvent::wxWebViewConsoleMessageEvent(wxWindow* win) { SetEventType(wxEVT_WEBVIEW_CONSOLE_MESSAGE); SetEventObject(win); if (win) SetId(win->GetId()); }
wxWebViewRightClickEvent::wxWebViewRightClickEvent(wxWindow* win) { SetEventType(wxEVT_WEBVIEW_RIGHT_CLICK); SetEventObject(win); if (win) SetId(win->GetId()); }
wxWebViewNewWindowEvent::wxWebViewNewWindowEvent(wxWindow* win) { SetEventType(wxEVT_WEBVIEW_NEW_WINDOW); SetEventObject(win); if (win) SetId(win->GetId()); }
wxWebViewBeforeLoadEvent::wxWebViewBeforeLoadEvent(wxWindow* win) { m_cancelled = false; SetEventType(wxEVT_WEBVIEW_BEFORE_LOAD); SetEventObject(win); if (win) SetId(win->GetId()); }
wxTreeEvent::wxTreeEvent(wxEventType commandType, wxTreeCtrlBase *tree, const wxTreeItemId& item) : wxNotifyEvent(commandType, tree->GetId()), m_item(item) { m_editCancelled = false; SetEventObject(tree); if ( item.IsOk() ) SetClientObject(tree->GetItemData(item)); }
wxLuaDebuggerEvent::wxLuaDebuggerEvent(wxEventType eventType, wxObject* eventObject, int line_number, const wxString &file, bool enabled_flag) :wxEvent(0, eventType), m_line_number(line_number), m_fileName(file), m_has_message(false), m_lua_ref(-1), m_debugData(wxNullLuaDebugData), m_enabled_flag(enabled_flag) { SetEventObject(eventObject); }
VisualCardMouseEvent::VisualCardMouseEvent( wxWindow* win, CARD_VECTOR cv ): m_cv(cv) { SetEventType( myEVT_VISUALCARD_DROPPED_EVENT ); SetEventObject( win ); }
void StateGraphViewerPanel::workerTaskLoop() { while (true) { std::unique_lock<std::mutex> Lock{TaskMutex}; // Wait until the main thread gives us a task. TaskCV.wait(Lock); // This indicates that we should end the worker thread because the panel is // being destroyed. if (!TaskAccess && !TaskProcess) return; // Create a graph of the process state in dot format. auto const GraphString = workerGenerateDot(); if (GraphString.empty()) { wxLogDebug("GraphString.empty()"); continue; } // The remainder of the graph generation does not use the state, so we can // release access to the task information. Lock.unlock(); // Write the graph to a temporary file. llvm::SmallString<256> GraphPath; { int GraphFD; auto const GraphErr = llvm::sys::fs::createTemporaryFile("seecgraph", "dot", GraphFD, GraphPath); if (GraphErr) { wxLogDebug("Couldn't create temporary dot file: %s", wxString(GraphErr.message())); continue; } llvm::raw_fd_ostream GraphStream(GraphFD, true); GraphStream << GraphString; } // Remove the temporary file when we exit this function. auto const RemoveGraph = seec::scopeExit([&] () { bool Existed = false; llvm::sys::fs::remove(GraphPath.str(), Existed); }); // Create a temporary filename for the dot result. llvm::SmallString<256> SVGPath; auto const SVGErr = llvm::sys::fs::createTemporaryFile("seecgraph", "svg", SVGPath); if (SVGErr) { wxLogDebug("Couldn't create temporary svg file: %s", wxString(SVGErr.message())); continue; } auto const RemoveSVG = seec::scopeExit([&] () { bool Existed = false; llvm::sys::fs::remove(SVGPath.str(), Existed); }); // Run dot using the temporary input/output files. char const *Args[] = { "dot", "-Gfontnames=svg", #if defined(__APPLE__) "-Nfontname=\"Times-Roman\"", #endif "-o", SVGPath.c_str(), "-Tsvg", GraphPath.c_str(), nullptr }; std::vector<char const *> Environment; #if !defined(_WIN32) Environment.emplace_back(PathToGraphvizLibraries.c_str()); Environment.emplace_back(PathToGraphvizPlugins.c_str()); #endif Environment.emplace_back(nullptr); char const **EnvPtr = Environment.size() > 1 ? Environment.data() : nullptr; std::string ErrorMsg; bool ExecFailed = false; auto const Result = HiddenExecuteAndWait(PathToDot, Args, EnvPtr, &ErrorMsg, &ExecFailed); if (!ErrorMsg.empty()) { wxLogDebug("Dot failed: %s", ErrorMsg); continue; } if (Result) { // TODO: send a message to the user - possibly they have selected the // wrong executable? wxLogDebug("Dot returned non-zero."); continue; } // Read the dot-generated SVG from the temporary file. auto ErrorOrSVGData = llvm::MemoryBuffer::getFile(SVGPath.str()); if (!ErrorOrSVGData) { wxLogDebug("Couldn't read temporary svg file: %s", wxString(ErrorOrSVGData.getError().message())); continue; } auto &SVGData = *ErrorOrSVGData; auto SharedSVG = std::make_shared<std::string>(SVGData->getBufferStart(), SVGData->getBufferEnd()); // Remove all non-print characters from the SVG and prepare it to be sent to // the WebView via javascript. auto SharedScript = std::make_shared<wxString>(); auto &Script = *SharedScript; Script.reserve(SVGData->getBufferSize() + 256); Script << "SetState(\""; for (auto const Ch : *SharedSVG) { if (std::isprint(Ch)) { if (Ch == '\\' || Ch == '"') Script << '\\'; Script << Ch; } } Script << "\");"; auto EvPtr = seec::makeUnique<GraphRenderedEvent> (SEEC_EV_GRAPH_RENDERED, this->GetId(), std::move(SharedSVG), std::move(SharedScript)); EvPtr->SetEventObject(this); wxQueueEvent(this->GetEventHandler(), EvPtr.release()); } }
MusikPlayerEvent::MusikPlayerEvent(CMusikPlayer *pMP, wxEventType type) : wxCommandEvent(type) { SetEventObject(pMP); }