bool wxGLCanvas::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name, const int *attribList, const wxPalette& palette) { // Create the window first: we will either use it as is or use it to query // for multisampling support and recreate it later with another pixel format if ( !CreateWindow(parent, id, pos, size, style, name) ) return false; // these will be used for the context creation attributes // if a core profile is requested bool useGLCoreProfile = false; // the minimum gl core version is 3.0 int glVersionMajor = 3, glVersionMinor = 0; // Check for a core profile request if ( attribList ) { for ( int i = 0; attribList[i]; ) { switch ( attribList[i++] ) { case WX_GL_CORE_PROFILE: useGLCoreProfile = true; break; case WX_GL_MAJOR_VERSION: glVersionMajor = attribList[i++]; break; case WX_GL_MINOR_VERSION: glVersionMinor = attribList[i++]; break; default: // ignore all other flags for now break; } } } if ( useGLCoreProfile ) { s_wglContextAttribs[0] = WGL_CONTEXT_MAJOR_VERSION_ARB; s_wglContextAttribs[1] = glVersionMajor; s_wglContextAttribs[2] = WGL_CONTEXT_MINOR_VERSION_ARB; s_wglContextAttribs[3] = glVersionMinor; s_wglContextAttribs[4] = WGL_CONTEXT_FLAGS_ARB; s_wglContextAttribs[5] = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; s_wglContextAttribs[6] = WGL_CONTEXT_PROFILE_MASK_ARB; s_wglContextAttribs[7] = WGL_CONTEXT_CORE_PROFILE_BIT_ARB; s_wglContextAttribs[8] = 0; // terminate } else // create legacy/compatibility context { s_wglContextAttribs[0] = 0; } PIXELFORMATDESCRIPTOR pfd; const int setupVal = DoSetup(pfd, attribList); if ( setupVal == 0 ) // PixelFormat error return false; if ( setupVal == -1 ) // FSAA requested { // now that we have a valid OpenGL window, query it for FSAA support int pixelFormat; { wxGLContext ctx(this); ctx.SetCurrent(*this); pixelFormat = ::ChoosePixelFormatARB(m_hDC, attribList); } if ( pixelFormat > 0 ) { // from http://msdn.microsoft.com/en-us/library/ms537559(VS.85).aspx: // // Setting the pixel format of a window more than once can // lead to significant complications for the Window Manager // and for multithread applications, so it is not allowed. An // application can only set the pixel format of a window one // time. Once a window's pixel format is set, it cannot be // changed. // // so we need to delete the old window and create the new one // destroy Window ::ReleaseDC(GetHwnd(), m_hDC); m_hDC = 0; parent->RemoveChild(this); const HWND hwnd = GetHwnd(); DissociateHandle(); // will do SetHWND(0); ::DestroyWindow(hwnd); // now recreate with FSAA pixelFormat if ( !CreateWindow(parent, id, pos, size, style, name) ) return false; if ( !::SetPixelFormat(m_hDC, pixelFormat, &pfd) ) { wxLogLastError(wxT("SetPixelFormat")); return false; } } } #if wxUSE_PALETTE if ( !SetupPalette(palette) ) return false; #else // !wxUSE_PALETTE wxUnusedVar(palette); #endif // wxUSE_PALETTE/!wxUSE_PALETTE return true; }
void ContextPhp::AddMenuDynamicContent(wxMenu* menu) { wxUnusedVar(menu); }
void ContextPhp::AutoIndent(const wxChar& nChar) { LEditor& rCtrl = GetCtrl(); int curpos = rCtrl.GetCurrentPos(); if(rCtrl.GetDisableSmartIndent()) { return; } if(rCtrl.GetLineIndentation(rCtrl.GetCurrentLine()) && nChar == wxT('\n')) { int prevpos(wxNOT_FOUND); int foundPos(wxNOT_FOUND); wxString word; wxChar ch = rCtrl.PreviousChar(curpos, prevpos); wxUnusedVar(ch); word = rCtrl.PreviousWord(curpos, foundPos); // user hit ENTER after 'else'? if(word == wxT("else")) { int prevLine = rCtrl.LineFromPosition(prevpos); rCtrl.SetLineIndentation(rCtrl.GetCurrentLine(), rCtrl.GetIndent() + rCtrl.GetLineIndentation(prevLine)); rCtrl.SetCaretAt(rCtrl.GetLineIndentPosition(rCtrl.GetCurrentLine())); rCtrl.ChooseCaretX(); // set new column as "current" column } return; } if(IsCommentOrString(curpos) && nChar == wxT('\n')) { AutoAddComment(); return; } if(IsCommentOrString(curpos)) { ContextBase::AutoIndent(nChar); return; } int line = rCtrl.LineFromPosition(curpos); if(nChar == wxT('\n')) { int prevpos(wxNOT_FOUND); int foundPos(wxNOT_FOUND); wxString word; wxChar ch = rCtrl.PreviousChar(curpos, prevpos); word = rCtrl.PreviousWord(curpos, foundPos); // user hit ENTER after 'else' if(word == wxT("else")) { int prevLine = rCtrl.LineFromPosition(prevpos); rCtrl.SetLineIndentation(line, rCtrl.GetIndent() + rCtrl.GetLineIndentation(prevLine)); rCtrl.SetCaretAt(rCtrl.GetLineIndentPosition(line)); rCtrl.ChooseCaretX(); // set new column as "current" column return; } // User typed 'ENTER' immediatly after closing brace ')' if(prevpos != wxNOT_FOUND && ch == wxT(')')) { long openBracePos(wxNOT_FOUND); int posWordBeforeOpenBrace(wxNOT_FOUND); if(rCtrl.MatchBraceBack(wxT(')'), prevpos, openBracePos)) { rCtrl.PreviousChar(openBracePos, posWordBeforeOpenBrace); if(posWordBeforeOpenBrace != wxNOT_FOUND) { word = rCtrl.PreviousWord(posWordBeforeOpenBrace, foundPos); // c++ expression with single line and should be treated separatly if(word == wxT("if") || word == wxT("while") || word == wxT("for")) { int prevLine = rCtrl.LineFromPosition(prevpos); rCtrl.SetLineIndentation(line, rCtrl.GetIndent() + rCtrl.GetLineIndentation(prevLine)); rCtrl.SetCaretAt(rCtrl.GetLineIndentPosition(line)); rCtrl.ChooseCaretX(); // set new column as "current" column return; } } } } // User typed 'ENTER' immediatly after colons ':' if(prevpos != wxNOT_FOUND && ch == wxT(':')) { int posWordBeforeColons(wxNOT_FOUND); rCtrl.PreviousChar(prevpos, posWordBeforeColons); if(posWordBeforeColons != wxNOT_FOUND) { word = rCtrl.PreviousWord(posWordBeforeColons, foundPos); int prevLine = rCtrl.LineFromPosition(posWordBeforeColons); // If we found one of the following keywords, un-indent their line by (foldLevel - 1)*indentSize if(word == wxT("public") || word == wxT("private") || word == wxT("protected")) { ContextBase::AutoIndent(nChar); // Indent this line according to the block indentation level int foldLevel = (rCtrl.GetFoldLevel(prevLine) & wxSTC_FOLDLEVELNUMBERMASK) - wxSTC_FOLDLEVELBASE; if(foldLevel) { rCtrl.SetLineIndentation(prevLine, ((foldLevel - 1) * rCtrl.GetIndent())); rCtrl.ChooseCaretX(); } return; } } } // use the previous line indentation level if(prevpos == wxNOT_FOUND || ch != wxT('{') || IsCommentOrString(prevpos)) { ContextBase::AutoIndent(nChar); return; } // Open brace? increase indent size int prevLine = rCtrl.LineFromPosition(prevpos); rCtrl.SetLineIndentation(line, rCtrl.GetIndent() + rCtrl.GetLineIndentation(prevLine)); rCtrl.SetCaretAt(rCtrl.GetLineIndentPosition(line)); } else if(nChar == wxT('}')) { long matchPos = wxNOT_FOUND; if(!rCtrl.MatchBraceBack(wxT('}'), rCtrl.PositionBefore(curpos), matchPos)) return; int secondLine = rCtrl.LineFromPosition(matchPos); if(secondLine == line) return; rCtrl.SetLineIndentation(line, rCtrl.GetLineIndentation(secondLine)); } else if(nChar == wxT('{')) { wxString lineString = rCtrl.GetLine(line); lineString.Trim().Trim(false); int matchPos = wxNOT_FOUND; wxChar previousChar = rCtrl.PreviousChar(rCtrl.PositionBefore(curpos), matchPos); if(previousChar != wxT('{') && lineString == wxT("{")) { // indent this line accroding to the previous line int line = rCtrl.LineFromPosition(rCtrl.GetCurrentPos()); rCtrl.SetLineIndentation(line, rCtrl.GetLineIndentation(line - 1)); rCtrl.ChooseCaretX(); } } // set new column as "current" column rCtrl.ChooseCaretX(); }
bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) { // Find out which MSW item before which we'll be inserting before // wxMenuBarBase::Insert is called and GetMenu(pos) is the new menu. // If IsAttached() is false this won't be used anyway bool isAttached = #if defined(WINCE_WITHOUT_COMMANDBAR) IsAttached(); #else (GetHmenu() != 0); #endif int mswpos = (!isAttached || (pos == m_menus.GetCount())) ? -1 // append the menu : MSWPositionForWxMenu(GetMenu(pos),pos); if ( !wxMenuBarBase::Insert(pos, menu, title) ) return false; m_titles.Insert(title, pos); if ( isAttached ) { #if defined(WINCE_WITHOUT_COMMANDBAR) if (!GetToolBar()) return false; TBBUTTON tbButton; memset(&tbButton, 0, sizeof(TBBUTTON)); tbButton.iBitmap = I_IMAGENONE; tbButton.fsState = TBSTATE_ENABLED; tbButton.fsStyle = TBSTYLE_DROPDOWN | TBSTYLE_NO_DROPDOWN_ARROW | TBSTYLE_AUTOSIZE; HMENU hPopupMenu = (HMENU) menu->GetHMenu() ; tbButton.dwData = (DWORD)hPopupMenu; wxString label = wxStripMenuCodes(title); tbButton.iString = (int) label.wx_str(); tbButton.idCommand = NewControlId(); if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton)) { wxLogLastError(wxT("TB_INSERTBUTTON")); return false; } wxUnusedVar(mswpos); #else if ( !::InsertMenu(GetHmenu(), mswpos, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)GetHmenuOf(menu), title.wx_str()) ) { wxLogLastError(wxT("InsertMenu")); } #endif #if wxUSE_ACCEL if ( menu->HasAccels() ) { // need to rebuild accell table RebuildAccelTable(); } #endif // wxUSE_ACCEL if (IsAttached()) Refresh(); } return true; }
int FLACImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTracks, Tags *tags) { outTracks.clear(); wxASSERT(mStreamInfoDone); CreateProgress(); mChannels.resize(mNumChannels); auto iter = mChannels.begin(); for (int c = 0; c < mNumChannels; ++iter, ++c) { *iter = trackFactory->NewWaveTrack(mFormat, mSampleRate); if (mNumChannels == 2) { switch (c) { case 0: iter->get()->SetChannel(Track::LeftChannel); iter->get()->SetLinked(true); break; case 1: iter->get()->SetChannel(Track::RightChannel); break; } } else { iter->get()->SetChannel(Track::MonoChannel); } } //Start OD bool useOD = false; #ifdef EXPERIMENTAL_OD_FLAC useOD=true; #endif // TODO: Vigilant Sentry: Variable res unused after assignment (error code DA1) // Should check the result. #ifdef LEGACY_FLAC bool res = (mFile->process_until_end_of_file() != 0); #else bool res = true; if(!useOD) res = (mFile->process_until_end_of_stream() != 0); #endif wxUnusedVar(res); //add the task to the ODManager if(useOD) { sampleCount fileTotalFrames = mNumSamples; sampleCount maxBlockSize = mChannels.begin()->get()->GetMaxBlockSize(); for (sampleCount i = 0; i < fileTotalFrames; i += maxBlockSize) { sampleCount blockLen = maxBlockSize; if (i + blockLen > fileTotalFrames) blockLen = fileTotalFrames - i; auto iter = mChannels.begin(); for (int c = 0; c < mNumChannels; ++c, ++iter) iter->get()->AppendCoded(mFilename, i, blockLen, c, ODTask::eODFLAC); mUpdateResult = mProgress->Update(i, fileTotalFrames); if (mUpdateResult != eProgressSuccess) break; } bool moreThanStereo = mNumChannels>2; for (const auto &channel : mChannels) { mDecoderTask->AddWaveTrack(channel.get()); if(moreThanStereo) { //if we have 3 more channels, they get imported on seperate tracks, so we add individual tasks for each. ODManager::Instance()->AddNewTask(mDecoderTask); mDecoderTask=new ODDecodeFlacTask; //TODO: see if we need to use clone to keep the metadata. } } //if we have mono or a linked track (stereo), we add ONE task for the one linked wave track if(!moreThanStereo) ODManager::Instance()->AddNewTask(mDecoderTask); } //END OD if (mUpdateResult == eProgressFailed || mUpdateResult == eProgressCancelled) { return mUpdateResult; } for (const auto &channel : mChannels) { channel->Flush(); } outTracks.swap(mChannels); tags->Clear(); size_t cnt = mFile->mComments.GetCount(); for (int c = 0; c < cnt; c++) { wxString name = mFile->mComments[c].BeforeFirst(wxT('=')); wxString value = mFile->mComments[c].AfterFirst(wxT('=')); if (name.Upper() == wxT("DATE") && !tags->HasTag(TAG_YEAR)) { long val; if (value.Length() == 4 && value.ToLong(&val)) { name = TAG_YEAR; } } tags->SetTag(name, value); } return mUpdateResult; }
void AccelTableDlg::OnDVItemActivated(wxDataViewEvent& event) { wxUnusedVar(event); DoItemActivated(); }
void AccelTableDlg::OnText(wxCommandEvent& event) { wxUnusedVar(event); CallAfter(&AccelTableDlg::PopulateTable, m_textCtrlFilter->GetValue()); }
void AccelTableDlg::OnEditButton(wxCommandEvent& e) { wxUnusedVar(e); DoItemActivated(); }
bool MainApp::DoParseCommandLine(wxCmdLineParser& parser) { wxUnusedVar(parser); return true; }
void PSCustomMakefileRulesPage::OnCmdEvtVModified( wxCommandEvent& event ) { wxUnusedVar(event); m_dlg->SetIsDirty(true); }