void TresizeSettingsPage::param2dlg(const TparamsIDs &ids) { int max, step1, step2, pos; char_t pomS[256]; double realPos; const int idParam[] = {ids.idc_lbl, ids.idc_tbr, 0}; int method = cfgGet(ids.idff_method); const char_t *name = _l("Parameter"); switch (method) { case TresizeAspectSettings::METHOD_SWS_BICUBIC: max = 400; step1 = 10; step2 = 40; pos = cfgGet(ids.idff_bicubicParam); realPos = -0.01 * pos; pos = 400 - pos; break; case TresizeAspectSettings::METHOD_SWS_GAUSS: max = 100; step1 = 5 ; step2 = 20; pos = cfgGet(ids.idff_gaussParam); realPos = 0.1 * pos; break; case TresizeAspectSettings::METHOD_SWS_LANCZOS: max = 10 ; step1 = 1 ; step2 = 2 ; pos = cfgGet(ids.idff_lanczosParam); name = _l("Number of taps:"); realPos = pos; break; default: enable(0, idParam); tbrSet(ids.idc_tbr, 0); setDlgItemText(m_hwnd, ids.idc_lbl, _(ids.idc_lbl)); return; }; int sws = TresizeAspectSettings::methodsProps[cfgGet(IDFF_resizeMethodLuma)].library == TresizeAspectSettings::LIB_SWSCALER; enable(sws, idParam); tbrSetRange(ids.idc_tbr, 0, max); //SendDlgItemMessage(m_hwnd,ids.idc_tbr,TBM_SETRANGE,TRUE,MAKELPARAM(0,max)); SendDlgItemMessage(m_hwnd, ids.idc_tbr, TBM_SETLINESIZE, 0, step1); SendDlgItemMessage(m_hwnd, ids.idc_tbr, TBM_SETPAGESIZE, 0, step2); tbrSet(ids.idc_tbr, pos); if (realPos == 0) { tsnprintf_s(pomS, countof(pomS), _TRUNCATE, _l("%s %s"), _(ids.idc_lbl, name), _(ids.idc_lbl, _l("default"))); } else { tsnprintf_s(pomS, countof(pomS), _TRUNCATE, _l("%s %3.2f"), _(ids.idc_lbl, name), realPos); } setDlgItemText(m_hwnd, ids.idc_lbl, pomS); }
bool TwarpsharpSettings::getTip(unsigned int pageId, char_t *buf, size_t buflen) { switch (method) { case 0: tsnprintf_s(buf, buflen, _TRUNCATE, _l("original warpsharp - depth:%i, threshold:%i"), warpsharpDepth, warpsharpThreshold); break; case 1: tsnprintf_s(buf, buflen, _TRUNCATE, _l("aWarpSharp - depth:%g, threshold:%g, %i %s blur, chroma mode:%s"), awarpsharpDepth / 100.0f, awarpsharpThresh / 100.0f, awarpsharpBlur, bms[awarpsharpBM], cms[awarpsharpCM]); break; } buf[buflen - 1] = '\0'; return true; }
void TaudioCodec::getInputDescr(char_t *buf,size_t buflen) const { char_t samplefmt[255]; fmt.description(samplefmt,255); char_t input[256]; getInputDescr1(input,256); if (numframes && bpssum) { tsnprintf_s(buf, buflen, _TRUNCATE, _l("%s, %s, %u kbps (%s)"), input, samplefmt, roundDiv(bpssum,numframes), getName()); } else { tsnprintf_s(buf, buflen, _TRUNCATE, _l("%s, %s (%s)"), input, samplefmt, getName()); } buf[buflen-1]='\0'; }
void Twindow::tbrSet(int id,int val,int lblId,const char_t *Icapt,float div) { SendDlgItemMessage(m_hwnd,id,TBM_SETPOS,TRUE,val); if (lblId) { const char_t *capt=((Icapt && Icapt[0])?Icapt:_(lblId)); char_t s[256]; if (div==0) { tsnprintf_s(s, countof(s), _TRUNCATE, _l("%s %i"), capt, val); } else { tsnprintf_s(s, countof(s), _TRUNCATE, _l("%s %g"), capt, float(val/div)); } setDlgItemText(m_hwnd,lblId,s); } }
void Tpresets::listRegKeys(strings &l) { l.clear(); HKEY hKey; char_t rkey[MAX_PATH]; tsnprintf_s(rkey, countof(rkey), _TRUNCATE, FFDSHOW_REG_PARENT _l("\\%s"), reg_child); RegOpenKeyEx(HKEY_CURRENT_USER,rkey,0,KEY_READ,&hKey); for (int i=0,retCode=ERROR_SUCCESS; retCode==ERROR_SUCCESS; i++) { char_t keyName[256]; DWORD keyNameSize=255; FILETIME ftLastWriteTime; retCode = RegEnumKeyEx(hKey, i, keyName, &keyNameSize, NULL, NULL, NULL, &ftLastWriteTime ); if (retCode==ERROR_SUCCESS) { l.push_back(ffstring(keyName)); } else { break; } } RegCloseKey(hKey); }
void TaudioCodecLibFAAD::getInputDescr1(char_t *buf, size_t buflen) const { if (!inited) { return; } tsnprintf_s(buf, buflen, _TRUNCATE, _l("%s%sAAC"), sbr ? _l("SBR ") : _l(""), ps ? _l("PS ") : _l("")); }
void Tpreset::saveReg(void) { char_t presetRegStr[MAX_PATH]; tsnprintf_s(presetRegStr, countof(presetRegStr), _TRUNCATE, FFDSHOW_REG_PARENT _l("\\%s\\%s"), reg_child, presetName); TregOpRegWrite t(HKEY_CURRENT_USER,presetRegStr); reg_op(t); }
const char_t* TinfoDec::TinfoValueDec::getVal0(bool &wasChange, bool &splitline) { switch (item->type) { case IDFF_OSDtype_encoderInfo: if (olds[0] == '\0') { char_t encoder[100] = _l("unknown"); deciD->getEncoderInfo(encoder, 100); tsnprintf_s(s, countof(s), _TRUNCATE, _l("%s"), encoder); wasChange = true; } return s; case IDFF_OSDtype_shortInfo: deciD->getShortDescription(s, 512); wasChange = strcmp(s, olds) != 0; splitline = true; return s; case IDFF_OSDtype_movieSource: ff_strncpy(s, deciD->getDecoderName(), countof(s)); wasChange = strcmp(s, olds) != 0; return s; case IDFF_OSDtype_bps: { int bps = deciD->getInputBitrate2(); tsprintf(s, bps == -1 ? _l("N/A") : _l("%i kbps"), bps); wasChange = true; return s; } case IDFF_OSDtype_activePresetName: { deciD->getActivePresetName(s, countof(s)); wasChange = strcmp(s, olds) != 0; return s; } default: return TinfoValueBase::getVal0(wasChange, splitline); } }
void TdecoderOptionsPage::getTip(char_t *tipS, size_t len) { tsnprintf_s(tipS, len, _TRUNCATE, _l("IDCT: %s"), Tlibavcodec::idctNames[cfgGet(IDFF_idct)]); int bugs = cfgGet(IDFF_workaroundBugs); if (bugs && bugs != FF_BUG_AUTODETECT) { strncatf(tipS, len, _l("\nBugs workaround")); } }
bool TlevelsSettings::getTip(unsigned int pageId, char_t *tipS, size_t len) { tsnprintf_s(tipS, len, _TRUNCATE, _l("%s\nInput min: %i, input max: %i, output min:%i, output max:%i\nGamma correction: %5.2f"), modes[mode], inMin, inMax, outMin, outMax, gamma / 100.0f); if (posterize != 255) { strncatf(tipS, len, _l("\nPosterizing to %i levels"), posterize); } return true; }
bool TdeinterlaceSettings::getTip(unsigned int pageId, char_t *tipS, size_t len) { if (getMethod(cfgId).id != DSCALER) { tsnprintf_s(tipS, len, _TRUNCATE, _l("Method: %s"), getMethod(cfgId).name); return true; } else { return false; } }
bool Twinamp2settings::getTip(unsigned int pageId, char_t *tipS, size_t len) { if (flnm[0] && modulename[0]) { tsnprintf_s(tipS, len, _TRUNCATE, _l("%s: %s"), flnm, modulename); return true; } else { return false; } }
bool TeqSettings::getTip(unsigned int pageId, char_t *tipS, size_t len) { char_t tip[200] = _l(""); for (int i = 0; i < 10; i++) { strncatf(tip, countof(tip), _l("%.2f, "), ((highdb - lowdb) * (&eq0)[i] / 200 + lowdb) / 100.0f); } *strrchr(tip, ',') = '\0'; tsnprintf_s(tipS, len, _TRUNCATE, _l("%s%s"), tip, super ? _l("\nSuperEQ") : _l("")); tipS[len - 1] = '\0'; return true; }
char_t* csp_getName2(const TcspInfo *cspInfo, uint64_t csp, char_t *buf, size_t len) { const char_t *colorspaceName = cspInfo ? cspInfo->name : _l("unknown"); tsnprintf_s(buf, len, _TRUNCATE, _l("%s%s%s"), colorspaceName, csp & FF_CSP_FLAGS_VFLIP ? _l(", flipped vertically") : _l(""), csp & FF_CSP_FLAGS_INTERLACED ? _l(", interlaced") : _l("")); return buf; }
void TsubtitlesSettings::getPosVert(int x, char_t *s, Twindow *w, int id, size_t len) { const char_t *posS; if (x < 40) { posS = _l("top"); } else if (x > 60) { posS = _l("bottom"); } else { posS = _l("center"); } tsnprintf_s(s, len, _TRUNCATE, _l("%s %3i%% (%s)"), w ? w->_(id) : _l("Vertical position:"), x, w ? w->_(id, posS) : posS); }
void TsubtitlesSettings::getPosHoriz(int x, char_t *s, Twindow *w, int id, size_t len) { const char_t *posS; if (x < 40) { posS = _l("left"); } else if (x > 60) { posS = _l("right"); } else { posS = _l("center"); } tsnprintf_s(s, len, _TRUNCATE, _l("%s %3i%% (%s)"), w ? w->_(id) : _l("Horizontal position:"), x, w ? w->_(id, posS) : posS); }
void TautoPresetProps::getVolume(void) { const char_t *flnm=deci->getSourceName(); char_t dsk[MAX_PATH]; _splitpath_s(flnm,dsk,MAX_PATH,NULL,0,NULL,0,NULL,0); DWORD serial,maximumComponentLength,volumeFlags; ffstring disk(dsk); disk += _l("\\"); wasVolume=GetVolumeInformation(disk.c_str(),volumeName,256,&serial,&maximumComponentLength,&volumeFlags,NULL,0); if (wasVolume) { tsnprintf_s(volumeSerial, countof(volumeSerial), _TRUNCATE, _l("%X-%X"),(int)HIWORD(serial),(int)LOWORD(serial)); } }
bool TcropSettings::getTip(unsigned int pageId,char_t *tipS,size_t len) { switch (mode) { case 0: if (magnificationLocked) { tsnprintf_s(tipS, len, _TRUNCATE, _l("zoom: %i%%"), magnificationX); } else { tsnprintf_s(tipS, len, _TRUNCATE, _l("horizontal magnification: %i%%, vertical magnification: %i%%"), magnificationX,magnificationY); } break; case 1: tsnprintf_s(tipS, len, _TRUNCATE, _l("crop: left:%i, top:%i, right:%i, bottom:%i"), cropLeft, cropTop, cropRight,cropBottom); break; case 2: tsnprintf_s(tipS, len, _TRUNCATE, _l("Pan & scan")); break; default: tipS[0]='\0'; } tipS[len-1]='\0'; return true; }
HRESULT TffdshowVideoInputPin::getInCodecString(char_t *buf, size_t buflen) { if (!buf) { return E_POINTER; } if (video) { char_t name[60]; tsnprintf_s(buf, buflen, _TRUNCATE, _l("%s (%s)"), fourcc2str(biIn.bmiHeader.biCompression, name, 60), video->getName()); buf[buflen - 1] = '\0'; } else { buf[0] = '\0'; } return S_OK; }
void TkeysPage::keyChange(int newkey) { if (keyChanging == -1) { return; } int prev; const char_t *prevDescr; if (deciD->setKeyParamKeyCheck(keyChanging, newkey, &prev, &prevDescr) != S_OK) { endKeyChange(); ignoreNextKey = true; char_t s[256]; tsnprintf_s(s, countof(s), _TRUNCATE, _l("%s %s"), _(-IDD_KEYS, _l("This key is already assigned to")), _(IDC_LV_KEYS, prevDescr)); msg(s); } }
void Tpresets::nextUniqueName(char_t *presetName, size_t buflen) { iterator i=findPreset(presetName); if (i==end()) { return; } for (int ii=1;; ii++) { char_t pomS[MAX_PATH]; tsnprintf_s(pomS, countof(pomS), _TRUNCATE, _l("%s %i"),presetName,ii); if (findPreset(pomS)==end()) { ff_strncpy(presetName, pomS, buflen); return; } } }
size_t TmuxerFile::write(const void *data, size_t len, int framenum) { if (flnmmask[0]) { char_t flnm[MAX_PATH]; tsnprintf_s(flnm, countof(flnm), _TRUNCATE, flnmmask, framenum); FILE *f = fopen(flnm, _l("wb")); if (!f) { return 0; } len = fwrite(data, 1, len, f); fclose(f); return len; } else { return f ? fwrite(data, 1, len, f) : 0; } }
void Tpresets::saveRegAll(void) { for (iterator ii=begin(); ii!=end(); ii++) if (!(*ii)->autoLoadedFromFile) { (*ii)->saveReg(); } strings keys; listRegKeys(keys); for (strings::const_iterator i=keys.begin(); i!=keys.end(); i++) if (i->c_str()[0]!='\0' && findPreset(i->c_str())==end()) { char_t presetRegStr[256]; tsnprintf_s(presetRegStr, countof(presetRegStr), _TRUNCATE, FFDSHOW_REG_PARENT _l("\\%s\\%s"), reg_child, i->c_str()); RegDeleteKey(HKEY_CURRENT_USER,presetRegStr); } }
void TlevelsPage::levels2dlg(void) { setCheck(IDC_CHB_LEVELS_ONLYLUMA,cfgGet(IDFF_levelsOnlyLuma)); int x=cfgGet(IDFF_levelsGamma); tbrSet(IDC_TBR_LEVELS_GAMMA,x); char_t pomS[256]; tsnprintf_s(pomS, countof(pomS), _TRUNCATE, _l("%s %3.2f"), _(IDC_LBL_LEVELS_GAMMA), float(x/100.0)); if (x==100) { strncatf(pomS, countof(pomS), _l(" (%s)"),_(IDC_LBL_LEVELS_GAMMA,_l("off"))); } setDlgItemText(m_hwnd,IDC_LBL_LEVELS_GAMMA,pomS); tbrSet(IDC_TBR_LEVELS_POSTERIZE,cfgGet(IDFF_levelsPosterize),IDC_LBL_LEVELS_POSTERIZE); SetDlgItemInt(m_hwnd,IDC_ED_Y_MAX_DELTA ,deci->getParam2(IDFF_levelsYmaxDelta ),FALSE); SetDlgItemInt(m_hwnd,IDC_ED_Y_THRESHOLD ,deci->getParam2(IDFF_levelsYthreshold ),FALSE); SetDlgItemInt(m_hwnd,IDC_ED_Y_TEMPORAL ,deci->getParam2(IDFF_levelsYtemporal ),FALSE); mode2dlg(); }
bool TsubtitlesSettings::getTip(unsigned int pageId, char_t *buf, size_t len) { if (pageId == 1) { char_t tipS[256]; char_t horiz[256], vert[256]; getPosHoriz(posX, horiz, NULL, 0, countof(horiz)); getPosVert(posY, vert, NULL, 0, countof(vert)); tsnprintf_s(tipS, countof(tipS), _TRUNCATE, _l("%s, %s"), horiz, vert); if (delay != delayDef) { strncatf(tipS, countof(tipS), _l("\nDelay: %i ms"), delay); } if (speed != speedDef || speed2 != speedDef) { strncatf(tipS, countof(tipS), _l("\nSpeed: %i/%i"), speed, speed2); } ff_strncpy(buf, tipS, len); buf[len - 1] = '\0'; } else if (pageId == 2) { font.getTip(buf, len); } return true; }
void TresizeAspectPage::aspect2dlg(void) { int ra = cfgGet(IDFF_isAspect); setCheck(IDC_RBT_ASPECT_NO , ra == 0); setCheck(IDC_RBT_ASPECT_KEEP, ra == 1); setCheck(IDC_RBT_ASPECT_USER, ra == 2); char_t pomS[256]; unsigned int a1, a2; if (deciV->getInputDAR(&a1, &a2) == S_OK) { setText(IDC_RBT_ASPECT_KEEP, _l("%s %3.2f:1"), _(IDC_RBT_ASPECT_KEEP), float(a1) / a2); } int aspectI = cfgGet(IDFF_hwOverlayAspect); tbrSet(IDC_TBR_HWOVERLAY_ASPECT, aspectI / 256); tsnprintf_s(pomS, countof(pomS), _TRUNCATE, _l("%s "), _(IDC_LBL_HWOVERLAY_ASPECT)); if (aspectI == 0) { strncat_s(pomS, countof(pomS), _(IDC_LBL_HWOVERLAY_ASPECT, _l("default")), _TRUNCATE); } else { strncatf(pomS, countof(pomS), _l("%3.2f:1"), float(aspectI / 65536.0)); } setDlgItemText(m_hwnd, IDC_LBL_HWOVERLAY_ASPECT, pomS); }
unsigned int __stdcall Twinamp2dsp::threadProc(void *self0) { Twinamp2dsp *self = (Twinamp2dsp*)self0; static const char_t *FFDSHOW_WINAMP_CLASS = _l("ffdshow_winamp_class"); randomize(); setThreadName(DWORD(-1), "winamp2"); HINSTANCE hi = self->mod->hDllInstance; char_t windowName[80]; tsnprintf_s(windowName, countof(windowName), _TRUNCATE, _l("%s_window%i"), FFDSHOW_WINAMP_CLASS, rand()); HWND h = createInvisibleWindow(hi, FFDSHOW_WINAMP_CLASS, windowName, wndProc, self, NULL); self->mod->hwndParent = h; if (self->mod->Init(self->mod) == 0) { { boost::unique_lock<boost::mutex> lock(self->mut); self->h = h; } self->cond.notify_one(); if (self->h) { SetWindowLongPtr(self->h, GWLP_USERDATA, LONG_PTR(self)); MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } else { self->h = (HWND) - 1; DestroyWindow(h); } if (self->mod->Quit) { self->mod->Quit(self->mod); } UnregisterClass(FFDSHOW_WINAMP_CLASS, hi); _endthreadex(0); return 0; }
void TdeinterlacePage::fillDeinterlacers(void) { int ii = cbxGetCurSel(IDC_CBX_DEINT_METHOD); cbxClear(IDC_CBX_DEINT_METHOD); int i; for (i = 0; TdeinterlaceSettings::methodProps[i].name; i++) if (!(TdeinterlaceSettings::methodProps[i].id == TdeinterlaceSettings::FRAMERATEDOUBLER && !(Tconfig::cpu_flags & FF_CPU_MMXEXT)) && TdeinterlaceSettings::methodProps[i].id != TdeinterlaceSettings::DSCALER) { cbxAdd(IDC_CBX_DEINT_METHOD, _(IDC_CBX_DEINT_METHOD, TdeinterlaceSettings::methodProps[i].name), TdeinterlaceSettings::methodProps[i].cfgId); } const char_t *dscalerDir = cfgGetStr(IDFF_dscalerPath); if (!dscalerDir || !dscalerDir[0]) { dscalerstart = 0; return; } char_t dsmask[MAX_PATH]; _makepath_s(dsmask, MAX_PATH, NULL, dscalerDir, _l("DI_*"), _l("dll")); strings dis; findFiles(dsmask, dis, true); dscalerstart = i - 1; diflnms.clear(); for (strings::const_iterator di = dis.begin(); di != dis.end(); di++) { char_t flnm[MAX_PATH]; extractfilename(di->c_str(), flnm); if (stricmp(flnm, _l("DI_Adaptive.dll")) != 0) { char_t diname[256]; Tdscaler_DI didll(di->c_str(), deci, true); if (didll.fm) { tsnprintf_s(diname, countof(diname), _TRUNCATE, _l("DScaler: %s"), (const char_t*)text<char_t>(didll.fm->szName)); cbxAdd(IDC_CBX_DEINT_METHOD, diname, 9); diflnms.push_back(*di); } } } cbxSetCurSel(IDC_CBX_DEINT_METHOD, ii); }
INT_PTR TinfoPageDec::msgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_CHB_ALLOW_MMX: case IDC_CHB_ALLOW_MMXEXT: case IDC_CHB_ALLOW_SSE: case IDC_CHB_ALLOW_SSE2: case IDC_CHB_ALLOW_SSE3: case IDC_CHB_ALLOW_SSSE3: case IDC_CHB_ALLOW_3DNOW: case IDC_CHB_ALLOW_3DNOWEXT: case IDC_CHB_ALLOW_SSE41: case IDC_CHB_ALLOW_SSE42: case IDC_CHB_ALLOW_SSE4A: case IDC_CHB_ALLOW_SSE5: { int allow=0; if (getCheck(IDC_CHB_ALLOW_MMX )) { allow|=FF_CPU_MMX; } if (getCheck(IDC_CHB_ALLOW_MMXEXT )) { allow|=FF_CPU_MMXEXT; } if (getCheck(IDC_CHB_ALLOW_SSE )) { allow|=FF_CPU_SSE; } if (getCheck(IDC_CHB_ALLOW_SSE2 )) { allow|=FF_CPU_SSE2; } if (getCheck(IDC_CHB_ALLOW_SSE3 )) { allow|=FF_CPU_SSE3; } if (getCheck(IDC_CHB_ALLOW_SSSE3 )) { allow|=FF_CPU_SSSE3; } if (getCheck(IDC_CHB_ALLOW_3DNOW )) { allow|=FF_CPU_3DNOW; } if (getCheck(IDC_CHB_ALLOW_3DNOWEXT)) { allow|=FF_CPU_3DNOWEXT; } if (getCheck(IDC_CHB_ALLOW_SSE41 )) { allow|=FF_CPU_SSE41; } if (getCheck(IDC_CHB_ALLOW_SSE42 )) { allow|=FF_CPU_SSE42; } if (getCheck(IDC_CHB_ALLOW_SSE4A )) { allow|=FF_CPU_SSE4A; } if (getCheck(IDC_CHB_ALLOW_SSE5 )) { allow|=FF_CPU_SSE5; } cfgSet(IDFF_allowedCpuFlags,allow); return TRUE; } } break; case WM_NOTIFY: { NMHDR *nmhdr=LPNMHDR(lParam); if (nmhdr->hwndFrom==hlv && nmhdr->idFrom==IDC_LV_INFO) switch (nmhdr->code) { case LVN_GETDISPINFO: { NMLVDISPINFO *nmdi=(NMLVDISPINFO*)lParam; int i=nmdi->item.iItem; if (i==-1) { break; } if (nmdi->item.mask&LVIF_TEXT) switch (nmdi->item.iSubItem) { case 0: { nmdi->item.pszText = pszTextBuf; tsnprintf_s(pszTextBuf,countof(pszTextBuf),_TRUNCATE,_l("%s: %s"),infoitems[i].translatedName,infoitems[i].val?infoitems[i].val:_l("")); break; } } return TRUE; } } break; } } return TconfPageDec::msgProc(uMsg,wParam,lParam); }
INT_PTR TOSDpageDec::msgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_CHB_OSD: cfgSet(IDFF_isOSD, getCheck(IDC_CHB_OSD)); parent->drawInter(); return TRUE; case IDC_CHB_OSD_IS_AUTO_HIDE: cfgSet(IDFF_OSDisAutoHide, getCheck(IDC_CHB_OSD_IS_AUTO_HIDE)); osd2dlg(); parent->setChange(); break; case IDC_ED_OSD_DURATION_VISIBLE: if (HIWORD(wParam) == EN_CHANGE && !isSetWindowText) { HWND hed = GetDlgItem(m_hwnd, LOWORD(wParam)); if (hed != GetFocus()) { return FALSE; } repaint(hed); parent->setChange(); break; } break; case IDC_CHB_OSD_USER: if (!getCheck(IDC_CHB_OSD_USER)) { lv2osdFormat(); } else { cfgSet(IDFF_OSDformat, _l("user")); } osd2dlg(); parent->setChange(); break; case IDC_ED_OSD_USER: if (HIWORD(wParam) == EN_CHANGE && !isSetWindowText) { char_t ed[1020]; //4 chars are reserved for "user" prefix GetDlgItemText(m_hwnd, IDC_ED_OSD_USER, ed, 1020); char_t format[1024]; tsnprintf_s(format, 1024, _TRUNCATE, _l("user%s"), ed); cfgSet(IDFF_OSDformat, format); parent->setChange(); }; break; case IDC_ED_OSD_SAVE: if (HIWORD(wParam) == EN_CHANGE && !isSetWindowText) { char_t saveflnm[MAX_PATH]; GetDlgItemText(m_hwnd, IDC_ED_OSD_SAVE, saveflnm, MAX_PATH); cfgSet(IDFF_OSDsaveFlnm, saveflnm); return TRUE; } return TRUE; } break; case WM_NOTIFY: { NMHDR *nmhdr = LPNMHDR(lParam); if (!nostate && nmhdr->hwndFrom == hlv && nmhdr->idFrom == IDC_LV_OSD_LINES) switch (nmhdr->code) { case LVN_ITEMCHANGED: { LPNMLISTVIEW nmlv = LPNMLISTVIEW(lParam); if (nmlv->uChanged & LVIF_STATE && ((nmlv->uOldState & 4096) != (nmlv->uNewState & 4096))) { lv2osdFormat(); } return TRUE; } case LVN_BEGINDRAG: { if (!user) { LPNMLISTVIEW nmlv = LPNMLISTVIEW(lParam); if (nmlv->iItem != -1) { dragitem = nmlv->iItem; SetCapture(m_hwnd); } } break; } case NM_DBLCLK: { if (user) { LPNMITEMACTIVATE nmia = LPNMITEMACTIVATE(lParam); if (nmia->iItem != -1) { const char_t *shortcut = deci->getInfoItemShortcut((int)lvGetItemParam(IDC_LV_OSD_LINES, nmia->iItem)); if (shortcut && shortcut[0]) { char_t osd[1020]; tsnprintf_s(osd, countof(osd), _TRUNCATE, _l("%%%s"), shortcut); SendDlgItemMessage(m_hwnd, IDC_ED_OSD_USER, EM_REPLACESEL, TRUE, LPARAM(osd)); } } } break; } } break; } case WM_MOUSEMOVE: if (dragitem != -1) { LVHITTESTINFO lvhti; lvhti.pt.x = LOWORD(lParam) - lvx; lvhti.pt.y = HIWORD(lParam) - lvy; int target = ListView_HitTest(hlv, &lvhti); if (target != -1) { lvSwapItems(IDC_LV_OSD_LINES, target, dragitem); lv2osdFormat(); dragitem = target; } return TRUE; } break; case WM_LBUTTONUP: if (dragitem != -1) { dragitem = -1; ReleaseCapture(); return TRUE; } break; } return TconfPageDec::msgProc(uMsg, wParam, lParam); }