void ToutPage::onStoreExternal(void) { char_t storeExtFlnm[MAX_PATH]; cfgGet(IDFF_enc_storeExtFlnm,storeExtFlnm,MAX_PATH); if (dlgGetFile(true,m_hwnd,_(-IDD_OUT,_l("Select file for storing frames")),_l("All files (*.*)\0*.*\0"),_l(""),storeExtFlnm,_l("."),0)) { cfgSet(IDFF_enc_storeExtFlnm,storeExtFlnm); out2dlg(); } }
void TbitmapPage::onFlnm(void) { char_t flnm[MAX_PATH]; cfgGet(IDFF_bitmapFlnm,flnm,MAX_PATH); if (dlgGetFile(false,m_hwnd,_(-IDD_BITMAP,_l("Load image file")),_l("All supported (*.jpg,*.bmp,*.gif,*.png)\0*.bmp;*.jpg;*.jpeg;*.gif;*.png\0Windows Bitmap (*.bmp)\0*.bmp\0JPEG (*.jpg)\0*.jpg\0Compuserve Graphics Interchange (*.gif)\0*.gif\0Portable Network Graphics (*.png)\0*.png"),_l("bmp"),flnm,_l("."),0)) { setDlgItemText(m_hwnd,IDC_ED_BITMAP_FLNM,flnm); cfgSet(IDFF_bitmapFlnm,flnm); } }
void TOSDpageDec::onSave(void) { char_t flnm[MAX_PATH]; cfgGet(IDFF_OSDsaveFlnm, flnm, MAX_PATH); if (dlgGetFile(true, m_hwnd, _(-IDD_OSD, _l("File where to write statistics")), _l("Comma delimited (*.csv)\0*.csv\0"), _l("csv"), flnm, _l("."), 0)) { setDlgItemText(m_hwnd, IDC_ED_OSD_SAVE, flnm); cfgSet(IDFF_OSDsaveFlnm, flnm); } }
void TgraphPage::onDebugoutputfile(void) { char_t debugfile[MAX_PATH]; cfgGet(IDFF_debugfile, debugfile, MAX_PATH); if (dlgGetFile(true, m_hwnd, _(-IDD_GRAPH, _l("Select file for debug info")), _l("Log files (*.log)\0*.log\0All files (*.*)\0*.*\0"), _l("log"), debugfile, _l("."), 0)) { cfgSet(IDFF_debugfile, debugfile); debug2dlg(); } }
void TpresetsPage::onSaveToFile(void) { int i=lvGetSelItem(IDC_LV_PRESETS); char_t presetFlnm[MAX_PATH]; _splitpath_s((*parent->localPresets)[i]->presetName, NULL, 0, NULL, 0, presetFlnm, countof(presetFlnm), NULL, 0); if (dlgGetFile(true,m_hwnd,_(-IDD_PRESETS,_l("Save ffdshow preset")),presetfilter,presetext,presetFlnm,_l("."),0)) { (*parent->localPresets)[i]->saveFile(presetFlnm); } }
ffstring TconvolverPage::selectFile(int idff,int idc) { char_t flnm[MAX_PATH]; cfgGet(idff,flnm,MAX_PATH); if (dlgGetFile(false,m_hwnd,_(-IDD_CONVOLVER,_l("Select impulse file")),_l("Wave files (*.wav,*.wv)\0*.wav;*.wv\0All files (*.*)\0*.*\0"),_l("wav"),flnm,_l("."),0)) { if (idc) { setDlgItemText(m_hwnd,idc,flnm); } cfgSet(idff,flnm); return flnm; } else { return ffstring(); } }
void TkeysPage::onGirder(void) { if (deciD->getKeyParamKey2(0) != VK_CONTROL || deciD->getKeyParamKey2(1) != VK_MENU || deciD->getKeyParamKey2(2) != VK_SHIFT) { err(_(-IDD_KEYS, _l("GML file can be exported only if:\nActivation key 1 is 'ctrl'\nActivation key 2 is 'alt' and\nSecond function key is 'shift'")), _(-IDD_KEYS, _l("Girder export"))); } else { char_t flnm[MAX_PATH] = _l("ffdshow.gml"); if (dlgGetFile(true, m_hwnd, _(-IDD_KEYS, _l("Select name of exported Girder file")), _l("Girder Files (*.gml)\0*.gml\0"), _l("gml"), flnm, _l("."), 0)) if (deciD->exportKeysToGML(flnm) == S_OK) { msg(_(-IDD_KEYS, _l("GML file exported successfully")), _(-IDD_KEYS, _l("Girder export"))); } else { err(_(-IDD_KEYS, _l("GML file export failed")), _(-IDD_KEYS, _l("Girder export"))); } } }
void TpresetsPage::onReadFromFile(void) { int i=lvGetSelItem(IDC_LV_PRESETS); char_t presetFlnm[MAX_PATH]; _splitpath_s((*parent->localPresets)[i]->presetName, NULL, 0, NULL, 0, presetFlnm, countof(presetFlnm), NULL, 0); if (dlgGetFile(false,m_hwnd,_(-IDD_PRESETS,_l("Load ffdshow preset")),presetfilter,presetext,presetFlnm,_l("."),0)) { char_t presetName[MAX_PATH]; ff_strncpy(presetName,(*parent->localPresets)[i]->presetName,MAX_PATH); (*parent->localPresets)[i]->loadFile(presetFlnm); ff_strncpy((*parent->localPresets)[i]->presetName, presetName, countof((*parent->localPresets)[i]->presetName)); parent->selectPreset(presetName); cfg2dlg(); parent->setChange(); } }
void TavisynthPage::onLoad(void) { char_t scriptflnm[MAX_PATH] = _l(""); if (dlgGetFile(false, m_hwnd, _(-IDD_AVISYNTH, _l("Load Avisynth script")), avs_mask, _l("avs"), scriptflnm, _l("."), 0)) { FILE *f = fopen(scriptflnm, _l("rb")); if (f) { char script[MAX_AVISYNTH_SCRIPT_LENGTH]; size_t len = fread(script, 1, MAX_AVISYNTH_SCRIPT_LENGTH, f); fclose(f); script[len] = '\0'; setDlgItemText(m_hwnd, IDC_ED_AVISYNTH, text<char_t>(script)); } parent->setChange(); } }
void TquantTablesPageBase::onSave(void) { if (dlgGetFile(true,m_hwnd,_(-IDD_QUANT_TABLES,_l("Save quantization matrices")),_l("XviD quantization matrices file (*.xcm)\0*.xcm\0ffdshow quantization matrices file (*.qmatrix)\0*.qmatrix\0Custom quantization matrix (*.cqm)\0*.cqm\0All files (*.*)\0*.*\0"),_l("*.xcm"),matrixflnm,firstdir?matrixdir:_l("."),0)) { firstdir=false; FILE *f=fopen(matrixflnm,_l("wb")); if (f) { uint8_t *qmatrix_intra_custom,*qmatrix_inter_custom; getCustomQuantMatrixes(&qmatrix_intra_custom,&qmatrix_inter_custom,NULL,NULL,NULL,NULL); if (qmatrix_intra_custom || qmatrix_inter_custom) { fwrite(qmatrix_intra_custom?qmatrix_intra_custom:qmatrix_inter_custom,1,64,f); fwrite(qmatrix_inter_custom?qmatrix_inter_custom:qmatrix_intra_custom,1,64,f); } fclose(f); } else { err(_(-IDD_QUANT_TABLES,_l("Error while saving quantization matrices"))); } } }
void TavisynthPage::onSave(void) { char_t scriptflnm[MAX_PATH] = _l(""); if (dlgGetFile(true, m_hwnd, _(-IDD_AVISYNTH, _l("Save Avisynth script")), avs_mask, _l("avs"), scriptflnm, _l("."), 0)) { FILE *f = fopen(scriptflnm, _l("wt")); if (f) { int linescnt = (int)SendDlgItemMessage(m_hwnd, IDC_ED_AVISYNTH, EM_GETLINECOUNT, 0, 0); for (int i = 0; i < linescnt; i++) { char_t line[MAX_AVISYNTH_SCRIPT_LENGTH]; WORD *lparam = (WORD*)line; *lparam = MAX_AVISYNTH_SCRIPT_LENGTH; LRESULT len = SendDlgItemMessage(m_hwnd, IDC_ED_AVISYNTH, EM_GETLINE, i, LPARAM(line)); line[len] = '\0'; if (i > 0) { fputs("\n", f); } fputs(text<char>(line), f); } fclose(f); } } }
void TlevelsPage::onCurveLoad(void) { if (dlgGetFile(false,m_hwnd,_(-IDD_LEVELS,_l("Select curve file")),_l("Adobe Photoshop Curves (*.acv)\0*.acv\0All files (*.*)\0*.*\0"),_l("acv"),curvesflnm,_l("."),0)) { FILE *f=fopen(curvesflnm,_l("rb")); if (!f) { return; } int16_t w; if (fread(&w,1,2,f)==2 && av_be2ne16(w)==4) if (fread(&w,1,2,f)==2 && av_be2ne16(w)==5) { int16_t cnt; if (fread(&cnt,1,2,f)==2 && (cnt=av_be2ne16(cnt))>0) { cnt=std::min(cnt,int16_t(10)); cfgSet(IDFF_levelsNumPoints,cnt); std::pair<uint8_t,uint8_t> pts[10]; int numpoints=0; for (int i=0; i<cnt; i++) { int16_t x,y; if (fread(&y,1,2,f)!=2 || fread(&x,1,2,f)!=2) { break; } pts[numpoints].first=limit_uint8(av_be2ne16(x)); pts[numpoints].second=limit_uint8(av_be2ne16(y)); numpoints++; } std::sort(pts,pts+numpoints); for (int i=0; i<numpoints; i++) { cfgSet(TwidgetCurves::idffs[2*i+0],pts[i].first); cfgSet(TwidgetCurves::idffs[2*i+1],pts[i].second); } wCurves->reset(); map2dlg(); } } fclose(f); } }
void TquantTablesPageBase::onLoad(void) { if (dlgGetFile(false,m_hwnd,_(-IDD_QUANT_TABLES,_l("Load quantization matrices")),_l("All matrix files (*.xcm;*.qmatrix;*.cqm;*.txt)\0*.xcm;*.qmatrix;*.txt\0XviD quantization matrices file (*.xcm)\0*.xcm\0ffdshow quantization matrices file (*.qmatrix;*.txt)\0*.qmatrix;*.txt\0Custom quantization matrix (*.cqm)\0*.cqm\0All files (*.*)\0*.*\0"),_l("*.xcm"),matrixflnm,firstdir?matrixdir:_l("."),0)) { firstdir=false; const char_t *error=NULL; size_t readed=0; FILE *f=fopen(matrixflnm,_l("rb")); if (f) { uint8_t *qmatrix_intra_custom,*qmatrix_inter_custom; getCustomQuantMatrixes(&qmatrix_intra_custom,&qmatrix_inter_custom,NULL,NULL,NULL,NULL); if (qmatrix_intra_custom) { readed+=fread(qmatrix_intra_custom,1,64,f); } else { fseek(f,64,SEEK_CUR); readed+=64; } if (qmatrix_inter_custom) { readed+=fread(qmatrix_inter_custom,1,64,f); } else { fseek(f,64,SEEK_CUR); readed+=64; } fclose(f); if (readed!=128) { error=_l("Error while loading quantization matrices"); } } if (error) { err(_(-IDD_QUANT_TABLES,error)); } else { if (readed) { setChange(); } cfg2dlg(); } } }
void TcompatibilityList::onAddFile(void) { char_t newFileName[MAX_PATH] = _l(""); const char_t* mask = _l("Executable (*.exe)\0*.exe\0"); ffstring startdir(config->pth); if (startdir[startdir.size() - 1] == '\\') { startdir += _l(".."); } else { startdir += _l("\\.."); } const char_t *capt; if (IDFF_target == IDFF_whitelist) { capt = _l("Add compatible executable file"); } else { capt = _l("Add incompatible executable file"); } if (dlgGetFile(false, m_hwnd, _(-IDD_COMPATIBILITY, capt), mask, _l("exe"), newFileName, startdir.c_str(), 0)) { char_t filename[MAX_PATH]; extractfilename(newFileName, filename); dlg2dlg(filename); } }