ssize_t bbcp_IO::Write(const struct iovec *iovp, int iovn) { ssize_t nbytes; // If logging, add up the bytes to be written // if (WKeyA) {int i; nbytes = iovp[0].iov_len; for (i = 1; i < iovn; i++) nbytes += iovp[i].iov_len; } // Write data from the buffer. Note that logging only occurs once even though // we may execute the write multiple times simply because a writev() is an all // or nothing operation and EINTR's rarely if ever happen on a writev(). // xfrtime.Start(); LOGIT(WKeyA, nbytes); while((nbytes = writev(iofd, (const struct iovec *)iovp, iovn)) < 0 && errno == EINTR) {} LOGIT(WKeyZ, (nbytes < 0 ? 0 : nbytes)); xfrtime.Stop(); // All done // if (nbytes >= 0) {xfrbytes += nbytes; xfrseek += nbytes;} else nbytes = -errno; return nbytes; }
ssize_t bbcp_IO::Write(char *buff, size_t wrsz, off_t offs) { ssize_t nbytes, wlen = 0; // Write data from the buffer // xfrseek = offs; xfrtime.Start(); while(wrsz > 0) {LOGIT(WKeyA, wrsz); if ((nbytes = pwrite(iofd, (void *)buff, wrsz, offs)) < 0) {int rc = errno; LOGIT(WKeyZ, 0); if (rc == EINTR) continue; break; } LOGIT(WKeyZ, nbytes); wrsz -= nbytes; wlen += nbytes; buff += nbytes; offs += nbytes; } xfrtime.Stop(); // All done // if (wlen >= 0) {xfrbytes += wlen; xfrseek += wlen;} else wlen = -errno; return wlen; }
// ---------------------------------------------------------------------------- void MMSapEvents::DumpClipboard() // ---------------------------------------------------------------------------- { #if defined(LOGGING) wxTextDataObject primaryData; wxTextDataObject normalData; bool gotPrimaryData = false; bool gotNormalData = false; wxString primaryText = wxEmptyString; wxString normalText = wxEmptyString; if (wxTheClipboard->Open()) { wxTheClipboard->UsePrimarySelection(true); gotPrimaryData = wxTheClipboard->GetData(primaryData); wxTheClipboard->UsePrimarySelection(false); gotNormalData = wxTheClipboard->GetData(normalData); wxTheClipboard->Close(); } else { LOGIT(wxT("DumpClipboard: failed to open")); return; } if (gotPrimaryData) primaryText = primaryData.GetText() ; if (gotNormalData) normalText = normalData.GetText() ; LOGIT(wxT("Clipboard Primary[%s]"), primaryText.c_str() ); LOGIT(wxT("Clipboard Normal[%s]"), normalText.c_str() ); #endif //defined(LOGGING) }//DumpClipboard
ssize_t bbcp_IO::Read(char *buff, size_t rdsz) { ssize_t nbytes=1, rlen = 0; // Read data into the buffer // xfrtime.Start(); while(1) {LOGIT(RKeyA, rdsz); if ((nbytes = read(iofd, (void *)buff, rdsz)) < 0) {int rc = errno; LOGIT(RKeyZ, 0); if (rc == EINTR) continue; break; } LOGIT(RKeyZ, nbytes); if (!nbytes) break; rdsz -= nbytes; rlen += nbytes; buff += nbytes; } xfrtime.Stop(); // All done // if (rlen >= 0) {xfrbytes += rlen; xfrseek += rlen;} else rlen = -errno; return rlen; }
// ---------------------------------------------------------------------------- void BrowseMarks::Dump() // ---------------------------------------------------------------------------- { // get editor by filename in case the editor was close/opened again #if defined(LOGGING) EditorBase* eb = m_pEdMgr->GetEditor(m_filePath); LOGIT( _T("BT --BrowseMarks for[%p][%s]--"), eb, m_fileShortName.c_str() ); cbEditor* cbed = 0; cbStyledTextCtrl* control = 0; //cbEditor* cbed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor(); if (eb) cbed = Manager::Get()->GetEditorManager()->GetBuiltinEditor(eb); if (cbed) control = cbed->GetControl(); LOGIT( _T("BT Array[%p] Current[%d]Last[%d]"), this, m_currIndex, m_lastIndex); for (int i = 0; i < MaxEntries; ++i ) { const int pos = m_EdPosnArray[i]; if (control && (pos != -1)) LOGIT(_T("BT Array[%p] index[%d]Line[%d]Pos[%d]"), this, i, control->LineFromPosition(pos) ,pos ); else LOGIT( _T("Array[%p] index[%d]Pos[%d]"), this, i, pos ); } #endif }
// ---------------------------------------------------------------------------- void BrowseSelector::OnNavigationKey(wxKeyEvent &event) // ---------------------------------------------------------------------------- { //FIXME: the keys should dynamically reflect the menu cmdkeys long selected = m_listBox->GetSelection(); long maxItems = m_listBox->GetCount(); long itemToSelect = 0; LOGIT( _T("OnNavigationKey selected[%ld]maxItems[%ld]key[%d]"), selected, maxItems, event.GetKeyCode() ); if( (event.GetKeyCode() == WXK_RIGHT) || (event.GetKeyCode() == WXK_DOWN) ) { // Select next page if (selected == maxItems - 1) itemToSelect = 0; else itemToSelect = selected + 1; } if( (event.GetKeyCode() == WXK_LEFT) || (event.GetKeyCode() == WXK_UP) ) { // Previous page if( selected == 0 ) itemToSelect = maxItems - 1; else itemToSelect = selected - 1; } m_listBox->SetSelection( itemToSelect ); LOGIT( _T("OnNavigationKey Selection[%ld]"), itemToSelect ); }
// ---------------------------------------------------------------------------- void ProjectData::DumpHash( const wxString #if defined(LOGGING) hashType #endif ) // ---------------------------------------------------------------------------- { #if defined(LOGGING) FileBrowse_MarksHash* phash = &m_FileBrowse_MarksArchive; if ( hashType == wxT("BookMarks") ) phash = &m_FileBook_MarksArchive; FileBrowse_MarksHash& hash = *phash; LOGIT( _T("--- DumpProjectHash ---[%s]Count[%d]"), hashType.c_str(), hash.size(), m_ProjectFilename.c_str() ); for (FileBrowse_MarksHash::iterator it = hash.begin(); it != hash.end(); it++) { wxString filename = it->first; //an Editor filename withing this project BrowseMarks* p = it->second; // ptr to array of Editor Browse/Book mark cursor positions LOGIT( _T("filename[%s]BrowseMark*[%p]name[%s]"), filename.c_str(), p, p->GetFilePath().c_str() ); } #endif }
// ---------------------------------------------------------------------------- void ProjectData::DumpBrowse_Marks( const wxString hashType ) // ---------------------------------------------------------------------------- { #if defined(LOGGING) LOGIT( _T("--- DumpBrowseData ---[%s]"), hashType.c_str() ); FileBrowse_MarksHash* phash = &m_FileBrowse_MarksArchive; if ( hashType == wxT("BookMarks") ) phash = &m_FileBook_MarksArchive; FileBrowse_MarksHash& hash = *phash; LOGIT( _T("Dump_%s Size[%d]"), hashType.c_str(), hash.size() ); for (FileBrowse_MarksHash::iterator it = hash.begin(); it != hash.end(); ++it) { wxString filename = it->first; BrowseMarks* p = it->second; LOGIT( _T("Filename[%s]%s*[%p]name[%s]"), filename.c_str(), hashType.c_str(), p, p->GetFilePath().c_str() ); if (p) { //dump the browse marks p->Dump(); } } #endif }
// ---------------------------------------------------------------------------- void CodeSnippetsConfig::SettingsLoad() // ---------------------------------------------------------------------------- { // file will be saved in $HOME/codesnippets.ini #ifdef LOGGING wxString fn(__FUNCTION__, wxConvUTF8); LOGIT( _T("--- [%s] ---"),fn.c_str() ); LOGIT(wxT("Loading Settings File[%s]"),SettingsSnippetsCfgPath.c_str()); #endif //LOGGING wxFileConfig cfgFile( wxEmptyString, // appname wxEmptyString, // vendor SettingsSnippetsCfgPath,// local filename wxEmptyString, // global file wxCONFIG_USE_LOCAL_FILE); cfgFile.Read( wxT("ExternalEditor"), &SettingsExternalEditor, wxEmptyString ) ; cfgFile.Read( wxT("SnippetFile"), &SettingsSnippetsXmlPath, wxEmptyString ) ; cfgFile.Read( wxT("SnippetFolder"), &SettingsSnippetsFolder, wxEmptyString ) ; cfgFile.Read( wxT("ViewSearchBox"), &GetConfig()->SettingsSearchBox, true ) ; cfgFile.Read( wxT("casesensitive"), &m_SearchConfig.caseSensitive, true ) ; int nScope; cfgFile.Read( wxT("scope"), &nScope, SCOPE_BOTH ) ; m_SearchConfig.scope = (SearchScope)nScope; // read Editors Stay-On-Top of main window option cfgFile.Read( _T("EditorsStayOnTop"), &SettingsEditorsStayOnTop, true); // read Editors ToolTips option cfgFile.Read( _T("ToolTipsOption"), &SettingsToolTipsOption, true); // Read External App state. Launched App will see it as false because // plugin has not set it true yet, so if this is launched App, set it true cfgFile.Read( wxT("ExternalPersistentOpen"), &m_IsExternalPersistentOpen, false ) ; if ( IsApplication() ) SetExternalPersistentOpen(true); // read user specified window state (External, Floating, or Docked) cfgFile.Read( wxT("WindowState"), &m_SettingsWindowState, wxT("Floating") ); #if defined(LOGGING) LOGIT( _T("WindowState[%s]"), GetSettingsWindowState().c_str() ); #endif // read last window position wxString winPos; cfgFile.Read( wxT("WindowPosition"), &winPos, wxEmptyString) ; if ( not winPos.IsEmpty() ) { const wxWX2MBbuf buf = csU2C(winPos); std::string cstring( buf ); std::stringstream istream(cstring); istream >> windowXpos ; istream >> windowYpos ; istream >> windowWidth ; istream >> windowHeight ; } else {
// ---------------------------------------------------------------------------- VALUE RubyClassHandler::SetFocusSketchUp(VALUE self) // ---------------------------------------------------------------------------- {//static called from Ruby // Show Ruby Console, but put focus back to SketchUp window #if defined(LOGGING) LOGIT( _T("ERSetFocusSketchUp self[%lu]"), self); #endif HWND oldhWnd = ::GetFocus(); // This wont work, the WM_COMMAND is in the queue. Window is not up yet. //unsigned menuId = pHiddenFrame->GetMenuIdFromPath(_T("Window/Ruby Console")); //LRESULT lresult = ::SendMessage( g_hWndSketchUp, WM_COMMAND, menuId, 0); //HWND rubyConsole = ::FindWindow("#32770", "Ruby Console"); HWND fghWnd = ::GetForegroundWindow(); if ( oldhWnd == g_hWndSketchUpView) return Qtrue; if ( fghWnd == g_hWndSketchUp) { return Qtrue; } ::EnableWindow( g_hWndSketchUp, TRUE ); ::EnableWindow( g_hWndSketchUpView, TRUE ); ::SetForegroundWindow(g_hWndSketchUp); ::SetFocus(g_hWndSketchUpView); HWND newhWnd = ::GetFocus(); HWND newfgWnd = ::GetForegroundWindow(); //if ( lresult || oldhWnd || newhWnd || rubyConsole ) {;} //shush compiler unused warning #if defined(LOGGING) LOGIT( _T("ERSetFocusSketchUp OldFocus[%p] NewFocus[%p]] "), (void*)oldhWnd, (void*)newhWnd); LOGIT( _T("ERSetFocusSketchUp ForeGrnd[%p] SketchUp[%p]]"), (void*)fghWnd, (void*)g_hWndSketchUp); #endif #if defined(LOGGING) LOGIT( _T("ERSetFocusSketchUp self[%lu] Focus[%s]"), self, ( newhWnd == g_hWndSketchUp )?_T("TRUE":_T("FALSE"))); #endif if ( newhWnd == g_hWndSketchUpView ) return Qtrue; if ( newfgWnd == g_hWndSketchUp ) return Qtrue; return Qfalse; }
// ---------------------------------------------------------------------------- bool CodeSnippetsEvent::PostCodeSnippetsEvent(const CodeSnippetsEvent& event) // ---------------------------------------------------------------------------- { // Propagate CodeSnippetsEvent to ThreadSearchFrame // They wont get there otherwise. // Here we append the events to the lowest window that // might conceivable want the CodeSnippetsEvents (niz., "Flat Notebook") // "Flat Notebook" belongs to both CodeSnippets() *and* ThreadSearch() frames // when ThreadSearch() re-parented ThreadSearchView() and cbEditor wxNotebook // into ThreadSearchFrame's wxSplitterWindow. // That way, the events propagate back up both frame chains for all to see. Utils utils; ////#if defined(LOGGING) //// int snippetID = event.GetSnippetID(); //// wxString snippetString = event.GetSnippetString(); //// wxString eventTypeLabel = event.GetEventTypeLabel(); //// LOGIT( _T("PostCodeSnippetsEvent type[%s]id[%d]str[%s]"), eventTypeLabel.c_str(), snippetID, snippetString.c_str()); ////#endif wxWindow* pCodeSnippetsTreeCtrl = (wxWindow*)GetConfig()->GetSnippetsTreeCtrl(); wxWindow* pSearchPath = utils.FindWindowRecursively( (wxWindow*)GetConfig()->GetThreadSearchFrame(), _T("SCIwindow") ); #if defined(LOGGING) if ( pCodeSnippetsTreeCtrl) LOGIT( _T("PostCodeSnippetsEvent TreeCtrl[%p][%s]"), pCodeSnippetsTreeCtrl, pCodeSnippetsTreeCtrl->GetName().c_str()); if ( pSearchPath ) LOGIT( _T("PostCodeSnippetsEvent SrchPath[%p][%s]"), pSearchPath, pSearchPath->GetName().c_str()); #endif // Propagate the event to ThreadSearchFrame if ( pSearchPath && pCodeSnippetsTreeCtrl) { #if wxCHECK_VERSION(2, 9, 0) pSearchPath->GetEventHandler()->AddPendingEvent( (wxEvent&)event ); pCodeSnippetsTreeCtrl->GetEventHandler()->AddPendingEvent( (wxEvent&)event ); #else pSearchPath->AddPendingEvent( (wxEvent&)event ); pCodeSnippetsTreeCtrl->AddPendingEvent( (wxEvent&)event ); #endif } else { #if defined(LOGGING) LOGIT( _T("PostCodeSnippetsEvent[%s]"), _T("Failed")); #endif return false; } return true; }//PostCodeSnippetsEvent
void VikeEvtBinder::OnFocus(wxFocusEvent &event) { LOGIT(_("on focus")); cbEditor *edBase = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor(); wxScintilla *editor = NULL; if(edBase){ editor = (wxScintilla *)edBase->GetControl(); LOGIT(_T("window is %p, edbase is %p, editor is %p"),event.GetWindow(), edBase, editor); m_pVikeWin->UpdateStatusBar(); m_pVikeWin->UpdateCaret((wxScintilla *)editor); } event.Skip(); }
// ---------------------------------------------------------------------------- void Navigator::OnMenuJumpBack(wxCommandEvent &/*event*/) // ---------------------------------------------------------------------------- { int tailPlusOne; #if defined(LOGGING) LOGIT( _T("JT [%s]"), _T("OnMenuJumpBack")); #endif tailPlusOne = m_Tail+1; if(tailPlusOne >= POS_BUFFER_SIZE ) tailPlusOne = 0; // Can we go further back if( m_Cursor == tailPlusOne) return; m_Cursor--; if(m_Cursor == -1) m_Cursor = POS_BUFFER_SIZE-1; EditorManager* edmgr = Manager::Get()->GetEditorManager(); wxString edFilename = m_ArrayOfJumpData[m_Cursor].m_Filename; long edPosn = m_ArrayOfJumpData[m_Cursor].m_Posn; #if defined(LOGGING) LOGIT( _T("JT OnMenuJumpBack [%s][%ld]curs[%d]"), edFilename.c_str(), edPosn, m_Cursor); #endif // activate editor cbEditor* ed = edmgr->Open(edFilename); if(ed) { cbStyledTextCtrl* control = ed->GetControl(); ed->GotoLine(ed->GetControl()->LineFromPosition(edPosn)); //center on scrn ed->SetFocus(); control->GotoPos(edPosn); } #if defined(LOGGING) LOGIT( _T("JT [%s]"), _T("END OnMenuJumpBack")); #endif }
// ---------------------------------------------------------------------------- void SnippetProperty::InvokeEditOnSnippetFile() // ---------------------------------------------------------------------------- { // Open as file if (not IsSnippetFile() ) return; // If snippet is file, open it wxString FileName = GetConfig()->GetSnippetsTreeCtrl()->GetSnippetFileLink(); // we have an actual file name, not just text wxString pgmName = GetConfig()->SettingsExternalEditor; if ( pgmName.IsEmpty() ) { #if defined(__WXMSW__) pgmName = wxT("notepad"); #elif defined(__UNIX__) pgmName = wxT("gedit"); #endif } // file name must be surrounded with quotes when using wxExecute wxString execString = pgmName + wxT(" \"") + FileName + wxT("\""); #ifdef LOGGING LOGIT( _T("InvokeEditOnSnippetFile[%s]"), execString.GetData() ); #endif //LOGGING ::wxExecute( execString); return; }//InvokeEditOnSnippetFile
VikeEvtBinder::VikeEvtBinder(cbVike *vike, cbStyledTextCtrl* controller, cbEditor *editor) : m_pVike(vike), m_pTarget(controller), m_pEditor(editor) { VikeStatusBar *bar = nullptr; wxArrayPtrVoid *found = vike->FindHandlerFor(editor); if(found->Count() == 0){ LOGIT(_T("new status bar")); bar = new VikeStatusBar(editor, wxSB_NORMAL); }else{ LOGIT(_T("old status bar")); bar = ((VikeEvtBinder *)found->Item(0))->GetVikeWin()->GetStatusBar(); } m_pVikeWin = new VikeWin(controller, editor, bar); m_pTarget->PushEventHandler(this); delete found; }
void UserIdCache::updateItem(const QString &userId, int taskId) { LOGIT("updateItem() A"); UserIdList::iterator curr; for (curr = _userIdList->begin(); curr != _userIdList->end(); curr++) { if (((curr->getUserId()).compare(userId) == 0) && (curr->getTaskId() == -1)) { qDebug() << "EEEE UserIdCache::updateItem - unassigned entry found for userId=" << userId << endl; curr->setTaskId(taskId); LOGIT("updateItem() B"); return; } } qWarning() << "EEEE UserIdCache::updateItem - NO unassigned entries found for userId=" << userId << endl; }
// ---------------------------------------------------------------------------- void SettingsDlg::OnOk(wxCommandEvent& event) // ---------------------------------------------------------------------------- { wxString filename = m_ExtEditorTextCtrl->GetValue(); if ( not filename.IsEmpty() ) GetConfig()->SettingsExternalEditor = filename; else GetConfig()->SettingsExternalEditor = wxEmptyString; filename = m_SnippetFileTextCtrl->GetValue(); if ( not filename.IsEmpty() ) GetConfig()->SettingsSnippetsFolder = filename; else GetConfig()->SettingsSnippetsFolder = wxEmptyString; // Get the EditorsStayOnTop options GetConfig()->SetEditorsStayOnTop( m_EditorsStayOnTopChkBox->GetValue() ); // Get the ToolTips options GetConfig()->SetToolTipsOption( m_ToolTipsChkBox->GetValue() ); wxString windowState = wxT("Floating"); if (m_RadioFloatBtn->GetValue() ) windowState = wxT("Floating"); if (m_RadioDockBtn->GetValue() ) windowState = wxT("Docked"); if (m_RadioExternalBtn->GetValue()) windowState = wxT("External"); GetConfig()->SetSettingsWindowState( windowState) ; this->EndModal(wxID_OK); LOGIT( _T("OnOK Saving Settings")); GetConfig()->SettingsSave(); }
// ---------------------------------------------------------------------------- void SettingsDlg::OnOk(wxCommandEvent& event) // ---------------------------------------------------------------------------- { wxString filename = m_ExtEditorTextCtrl->GetValue(); if ( not filename.IsEmpty() ) GetConfig()->SettingsExternalEditor = filename; else GetConfig()->SettingsExternalEditor = wxEmptyString; filename = m_SnippetFileTextCtrl->GetValue(); if ( not filename.IsEmpty() ) GetConfig()->SettingsSnippetsFolder = filename; else GetConfig()->SettingsSnippetsFolder = wxEmptyString; // "Adaptive Mouse Speed Sensitivity" GetConfig()->MouseDragSensitivity = m_MouseSpeedSlider->GetValue(); // "Mouse Movement to Scroll Ratio" GetConfig()->MouseToLineRatio = m_MouseScrollSlider->GetValue(); // "Context Menu Delay (millisec)" GetConfig()->MouseContextDelay = m_MouseDelaylider->GetValue(); wxString windowState = wxT("Floating"); if (m_RadioFloatBtn->GetValue() ) windowState = wxT("Floating"); if (m_RadioDockBtn->GetValue() ) windowState = wxT("Docked"); if (m_RadioExternalBtn->GetValue()) windowState = wxT("External"); GetConfig()->SettingsWindowState = windowState; this->EndModal(wxID_OK); LOGIT( _T("OnOK Saving Settings")); GetConfig()->SettingsSave(); }
// ---------------------------------------------------------------------------- void SettingsDlg::GetFileName(wxString& newFileName) // ---------------------------------------------------------------------------- { newFileName = wxEmptyString; // Ask user for filename wxFileDialog dlg(this, //parent window _T("Select file "), //message wxEmptyString, //default directory wxEmptyString, //default file wxT("*.*"), //wildcards wxFD_OPEN | wxFD_FILE_MUST_EXIST ); //style // move dialog into the parents frame space wxPoint mousePosn = ::wxGetMousePosition(); (&dlg)->Move(mousePosn.x, mousePosn.y); if (dlg.ShowModal() != wxID_OK) return; newFileName = dlg.GetPath(); #ifdef LOGGING LOGIT( _T("New filename[%s]"), newFileName.GetData() ); #endif //LOGGING; }
// ---------------------------------------------------------------------------- void Navigator::JumpDataAdd(const wxString& filename, const long posn, const long lineNum) // ---------------------------------------------------------------------------- { // Skip this position if it was equal to the previous on line number level. if( (m_ArrayOfJumpData[m_Cursor].m_Filename == filename) && (m_ArrayOfJumpData[m_Cursor].m_Posn == posn ) ) return; if ( ++m_Cursor >= POS_BUFFER_SIZE ) m_Cursor = 0; m_Head = m_Cursor; m_ArrayOfJumpData[m_Cursor].m_Filename = filename; m_ArrayOfJumpData[m_Cursor].m_Posn = posn; if(m_Head == m_Tail) { m_Tail++; if ( m_Tail >= POS_BUFFER_SIZE ) m_Tail = 0; } #if defined(LOGGING) LOGIT( _T("JT JumpDataAdd[%s][%ld][%d]"), filename.c_str(), posn, m_head); #endif }
// ---------------------------------------------------------------------------- void BrowseMarks::ImportBrowse_Marks() // ---------------------------------------------------------------------------- { // rebuild BrowseMarks from scintilla browse marks #if defined(LOGGING) ///LOGIT( _T("BT ImportBrowse_Marks") ); #endif //-EditorBase* eb = m_pEditorBase ; EditorBase* eb = m_pEdMgr->GetEditor(m_filePath); #if defined(LOGGING) LOGIT(_T("BT ImportBrowse_Marks entered with no active editor base.")); #endif // This can happens when editing script for example . if (not eb) return; cbEditor* pcbEditor = Manager::Get()->GetEditorManager()->GetBuiltinEditor( eb ) ; if (not pcbEditor) return; ClearAllBrowse_Marks(); cbStyledTextCtrl* pControl = pcbEditor->GetControl(); //-int line = pControl->MarkerNext( 0, 1<<BROWSETRACKER_MARKER); int line = pControl->MarkerNext( 0, 1<<GetBrowseMarkerId()); while( line != -1) { int posn = pControl->PositionFromLine( line ); RecordMark( posn ); //-line = pControl->MarkerNext( ++line, 1<<BROWSETRACKER_MARKER); line = pControl->MarkerNext( ++line, 1<<GetBrowseMarkerId()); } }//ImportBrowse_Marks
// ---------------------------------------------------------------------------- void SnippetProperty::OnCancel(wxCommandEvent& event) // ---------------------------------------------------------------------------- { LOGIT( _T("SnippetProperty::OnCancel") ); if (m_pWaitingSemaphore) m_pWaitingSemaphore->Post(); this->EndModal(wxID_CANCEL); }
// ---------------------------------------------------------------------------- MMSapEvents::~MMSapEvents() // ---------------------------------------------------------------------------- { #if defined(LOGGING) LOGIT(_T("MMSapEvents dtor")); #endif return; }//dtor
// ---------------------------------------------------------------------------- void cbDragScrollCfg::OnDoneButtonClick(wxCommandEvent& /*event*/) // ---------------------------------------------------------------------------- { //EndModal(0); #if defined(LOGGING) LOGIT( _T("cbDragScrollCfg::OnDoneButtonClick erroniously called") ); #endif }
/******************* cbVike start *****************************/ void cbVike::ReAttach(cbStyledTextCtrl *p, cbEditor *editor) { LOGIT(_T("Re-attach to %p"), p); VikeEvtBinder *handler = FindHandlerFor(p); if(handler){ handler->ReAttach(p, editor); } }
void cbVike::Detach(cbStyledTextCtrl *p, bool deleteEvtHandler) { if (!p || !IsAttachedTo(p)) return; // this is not attached... LOGIT(wxT("wxKeyBinder::Detach - detaching from [%s] %p"), p->GetName().c_str(),p); // remove the event handler int idx = FindHandlerIdxFor(p); LOGIT(wxT("idx is %d"), idx); VikeEvtBinder *toremove = (VikeEvtBinder*)m_arrHandlers.Item(idx); m_arrHandlers.RemoveAt(idx, 1); // the wxBinderEvtHandler will remove itself from p's event handlers if (deleteEvtHandler) delete toremove; LOGIT(wxT("%d handlers left"), m_arrHandlers.GetCount()); }
// ---------------------------------------------------------------------------- void MouseSap::Attach(wxWindow *p) // ----------------------------------------------------------------------------{ { if (!p || IsAttachedTo(p)) return; // already attached !!! // allow only static windows to be attached by codeblocks // Disappearing frames/windows cause crashes // eg., wxArrayString m_UsableWindows = "sciwindow notebook"; wxString windowName = p->GetName().MakeLower(); if (wxNOT_FOUND == m_UsableWindows.Index(windowName,false)) { #if defined(LOGGING) LOGIT(wxT("MMSap::Attach skipping [%s]"), p->GetName().c_str()); #endif return; } #if defined(LOGGING) LOGIT(wxT("MMSap::Attach - attaching to [%s] %p"), p->GetName().c_str(),p); #endif //add window to our array, attach a mouse event handler m_EditorPtrs.Add(p); if ( not m_pMMSapEvents ) m_pMMSapEvents = new MMSapEvents(p); MMSapEvents* thisEvtHndlr = m_pMMSapEvents; p->Connect(wxEVT_MIDDLE_DOWN, (wxObjectEventFunction)(wxEventFunction) (wxMouseEventFunction)&MMSapEvents::OnMouseEvent, NULL, thisEvtHndlr); p->Connect(wxEVT_MIDDLE_UP, (wxObjectEventFunction)(wxEventFunction) (wxMouseEventFunction)&MMSapEvents::OnMouseEvent, NULL, thisEvtHndlr); p->Connect(wxEVT_KILL_FOCUS , (wxObjectEventFunction)(wxEventFunction) (wxFocusEventFunction)&MMSapEvents::OnKillFocusEvent, NULL, thisEvtHndlr); #if defined(LOGGING) LOGIT(_T("MMSap:Attach Window:%p Handler:%p"), p,thisEvtHndlr); #endif }
void cbVike::DetachBrother(cbStyledTextCtrl *controller) { VikeEvtBinder *toRemove = FindBrother(controller); if(toRemove){ m_arrHandlers.Remove((void *)toRemove); delete toRemove; } LOGIT(wxT("%d handlers left"), m_arrHandlers.GetCount()); }
// ---------------------------------------------------------------------------- void JumpTracker::OnMenuJumpNext(wxCommandEvent &event) // ---------------------------------------------------------------------------- { #if defined(LOGGING) //LOGIT( _T("JT [%s]"), _T("OnMenuJumpNext")); #endif m_bJumpInProgress = true; do { int count = m_ArrayOfJumpData.GetCount(); if (not count) break; if ( count > 1 ) m_Cursor += 1; if (m_Cursor > (int)count-1) m_Cursor = 0; EditorManager* edmgr = Manager::Get()->GetEditorManager(); int cursor = m_Cursor; wxString edFilename; long edPosn; bool found = false; for (int i = 0; i<count; ++i, ++cursor) { if (cursor > count-1) cursor = 0; JumpData& jumpNext = m_ArrayOfJumpData.Item(cursor); edFilename = jumpNext.GetFilename(); edPosn = jumpNext.GetPosition(); if (not edmgr->IsOpen(edFilename)) continue; found = true; break; } if (not found) break; m_Cursor = cursor; #if defined(LOGGING) LOGIT( _T("JT OnMenuJumpNext [%s][%ld]curs[%d]"), edFilename.c_str(), edPosn, m_Cursor); #endif // activate editor EditorBase* eb = edmgr->GetEditor(edFilename); if (not eb) break; edmgr->SetActiveEditor(eb); // position to editor line cbEditor* cbed = edmgr->GetBuiltinEditor(eb); if (not cbed) break; cbed->GotoLine(cbed->GetControl()->LineFromPosition(edPosn)); //center on scrn cbed->GetControl()->GotoPos(edPosn); }while(0); m_bJumpInProgress = false; return; }
VikeEvtBinder::~VikeEvtBinder() { LOGIT(_T("Deleting VikeEvtBinder")); if ( m_pTarget ){ bool ret = m_pTarget->RemoveEventHandler(this); LOGIT(_T("remove handler ret %d"), ret); } wxArrayPtrVoid *found = m_pVike->FindHandlerFor(m_pEditor); if(found->Count() == 0 || (found->Count() == 1 && found->Item(0) == this)){ LOGIT(_T("delete status bar")); delete m_pVikeWin->GetStatusBar(); } delete found; if ( m_pVikeWin ){ delete m_pVikeWin; } }