void RenderWindow::OnInitialize() { //TODO: add config logger.info() << L"Initializing OpenGL..."; SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); SDL_SetVideoMode(800, 600, 0, SDL_OPENGL | SDL_ANYFORMAT); SDL_WM_SetCaption("P3D RenderWindow", "P3D"); logger.info() << L"Loading extensions..."; GLenum err = glewInit(); if (GLEW_OK != err) { logger.warn() << L"glewInit something is seriously wrong. Error: " << ToUTF16((const char*)glewGetErrorString(err)); } logger.info() << L"Creating texture manager..."; _textureManager = new TextureManager(); logger.info() << L"OpenGL initialization completed."; }
void ID3v2Frame::setFrameValue ( const std::string& rawvalue, bool needDescriptor, bool utf16, bool isXMPPRIVFrame, bool needEncodingByte ) { std::string value; if ( isXMPPRIVFrame ) { XMP_Assert ( (! needDescriptor) && (! utf16) ); value.append ( "XMP\0", 4 ); value.append ( rawvalue ); value.append ( "\0", 1 ); // final zero byte } else { if ( needEncodingByte ) { if ( utf16 ) { value.append ( "\x1", 1 ); } else { value.append ( "\x0", 1 ); } } if ( needDescriptor ) value.append ( "eng", 3 ); if ( utf16 ) { if ( needDescriptor ) value.append ( "\xFF\xFE\0\0", 4 ); value.append ( "\xFF\xFE", 2 ); std::string utf16str; ToUTF16 ( (XMP_Uns8*) rawvalue.c_str(), rawvalue.size(), &utf16str, false ); value.append ( utf16str ); value.append ( "\0\0", 2 ); } else { std::string convertedValue; ReconcileUtils::UTF8ToLatin1 ( rawvalue.c_str(), rawvalue.size(), &convertedValue ); if ( needDescriptor ) value.append ( "\0", 1 ); value.append ( convertedValue ); value.append ( "\0", 1 ); } } this->changed = true; this->release(); this->contentSize = (XMP_Int32) value.size(); XMP_Validate ( (this->contentSize < 20*1024*1024), "XMP Property exceeds 20MB in size", kXMPErr_InternalFailure ); this->content = new char [ this->contentSize ]; memcpy ( this->content, value.c_str(), this->contentSize ); } // ID3v2Frame::setFrameValue
const String Config::ReadWideString(const std::string& section, const std::string& name, const String& def) { const TiXmlElement* tag = GetSection(section.c_str()); if (tag == NULL) return def; const char* attr = tag->Attribute(name.c_str()); if (attr == NULL) return def; else return ToUTF16(attr); }
inline LONG RegSetValueExX( HKEY hKey, const Char* lpValueName, DWORD dwType, const BYTE* lpData, DWORD cbData) { std::wstring valueName; if(lpValueName) { valueName = ToUTF16(lpValueName); } return RegSetValueExX(hKey, lpValueName ? valueName.c_str() : 0, dwType, lpData, cbData); }
inline LONG RegSetValueExStringX( HKEY hKey, const Char* lpValueName, DWORD Reserved, DWORD dwType, const Char* strX) { std::wstring valueName; std::wstring strW = ToUTF16(strX); if(lpValueName) { StringConvert(lpValueName, valueName); } return RegSetValueExW(hKey, lpValueName ? valueName.c_str() : 0, Reserved, REG_SZ, (const BYTE*)(strW.c_str()), (DWORD)(strW.size() + 1) * sizeof(wchar_t)); }
void GxSystemInterfaceWin32::SetClipboardText(const GxString& text) { if(!OpenClipboard(NULL)) return; std::wstring wstr; ToUTF16(wstr, text.Raw()); GxList<char> cstr = Narrow(wstr.c_str()); EmptyClipboard(); HGLOBAL bufferHandle = GlobalAlloc(GMEM_DDESHARE, cstr.Size()); char* buffer = (char*)GlobalLock(bufferHandle); if(buffer != NULL) { memcpy(buffer, cstr.Data(), cstr.Size()); SetClipboardData(CF_TEXT, bufferHandle); } GlobalUnlock(bufferHandle); CloseClipboard(); }
int ASF_LegacyManager::ExportLegacy ( const SXMPMeta& xmp ) { int changed = 0; objectsToExport = 0; legacyDiff = 0; std::string utf8; std::string utf16; XMP_OptionBits flags; if ( ! broadcastSet ) { if ( xmp.GetProperty ( kXMP_NS_XMP, "CreateDate", &utf8, &flags ) ) { std::string date; ConvertISODateToMSDate ( utf8, &date ); if ( fields[fieldCreationDate] != date ) { legacyDiff += date.size(); legacyDiff -= fields[fieldCreationDate].size(); this->SetField ( fieldCreationDate, date ); objectsToExport |= objectFileProperties; changed ++; } } } if ( xmp.GetLocalizedText ( kXMP_NS_DC, "title", "", "x-default", 0, &utf8, &flags ) ) { NormalizeStringTrailingNull ( utf8 ); ToUTF16 ( (const UTF8Unit*)utf8.data(), utf8.size(), &utf16, false ); if ( fields[fieldTitle] != utf16 ) { legacyDiff += utf16.size(); legacyDiff -= fields[fieldTitle].size(); this->SetField ( fieldTitle, utf16 ); objectsToExport |= objectContentDescription; changed ++; } } utf8.clear(); SXMPUtils::CatenateArrayItems ( xmp, kXMP_NS_DC, "creator", 0, 0, kXMPUtil_AllowCommas, &utf8 ); if ( ! utf8.empty() ) { NormalizeStringTrailingNull ( utf8 ); ToUTF16 ( (const UTF8Unit*)utf8.data(), utf8.size(), &utf16, false ); if ( fields[fieldAuthor] != utf16 ) { legacyDiff += utf16.size(); legacyDiff -= fields[fieldAuthor].size(); this->SetField ( fieldAuthor, utf16 ); objectsToExport |= objectContentDescription; changed ++; } } if ( xmp.GetLocalizedText ( kXMP_NS_DC, "rights", "", "x-default", 0, &utf8, &flags ) ) { NormalizeStringTrailingNull ( utf8 ); ToUTF16 ( (const UTF8Unit*)utf8.data(), utf8.size(), &utf16, false ); if ( fields[fieldCopyright] != utf16 ) { legacyDiff += utf16.size(); legacyDiff -= fields[fieldCopyright].size(); this->SetField ( fieldCopyright, utf16 ); objectsToExport |= objectContentDescription; changed ++; } } if ( xmp.GetLocalizedText ( kXMP_NS_DC, "description", "", "x-default", 0, &utf8, &flags ) ) { NormalizeStringTrailingNull ( utf8 ); ToUTF16 ( (const UTF8Unit*)utf8.data(), utf8.size(), &utf16, false ); if ( fields[fieldDescription] != utf16 ) { legacyDiff += utf16.size(); legacyDiff -= fields[fieldDescription].size(); this->SetField ( fieldDescription, utf16 ); objectsToExport |= objectContentDescription; changed ++; } } if ( xmp.GetProperty ( kXMP_NS_XMP_Rights, "WebStatement", &utf8, &flags ) ) { NormalizeStringTrailingNull ( utf8 ); if ( fields[fieldCopyrightURL] != utf8 ) { legacyDiff += utf8.size(); legacyDiff -= fields[fieldCopyrightURL].size(); this->SetField ( fieldCopyrightURL, utf8 ); objectsToExport |= objectContentBranding; changed ++; } } #if ! Exclude_LicenseURL_Recon if ( xmp.GetProperty ( kXMP_NS_XMP_Rights, "Certificate", &utf8, &flags ) ) { NormalizeStringTrailingNull ( utf8 ); if ( fields[fieldLicenseURL] != utf8 ) { legacyDiff += utf8.size(); legacyDiff -= fields[fieldLicenseURL].size(); this->SetField ( fieldLicenseURL, utf8 ); objectsToExport |= objectContentEncryption; changed ++; } } #endif // find objects, that would need to be created on legacy export int newObjects = (objectsToExport & !objectsExisting); // calculate minimum storage for new objects, that might be created on export if ( newObjects & objectContentDescription ) legacyDiff += sizeContentDescription; if ( newObjects & objectContentBranding ) legacyDiff += sizeContentBranding; if ( newObjects & objectContentEncryption ) legacyDiff += sizeContentEncryption; ComputeDigest(); return changed; }
inline LONG RegDeleteValueX(HKEY hKey, const Char* lpValueName) { std::wstring buf = ToUTF16(lpValueName); return RegDeleteValueW(hKey, buf.c_str()); }
inline LONG RegOpenKeyExX(HKEY hKey, const Char* szSubKey, DWORD dwOptions, REGSAM Sam, PHKEY pResult) { std::wstring buf = ToUTF16(szSubKey); return RegOpenKeyExW(hKey, buf.c_str(), dwOptions, Sam, pResult); }