///////////////////////////////////////////////////////////////////////////////////////////// // Output means output of SSM, so this connects plugin inputs to a jack destination void JackClient::ConnectOutput(int n, const std::string &JackPort) { if(!IsAttached()) return; std::cerr << "JackClient::ConnectOutput: connecting source [" << m_OutputPortMap[n]->Name << "] \ to dest [" << JackPort << "]" << std::endl; if(m_OutputPortMap[n]->ConnectedTo != "") { if(jack_disconnect(m_Client, jack_port_name(m_OutputPortMap[n]->Port), m_OutputPortMap[n]->ConnectedTo.c_str())) error("JackClient::ConnectOutput: cannot disconnect output port [%s] to [%s]", m_OutputPortMap[n]->ConnectedTo.c_str(), m_OutputPortMap[n]->Name.c_str()); } m_OutputPortMap[n]->ConnectedTo = JackPort; if(jack_connect(m_Client, jack_port_name(m_OutputPortMap[n]->Port), JackPort.c_str())) error("JackClient::ConnectOutput: cannot connect output port [%s] to [%s]", m_OutputPortMap[n]->Name.c_str(), JackPort.c_str()); m_OutputPortMap[n]->Connected = true; }
wxMenu *wxMenuBar::Remove(size_t pos) { wxMenu *menu = wxMenuBarBase::Remove(pos); if ( !menu ) return NULL; if ( IsAttached() ) { if (s_macInstalledMenuBar == this) ::DeleteMenu( menu->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ; Refresh(); } m_titles.RemoveAt(pos); return menu; }
// The wxWindow destructor will take care of deleting the submenus. wxMenu::~wxMenu() { // we should free Windows resources only if Windows doesn't do it for us // which happens if we're attached to a menubar or a submenu of another // menu if ( !IsAttached() && !GetParent() ) { if ( !::DestroyMenu(GetHmenu()) ) { wxLogLastError(wxT("DestroyMenu")); } } #if wxUSE_ACCEL // delete accels WX_CLEAR_ARRAY(m_accels); #endif // wxUSE_ACCEL }
void SourceBuffer::Abort(ErrorResult& aRv) { MOZ_ASSERT(NS_IsMainThread()); MSE_API("Abort()"); if (!IsAttached()) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; } if (mMediaSource->ReadyState() != MediaSourceReadyState::Open) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; } AbortBufferAppend(); mContentManager->ResetParserState(); mAttributes->SetAppendWindowStart(0); mAttributes->SetAppendWindowEnd(PositiveInfinity<double>()); }
void SourceBuffer::Remove(double aStart, double aEnd, ErrorResult& aRv) { MSE_DEBUG("%p Remove(Start=%f End=%f)", this, aStart, aEnd); if (!IsAttached() || mUpdating || mMediaSource->ReadyState() != MediaSourceReadyState::Open) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; } if (aStart < 0 || aStart > mMediaSource->Duration() || aEnd <= aStart) { aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR); return; } StartUpdating(); /// TODO: Run coded frame removal algorithm asynchronously (would call StopUpdating()). StopUpdating(); }
BOOL COXShortkeysOrganizer::AddAccelTable(HACCEL hAccelTable, CMultiDocTemplate* pDocTemplate) { ASSERT(hAccelTable!=NULL); if(!IsAttached()) { TRACE(_T("COXShortkeysOrganizer::AddAccelTable: there is no attached frame window. You have to attach frame window before calling this function\n")); return FALSE; } COXArrAccelerators* pArrAccels=FindAcceleratorTable(pDocTemplate); if(pArrAccels!=NULL) { TRACE(_T("COXShortkeysOrganizer::AddAccelTable: accelerator table for specified CMultiDocTemplate object has already been added\n")); return FALSE; } OXACCELTABLE accelTable; accelTable.m_docTemplate=pDocTemplate; int nAccelCount=::CopyAcceleratorTable(hAccelTable,NULL,0); if(nAccelCount!=0) { ACCEL* pAccel=new ACCEL[nAccelCount]; if (pAccel==NULL) { TRACE(_T("COXShortkeysOrganizer::AddAccelTable: failed to copy an accelerator table\n")); return FALSE; } VERIFY(::CopyAcceleratorTable(hAccelTable,pAccel,nAccelCount)==nAccelCount); for(int nIndex=0; nIndex<nAccelCount; nIndex++) { accelTable.m_accelerators.Add(pAccel[nIndex]); } delete[] pAccel; } m_arrAccelTables.Add(accelTable); return TRUE; }
void ThreadSearch::OnMnuEditCopyUpdateUI(wxUpdateUIEvent& event) { if ( !IsAttached() ) { event.Skip(); return; } wxWindow* pFocused = wxWindow::FindFocus(); if (not pFocused) return; wxMenuBar* mbar = Manager::Get()->GetAppFrame()->GetMenuBar(); if (not mbar) return; bool hasSel = false; // if the following window have the focus, own the copy. if ( pFocused == m_pCboSearchExpr ) { //event.Enable(m_pCboSearchExpr->CanCopy()); hasSel = m_pCboSearchExpr->CanCopy() ; //LOGIT( _T("OnMnuEditCopyUpdateUI m_pCboSearchExpr") ); } else if ( pFocused == m_pThreadSearchView->m_pCboSearchExpr ) { //event.Enable(m_pThreadSearchView->m_pCboSearchExpr->CanCopy()); hasSel = m_pThreadSearchView->m_pCboSearchExpr->CanCopy(); //LOGIT( _T("OnMnuEditCopyUpdateUI m_pThreadSearchView->m_pCboSearchExpr") ); } else if ( pFocused == static_cast<wxWindow*>(m_pThreadSearchView->m_pSearchPreview) ) { hasSel = m_pThreadSearchView->m_pSearchPreview->GetSelectionStart() != m_pThreadSearchView->m_pSearchPreview->GetSelectionEnd(); //LOGIT( _T("OnMnuEditCopyUpdateUI m_pSearchPreview") ); } if ( hasSel ) { mbar->Enable(idMenuEditCopy, hasSel); wxToolBar* pMainToolBar = (wxToolBar*) ::wxFindWindowByName(wxT("toolbar"), NULL); if (pMainToolBar) pMainToolBar->EnableTool(idMenuEditCopy, hasSel); return; } event.Skip(); return; }
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) { // we need to find the item's position in the child list size_t pos; wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); for ( pos = 0; node; pos++ ) { if ( node->GetData() == item ) break; node = node->GetNext(); } #if wxUSE_ACCEL // remove the corresponding accel from the accel table int n = FindAccel(item->GetId()); if ( n != wxNOT_FOUND ) { delete m_accels[n]; m_accels.RemoveAt(n); #if wxUSE_OWNER_DRAWN ResetMaxAccelWidth(); #endif } //else: this item doesn't have an accel, nothing to do #endif // wxUSE_ACCEL // remove the item from the menu if ( !::RemoveMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION) ) { wxLogLastError(wxT("RemoveMenu")); } if ( IsAttached() && GetMenuBar()->IsAttached() ) { // otherwise, the change won't be visible GetMenuBar()->Refresh(); } // and from internal data structures return wxMenuBase::DoRemove(item); }
int HeaderFixup::Execute() { // if not attached, exit if ( !IsAttached() ) return -1; // if no project is opened -> inform the user and do not operate const cbProject* prj = Manager::Get()->GetProjectManager()->GetActiveProject(); if (!prj) { cbMessageBox(_("You need to open a project/workspace before using this plugin!"), _T("Header Fixup"), wxICON_ERROR | wxOK); return -1; } Execution Dlg(NULL); Dlg.ShowModal(); return 0; }// Execute
void wxMenuBar::Refresh() { if ( IsFrozen() ) return; wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") ); #if defined(WINCE_WITHOUT_COMMANDBAR) if (GetToolBar()) { CommandBar_DrawMenuBar((HWND) GetToolBar()->GetHWND(), 0); } #elif defined(WINCE_WITH_COMMANDBAR) if (m_commandBar) DrawMenuBar((HWND) m_commandBar); #else DrawMenuBar(GetHwndOf(GetFrame())); #endif }
bool CEngineTap::Bypass(bool Enable) { if (Enable == m_IsBypassed) // if already in requested state return(TRUE); // nothing to do #ifdef ENGINE_TAP_NATTER _tprintf(_T("CEngineTap::Bypass %d\n"), Enable); #endif m_IsBypassed = Enable; // update state first to fail safe if (IsAttached()) { // if attached to plugin if (Enable) { // if entering bypass if (!Disconnect(*m_Plugin)) // disconnect from plugin return(FALSE); } else { // exiting bypass if (!Connect(*m_Plugin)) // connect to plugin return(FALSE); } } return(TRUE); }
void SourceBuffer::Abort(ErrorResult& aRv) { if (!IsAttached()) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; } if (mMediaSource->ReadyState() != MediaSourceReadyState::Open) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; } if (mUpdating) { // TODO: Abort segment parser loop, buffer append, and stream append loop algorithms. AbortUpdating(); } // TODO: Run reset parser algorithm. mAppendWindowStart = 0; mAppendWindowEnd = PositiveInfinity<double>(); }
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) { // we need to find the item's position in the child list size_t pos; wxMenuItemList::compatibility_iterator node = GetMenuItems().GetFirst(); for ( pos = 0; node; pos++ ) { if ( node->GetData() == item ) break; node = node->GetNext(); } #if wxUSE_ACCEL RemoveAccel(item); #endif // wxUSE_ACCEL // Update indices of radio groups. if ( m_radioData ) { if ( m_radioData->UpdateOnRemoveItem(pos) ) { wxASSERT_MSG( item->IsRadio(), wxT("Removing non radio button from radio group?") ); } //else: item being removed is not in a radio group } // remove the item from the menu if ( !::RemoveMenu(GetHmenu(), (UINT)pos, MF_BYPOSITION) ) { wxLogLastError(wxT("RemoveMenu")); } if ( IsAttached() && GetMenuBar()->IsAttached() ) { // otherwise, the change won't be visible GetMenuBar()->Refresh(); } // and from internal data structures return wxMenuBase::DoRemove(item); }
cLiveStreamer::~cLiveStreamer() { DEBUGLOG("Started to delete live streamer"); cTimeMs t; DEBUGLOG("Stopping streamer thread ..."); Cancel(5); DEBUGLOG("Done."); cMutexLock lock(&m_FilterMutex); DEBUGLOG("Detaching"); if(m_PatFilter != NULL && m_Device != NULL) { m_Device->Detach(m_PatFilter); delete m_PatFilter; m_PatFilter = NULL; } if (IsAttached()) { Detach(); } for (std::list<cTSDemuxer*>::iterator i = m_Demuxers.begin(); i != m_Demuxers.end(); i++) { if ((*i) != NULL) { DEBUGLOG("Deleting stream demuxer for pid=%i and type=%i", (*i)->GetPID(), (*i)->GetType()); delete (*i); } } m_Demuxers.clear(); delete m_Queue; m_uid = 0; { cMutexLock lock(&m_DeviceMutex); m_Device = NULL; } DEBUGLOG("Finished to delete live streamer (took %llu ms)", t.Elapsed()); }
bool GDocApp<OptionsFmt>::SetDirty(bool Dirty) { if (IsAttached() && (d->Dirty ^ Dirty)) { // Changing... if (Dirty) { // Setting dirty d->Dirty = true; SetCurFile(d->CurFile); } else { // Clearing dirty int Result = LgiMsg(this, LgiLoadString(L_DOCAPP_SAVE_CHANGE, "Do you want to save your changes?"), d->AppName, MB_YESNOCANCEL); if (Result == IDYES) { if (!ValidStr(d->CurFile)) { GMru::OnCommand(IDM_SAVEAS); } else { _SaveFile(d->CurFile); } } else if (Result == IDCANCEL) { return false; } d->Dirty = false; SetCurFile(d->CurFile); } OnDirty(d->Dirty); } return true; }
void SourceBuffer::AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aRv) { if (!IsAttached() || mUpdating) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; } if (mMediaSource->ReadyState() == MediaSourceReadyState::Ended) { mMediaSource->SetReadyState(MediaSourceReadyState::Open); } // TODO: Run coded frame eviction algorithm. // TODO: Test buffer full flag. MSE_DEBUG("%p Append(ArrayBuffer=%u)", this, aLength); StartUpdating(); // XXX: For future reference: NDA call must run on the main thread. mDecoder->NotifyDataArrived(reinterpret_cast<const char*>(aData), aLength, mDecoder->GetResource()->GetLength()); // TODO: Run buffer append algorithm asynchronously (would call StopUpdating()). mDecoder->GetResource()->AppendData(aData, aLength); // Eviction uses a byte threshold. If the buffer is greater than the // number of bytes then data is evicted. The time range for this // eviction is reported back to the media source. It will then // evict data before that range across all SourceBuffer's it knows // about. const int evict_threshold = 1000000; bool evicted = mDecoder->GetResource()->EvictData(evict_threshold); if (evicted) { double start = 0.0; double end = 0.0; GetBufferedStartEndTime(&start, &end); // We notify that we've evicted from the time range 0 through to // the current start point. mMediaSource->NotifyEvicted(0.0, start); } StopUpdating(); // Schedule the state machine thread to ensure playback starts // if required when data is appended. mMediaSource->GetDecoder()->ScheduleStateMachineThread(); }
bool ThreadSearch::BuildToolBar(wxToolBar* toolBar) { if ( !IsAttached() || !toolBar ) return false; m_pToolbar = toolBar; m_pThreadSearchView->SetToolBar(toolBar); const wxString &prefix = m_pThreadSearchView->GetImagePrefix(); ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("app")); if (cfg->ReadBool(_T("/environment/toolbar_size"),true)) m_pToolbar->SetToolBitmapSize(wxSize(16,16)); else m_pToolbar->SetToolBitmapSize(wxSize(22,22)); m_pCboSearchExpr = new wxComboBox(toolBar, controlIDs.Get(ControlIDs::idCboSearchExpr), wxEmptyString, wxDefaultPosition, wxSize(130, -1), 0, NULL, wxCB_DROPDOWN); m_pCboSearchExpr->SetToolTip(_("Text to search")); toolBar->AddControl(m_pCboSearchExpr); toolBar->AddTool(controlIDs.Get(ControlIDs::idBtnSearch), _(""), wxBitmap(prefix + wxT("findf.png"), wxBITMAP_TYPE_PNG), wxBitmap(prefix + wxT("findfdisabled.png"), wxBITMAP_TYPE_PNG), wxITEM_NORMAL, _("Run search")); toolBar->AddTool(controlIDs.Get(ControlIDs::idBtnOptions), _(""), wxBitmap(prefix + wxT("options.png"), wxBITMAP_TYPE_PNG), wxBitmap(prefix + wxT("optionsdisabled.png"), wxBITMAP_TYPE_PNG), wxITEM_NORMAL, _("Show options window")); m_pThreadSearchView->UpdateOptionsButtonImage(m_FindData); m_pCboSearchExpr->Append(m_pThreadSearchView->GetSearchHistory()); if ( m_pCboSearchExpr->GetCount() > 0 ) { m_pCboSearchExpr->SetSelection(0); } toolBar->Realize(); toolBar->SetInitialSize(); return true; }
void wxMenuBar::SetMenuLabel(size_t pos, const wxString& label) { wxCHECK_RET( pos < GetMenuCount(), wxT("invalid menu index") ); m_menus[pos]->wxMenuBase::SetTitle(label); if ( !IsAttached() ) { return; } //else: have to modify the existing menu int mswpos = MSWPositionForWxMenu(GetMenu(pos),pos); UINT_PTR id; UINT flagsOld = ::GetMenuState((HMENU)m_hMenu, mswpos, MF_BYPOSITION); if ( flagsOld == 0xFFFFFFFF ) { wxLogLastError(wxT("GetMenuState")); return; } if ( flagsOld & MF_POPUP ) { // HIBYTE contains the number of items in the submenu in this case flagsOld &= 0xff; id = (UINT_PTR)::GetSubMenu((HMENU)m_hMenu, mswpos); } else { id = pos; } if ( ::ModifyMenu(GetHmenu(), mswpos, MF_BYPOSITION | MF_STRING | flagsOld, id, label.t_str()) == (int)0xFFFFFFFF ) { wxLogLastError(wxT("ModifyMenu")); } Refresh(); }
// ---------------------------------------------------------------------------- void JumpTracker::OnEditorActivated(CodeBlocksEvent& event) // ---------------------------------------------------------------------------- { // Record this activation event and place activation in history event.Skip(); if (m_bShuttingDown) return; if (not IsAttached()) return; // Don't record closing editor activations if (m_bProjectClosing) return; EditorBase* eb = event.GetEditor(); wxString edFilename = eb->GetFilename(); cbEditor* cbed = Manager::Get()->GetEditorManager()->GetBuiltinEditor(eb); if (not cbed) { // Since wxAuiNotebook added, there's no cbEditor associated during // an initial cbEVT_EDITOR_ACTIVATED event. So we ignore the inital // call and get OnEditorOpened() to re-issue OnEditorActivated() when // it does have a cbEditor, but no cbProject associated; #if defined(LOGGING) LOGIT( _T("JT [OnEditorActivated ignored:no cbEditor[%s]"), edFilename.c_str()); #endif return; } #if defined(LOGGING) LOGIT( _T("JT Editor Activated[%s]"), eb->GetShortName().c_str() ); #endif cbStyledTextCtrl* edstc = cbed->GetControl(); if(edstc->GetCurrentLine() == wxSCI_INVALID_POSITION) return; long edPosn = edstc->GetCurrentPos(); //if ( m_Cursor not_eq JumpDataContains(edFilename, edPosn) ) JumpDataAdd(edFilename, edPosn); return; }//OnEditorActivated
wxMenu* wxMenuBar::Remove( size_t nPos ) { wxMenu* pMenu = wxMenuBarBase::Remove(nPos); SHORT nId; if (!pMenu) return NULL; nId = SHORT1FROMMR(::WinSendMsg( (HWND)GetHmenu() ,MM_ITEMIDFROMPOSITION ,MPFROMSHORT(nPos) ,(MPARAM)0) ); if (nId == MIT_ERROR) { wxLogLastError(wxT("LogLastError")); return NULL; } if (IsAttached()) { ::WinSendMsg( (HWND)GetHmenu() ,MM_REMOVEITEM ,MPFROM2SHORT(nId, TRUE) ,(MPARAM)0 ); #if wxUSE_ACCEL if (pMenu->HasAccels()) { // // Need to rebuild accell table // RebuildAccelTable(); } #endif // wxUSE_ACCEL Refresh(); } m_titles.RemoveAt(nPos); return pMenu; } // end of wxMenuBar::Remove
void cbDebuggerPlugin::BuildModuleMenu(const ModuleType type, wxMenu* menu, cb_unused const FileTreeData* data) { if (!IsAttached()) return; // we 're only interested in editor menus // we 'll add a "debug watches" entry only when the debugger is running... if (type != mtEditorManager || !menu) return; cbDebuggerPlugin *active_plugin = Manager::Get()->GetDebuggerManager()->GetActiveDebugger(); if (active_plugin != this) return; wxString word; if (IsRunning()) { // has to have a word under the caret... word = GetEditorWordAtCaret(); } Manager::Get()->GetDebuggerManager()->BuildContextMenu(*menu, word, IsRunning()); }
bool Wait(TimeSpan Timeout = TimeSpan::Infinite) { LD_ASSERT(IsAttached()); DWORD TimeoutMs = (DWORD)Timeout.GetTotalMilliseconds(); if (Timeout == TimeSpan::Infinite) { TimeoutMs = INFINITE; } DWORD Status = WaitForSingleObject(m_ProcessInfo.hProcess, TimeoutMs); if (Status == WAIT_TIMEOUT) { return false; } else { return true; } }
already_AddRefed<TimeRanges> SourceBuffer::GetBuffered(ErrorResult& aRv) { MOZ_ASSERT(NS_IsMainThread()); if (!IsAttached()) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return nullptr; } nsRefPtr<TimeRanges> ranges = new TimeRanges(); double highestEndTime = mTrackBuffer->Buffered(ranges); if (mMediaSource->ReadyState() == MediaSourceReadyState::Ended) { // Set the end time on the last range to highestEndTime by adding a // new range spanning the current end time to highestEndTime, which // Normalize() will then merge with the old last range. ranges->Add(ranges->GetEndTime(), highestEndTime); ranges->Normalize(); } MSE_DEBUGV("ranges=%s", DumpTimeRanges(ranges).get()); return ranges.forget(); }
void SourceBuffer::Remove(double aStart, double aEnd, ErrorResult& aRv) { MOZ_ASSERT(NS_IsMainThread()); MSE_API("SourceBuffer(%p)::Remove(aStart=%f, aEnd=%f)", this, aStart, aEnd); if (IsNaN(mMediaSource->Duration()) || aStart < 0 || aStart > mMediaSource->Duration() || aEnd <= aStart || IsNaN(aEnd)) { aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR); return; } if (!IsAttached() || mUpdating || mMediaSource->ReadyState() != MediaSourceReadyState::Open) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; } StartUpdating(); /// TODO: Run coded frame removal algorithm asynchronously (would call StopUpdating()). StopUpdating(); }
COXArrAccelerators* COXShortkeysOrganizer:: FindRemovedAcceleratorTable(CMultiDocTemplate* pDocTemplate) { if(!IsAttached()) { TRACE(_T("COXShortkeysOrganizer::FindRemovedAcceleratorTable: there is no attached frame window. You have to attach frame window before calling this function\n")); return NULL; } for(int nIndex=0; nIndex<m_arrRemovedAccelTables.GetSize(); nIndex++) { if(m_arrRemovedAccelTables[nIndex].m_docTemplate==pDocTemplate) { return &m_arrRemovedAccelTables[nIndex].m_accelerators; } } TRACE(_T("COXShortkeysOrganizer::FindRemovedAcceleratorTable: specified CMultiDocTemplate object hasn't been identified as valid host of an accelerator table\n")); return NULL; }
int CEngineTap::OnEndSlotChange() { CFFEngine& Engine = theApp.GetEngine(); ASSERT(!Engine.IsRunning()); // engine must be stopped ASSERT(!Engine.InSlotChange()); // must be called after slot change if (!IsAttached()) return(-1); int PlugIdx = Engine.FindPluginByUID(m_PluginUID); #ifdef ENGINE_TAP_NATTER _tprintf(_T("CEngineTap::OnEndSlotChange PlugIdx=%d\n"), PlugIdx); #endif if (PlugIdx < 0) { // if tapped plugin not found // plugin was presumably deleted, making m_Plugin an invalid pointer m_Plugin = NULL; // force detached state without accessing m_Plugin m_PluginUID = 0; return(-1); } int SlotIdx = Engine.PluginToSlot(PlugIdx); // convert to slot index return(SlotIdx); // index of slot in which tapped plugin was found }
int ThreadSearch::GetInsertionMenuIndex(const wxMenu* const pCtxMenu) { if ( !IsAttached() ) return -1; // Looks after the "Find implementation of:" menu item const wxMenuItemList ItemsList = pCtxMenu->GetMenuItems(); for (int i = 0; i < (int)ItemsList.GetCount(); ++i) { #if wxCHECK_VERSION(3, 0, 0) if (ItemsList[i]->GetItemLabelText().StartsWith(_("Find implementation of:")) ) #else if (ItemsList[i]->GetLabel().StartsWith(_("Find implementation of:")) ) #endif { return ++i; } } return -1; }
wxMenu* wxMenuBar::Replace( size_t nPos , wxMenu* pMenu , const wxString& rTitle ) { SHORT nId; wxString sTitle = wxPMTextToLabel(rTitle); wxMenu* pMenuOld = wxMenuBarBase::Replace( nPos ,pMenu ,sTitle ); nId = SHORT1FROMMR(::WinSendMsg((HWND)m_hMenu, MM_ITEMIDFROMPOSITION, MPFROMSHORT(nPos), (MPARAM)0)); if (nId == MIT_ERROR) { wxLogLastError(wxT("LogLastError")); return NULL; } if (!pMenuOld) return NULL; m_titles[nPos] = sTitle; if (IsAttached()) { ::WinSendMsg((HWND)m_hMenu, MM_REMOVEITEM, MPFROM2SHORT(nId, TRUE), (MPARAM)0); ::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)sTitle.wx_str()); #if wxUSE_ACCEL if (pMenuOld->HasAccels() || pMenu->HasAccels()) { // // Need to rebuild accell table // RebuildAccelTable(); } #endif // wxUSE_ACCEL Refresh(); } return pMenuOld; } // end of wxMenuBar::Replace
BOOL COXShortkeysOrganizer::RemoveAccelerator(BYTE fVirt, WORD key, WORD cmd, CMultiDocTemplate* pDocTemplate) { if(!IsAttached()) { TRACE(_T("COXShortkeysOrganizer::RemoveAccelerator: there is no attached frame window. You have to attach frame window before calling this function\n")); return FALSE; } COXArrAccelerators* pArrAccels=FindAcceleratorTable(pDocTemplate); if(pArrAccels==NULL) { return FALSE; } COXArrAccelerators* pArrRemovedAccels=FindRemovedAcceleratorTable(pDocTemplate); if(pArrRemovedAccels==NULL) { OXACCELTABLE accelTable; accelTable.m_docTemplate=pDocTemplate; m_arrRemovedAccelTables.Add(accelTable); pArrRemovedAccels=FindRemovedAcceleratorTable(pDocTemplate); } ASSERT(pArrRemovedAccels!=NULL); for(int nAccelIndex=0; nAccelIndex<pArrAccels->GetSize(); nAccelIndex++) { ACCEL accel=pArrAccels->GetAt(nAccelIndex); if((accel.fVirt&~FNOINVERT)==(fVirt&~FNOINVERT) && accel.key==key && accel.cmd==cmd) { pArrAccels->RemoveAt(nAccelIndex); nAccelIndex--; // save the removed accelerator pArrRemovedAccels->Add(accel); break; } } return TRUE; }
void GLFramebuffer::Attach(){ if(IsAttached()) return; glGenFramebuffers(1, &fFramebufferObject); glBindFramebuffer(GL_FRAMEBUFFER, fFramebufferObject); if(fFramebufferType & kColorOnly){ glGenTextures(1, &fColorTextureObject); glBindTexture(GL_TEXTURE_2D, fColorTextureObject); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, fBufferSize[0], fBufferSize[1], 0, GL_RGB, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, fMagfilter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, fMinfilter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fColorTextureObject, 0); } if(fFramebufferType & kDepthOnly){ glGenTextures(1, &fDepthTextureObject); glBindTexture(GL_TEXTURE_2D, fDepthTextureObject); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, fBufferSize[0], fBufferSize[1], 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, fMagfilter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, fMinfilter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, fDepthTextureObject, 0); } if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) Error(__FUNCTION__, "framebuffer creation failed"); glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindTexture(GL_TEXTURE_2D, 0); fIsAttached = true; }