void SimpleSurface::applyFilter (Surface *inSrc, const Rect &inRect, ImagePoint inOffset, Filter *inFilter) { if (!mBase) return; FilterList f; f.push_back (inFilter); Rect src_rect (inRect.w, inRect.h); Rect dest = GetFilteredObjectRect (f, src_rect); inSrc->IncRef (); Surface *result = FilterBitmap (f, inSrc, src_rect, dest, false, ImagePoint (inRect.x, inRect.y)); dest.Translate (inOffset.x, inOffset.y); src_rect = Rect (0, 0, result->Width (), result->Height ()); int dx = dest.x; int dy = dest.y; dest = dest.Intersect (Rect (0, 0, mWidth, mHeight)); dest.Translate (-dx, -dy); dest = dest.Intersect (src_rect); dest.Translate (dx, dy); int bpp = BytesPP (); RenderTarget t = BeginRender (dest, false); //printf("Copy back @ %d,%d %dx%d + (%d,%d)\n", dest.x, dest.y, t.Width(), t.Height(), dx, dy); for (int y = 0; y < t.Height (); y++) memcpy ((void *)(t.Row (y + dest.y) + ((dest.x) * bpp)), result->Row (y - dy) - (dx * bpp), dest.w * bpp); EndRender (); result->DecRef (); }
VFS_BOOL VFS_Archive_GetUsedFilters( const VFS_String& strArchiveFileName, VFS_FilterNameList& FilterNames ) { // Get Information about that Archive. VFS_EntityInfo Info; if( !VFS_Archive_GetInfo( strArchiveFileName, Info ) ) return VFS_FALSE; // Check if the Archive isn't open yet. if( GetOpenArchives().find( ToLower( Info.strPath ) ) == GetOpenArchives().end() ) { // Open the Archive. CArchive* pArchive = CArchive::Open( ToLower( Info.strPath ) ); if( pArchive == NULL ) return VFS_FALSE; // Add the Archive to the Open Archives List. GetOpenArchives()[ Info.strPath ] = pArchive; } // Get the Filter Names List. FilterList Filters = GetOpenArchives()[ ToLower( Info.strPath ) ]->GetHeader()->Filters; FilterNames.clear(); for( FilterList::const_iterator iter = Filters.begin(); iter != Filters.end(); iter++ ) { FilterNames.push_back( ( *iter )->GetName() ); } return VFS_TRUE; }
void MainWindow::on_servers_setupFilters_clicked() { FilterList* list = new FilterList(this); list->setFilterList(ui->serverList->getFilterList()); list->setModal(true); list->show(); connect(list, SIGNAL(closedSave()), this, SLOT(sFiltersOkay())); }
void MainWindow::sFiltersOkay() { FilterList* list = qobject_cast<FilterList*>(sender()); if (!list) return; ui->serverList->setFilterList(list->getFilterList()); list->deleteLater(); ui->serverList->saveFilterList(); }
void FilterWriter::ParseFilterGeneratedFiles(tinyxml2::XMLNode* parentNode, const FilterList &filterList) { for(FilterList::const_iterator filterIterator = filterList.cbegin(); filterIterator != filterList.cend(); ++filterIterator) { for(std::list<std::string>::const_iterator it = filterIterator->getGenerated().cbegin(); it != filterIterator->getGenerated().cend(); ++it) { WriteFilterGeneratedFile(parentNode, *filterIterator, *it); } } }
static void SaveAsColorFile(HWND hWnd) { TSTR *fileName = DLGetWindowLongPtr<TSTR*>(hWnd); if (fileName) _tcscpy(fname,fileName->data()); // RB 10/15/2000: Init directory string if (fdir[0]==_T('\0')) { _tcscpy(fdir, GetCOREInterface()->GetDir(APP_IMAGE_DIR)); } OPENFILENAME ofn; memset(&ofn,0,sizeof(ofn)); FilterList fl; fl.Append(GetString(IDS_RB_COLORCLIPFILES)); fl.Append(_T("*.ccb")); TSTR title = GetString(IDS_RB_SAVECOLOR); ofn.lStructSize = sizeof(OPENFILENAME); // No OFN_ENABLEHOOK ofn.hwndOwner = hWnd; ofn.lpstrFilter = fl; ofn.lpstrFile = fname; ofn.nMaxFile = 256; ofn.lpstrInitialDir = fdir; ofn.Flags = OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST; ofn.FlagsEx = OFN_EX_NOPLACESBAR; ofn.lpstrDefExt = _T("ccb"); ofn.lpstrTitle = title; tryAgain: if (GetSaveFileName(&ofn)) { if (DoesFileExist(fname)) { TSTR buf1; TSTR buf2 = GetString(IDS_RB_SAVECOLOR); buf1.printf(GetString(IDS_RB_FILEEXISTS),fname); if (IDYES!=MessageBox( hWnd, buf1,buf2,MB_YESNO|MB_ICONQUESTION)) { goto tryAgain; } } if (!fileName) fileName = new TSTR; *fileName = fname; DLSetWindowLongPtr(hWnd, fileName); SaveColorFile(hWnd,*fileName); } }
EGLConfig chooseSingleConfig (const Library& egl, EGLDisplay display, const FilterList& filters) { const vector<EGLConfig> allConfigs (getConfigs(egl, display)); for (vector<EGLConfig>::const_iterator cfg = allConfigs.begin(); cfg != allConfigs.end(); ++cfg) { if (filters.match(egl, display, *cfg)) return *cfg; } TCU_THROW(NotSupportedError, "No matching EGL config found"); }
void AppClient::decode( const FilterList& fl ) { while ( fl.forth() ) { const FilterEntry& fe = fl.getEntry(); cout << "ID: " << fe.getFilterId() << " Action: " << fe.getAction() << " DataType: " << DataType( fe.getLoad().getDataType() ) << " Value: "; switch ( fe.getLoadType() ) { case DataType::ElementListEnum: decode( fe.getElementList() ); break; case DataType::MapEnum: decode( fe.getMap() ); break; default: cout << endl; break; } } }
BOOL CppOutPickModeCallback::Pick(IObjParam *ip,ViewExp *vpt) { INode *node = vpt->GetClosestHit(); if (node) { static TCHAR fname[256] = {'\0'}; OPENFILENAME ofn; memset(&ofn,0,sizeof(ofn)); FilterList fl; fl.Append( GetString(IDS_RB_CPPFILES)); fl.Append( _T("*.cpp")); TSTR title = GetString(IDS_RB_SAVEOBJECT); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = theCppOut.hPanel; ofn.lpstrFilter = fl; ofn.lpstrFile = fname; ofn.nMaxFile = 256; ofn.lpstrInitialDir = ip->GetDir(APP_EXPORT_DIR); ofn.Flags = OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST; ofn.lpstrDefExt = _T("asc"); ofn.lpstrTitle = title; tryAgain: if (GetSaveFileName(&ofn)) { if (DoesFileExist(fname)) { TSTR buf1; TSTR buf2 = GetString(IDS_RB_SAVEOBJECT); buf1.printf(GetString(IDS_RB_FILEEXISTS),fname); if (IDYES!=MessageBox( theCppOut.hPanel, buf1,buf2,MB_YESNO|MB_ICONQUESTION)) { goto tryAgain; } } theCppOut.OutputObject(node,fname); } } return TRUE; }
vector<EGLConfig> chooseConfigs (const Library& egl, EGLDisplay display, const FilterList& filters) { const vector<EGLConfig> allConfigs (getConfigs(egl, display)); vector<EGLConfig> matchingConfigs; for (vector<EGLConfig>::const_iterator cfg = allConfigs.begin(); cfg != allConfigs.end(); ++cfg) { if (filters.match(egl, display, *cfg)) matchingConfigs.push_back(*cfg); } return matchingConfigs; }
bool LoadNewDLL( HWND hWnd, Interface *ip) { TCHAR fullPath[MAX_PATH] = {0}; TCHAR fileTitle[100] = {0}; TCHAR initDir[MAX_PATH] = {0}; FilterList FileFilter; OPENFILENAME ofn; memset(&ofn,0,sizeof(ofn)); ofn.lStructSize = sizeof(OPENFILENAME); // No OFN_ENABLEHOOK ofn.hwndOwner=hWnd; ofn.hInstance=hInstance; #ifdef DESIGN_VER FileFilter.Append(GetString(IDS_MAX_PLUGINS_VIZ)); #else FileFilter.Append(GetString(IDS_MAX_PLUGINS)); #endif // DESIGN_VER FileFilter.Append(_T("*.DL?;*.BM?;*.FLT")); FileFilter.Append(GetString(IDS_ALL_FILES)); FileFilter.Append(_T("*.*")); ofn.lpstrFilter = FileFilter; ofn.lpstrCustomFilter=NULL; ofn.nMaxCustFilter=0; ofn.nFilterIndex=1; ofn.lpstrFile=fullPath; ofn.nMaxFile=500; ofn.lpstrFileTitle = fileTitle; ofn.nMaxFileTitle=99; IPathConfigMgr* manager = IPathConfigMgr::GetPathConfigMgr(); if(manager->GetPlugInEntryCount() > 0) { _tcsncpy(initDir, manager->GetPlugInDir(0), MAX_PATH); ofn.lpstrInitialDir = initDir; } else { ofn.lpstrInitialDir = NULL; } ofn.lpstrTitle = GetString(IDS_CHOOSE_PLUGIN); ofn.Flags = OFN_FILEMUSTEXIST; ofn.FlagsEx = OFN_EX_NOPLACESBAR; fullPath[0]=_T('\0'); GetOpenFileName(&ofn); if(fullPath[0]==_T('\0')){return false;} DllDir* dd = ip->GetDllDirectory(); int dllIndex = dd->FindDllDescFromDllPath(fullPath); if (dllIndex >= 0) { return dd->LoadADll((dd->GetDllDescription(dllIndex)).GetFullPath(), TRUE); } return dd->LoadADll(fullPath, TRUE); }
void tarch::logging::CommandLineLogger::addFilterListEntries( const FilterList& entries) { for (FilterList::const_iterator p = entries.begin(); p!=entries.end(); p++ ) { addFilterListEntry(*p); } }
static bool parse_filter(const string &filter, FilterList &pkg_filters, ObjFilterList &obj_filters, StrFilterList &str_filters) { // -fname=foo exact // -fname:foo glob // -fname/foo/ regex // -fname/foo/i iregex // the manpage calls REG_BASIC "obsolete" so we default to extended bool neg = false; size_t at = 0; while (filter.length() > at && filter[at] == '!') { neg = !neg; ++at; } if (filter.compare(at, string::npos, "broken") == 0) { auto pf = filter::PackageFilter::broken(neg); if (!pf) return false; pkg_filters.push_back(move(pf)); return true; } #ifdef PKGDEPDB_ENABLE_REGEX string regex; bool icase = false; auto parse_regex = [&]() -> bool { if (static_cast<unsigned char>(filter[at] - 'a') > ('z'-'a') && static_cast<unsigned char>(filter[at] - 'A') > ('Z'-'A') && static_cast<unsigned char>(filter[at] - '0') > ('9'-'0')) { // parse the regex enclosed using the character from filter[4] char unquote = filter[at]; if (unquote == '(') unquote = ')'; else if (unquote == '{') unquote = '}'; else if (unquote == '[') unquote = ']'; else if (unquote == '<') unquote = '>'; if (filter.length() < at+2) { fprintf(stderr, "empty filter content: %s\n", filter.c_str()); return false; } regex = filter.substr(at+1); icase = false; if (regex[regex.length()-1] == 'i') { if (regex[regex.length()-2] == unquote) { icase = true; regex.erase(regex.length()-2); } } else if (regex[regex.length()-1] == unquote) regex.pop_back(); return true; } return false; }; #endif auto parsematch = [&]() -> rptr<filter::Match> { if (filter[at] == '=') return filter::Match::CreateExact(move(filter.substr(at+1))); else if (filter[at] == ':') return filter::Match::CreateGlob(move(filter.substr(at+1))); #ifdef PKGDEPDB_ENABLE_REGEX else if (parse_regex()) return filter::Match::CreateRegex(move(regex), icase); #endif return nullptr; }; #define ADDFILTER2(TYPE, NAME, FUNC, DEST) do { \ if (filter.compare(at, sizeof(#NAME)-1, #NAME) == 0) { \ at += sizeof(#NAME)-1; \ auto match = parsematch(); \ if (!match) \ return false; \ DEST.push_back(move(filter::TYPE::FUNC(move(match), neg))); \ return true; \ } } while(0) #define ADDFILTER(TYPE, NAME, DEST) ADDFILTER2(TYPE, NAME, NAME, DEST) #define MAKE_PKGFILTER(NAME) ADDFILTER(PackageFilter, NAME, pkg_filters) MAKE_PKGFILTER(name); MAKE_PKGFILTER(group); MAKE_PKGFILTER(depends); MAKE_PKGFILTER(optdepends); MAKE_PKGFILTER(makedepends); MAKE_PKGFILTER(checkdepends); MAKE_PKGFILTER(alldepends); MAKE_PKGFILTER(provides); MAKE_PKGFILTER(conflicts); MAKE_PKGFILTER(replaces); MAKE_PKGFILTER(pkglibdepends); MAKE_PKGFILTER(pkglibrpath); MAKE_PKGFILTER(pkglibrunpath); MAKE_PKGFILTER(pkglibinterp); MAKE_PKGFILTER(contains); #undef MAKE_PKGFILTER #define MAKE_OBJFILTER(NAME) ADDFILTER2(ObjectFilter, lib##NAME, NAME, obj_filters) MAKE_OBJFILTER(name); MAKE_OBJFILTER(depends); MAKE_OBJFILTER(path); MAKE_OBJFILTER(rpath); MAKE_OBJFILTER(runpath); MAKE_OBJFILTER(interp); #undef MAKE_OBJFILTER ADDFILTER2(StringFilter, file, filter, str_filters); return false; }
bool Node::walk(WalkSink &inWalker, NodeType::Type inType) const { FilterList filter; filter.push_back(inType); return walk(inWalker, &filter); }
BOOL RendVueParamDlg::FileBrowse() { int tried = 0; FilterList filterList; HWND hWnd = hPanel; static int filterIndex = 1; OPENFILENAME ofn; TSTR filename; TCHAR fname[512]; TCHAR saveDir[1024]; { TSTR dir; SplitFilename(workFileName, &dir, &filename,NULL); _tcscpy(saveDir,dir.data()); } _tcscpy(fname,filename.data()); _tcscat(fname, VUEEXT); filterList.Append(GetString(IDS_VUE_FILE)); filterList.Append(VUEFILTER); memset(&ofn, 0, sizeof(ofn)); ofn.lStructSize = sizeof(OPENFILENAME); // No OFN_ENABLEHOOK ofn.hwndOwner = hWnd; ofn.hInstance = hInstance; ofn.nFilterIndex = filterIndex; ofn.lpstrFilter = filterList; ofn.lpstrTitle = GetString(IDS_WRITE_VUEFILE); ofn.lpstrFile = fname; ofn.nMaxFile = _countof(fname); Interface *iface = GetCOREInterface(); if(saveDir[0]) ofn.lpstrInitialDir = saveDir; else ofn.lpstrInitialDir = iface->GetDir(APP_SCENE_DIR); if(RunningNewShell()) { ofn.Flags = OFN_HIDEREADONLY | OFN_EXPLORER /* | OFN_ENABLEHOOK | OFN_ENABLETEMPLATE*/; // OFN_OVERWRITEPROMPT; ofn.lpfnHook = NULL;// (LPOFNHOOKPROC)FileHook; ofn.lCustData = 0; // 0 for save, 1 for open // ofn.lpTemplateName = MAKEINTRESOURCE(IDD_EXT_FILE); } else { ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST /* |OFN_ENABLEHOOK | OFN_ENABLETEMPLATE */; ofn.lpfnHook = NULL; // (LPOFNHOOKPROC)PMFileHook; ofn.lCustData = 0; // ofn.lpTemplateName = MAKEINTRESOURCE(IDD_PM_EXT_FILE); } ofn.FlagsEx = OFN_EX_NOPLACESBAR; FixFileExt(ofn,VUEEXT); // add ".vue" if absent while (GetSaveFileName(&ofn)) { FixFileExt(ofn,VUEEXT); // add ".vue" if absent workFileName = ofn.lpstrFile; return TRUE; } return FALSE; }
static void LoadColorFile(HWND hWnd) { // RB 10/15/2000: Init directory string if (fdir[0]==_T('\0')) { _tcscpy(fdir, GetCOREInterface()->GetDir(APP_IMAGE_DIR)); } OPENFILENAME ofn; memset(&ofn,0,sizeof(ofn)); FilterList fl; fl.Append(GetString(IDS_RB_COLORCLIPFILES)); fl.Append(_T("*.ccb")); TSTR title = GetString(IDS_RB_LOADCOLOR); ofn.lStructSize = sizeof(OPENFILENAME); // No OFN_ENABLEHOOK ofn.hwndOwner = hWnd; ofn.lpstrFilter = fl; ofn.lpstrFile = fname; ofn.nMaxFile = 256; ofn.lpstrInitialDir = fdir; ofn.Flags = OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST; ofn.FlagsEx = OFN_EX_NOPLACESBAR; ofn.lpstrDefExt = _T("ccb"); ofn.lpstrTitle = title; if (GetOpenFileName(&ofn)) { MaxSDK::Util::TextFile::Reader file; if(!file.Open(fname)) { TSTR buf2 = GetString(IDS_RB_COLORCLIPBOARD); TSTR buf1; buf1.printf(GetString(IDS_RB_CANTOPENFILE),fname); MessageBox(hWnd,buf1,buf2,MB_ICONEXCLAMATION); return; } TSTR colorLine; // pre-R6 for (int i=0; i<12; i++) { int r, g, b; colorLine = file.ReadLine(); if(EOF == _stscanf(colorLine, _T("%d %d %d\n"), &r, &g, &b)) break; Color color(float(r)/255.0f,float(g)/255.0f,float(b)/255.0f); TSTR name; name.printf(GetString(IDS_RB_COLORNUM),i); IColorSwatch *cs = GetIColorSwatch(GetDlgItem(hWnd,csIDs[i]),color,name); ReleaseIColorSwatch(cs); } // post-R6 for (int i=0; i<12; i++) { float r, g, b, a; colorLine = file.ReadLine(); if(EOF == _stscanf(colorLine, _T("%f %f %f %f\n"),&r, &g, &b, &a)) break; AColor color(r,g,b,a); TSTR name; name.printf(GetString(IDS_RB_COLORNUM),i); IColorSwatch *cs = GetIColorSwatch(GetDlgItem(hWnd,csIDs[i]),color,name); ReleaseIColorSwatch(cs); } file.Close(); TSTR *fileName = DLGetWindowLongPtr<TSTR*>(hWnd); delete fileName; fileName = new TSTR(fname); DLSetWindowLongPtr(hWnd, fileName); SetupTitle(hWnd,*fileName); } }