//============================================================================== void GlBuffer::setBinding(GLuint binding) const { ANKI_ASSERT(isCreated()); ANKI_ASSERT(m_target == GL_SHADER_STORAGE_BUFFER || m_target == GL_UNIFORM_BUFFER); glBindBufferBase(m_target, binding, m_glName); }
void * DynamicLibrary::getFunction(const char * name) { os::clearError(__LINE__, __FILE__); if (!isCreated()) { MACE__THROW(InitializationFailed, "Can\'t load a function symbol from an unitialized dynamic library"); } #ifdef MACE_WINAPI void* extractedSymbol = GetProcAddress(static_cast<HMODULE>(dll), name); #elif defined(MACE_POSIX) void* extractedSymbol = dlsym(dll, name); #endif if (extractedSymbol == nullptr) { #ifdef MACE_POSIX const char* errorMessage = dlerror(); #else MACE_CONSTEXPR char* errorMessage = "Returned function pointer was null pointer"; #endif os::checkError(__LINE__, __FILE__, "Attempt to load symbol " + std::string(name) + " returned a nullptr: " + std::string(errorMessage)); MACE__THROW(NullPointer, "Unable to load symbol from dynamic library: " + std::string(name) + ": " + std::string(errorMessage)); } os::checkError(__LINE__, __FILE__, "Error extracting symbol " + std::string(name) + " from dynamic library"); return extractedSymbol; }
void SimpleGrid::remove() { if (!isCreated()) { return; } Module::remove(); if (mVertices) { if (getNormalMode() == MaterialManager::NM_VERTEX) { delete [] static_cast<Mesh::POS_NORM_VERTEX*>(mVertices); } else if (getNormalMode() == MaterialManager::NM_RTT) { delete [] static_cast<Mesh::POS_VERTEX*>(mVertices); } } if (mVerticesChoppyBuffer) { delete [] mVerticesChoppyBuffer; } }
void RunMacroDlg::doDialog(bool isRTL) { if (!isCreated()) create(IDD_RUN_MACRO_DLG, isRTL); else ::ShowWindow(_hSelf, SW_SHOW); }
void DynamicLibrary::destroy() { if (!isCreated() || dll == nullptr) { return; } #ifdef MACE_WINAPI if (!FreeLibrary(static_cast<HMODULE>(dll))) { os::checkError(__LINE__, __FILE__, "Destruction of dynamic library failed"); MACE__THROW(AssertionFailed, "Destruction of dynamic library failed"); } #elif defined(MACE_POSIX) int result = dlclose(dll); if (result != 0) { const char* errorMessage = dlerror(); os::checkError(__LINE__, __FILE__, "Failed to close dynamic library handle: Error code " + std::to_string(result) + ": " + std::string(errorMessage)); MACE__THROW(AssertionFailed, "dlclose returned error code " + std::to_string(result) + ": " + std::string(errorMessage)); } #endif created = false; os::checkError(__LINE__, __FILE__, "Error destroying dynamic library"); }
CtrlrChildWindow *CtrlrManagerWindowManager::createWindow(const CtrlrManagerWindowManager::WindowType window) { if (isCreated(window)) { return (nullptr); } CtrlrChildWindow *w = new CtrlrChildWindow (*this); switch (window) { case CtrlrManagerWindowManager::MidiMonWindow: w->setContent (new CtrlrMIDIMon (owner)); break; case CtrlrManagerWindowManager::LogViewer: w->setContent (new CtrlrLogViewer (owner)); break; case CtrlrManagerWindowManager::MIDICalculator: w->setContent (new CtrlrMIDICalculator (owner)); break; case CtrlrManagerWindowManager::Repository: break; } w->setName("Ctrlr/" + w->getContent()->getContentName()); windows.add (w); return (w); }
void FileListDialog::ShowDialog( bool Show ) { if ( !isCreated() ) { create(&TBData); //TCHAR *name=new TCHAR(20); //lstrcpy( (LPWSTR)name , TEXT("Gtag Search Results") ); //TBData.pszName = name; TBData.pszName = TEXT("Gtag Search"); TBData.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB; TBData.pszModuleName = (LPCTSTR)getPluginFileName(); TBData.dlgID = FILELIST_DOCKABLE_WINDOW_INDEX ; // define the default docking behaviour ::SendMessage( _hParent, NPPM_DMMREGASDCKDLG, 0, (LPARAM)&TBData); gtagSearchResult.init(g_hInstance,getHSelf()); gtagFunctionList.init(g_hInstance,getHSelf()); } display( Show ); gtagSearchResult.display(Show); gtagFunctionList.display(Show); ResizeListBoxes(); IsShown = Show; }
void LangListDialog::update() { if (!isCreated ()) return; auto status = getSpellChecker()->getStatus(); ListBox_ResetContent(HLangList); for (auto &lang : status->languageList) ListBox_AddString(HLangList, lang.aliasName.c_str ()); auto settingsCopy = *getSpellChecker()->getSettings(); wchar_t *multiLangCopy = nullptr; wchar_t *context = nullptr; setString (multiLangCopy, settingsCopy.spellerSettings[SpellerType::hunspell].activeMultiLanguage.data ()); int index = 0; auto token = _tcstok_s(multiLangCopy, _T ("|"), &context); while (token) { index = -1; for (int i = 0; i < static_cast<int> (status->languageList.size ()); ++i) { if (status->languageList[i].originalName == token) { index = i; break; } } if (index != -1) CheckedListBox_SetCheckState(HLangList, index, BST_CHECKED); token = _tcstok_s(NULL, _T ("|"), &context); } CLEAN_AND_ZERO_ARR (multiLangCopy); }
VkCommandBuffer CommandBufferFactory::newCommandBuffer(CommandBufferFlag cmdbFlags) { ANKI_ASSERT(isCreated()); Bool secondLevel = !!(cmdbFlags & CommandBufferFlag::SECOND_LEVEL); Bool smallBatch = !!(cmdbFlags & CommandBufferFlag::SMALL_BATCH); CmdbType& type = m_types[secondLevel][smallBatch]; LockGuard<Mutex> lock(type.m_mtx); VkCommandBuffer out = VK_NULL_HANDLE; if(type.m_count > 0) { // Recycle --type.m_count; out = type.m_cmdbs[type.m_count]; } else { // Create a new one VkCommandBufferAllocateInfo ci = {}; ci.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; ci.commandPool = m_pool; ci.level = (secondLevel) ? VK_COMMAND_BUFFER_LEVEL_SECONDARY : VK_COMMAND_BUFFER_LEVEL_PRIMARY; ci.commandBufferCount = 1; ANKI_TRACE_INC_COUNTER(VK_CMD_BUFFER_CREATE, 1); ANKI_VK_CHECKF(vkAllocateCommandBuffers(m_dev, &ci, &out)); } ANKI_ASSERT(out); return out; }
//============================================================================== void GlBufferHandle::write(GlCommandBufferHandle& commands, GlClientBufferHandle& data, PtrSize readOffset, PtrSize writeOffset, PtrSize size) { class Command: public GlCommand { public: GlBufferHandle m_buff; GlClientBufferHandle m_data; PtrSize m_readOffset; PtrSize m_writeOffset; PtrSize m_size; Command(GlBufferHandle& buff, GlClientBufferHandle& data, PtrSize readOffset, PtrSize writeOffset, PtrSize size) : m_buff(buff), m_data(data), m_readOffset(readOffset), m_writeOffset(writeOffset), m_size(size) {} void operator()(GlCommandBuffer*) { ANKI_ASSERT(m_readOffset + m_size <= m_data.getSize()); m_buff._get().write( (U8*)m_data.getBaseAddress() + m_readOffset, m_writeOffset, m_size); } }; ANKI_ASSERT(isCreated()); commands._pushBackNewCommand<Command>( *this, data, readOffset, writeOffset, size); }
//============================================================================== void GlBufferHandle::bindShaderBufferInternal(GlCommandBufferHandle& commands, I32 offset, I32 size, U32 bindingPoint) { class Command: public GlCommand { public: GlBufferHandle m_buff; I32 m_offset; I32 m_size; U8 m_binding; Command(GlBufferHandle& buff, I32 offset, I32 size, U8 binding) : m_buff(buff), m_offset(offset), m_size(size), m_binding(binding) {} void operator()(GlCommandBuffer*) { U32 offset = (m_offset != -1) ? m_offset : 0; U32 size = (m_size != -1) ? m_size : m_buff._get().getSize(); m_buff._get().setBindingRange(m_binding, offset, size); } }; ANKI_ASSERT(isCreated()); commands._pushBackNewCommand<Command>(*this, offset, size, bindingPoint); }
void FindReplaceDlg::doDialog(HWND hParent, BOOL findReplace) { if (_hSCI == NULL) { /* create new scintilla handle */ _hSCI = (HWND)::SendMessage(_nppData._nppHandle, NPPM_CREATESCINTILLAHANDLE, 0, (LPARAM)_hSelf); } if (!isCreated()) { create(IDD_FINDREPLACE_DLG); ::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGADD, (LPARAM)_hSelf); ETDTProc EnableDlgTheme = (ETDTProc)::SendMessage(_nppData._nppHandle, NPPM_GETENABLETHEMETEXTUREFUNC, 0, 0); if (EnableDlgTheme != NULL) EnableDlgTheme(_hSelf, ETDT_ENABLETAB); } /* set kind of dialog */ _findReplace = findReplace; _hParentHandle = hParent; /* update dialog */ display(); updateDialog(); ::SetFocus(::GetDlgItem(_hSelf, IDC_COMBO_FIND)); }
void ButtonDlg::doDialog(bool isRTL) { if (!isCreated()) create(IDD_BUTTON_DLG, isRTL); display(); }
void HelpDlg::doDialog() { if (!isCreated()) create(IDD_HELP_DLG); ::ShowWindow(this->_hSelf, 5); }
void BoxTextGraphicsItem::setFont(const QFont &font) { m_gi->setFont(font); if (isCreated()) { adaptHeight(); } }
//============================================================================== void GlPipelineHandle::bind(GlCommandBufferHandle& commands) { ANKI_ASSERT(isCreated()); class Command: public GlCommand { public: GlPipelineHandle m_ppline; Command(GlPipelineHandle& ppline) : m_ppline(ppline) {} Error operator()(GlCommandBuffer* commands) { GlState& state = commands->getQueue().getState(); if(state.m_crntPpline != m_ppline._get().getGlName()) { m_ppline._get().bind(); state.m_crntPpline = m_ppline._get().getGlName(); } return ErrorCode::NONE; } }; commands._pushBackNewCommand<Command>(*this); }
void ViewZoneDlg::doDialog() { if (!isCreated()) create(IDD_VIEWZONE); display(); };
//============================================================================== void NativeWindow::swapBuffers() { ANKI_COUNTER_START_TIMER(SWAP_BUFFERS_TIME); ANKI_ASSERT(isCreated()); SDL_GL_SwapWindow(m_impl->m_window); ANKI_COUNTER_STOP_TIMER_INC(SWAP_BUFFERS_TIME); }
void DockingCont::doDialog(bool willBeShown, bool isFloating) { if (!isCreated()) { create(IDD_CONTAINER_DLG); _isFloating = isFloating; if (_isFloating) { ::SetWindowLongPtr(_hSelf, GWL_STYLE, POPUP_STYLES); ::SetWindowLongPtr(_hSelf, GWL_EXSTYLE, POPUP_EXSTYLES); ::ShowWindow(_hCaption, SW_HIDE); } else { ::SetWindowLongPtr(_hSelf, GWL_STYLE, CHILD_STYLES); ::SetWindowLongPtr(_hSelf, GWL_EXSTYLE, CHILD_EXSTYLES); ::ShowWindow(_hCaption, SW_SHOW); } //If you want defualt GUI font _hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); } display(willBeShown); }
void AboutDialog::doDialog() { if (!isCreated()) create(IDD_ABOUTDLG); goToCenter(); }
void HippoToolTip::setForWindow(HWND forWindow) { g_assert(!isCreated()); forWindow_ = forWindow; }
//============================================================================== void TexturePtr::create( CommandBufferPtr& commands, const Initializer& initS) { ANKI_ASSERT(!isCreated()); Initializer init(initS); // Copy data to temp buffers if(init.m_copyDataBeforeReturn) { for(U layer = 0; layer < MAX_TEXTURE_LAYERS; ++layer) { for(U level = 0; level < MAX_MIPMAPS; ++level) { SurfaceData& surf = init.m_data[level][layer]; if(surf.m_ptr) { void* newData = commands.get().getInternalAllocator(). allocate(surf.m_size); memcpy(newData, surf.m_ptr, surf.m_size); surf.m_ptr = newData; } } } } Base::create(commands.get().getManager()); get().setStateAtomically(GlObject::State::TO_BE_CREATED); // Fire the command commands.get().pushBackNewCommand<CreateTextureCommand>( *this, init, init.m_copyDataBeforeReturn); }
bool HippoToolTip::create() { g_assert(forWindow_ != NULL); if (!isCreated()) { if (!HippoAbstractWindow::create()) return false; g_assert(window_ != NULL); TOOLINFO ti; getTrackingToolInfo(&ti); if (!SendMessage(window_, TTM_ADDTOOL, 0, (LPARAM)&ti)) { hippoDebugLogW(L"Failed to send TTM_ADDTOOL"); return false; } // set a width, which leads to line wrapping (otherwise you can get hugely wide tips). // the wrapping is like Pango WRAP_WORD not WRAP_CHAR i.e. you must have whitespace if (!SendMessage(window_, TTM_SETMAXTIPWIDTH, 0, 300)) { hippoDebugLogW(L"Failed to set max tooltip width"); return false; } } return true; }
/*! Maps the contents of this buffer into the application's memory space and returns a pointer to it. Returns null if memory mapping is not possible. The \a access parameter indicates the type of access to be performed. It is assumed that create() has been called on this buffer and that it has been bound to the current context. \note This function is only supported under OpenGL ES 2.0 or earlier if the \c GL_OES_mapbuffer extension is present. \note On OpenGL ES 3.0 and newer, or, in case if desktop OpenGL, if \c GL_ARB_map_buffer_range is supported, this function uses \c glMapBufferRange instead of \c glMapBuffer. \sa unmap(), create(), bind(), mapRange() */ void *QOpenGLBuffer::map(QOpenGLBuffer::Access access) { Q_D(QOpenGLBuffer); #ifndef QT_NO_DEBUG if (!isCreated()) qWarning("QOpenGLBuffer::map(): buffer not created"); #endif if (!d->guard || !d->guard->id()) return 0; if (d->funcs->hasOpenGLExtension(QOpenGLExtensions::MapBufferRange)) { QOpenGLBuffer::RangeAccessFlags rangeAccess = 0; switch (access) { case QOpenGLBuffer::ReadOnly: rangeAccess = QOpenGLBuffer::RangeRead; break; case QOpenGLBuffer::WriteOnly: rangeAccess = QOpenGLBuffer::RangeWrite; break; case QOpenGLBuffer::ReadWrite: rangeAccess = QOpenGLBuffer::RangeRead | QOpenGLBuffer::RangeWrite; break; } return d->funcs->glMapBufferRange(d->type, 0, size(), rangeAccess); } else { return d->funcs->glMapBuffer(d->type, access); } }
void Mesh::create() { if(isCreated()) { return; } m_vao.create(); m_vao.bind(); m_vbo.create(); m_vbo.bind(); m_vbo.allocate(m_data.constData(), m_data.size() * sizeof(MeshVertex)); m_vbo.bind(); QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); f->glEnableVertexAttribArray(0); f->glEnableVertexAttribArray(1); f->glEnableVertexAttribArray(2); f->glEnableVertexAttribArray(3); f->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(MeshVertex), 0); f->glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(MeshVertex), reinterpret_cast<void *>(3 * sizeof(GLfloat))); f->glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(MeshVertex), reinterpret_cast<void *>(6 * sizeof(GLfloat))); f->glVertexAttribPointer(3, 4, GL_FLOAT, GL_FALSE, sizeof(MeshVertex), reinterpret_cast<void *>(8 * sizeof(GLfloat))); m_vbo.release(); m_vao.release(); m_isCreated = true; }
void SelectProxy::DoDialog () { if (!isCreated()) { create (IDD_DIALOG_SELECT_PROXY); } goToCenter (); }
void DebugInfoDlg::doDialog() { if (!isCreated()) create(IDD_DEBUGINFOBOX); // Adjust the position of AboutBox goToCenter(); }
void AboutDlg::doDialog() { if (!isCreated()) create(IDD_ABOUTBOX); // Adjust the position of AboutBox goToCenter(); }
void ConfigDialog::doDialog() { if (!isCreated()) create(IDD_CONFIGDIALOG); _isModal = FALSE; goToCenter(); }
void Mesh::bind() { if(!isCreated()) { create(); } m_vao.bind(); }