static api_bool EnumerationCallback( meta_format_handle handle, void* data ) { #define formats reinterpret_cast<Array<FileFormat>*>( data ) try { formats->Add( FileFormat( handle ) ); return api_true; } catch ( ... ) { return api_false; } #undef formats }
void SaveWindowAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("SaveWindowAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("outputToCurrentDirectory")) != 0) SetOutputToCurrentDirectory(node->AsBool()); if((node = searchNode->GetNode("outputDirectory")) != 0) SetOutputDirectory(node->AsString()); if((node = searchNode->GetNode("fileName")) != 0) SetFileName(node->AsString()); if((node = searchNode->GetNode("family")) != 0) SetFamily(node->AsBool()); if((node = searchNode->GetNode("format")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 14) SetFormat(FileFormat(ival)); } else if(node->GetNodeType() == STRING_NODE) { FileFormat value; if(FileFormat_FromString(node->AsString(), value)) SetFormat(value); } } if((node = searchNode->GetNode("width")) != 0) SetWidth(node->AsInt()); if((node = searchNode->GetNode("height")) != 0) SetHeight(node->AsInt()); if((node = searchNode->GetNode("screenCapture")) != 0) SetScreenCapture(node->AsBool()); if((node = searchNode->GetNode("saveTiled")) != 0) SetSaveTiled(node->AsBool()); if((node = searchNode->GetNode("quality")) != 0) SetQuality(node->AsInt()); if((node = searchNode->GetNode("progressive")) != 0) SetProgressive(node->AsBool()); if((node = searchNode->GetNode("binary")) != 0) SetBinary(node->AsBool()); if((node = searchNode->GetNode("lastRealFilename")) != 0) SetLastRealFilename(node->AsString()); if((node = searchNode->GetNode("stereo")) != 0) SetStereo(node->AsBool()); if((node = searchNode->GetNode("compression")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 4) SetCompression(CompressionType(ival)); } else if(node->GetNodeType() == STRING_NODE) { CompressionType value; if(CompressionType_FromString(node->AsString(), value)) SetCompression(value); } } if((node = searchNode->GetNode("forceMerge")) != 0) SetForceMerge(node->AsBool()); if((node = searchNode->GetNode("resConstraint")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 3) SetResConstraint(ResConstraint(ival)); } else if(node->GetNodeType() == STRING_NODE) { ResConstraint value; if(ResConstraint_FromString(node->AsString(), value)) SetResConstraint(value); } } if((node = searchNode->GetNode("advancedMultiWindowSave")) != 0) SetAdvancedMultiWindowSave(node->AsBool()); if((node = searchNode->GetNode("subWindowAtts")) != 0) subWindowAtts.SetFromNode(node); }
SaveWindowAttributes::FileFormat SaveWindowAttributes::GetFormat() const { return FileFormat(format); }
void CScene::ReBuild() { vector<wstring> fileList; GetFiles(fileList, TEXT(".\\Download\\"), false); TCHAR szCurrentDirectory[MAX_PATH]; TCHAR szDownloadDirectory[MAX_PATH]; GetCurrentDirectory(MAX_PATH + 1, szCurrentDirectory); if (m_vffFileList.size() > 0) m_vffFileList.clear(); for (size_t sz = 0; sz < fileList.size(); ++sz) { wsprintf(szDownloadDirectory, TEXT("%s\\Download\\%s"), szCurrentDirectory, fileList[sz].c_str()); ifstream fs(szDownloadDirectory, ios::binary); // size check; fs.seekg(0, fstream::end); size_t szData = fs.tellg(); fs.close(); m_vffFileList.push_back(FileFormat(fileList[sz], CImageBits(szDownloadDirectory), szData)); } m_ulspDownlist = 50; RECT rcWorldSize; RECT rcLocalSize; GetClientRect(m_hWnd, &rcWorldSize); rcLocalSize = rcWorldSize; rcLocalSize.right -= rcLocalSize.left; rcLocalSize.bottom -= rcLocalSize.top; rcLocalSize.left = rcLocalSize.top = 0; RECT rcValidArea = rcLocalSize; rcValidArea.top += m_ulspDownlist; rcValidArea.bottom = rcValidArea.top + CLIENT_HEIGHT - m_ulspDownlist * 3; for (size_t sz = 0; sz < m_vffFileList.size(); ++sz) { m_vffFileList[sz].cibFilethumbnail.CreateHBitmap(); m_vPageList.push_back(make_unique<pSelectFileButton>()); pSelectFileButton* pCreatedButton = static_cast<pSelectFileButton*>(m_vPageList.back().get()); pCreatedButton->Initialize(m_pMasterFramework, m_hWnd, true, &m_vffFileList[sz], MakeRect<LONG>(10UL, m_ulspDownlist + sz * 55, 10UL + 350, m_ulspDownlist + 50 + sz * 55) ); pCreatedButton->GetAdvanceInfo(0, &sz); pCreatedButton->GetAdvanceInfo(2, &rcValidArea); } LONG length = CLIENT_HEIGHT - m_ulspDownlist * 3; m_Scroll.initialize(scroll::SCR_V, (50 + (m_vffFileList.size() - 1) * 55 - length), length, length * 0.95, MakePoint<LONG>(CLIENT_WIDTH - 30, m_ulspDownlist * 1.25), 170 ); m_hIcon = NULL; m_cImage = NULL; }
FileFormat FileFormatInstance::Format() const { return FileFormat( (const void*)(*API->FileFormat->GetFileFormatInstanceFormat)( handle ) ); }