void wxSTEditorFindReplacePanel::OnMarginClick( wxStyledTextEvent &event ) { if (!m_resultEditor) return; // set after editor is fully created if (event.GetEventType() == wxEVT_STE_MARGINDCLICK) return; wxSTEditor *editor = (wxSTEditor*)event.GetEventObject(); int pos = event.GetPosition(); if (event.GetEventType() == wxEVT_STC_DOUBLECLICK) // event pos not set correctly pos = editor->GetCurrentPos(); int line = editor->LineFromPosition(pos); if (editor->GetLine(line).Strip(wxString::both).IsEmpty()) return; wxArrayString* findAllStrings = m_findReplaceData->GetFindAllStrings(); if ((line < 0) || (line >= (int)findAllStrings->GetCount())) return; editor->MarkerDeleteAll(STE_MARKER_BOOKMARK); editor->MarkerAdd(line, STE_MARKER_BOOKMARK); wxFindDialogEvent fEvent(wxEVT_COMMAND_FIND_NEXT, GetId()); fEvent.SetEventObject(this); fEvent.SetFindString(m_findCombo->GetValue()); fEvent.SetFlags(GetFindFlags()); fEvent.SetExtraLong(line); Send(fEvent); }
void NotifyWorker::startWatching() { QLOG_TRACE() << "inotify starting"; try { Inotify notify; int32_t watch_mask = (IN_CREATE | IN_DELETE | IN_MOVED_FROM | IN_MOVED_TO); QByteArray dir_str = watch_dir.toLocal8Bit(); InotifyWatch iw(dir_str.data(), watch_mask); notify.Add(iw); for(;;) { notify.WaitForEvents(); QLOG_TRACE() << "iNotify event received"; size_t count = notify.GetEventCount(); while(count > 0) { InotifyEvent event; bool got_event = notify.GetEvent(&event); if(got_event) { FileEvent e; std::string s; event.DumpTypes(s); e.type = QString::fromUtf8(s.c_str()); e.cookie = event.GetCookie(); e.name = QString(event.GetName().c_str()); if(!e.type.contains("IN_ISDIR")) { emit fEvent(e); } } count--; } } } catch(InotifyException e) { QLOG_WARN() << "Inotify failed to start: " + QString::fromStdString(e.GetMessage()); } }