void CCManager::OnTimer(wxTimerEvent& event) { if (event.GetId() == idCallTipTimer) // m_CallTipTimer { CodeBlocksEvent evt(cbEVT_SHOW_CALL_TIP); evt.SetInt(FROM_TIMER); Manager::Get()->ProcessEvent(evt); } else if (event.GetId() == idAutoLaunchTimer) // m_AutoLaunchTimer { cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor(); if (ed && ed->GetControl()->GetCurrentPos() == m_AutocompPosition) { CodeBlocksEvent evt(cbEVT_COMPLETE_CODE); evt.SetInt(FROM_TIMER); Manager::Get()->ProcessEvent(evt); } m_AutocompPosition = wxSCI_INVALID_POSITION; } else if (event.GetId() == idAutocompSelectTimer) // m_AutocompSelectTimer { cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor(); if (ed) { cbStyledTextCtrl* stc = ed->GetControl(); if (stc->AutoCompActive()) { m_LastAutocompIndex = stc->AutoCompGetCurrent(); DoShowDocumentation(ed); } } } else // ?! event.Skip(); }
void OpenResourceDlg::OnTimer(wxTimerEvent& event) { event.Skip(); wxString currentFilter = m_textCtrlFilter->GetValue(); if(currentFilter != m_lastFilter) { m_lastFilter = currentFilter; m_dvListCtrl->DeleteAllItems(); if(m_lastFilter.IsEmpty()) { m_timer->Start(500, true); return; } ResourceVector_t filesVec; ResourceVector_t allVec; // Refresh the list filesVec = DoGetFiles(m_lastFilter); DoGetResources(m_lastFilter); allVec.insert(allVec.end(), filesVec.begin(), filesVec.end()); allVec.insert(allVec.end(), m_resources.begin(), m_resources.end()); DoPopulateListCtrl(allVec); } m_timer->Start(500, true); }
void CLed::OnTimer(wxTimerEvent& event) { if (event.GetId() != TIMER_ID) { event.Skip(); return; } if (!m_timer.IsRunning()) return; if (!m_pState->m_pEngine) { m_timer.Stop(); return; } if (!m_pState->m_pEngine->IsActive(m_index == 0)) { Unset(); m_timer.Stop(); } return; }
// // Watch for shift key changes // void ToolManager::OnTimer( wxTimerEvent & event ) { // Go ahead and set the event to propagate event.Skip(); // Can't do anything if we're not dragging. This also prevents // us from intercepting events that don't belong to us from the // parent since we're Connect()ed to a couple. if( !mDragWindow ) { return; } bool state = wxGetKeyState( WXK_SHIFT ); if( mLastState != state ) { mLastState = state; #if defined(__WXMAC__) // Disable window animation wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, 1 ); #endif mIndicator->Show( !state ); #if defined(__WXMAC__) // Disable window animation wxSystemOptions::SetOption( wxMAC_WINDOW_PLAIN_TRANSITION, mTransition ); #endif } return; }
void SDRDevicesDialog::OnDeviceTimer( wxTimerEvent& event ) { if (refresh) { if (wxGetApp().areDevicesEnumerating() || !wxGetApp().areDevicesReady()) { std::string msg = wxGetApp().getNotification(); devStatusBar->SetStatusText(msg); devTree->DeleteAllItems(); devTree->AddRoot(msg); event.Skip(); return; } devTree->DeleteAllItems(); wxTreeItemId devRoot = devTree->AddRoot("Devices"); wxTreeItemId localBranch = devTree->AppendItem(devRoot, "Local"); wxTreeItemId dsBranch = devTree->AppendItem(devRoot, "Local Net"); wxTreeItemId remoteBranch = devTree->AppendItem(devRoot, "Remote"); devs[""] = SDREnumerator::enumerate_devices("",true); if (devs[""] != NULL) { for (devs_i = devs[""]->begin(); devs_i != devs[""]->end(); devs_i++) { if ((*devs_i)->isRemote()) { devItems[devTree->AppendItem(dsBranch, (*devs_i)->getName())] = (*devs_i); } else { devItems[devTree->AppendItem(localBranch, (*devs_i)->getName())] = (*devs_i); } } } std::vector<std::string> remotes = SDREnumerator::getRemotes(); std::vector<std::string>::iterator remotes_i; std::vector<SDRDeviceInfo *>::iterator remoteDevs_i; if (remotes.size()) { for (remotes_i = remotes.begin(); remotes_i != remotes.end(); remotes_i++) { devs[*remotes_i] = SDREnumerator::enumerate_devices(*remotes_i, true); wxTreeItemId remoteNode = devTree->AppendItem(remoteBranch, *remotes_i); if (devs[*remotes_i] != NULL) { for (remoteDevs_i = devs[*remotes_i]->begin(); remoteDevs_i != devs[*remotes_i]->end(); remoteDevs_i++) { devItems[devTree->AppendItem(remoteNode, (*remoteDevs_i)->getName())] = (*remoteDevs_i); } } } } m_addRemoteButton->Enable(); m_useSelectedButton->Enable(); devTree->Enable(); devTree->ExpandAll(); devStatusBar->SetStatusText("Ready."); refresh = false; } }
void wxVideoTerminal::OnTimer(wxTimerEvent &evt) { m_counter_blink = (m_counter_blink+1)% 10; if (m_counter_blink == 0) { m_cursor_blink = !m_cursor_blink; Refresh(false); } //wxLogDebug("%d", m_counter_test++); evt.Skip(); }
void CQueueViewBase::OnTimer(wxTimerEvent& event) { if (event.GetId() != m_filecount_delay_timer.GetId()) { event.Skip(); return; } if (m_fileCountChanged || m_folderScanCountChanged) DisplayNumberQueuedFiles(); }
void WXAppBar::OnTimer(wxTimerEvent& event) { #if defined(__WXGTK__) long x, y; m_pMouseControl->GetPointerLocation (x, y); wxRect barRect = GetRect(); if (m_autohide && m_currentDockingMode != NON_DOCKED && m_isAutohideWindowShown && !barRect.Contains(x,y)) { // Get X11 display Display* dd= (Display *) wxGetDisplay(); assert (dd); // Get desktop working area dimensions int xDesktop, yDesktop, widthDesktop, heightDesktop, screenWidth, screenHeight; GetDesktopDimensions (dd, xDesktop, yDesktop, widthDesktop, heightDesktop, screenWidth, screenHeight); // Get original dimensions of the bar wxSize proposedSize= GetBestSize(); // Compute bar position and size depending on docking mode m_Width= proposedSize.GetWidth(); m_Height= proposedSize.GetHeight(); switch (m_currentDockingMode) { case TOP_DOCKED: m_X= (screenWidth - proposedSize.GetWidth())/2; m_Y= 0 - proposedSize.GetHeight() + AUTOHIDE_FLANGE; break; case BOTTOM_DOCKED: m_X= (screenWidth - proposedSize.GetWidth())/2; m_Y= screenHeight - AUTOHIDE_FLANGE; break; case LEFT_DOCKED: m_X= 0 - proposedSize.GetWidth() + AUTOHIDE_FLANGE; m_Y= (screenHeight - proposedSize.GetHeight())/2; break; case RIGHT_DOCKED: m_X= screenWidth - AUTOHIDE_FLANGE; m_Y= (screenHeight - proposedSize.GetHeight())/2; break; case NON_DOCKED: default: assert (false); } // Set desired location and dimensions SetSize(m_X, m_Y, m_Width, m_Height); m_isAutohideWindowShown= false; } #endif event.Skip(false); }
void OpenResourceDlg::OnTimer(wxTimerEvent& event) { event.Skip(); wxString currentFilter = m_textCtrlFilter->GetValue(); if(currentFilter != m_lastFilter) { m_lastFilter = currentFilter; m_dvListCtrl->DeleteAllItems(); if(m_lastFilter.IsEmpty()) { m_timer->Start(50, true); return; } ResourceVector_t filesVec; ResourceVector_t allVec; // Refresh the list filesVec = DoGetFiles(m_lastFilter); DoGetResources(m_lastFilter); allVec.insert(allVec.end(), filesVec.begin(), filesVec.end()); allVec.insert(allVec.end(), m_resources.begin(), m_resources.end()); // and sort the results wxString lcFilter = m_lastFilter.Lower(); ResourceVector_t v1, v2, v3, v4, v5; std::for_each(allVec.begin(), allVec.end(), [&](const ResourceItem& a) { if(a.displayName == m_lastFilter) { v1.push_back(a); // Exact match } else if(a.displayName.Lower() == lcFilter) { v2.push_back(a); // case insenstive exact match } else if(a.displayName.StartsWith(m_lastFilter)) { v3.push_back(a); // starts with } else if(a.displayName.Lower().StartsWith(lcFilter)) { v4.push_back(a); // case insenstive starts with } else { // other v5.push_back(a); } }); allVec.clear(); allVec.insert(allVec.end(), v1.begin(), v1.end()); allVec.insert(allVec.end(), v2.begin(), v2.end()); allVec.insert(allVec.end(), v3.begin(), v3.end()); allVec.insert(allVec.end(), v4.begin(), v4.end()); allVec.insert(allVec.end(), v5.begin(), v5.end()); DoPopulateListCtrl(allVec); } m_timer->Start(50, true); }
void ControlToolBar::OnTimer(wxTimerEvent & event) { event.Skip(); // bug 307 fix: // Shift key-up events get swallowed if a command with a Shift in its keyboard // shortcut opens a dialog, and ControlToolBar::OnKeyUp() doesn't get called. if (!wxGetKeyState(WXK_SHIFT)) { wxKeyEvent dummyEvent; dummyEvent.m_keyCode = WXK_SHIFT; this->OnKeyUp(dummyEvent); mShiftKeyTimer.Stop(); } }
void WConfirmCalibration::OnTimer(wxTimerEvent& event) { if (m_okCountdown == 0) { m_timer.Stop(); EndModal(BUTTON_OK); } else if (m_cancelCountdown == 0) { m_timer.Stop(); EndModal(BUTTON_CANCEL); } else if (m_repeatCountdown == 0) { m_timer.Stop(); EndModal(BUTTON_REPEAT); } else { switch (m_activeButton) { case OK: m_okCountdown--; m_buttonOk->SetLabel(_("Ok") + wxString::Format(wxT(" %i"), m_okCountdown)); m_buttonCancel->SetLabel(_("Cancel")); m_buttonRepeat->SetLabel(_("Repeat")); break; case CANCEL: m_cancelCountdown--; m_buttonOk->SetLabel(_("Ok")); m_buttonCancel->SetLabel(_("Cancel") + wxString::Format(wxT(" %i"), m_cancelCountdown)); m_buttonRepeat->SetLabel(_("Repeat")); break; case REPEAT: m_repeatCountdown--; m_buttonOk->SetLabel(_("Ok")); m_buttonCancel->SetLabel(_("Cancel")); m_buttonRepeat->SetLabel(_("Repeat") + wxString::Format(wxT(" %i"), m_repeatCountdown)); break; } m_timer.Stop(); m_timer.Start(1000); } event.Skip(false); }
void App::Update(wxTimerEvent& event) { switch(mPage) // refresh draw panel { case PAGE_OSZI: { mOsziPage->RefreshPanel(); break; } case PAGE_FFT: { mFFTPage->RefreshPanel(); break; } } event.Skip(); }
void WebTools::OnTimer(wxTimerEvent& event) { event.Skip(); time_t curtime = time(NULL); if((curtime - m_lastColourUpdate) < 5) return; IEditor* editor = m_mgr->GetActiveEditor(); // Sanity CHECK_PTR_RET(editor); CHECK_PTR_RET(editor->IsModified()); if(!IsJavaScriptFile(editor->GetFileName())) return; // This file is a modified JS file m_lastColourUpdate = time(NULL); m_jsColourThread->QueueBuffer(editor->GetFileName().GetFullPath(), editor->GetTextRange(0, editor->GetLength())); }
void AButton::Listener::OnTimer(wxTimerEvent & event) { event.Skip(); // bug 307 fix: // Shift key-up events get swallowed if a command with a Shift in its keyboard // shortcut opens a dialog, and OnKeyUp() doesn't get called. // With CTRL now causing the button to change appearance, presumably similar // can happen with that key. if (!wxGetKeyState(WXK_SHIFT) || !wxGetKeyState(WXK_CONTROL)) { wxKeyEvent dummy; this->OnKeyUp(dummy); mShiftKeyTimer.Stop(); } }
void CLed::OnTimer(wxTimerEvent& event) { if (!m_timer.IsRunning()) return; if (event.GetId() != m_timer.GetId()) { event.Skip(); return; } if (!m_pEngine || !m_pEngine->IsActive((enum CFileZillaEngine::_direction)m_index)) { Unset(); m_timer.Stop(); } return; }
void ClangCodeCompletion::OnTimer(wxTimerEvent& event) { if (!IsAttached()) { return; } const int evId = event.GetId(); cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor(); if (!ed) { return; } if (evId == idReparseTimer) // m_ReparseTimer { //wxCommandEvent evt(cbEVT_COMMAND_REPARSE, idReparse); //AddPendingEvent(evt); m_pClangPlugin->RequestReparse( GetCurrentTranslationUnitId(), ed->GetFilename() ); } else if (evId == idHighlightTimer) { //if (m_TranslUnitId == wxNOT_FOUND) //{ // return; //} HighlightOccurrences(ed); } else if (evId == idDiagnosticTimer) { //wxCommandEvent evt(cbEVT_COMMAND_DIAGNOSEED, idDiagnoseEd); //AddPendingEvent(evt); } else { event.Skip(); } }
void CViewMessages::OnListRender (wxTimerEvent& event) { bool isConnected; static bool was_connected = false; static wxString strLastMachineName = wxEmptyString; wxString strNewMachineName = wxEmptyString; CMainDocument* pDoc = wxGetApp().GetDocument(); wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); isConnected = pDoc->IsConnected(); wxInt32 iRowCount = GetDocCount(); if (0 >= iRowCount) { m_pListPane->DeleteAllItems(); } else { // If connection status changed, adjust color of messages display if (was_connected != isConnected) { was_connected = isConnected; if (isConnected) { m_pMessageInfoAttr->SetTextColour(*wxBLACK); m_pMessageErrorAttr->SetTextColour(*wxRED); m_pMessageInfoGrayAttr->SetTextColour(*wxBLACK); m_pMessageErrorGrayAttr->SetTextColour(*wxRED); } else { wxColourDatabase colorBase; m_pMessageInfoAttr->SetTextColour(wxColour(128, 128, 128)); m_pMessageErrorAttr->SetTextColour(wxColour(255, 128, 128)); m_pMessageInfoGrayAttr->SetTextColour(wxColour(128, 128, 128)); m_pMessageErrorGrayAttr->SetTextColour(wxColour(255, 128, 128)); } // Force a complete update m_pListPane->DeleteAllItems(); m_pListPane->SetItemCount(iRowCount); m_iPreviousRowCount = 0; // Force scrolling to bottom } else { // Connection status didn't change if (m_iPreviousRowCount != iRowCount) { m_pListPane->SetItemCount(iRowCount); } } } if ((iRowCount>1) && (_EnsureLastItemVisible()) && (m_iPreviousRowCount != iRowCount)) { m_pListPane->EnsureVisible(iRowCount - 1); } if (isConnected) { pDoc->GetConnectedComputerName(strNewMachineName); if (strLastMachineName != strNewMachineName) { strLastMachineName = strNewMachineName; if (iRowCount) { m_pListPane->EnsureVisible(iRowCount - 1); } } } if (m_iPreviousRowCount != iRowCount) { m_iPreviousRowCount = iRowCount; } m_bProcessingListRenderEvent = false; } event.Skip(); }
void ClangPlugin::OnTimer(wxTimerEvent& event) { if (!IsAttached()) return; const int evId = event.GetId(); if (evId == idEdOpenTimer) { cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor(); if (!ed || !IsProviderFor(ed)) return; else if (m_Proxy.GetTranslationUnitId(ed->GetFilename()) != wxNOT_FOUND) { m_DiagnosticTimer.Start(DIAGNOSTIC_DELAY, wxTIMER_ONE_SHOT); return; } wxString compileCommand; ProjectFile* pf = ed->GetProjectFile(); ProjectBuildTarget* target = nullptr; Compiler* comp = nullptr; if (pf && pf->GetParentProject() && !pf->GetBuildTargets().IsEmpty() ) { target = pf->GetParentProject()->GetBuildTarget(pf->GetBuildTargets()[0]); comp = CompilerFactory::GetCompiler(target->GetCompilerID()); if (pf->GetUseCustomBuildCommand(target->GetCompilerID())) { compileCommand = pf->GetCustomBuildCommand(target->GetCompilerID()).AfterFirst(wxT(' ')); } } if (compileCommand.IsEmpty()) compileCommand = wxT("$options $includes"); cbProject* proj = (pf ? pf->GetParentProject() : nullptr); if (!comp && proj) comp = CompilerFactory::GetCompiler(proj->GetCompilerID()); if (!comp) { cbProject* tmpPrj = Manager::Get()->GetProjectManager()->GetActiveProject(); if (tmpPrj) comp = CompilerFactory::GetCompiler(tmpPrj->GetCompilerID()); } if (!comp) comp = CompilerFactory::GetDefaultCompiler(); comp->GetCommandGenerator(proj)->GenerateCommandLine(compileCommand, target, pf, ed->GetFilename(), g_InvalidStr, g_InvalidStr, g_InvalidStr ); wxStringTokenizer tokenizer(compileCommand); compileCommand.Empty(); wxString pathStr; while (tokenizer.HasMoreTokens()) { wxString flag = tokenizer.GetNextToken(); // make all include paths absolute, so clang does not choke if Code::Blocks switches directories if (flag.StartsWith(wxT("-I"), &pathStr)) { wxFileName path(pathStr); if (path.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE)) flag = wxT("-I") + path.GetFullPath(); } compileCommand += flag + wxT(" "); } compileCommand += GetCompilerInclDirs(comp->GetID()); if (FileTypeOf(ed->GetFilename()) == ftHeader) // try to find the associated source { const wxString& source = GetSourceOf(ed); if (!source.IsEmpty()) { m_Proxy.CreateTranslationUnit(source, compileCommand); if (m_Proxy.GetTranslationUnitId(ed->GetFilename()) != wxNOT_FOUND) return; // got it } } m_Proxy.CreateTranslationUnit(ed->GetFilename(), compileCommand); m_DiagnosticTimer.Start(DIAGNOSTIC_DELAY, wxTIMER_ONE_SHOT); } else if (evId == idReparseTimer) { EditorManager* edMgr = Manager::Get()->GetEditorManager(); cbEditor* ed = edMgr->GetBuiltinActiveEditor(); if (!ed) return; if (ed != m_pLastEditor) { m_TranslUnitId = m_Proxy.GetTranslationUnitId(ed->GetFilename()); m_pLastEditor = ed; } if (m_TranslUnitId == wxNOT_FOUND) return; std::map<wxString, wxString> unsavedFiles; for (int i = 0; i < edMgr->GetEditorsCount(); ++i) { ed = edMgr->GetBuiltinEditor(i); if (ed && ed->GetModified()) unsavedFiles.insert(std::make_pair(ed->GetFilename(), ed->GetControl()->GetText())); } m_Proxy.Reparse(m_TranslUnitId, unsavedFiles); DiagnoseEd(m_pLastEditor, dlMinimal); } else if (evId == idDiagnosticTimer) { cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor(); if (!ed) return; if (ed != m_pLastEditor) { m_TranslUnitId = m_Proxy.GetTranslationUnitId(ed->GetFilename()); m_pLastEditor = ed; } if (m_TranslUnitId == wxNOT_FOUND) return; DiagnoseEd(ed, dlFull); } else event.Skip(); }
void SDRDevicesDialog::OnDeviceTimer( wxTimerEvent& event ) { if (refresh) { if (wxGetApp().areModulesMissing()) { if (!failed) { wxMessageDialog *info; info = new wxMessageDialog(NULL, wxT("\nNo SoapySDR modules were found.\n\nCubicSDR requires at least one SoapySDR device support module to be installed.\n\nPlease visit https://github.com/cjcliffe/CubicSDR/wiki and in the build instructions for your platform read the 'Support Modules' section for more information."), wxT("\x28\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35\x20\u253B\u2501\u253B"), wxOK | wxICON_ERROR); info->ShowModal(); failed = true; } return; } if (wxGetApp().areDevicesEnumerating() || !wxGetApp().areDevicesReady()) { std::string msg = wxGetApp().getNotification(); devStatusBar->SetStatusText(msg); devTree->DeleteAllItems(); devTree->AddRoot(msg); event.Skip(); return; } devTree->DeleteAllItems(); wxTreeItemId devRoot = devTree->AddRoot("Devices"); wxTreeItemId localBranch = devTree->AppendItem(devRoot, "Local"); wxTreeItemId dsBranch = devTree->AppendItem(devRoot, "Local Net"); wxTreeItemId remoteBranch = devTree->AppendItem(devRoot, "Remote"); wxTreeItemId manualBranch = devTree->AppendItem(devRoot, "Manual"); devs[""] = SDREnumerator::enumerate_devices("",true); if (devs[""] != NULL) { for (devs_i = devs[""]->begin(); devs_i != devs[""]->end(); devs_i++) { DeviceConfig *devConfig = nullptr; if ((*devs_i)->isManual()) { std::string devName = "Unknown"; if ((*devs_i)->isAvailable()) { devConfig = wxGetApp().getConfig()->getDevice((*devs_i)->getDeviceId()); devName = devConfig->getDeviceName(); } else { devName = (*devs_i)->getDeviceId(); } devItems[devTree->AppendItem(manualBranch, devName)] = (*devs_i); } else if ((*devs_i)->isRemote()) { devConfig = wxGetApp().getConfig()->getDevice((*devs_i)->getDeviceId()); devItems[devTree->AppendItem(dsBranch, devConfig->getDeviceName())] = (*devs_i); } else { devConfig = wxGetApp().getConfig()->getDevice((*devs_i)->getDeviceId()); devItems[devTree->AppendItem(localBranch, devConfig->getDeviceName())] = (*devs_i); } } } std::vector<std::string> remotes = SDREnumerator::getRemotes(); std::vector<SDRDeviceInfo *>::iterator remoteDevs_i; if (remotes.size()) { for (std::string remote : remotes) { devs[remote] = SDREnumerator::enumerate_devices(remote, true); DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(remote); wxTreeItemId remoteNode = devTree->AppendItem(remoteBranch, devConfig->getDeviceName()); if (devs[remote] != NULL) { for (remoteDevs_i = devs[remote]->begin(); remoteDevs_i != devs[remote]->end(); remoteDevs_i++) { devItems[devTree->AppendItem(remoteNode, (*remoteDevs_i)->getName())] = (*remoteDevs_i); } } } } m_refreshButton->Enable(); m_addRemoteButton->Enable(); m_useSelectedButton->Enable(); devTree->Enable(); devTree->ExpandAll(); devStatusBar->SetStatusText("Ready."); refresh = false; } }
void Exword::OnTimer(wxTimerEvent& event) { if(m_device) exword_poll_disconnect(m_device); event.Skip(); }
void CViewMessages::OnListRender (wxTimerEvent& event) { bool isConnected; static bool was_connected = false; static wxString strLastMachineName = wxEmptyString; wxString strNewMachineName = wxEmptyString; CMainDocument* pDoc = wxGetApp().GetDocument(); wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); isConnected = pDoc->IsConnected(); wxInt32 iDocCount = GetDocCount(); if (0 >= iDocCount) { m_pListPane->DeleteAllItems(); } else { // If connection status changed, adjust color of messages display if (was_connected != isConnected) { was_connected = isConnected; if (isConnected) { m_pMessageInfoAttr->SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); m_pMessageErrorAttr->SetTextColour(*wxRED); } else { m_pMessageInfoAttr->SetTextColour(CBOINCListCtrl::GetBlendedColour( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW), 0.5)); m_pMessageErrorAttr->SetTextColour(CBOINCListCtrl::GetBlendedColour(*wxRED, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW), 0.5)); } m_pMessageInfoAttr->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); m_pMessageErrorAttr->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); // Force a complete update m_pListPane->DeleteAllItems(); m_pListPane->SetItemCount(iDocCount); } if (m_iPreviousDocCount != iDocCount) m_pListPane->SetItemCount(iDocCount); } if ((iDocCount > 1) && (_EnsureLastItemVisible()) && (m_iPreviousDocCount != iDocCount)) { m_pListPane->EnsureVisible(iDocCount - 1); } if (isConnected) { pDoc->GetConnectedComputerName(strNewMachineName); if (strLastMachineName != strNewMachineName) { strLastMachineName = strNewMachineName; if (iDocCount > 1) { m_pListPane->EnsureVisible(iDocCount - 1); } } } if (m_iPreviousDocCount != iDocCount) { m_iPreviousDocCount = iDocCount; } m_bProcessingListRenderEvent = false; } event.Skip(); }
void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); // Remember the key values of currently selected items SaveSelections(); int iDocCount = GetDocCount(); int iCacheCount = GetCacheCount(); if (iDocCount != iCacheCount) { if (0 >= iDocCount) { EmptyCache(); m_pListPane->DeleteAllItems(); } else { int iIndex = 0; int iReturnValue = -1; if (iDocCount > iCacheCount) { for (iIndex = 0; iIndex < (iDocCount - iCacheCount); iIndex++) { iReturnValue = AddCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->SetItemCount(iDocCount); m_bNeedSort = true; } else { // The virtual ListCtrl keeps a separate its list of selected rows; // make sure it does not reference any rows beyond the new last row. // We can ClearSelections() because we called SaveSelections() above. ClearSelections(); m_pListPane->SetItemCount(iDocCount); for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) { iReturnValue = RemoveCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); //fprintf(stderr, "CBOINCBaseView::OnListRender(): m_pListPane->RefreshItems(0, %d)\n", iDocCount - 1); m_pListPane->RefreshItems(0, iDocCount - 1); #ifdef __WXGTK__ // Work around an apparent bug in wxWidgets 3.0 // which drew blank lines at the top and failed // to draw the bottom items. This could happen // if the list was scrolled near the bottom and // the user selected "Show active tasks." m_pListPane->EnsureVisible(iDocCount - 1); #endif m_bNeedSort = true; } } } if (iDocCount > 0) { SynchronizeCache(); if (iDocCount > 1) { if (_EnsureLastItemVisible() && (iDocCount != iCacheCount)) { m_pListPane->EnsureVisible(iDocCount - 1); } } } // Find the previously selected items by their key values and reselect them RestoreSelections(); UpdateSelection(); m_bProcessingListRenderEvent = false; } event.Skip(); }
void CHideWin::OnTimer( wxTimerEvent& event ) { if ( !m_bMonitor ) { event.Skip(); return ; } //clipboard if ( wxTheClipboard->Open() ) { if ( wxTheClipboard->IsSupported( wxDF_TEXT ) ) { wxTextDataObject text; if ( wxTheClipboard->GetData( text ) ) { wxTheClipboard->Close(); wxString sUrl = text.GetText(); if ( sUrl == m_LastClip || sUrl.IsNull() ) { return ; } if ( m_pParent->IsUrlExist( string( sUrl.mb_str( wxConvLocal ) ) ) ) { return ; } //filter extention? if ( IgnoreExtention( sUrl ) ) { return ; } //monitor extention? if ( !MonitorExtention( sUrl ) ) { return ; } //no check anymore m_LastClip = sUrl; wxCommandEvent event( mgEVT_URL_NOTICE, 2 ); event.SetString( sUrl ); m_pParent->AddPendingEvent( event ); } else { wxTheClipboard->Close(); } } else { wxTheClipboard->Close(); } } else { return; //open clip fail } //event.Skip(); }
void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); // Remember the key values of currently selected items SaveSelections(); int iDocCount = GetDocCount(); int iCacheCount = GetCacheCount(); if (iDocCount != iCacheCount) { if (0 >= iDocCount) { EmptyCache(); m_pListPane->DeleteAllItems(); } else { int iIndex = 0; int iReturnValue = -1; if (iDocCount > iCacheCount) { for (iIndex = 0; iIndex < (iDocCount - iCacheCount); iIndex++) { iReturnValue = AddCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->SetItemCount(iDocCount); m_bNeedSort = true; } else { // The virtual ListCtrl keeps a separate its list of selected rows; // make sure it does not reference any rows beyond the new last row. // We can ClearSelections() because we called SaveSelections() above. ClearSelections(); m_pListPane->SetItemCount(iDocCount); for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) { iReturnValue = RemoveCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->RefreshItems(0, iDocCount - 1); m_bNeedSort = true; } } } if (iDocCount > 0) { SynchronizeCache(); if (iDocCount > 1) { if (_EnsureLastItemVisible() && (iDocCount != iCacheCount)) { m_pListPane->EnsureVisible(iDocCount - 1); } } if (m_pListPane->m_bIsSingleSelection) { // If no item has been selected yet, select the first item. #ifdef __WXMSW__ if ((m_pListPane->GetSelectedItemCount() == 0) && (m_pListPane->GetItemCount() >= 1)) { long desiredstate = wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED; m_pListPane->SetItemState(0, desiredstate, desiredstate); } #else if ((m_pListPane->GetFirstSelected() < 0) && (m_pListPane->GetItemCount() >= 1)) { m_pListPane->SetItemState(0, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED); } #endif } } // Find the previously selected items by their key values and reselect them RestoreSelections(); UpdateSelection(); m_bProcessingListRenderEvent = false; } event.Skip(); }
void P2PConnectionsWindow::onRefreshTimer(wxTimerEvent &e) { refreshConnections(); e.Skip(); }
void Parser::OnReparseTimer(wxTimerEvent& event) { ReparseModifiedFiles(); event.Skip(); }
void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); // Remember the key values of currently selected items SaveSelections(); int iDocCount = GetDocCount(); int iCacheCount = GetCacheCount(); if (iDocCount != iCacheCount) { if (0 >= iDocCount) { EmptyCache(); m_pListPane->DeleteAllItems(); } else { int iIndex = 0; int iReturnValue = -1; if (iDocCount > iCacheCount) { for (iIndex = 0; iIndex < (iDocCount - iCacheCount); iIndex++) { iReturnValue = AddCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->SetItemCount(iDocCount); m_bNeedSort = true; } else { // The virtual ListCtrl keeps a separate its list of selected rows; // make sure it does not reference any rows beyond the new last row. // We can ClearSelections() because we called SaveSelections() above. ClearSelections(); m_pListPane->SetItemCount(iDocCount); for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) { iReturnValue = RemoveCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); //fprintf(stderr, "CBOINCBaseView::OnListRender(): m_pListPane->RefreshItems(0, %d)\n", iDocCount - 1); m_pListPane->RefreshItems(0, iDocCount - 1); m_bNeedSort = true; } } } if (iDocCount > 0) { SynchronizeCache(); if (iDocCount > 1) { if (_EnsureLastItemVisible() && (iDocCount != iCacheCount)) { m_pListPane->EnsureVisible(iDocCount - 1); } } } // Find the previously selected items by their key values and reselect them RestoreSelections(); UpdateSelection(); m_bProcessingListRenderEvent = false; } event.Skip(); }