| 1 |
#include <windows.h> |
| 2 |
#include <commctrl.h> |
| 3 |
#include <tchar.h> |
| 4 |
#include "resource.h" |
| 5 |
#include "Message.h" |
| 6 |
#include "Tombo.h" |
| 7 |
#include "TString.h" |
| 8 |
#include "TomboURI.h" |
| 9 |
#include "FilterDefDlg.h" |
| 10 |
#include "PropertyPage.h" |
| 11 |
#include "VarBuffer.h" |
| 12 |
#include "VFManager.h" |
| 13 |
#include "VFStream.h" |
| 14 |
#include "DialogTemplate.h" |
| 15 |
#include "FilterAddDlg.h" |
| 16 |
|
| 17 |
#define NUM_TAB_FILTERCTL 2 |
| 18 |
|
| 19 |
BOOL FilterDefDlg::Init() |
| 20 |
{ |
| 21 |
return TRUE; |
| 22 |
} |
| 23 |
|
| 24 |
///////////////////////////////////////// |
| 25 |
// Src tab |
| 26 |
///////////////////////////////////////// |
| 27 |
|
| 28 |
|
| 29 |
class FilterDlgSrcTab : public PropertyTab { |
| 30 |
FilterDefDlg *pDialog; |
| 31 |
public: |
| 32 |
FilterDlgSrcTab(FilterDefDlg *pDlg) : pDialog(pDlg), |
| 33 |
PropertyTab(IDD_FILTERDEF_SRC, MSG_FILTERDEFPROPTTL_SRC, |
| 34 |
(DLGPROC)DefaultPageProc) {} |
| 35 |
|
| 36 |
void Init(HWND hDlg); |
| 37 |
BOOL Apply(HWND hDlg); |
| 38 |
}; |
| 39 |
|
| 40 |
void FilterDlgSrcTab::Init(HWND hDlg) |
| 41 |
{ |
| 42 |
HWND hSrcPath = GetDlgItem(hDlg, IDC_FILTERDEF_SRC_PATH); |
| 43 |
SetWindowText(hSrcPath, pDialog->pInfo->pGenerator->GetURI()->GetFullURI()); |
| 44 |
} |
| 45 |
|
| 46 |
BOOL FilterDlgSrcTab::Apply(HWND hDlg) |
| 47 |
{ |
| 48 |
HWND hEdit = GetDlgItem(hDlg, IDC_FILTERDEF_SRC_PATH); |
| 49 |
|
| 50 |
DWORD nLen = GetWindowTextLength(hEdit); |
| 51 |
TString sPath; |
| 52 |
|
| 53 |
if (!sPath.Alloc(nLen + 1)) return FALSE; |
| 54 |
GetWindowText(hEdit, sPath.Get(), nLen + 1); |
| 55 |
|
| 56 |
TomboURI sURI; |
| 57 |
if (!sURI.Init(sPath.Get())) return FALSE; |
| 58 |
|
| 59 |
return pDialog->pInfo->pGenerator->SetURI(&sURI); |
| 60 |
} |
| 61 |
|
| 62 |
///////////////////////////////////////// |
| 63 |
// Filter tab |
| 64 |
///////////////////////////////////////// |
| 65 |
|
| 66 |
class FilterDlgFilterTab : public PropertyTab { |
| 67 |
FilterDefDlg *pDialog; |
| 68 |
protected: |
| 69 |
BOOL InsertItem(HWND hList, DWORD iPos, VFStream *pStream, BOOL bFocus); |
| 70 |
void DeleteSelectedItem(HWND hDlg); |
| 71 |
public: |
| 72 |
FilterDlgFilterTab(FilterDefDlg *pDlg) : pDialog(pDlg), |
| 73 |
PropertyTab(IDD_FILTERDEF_FILTER, MSG_FILTERDEFPROPTTL_FILTER, |
| 74 |
(DLGPROC)DefaultPageProc) {} |
| 75 |
|
| 76 |
void Init(HWND hDlg); |
| 77 |
BOOL Apply(HWND hDlg); |
| 78 |
void Cancel(HWND hDlg, WPARAM wParam, LPARAM lParam); |
| 79 |
BOOL OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam); |
| 80 |
BOOL OnNotify(HWND hDlg, WPARAM wParam, LPARAM lParam); |
| 81 |
|
| 82 |
BOOL Notify_Keydown(HWND hDlg, LPARAM lParam); |
| 83 |
BOOL Notify_ItemChanged(HWND hDlg, LPARAM lParam); |
| 84 |
BOOL Notify_DblClick(HWND hDlg, LPARAM lParam); |
| 85 |
BOOL Command_UpDown(HWND hDlg, int nDelta); |
| 86 |
BOOL Command_Regex(HWND hDlg); |
| 87 |
BOOL Command_Limit(HWND hDlg); |
| 88 |
BOOL Command_Timestamp(HWND hDlg); |
| 89 |
BOOL Command_Sort(HWND hDlg); |
| 90 |
BOOL Command_Delete(HWND hDlg); |
| 91 |
}; |
| 92 |
|
| 93 |
static DlgMsgRes aFilterRes[] = { |
| 94 |
{ IDC_FILTERDEF_FILTER_UP, MSG_ID_DLG_FILTERDEF_FILTER_UP }, |
| 95 |
{ IDC_FILTERDEF_FILTER_DOWN, MSG_ID_DLG_FILTERDEF_FILTER_DOWN }, |
| 96 |
{ IDC_FILTERDEF_FILTER_DELETE, MSG_ID_DLG_FILTERDEF_FILTER_DELETE }, |
| 97 |
{ IDC_FILTERDEF_FILTER_REGEX, MSG_ID_DLG_FILTERDEF_FILTER_FIND }, |
| 98 |
{ IDC_FILTERDEF_FILTER_LIMIT, MSG_ID_DLG_FILTERDEF_FILTER_NUMBER }, |
| 99 |
{ IDC_FILTERDEF_FILTER_TIMESTAMP, MSG_ID_DLG_FILTERDEF_FILTER_TIMESTAMP }, |
| 100 |
{ IDC_FILTERDEF_FILTER_SORT, MSG_ID_DLG_FILTERDEF_FILTER_SORT }, |
| 101 |
}; |
| 102 |
|
| 103 |
void FilterDlgFilterTab::Init(HWND hDlg) |
| 104 |
{ |
| 105 |
OverrideDlgMsg(hDlg, -1, aFilterRes, sizeof(aFilterRes)/sizeof(DlgMsgRes)); |
| 106 |
|
| 107 |
HWND hList = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_LIST); |
| 108 |
///////////////////////////////////////// |
| 109 |
// Insert column headers |
| 110 |
|
| 111 |
LV_COLUMN lvc; |
| 112 |
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT; |
| 113 |
lvc.fmt = LVCFMT_LEFT; |
| 114 |
|
| 115 |
lvc.cx = 100; |
| 116 |
lvc.pszText = (LPTSTR)MSG_FILTERDEFPROPTTL_FILTERTYPE_HDR; |
| 117 |
ListView_InsertColumn(hList, 0, &lvc); |
| 118 |
|
| 119 |
lvc.cx = 150; |
| 120 |
lvc.pszText = (LPTSTR)MSG_FILTERDEFPROPTTL_FILTERVAL_HDR; |
| 121 |
ListView_InsertColumn(hList, 1, &lvc); |
| 122 |
|
| 123 |
///////////////////////////////////////// |
| 124 |
// Create stream data |
| 125 |
|
| 126 |
DWORD i = 0; |
| 127 |
VFStream *p = pDialog->pInfo->pGenerator->GetNext(); |
| 128 |
|
| 129 |
// for exclude VFStore, loop condition is not "p". |
| 130 |
while(p->GetNext()) { |
| 131 |
InsertItem(hList, i, p, FALSE); |
| 132 |
i++; |
| 133 |
p = p->GetNext(); |
| 134 |
} |
| 135 |
|
| 136 |
///////////////////////////////////////// |
| 137 |
// Initialize buttons |
| 138 |
HWND hUp = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_UP); |
| 139 |
HWND hDown = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_DOWN); |
| 140 |
EnableWindow(hUp, FALSE); |
| 141 |
EnableWindow(hDown, FALSE); |
| 142 |
} |
| 143 |
|
| 144 |
BOOL FilterDlgFilterTab::Apply(HWND hDlg) |
| 145 |
{ |
| 146 |
HWND hList = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_LIST); |
| 147 |
VFInfo *pInfo = pDialog->pInfo; |
| 148 |
VFDirectoryGenerator *pGen = pInfo->pGenerator; |
| 149 |
VFStore *pStore = pInfo->pStore; |
| 150 |
|
| 151 |
int n = ListView_GetItemCount(hList); |
| 152 |
int i; |
| 153 |
LVITEM li; |
| 154 |
|
| 155 |
li.mask = LVIF_PARAM; |
| 156 |
li.iSubItem = 0; |
| 157 |
|
| 158 |
VFStream *pPrev = pGen; |
| 159 |
|
| 160 |
for (i = 0; i < n; i++) { |
| 161 |
li.iItem = i; |
| 162 |
ListView_GetItem(hList, &li); |
| 163 |
|
| 164 |
VFStream *p = (VFStream*)li.lParam; |
| 165 |
|
| 166 |
pPrev->SetNext(p); |
| 167 |
pPrev = p; |
| 168 |
} |
| 169 |
|
| 170 |
pPrev->SetNext(pStore); |
| 171 |
|
| 172 |
return TRUE; |
| 173 |
} |
| 174 |
|
| 175 |
void FilterDlgFilterTab::Cancel(HWND hDlg, WPARAM wParam, LPARAM lParam) |
| 176 |
{ |
| 177 |
Apply(hDlg); |
| 178 |
} |
| 179 |
|
| 180 |
BOOL FilterDlgFilterTab::InsertItem(HWND hList, DWORD iPos, VFStream *pStream, BOOL bFocus) |
| 181 |
{ |
| 182 |
LV_ITEM li; |
| 183 |
TString sValue; |
| 184 |
|
| 185 |
li.iItem = iPos; |
| 186 |
|
| 187 |
// type |
| 188 |
li.mask = LVIF_TEXT | LVIF_PARAM; |
| 189 |
li.pszText = (LPTSTR)pStream->GetFilterType(); |
| 190 |
li.cchTextMax = _tcslen(li.pszText); |
| 191 |
li.iSubItem = 0; |
| 192 |
li.lParam = (LPARAM)pStream; |
| 193 |
if (bFocus) { |
| 194 |
li.mask |= LVIF_STATE; |
| 195 |
li.state = li.stateMask = LVIS_FOCUSED | LVIS_SELECTED; |
| 196 |
} |
| 197 |
ListView_InsertItem(hList, &li); |
| 198 |
|
| 199 |
// value |
| 200 |
if (!pStream->ToString(&sValue)) return FALSE; |
| 201 |
|
| 202 |
li.mask = LVIF_TEXT; |
| 203 |
li.pszText = sValue.Get(); |
| 204 |
li.cchTextMax = _tcslen(li.pszText); |
| 205 |
li.iSubItem = 1; |
| 206 |
ListView_SetItem(hList, &li); |
| 207 |
return TRUE; |
| 208 |
} |
| 209 |
|
| 210 |
///////////////////////////////////////// |
| 211 |
// WM_COMMAND handler |
| 212 |
///////////////////////////////////////// |
| 213 |
|
| 214 |
BOOL FilterDlgFilterTab::OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) |
| 215 |
{ |
| 216 |
switch(LOWORD(wParam)) { |
| 217 |
case IDC_FILTERDEF_FILTER_UP: |
| 218 |
return Command_UpDown(hDlg, -1); |
| 219 |
case IDC_FILTERDEF_FILTER_DOWN: |
| 220 |
return Command_UpDown(hDlg, 1); |
| 221 |
case IDC_FILTERDEF_FILTER_REGEX: |
| 222 |
return Command_Regex(hDlg); |
| 223 |
case IDC_FILTERDEF_FILTER_LIMIT: |
| 224 |
return Command_Limit(hDlg); |
| 225 |
case IDC_FILTERDEF_FILTER_TIMESTAMP: |
| 226 |
return Command_Timestamp(hDlg); |
| 227 |
case IDC_FILTERDEF_FILTER_SORT: |
| 228 |
return Command_Sort(hDlg); |
| 229 |
case IDC_FILTERDEF_FILTER_DELETE: |
| 230 |
return Command_Delete(hDlg); |
| 231 |
} |
| 232 |
return TRUE; |
| 233 |
} |
| 234 |
|
| 235 |
BOOL FilterDlgFilterTab::Command_UpDown(HWND hDlg, int iDelta) |
| 236 |
{ |
| 237 |
HWND hList = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_LIST); |
| 238 |
int iSel = ListView_GetNextItem(hList, -1, LVNI_SELECTED); |
| 239 |
|
| 240 |
if (iSel < 0) return TRUE; |
| 241 |
|
| 242 |
LVITEM li; |
| 243 |
li.mask = LVIF_PARAM; |
| 244 |
li.iItem = iSel; |
| 245 |
li.iSubItem = 0; |
| 246 |
ListView_GetItem(hList, &li); |
| 247 |
|
| 248 |
VFStream *pStream = (VFStream*)li.lParam; |
| 249 |
|
| 250 |
ListView_DeleteItem(hList, iSel); |
| 251 |
|
| 252 |
InsertItem(hList, iSel + iDelta, pStream, TRUE); |
| 253 |
SetFocus(hList); |
| 254 |
return TRUE; |
| 255 |
} |
| 256 |
|
| 257 |
BOOL FilterDlgFilterTab::Command_Regex(HWND hDlg) |
| 258 |
{ |
| 259 |
RegexFilterAddDlg ad; |
| 260 |
if (!ad.Init()) { |
| 261 |
MessageBox(hDlg, MSG_DLG_INIT_FAIL, TOMBO_APP_NAME, MB_OK | MB_ICONERROR); |
| 262 |
return TRUE; |
| 263 |
} |
| 264 |
if (ad.Popup(g_hInstance, hDlg) == IDOK) { |
| 265 |
VFRegexFilter *pFilter = new VFRegexFilter(); |
| 266 |
if (pFilter == NULL) { |
| 267 |
MessageBox(hDlg, MSG_NOT_ENOUGH_MEMORY, TOMBO_APP_NAME, MB_OK | MB_ICONERROR); |
| 268 |
return TRUE; |
| 269 |
} |
| 270 |
|
| 271 |
if (!pFilter->Init(ad.GetMatchString()->Get(), |
| 272 |
ad.IsCaseSensitive(), ad.IsCheckEncrypt(), |
| 273 |
ad.IsCheckFileName(), ad.IsNegate(), g_pPasswordManager)) { |
| 274 |
MessageBox(hDlg, MSG_INVALID_REGEXP, TOMBO_APP_NAME, MB_OK | MB_ICONWARNING); |
| 275 |
return TRUE; |
| 276 |
} |
| 277 |
HWND hList = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_LIST); |
| 278 |
DWORD iPos = ListView_GetItemCount(hList); |
| 279 |
InsertItem(hList, iPos, pFilter, TRUE); |
| 280 |
} |
| 281 |
|
| 282 |
return TRUE; |
| 283 |
} |
| 284 |
|
| 285 |
BOOL FilterDlgFilterTab::Command_Limit(HWND hDlg) |
| 286 |
{ |
| 287 |
LimitFilterAddDlg ad; |
| 288 |
if (!ad.Init()) { |
| 289 |
MessageBox(hDlg, MSG_DLG_INIT_FAIL, TOMBO_APP_NAME, MB_OK | MB_ICONERROR); |
| 290 |
return TRUE; |
| 291 |
} |
| 292 |
if (ad.Popup(g_hInstance, hDlg) == IDOK) { |
| 293 |
VFLimitFilter *pFilter = new VFLimitFilter(); |
| 294 |
if (!pFilter || !pFilter->Init(ad.GetLimit())) { |
| 295 |
MessageBox(hDlg, MSG_NOT_ENOUGH_MEMORY, TOMBO_APP_NAME, MB_OK | MB_ICONERROR); |
| 296 |
return TRUE; |
| 297 |
} |
| 298 |
HWND hList = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_LIST); |
| 299 |
DWORD iPos = ListView_GetItemCount(hList); |
| 300 |
InsertItem(hList, iPos, pFilter, TRUE); |
| 301 |
} |
| 302 |
return TRUE; |
| 303 |
} |
| 304 |
|
| 305 |
BOOL FilterDlgFilterTab::Command_Timestamp(HWND hDlg) |
| 306 |
{ |
| 307 |
TimestampFilterAddDlg ad; |
| 308 |
if (!ad.Init()) { |
| 309 |
MessageBox(hDlg, MSG_DLG_INIT_FAIL, TOMBO_APP_NAME, MB_OK | MB_ICONERROR); |
| 310 |
return TRUE; |
| 311 |
} |
| 312 |
if (ad.Popup(g_hInstance, hDlg) == IDOK) { |
| 313 |
VFTimestampFilter *pFilter = new VFTimestampFilter(); |
| 314 |
if (!pFilter || !pFilter->Init(ad.GetDeltaDay(), ad.IsNewer())) { |
| 315 |
MessageBox(hDlg, MSG_NOT_ENOUGH_MEMORY, TOMBO_APP_NAME, MB_OK | MB_ICONERROR); |
| 316 |
return TRUE; |
| 317 |
} |
| 318 |
HWND hList = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_LIST); |
| 319 |
DWORD iPos = ListView_GetItemCount(hList); |
| 320 |
InsertItem(hList, iPos, pFilter, TRUE); |
| 321 |
} |
| 322 |
return TRUE; |
| 323 |
} |
| 324 |
|
| 325 |
BOOL FilterDlgFilterTab::Command_Sort(HWND hDlg) |
| 326 |
{ |
| 327 |
SortFilterAddDlg ad; |
| 328 |
if (!ad.Init()) { |
| 329 |
MessageBox(hDlg, MSG_DLG_INIT_FAIL, TOMBO_APP_NAME, MB_OK | MB_ICONERROR); |
| 330 |
return TRUE; |
| 331 |
} |
| 332 |
if (ad.Popup(g_hInstance, hDlg) == IDOK) { |
| 333 |
VFSortFilter *pFilter = new VFSortFilter(); |
| 334 |
if (!pFilter || !pFilter->Init(ad.GetType())) { |
| 335 |
MessageBox(hDlg, MSG_NOT_ENOUGH_MEMORY, TOMBO_APP_NAME, MB_OK | MB_ICONERROR); |
| 336 |
return TRUE; |
| 337 |
} |
| 338 |
HWND hList = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_LIST); |
| 339 |
DWORD iPos = ListView_GetItemCount(hList); |
| 340 |
InsertItem(hList, iPos, pFilter, TRUE); |
| 341 |
} |
| 342 |
return TRUE; |
| 343 |
} |
| 344 |
|
| 345 |
BOOL FilterDlgFilterTab::Command_Delete(HWND hDlg) |
| 346 |
{ |
| 347 |
DeleteSelectedItem(hDlg); |
| 348 |
return TRUE; |
| 349 |
} |
| 350 |
|
| 351 |
///////////////////////////////////////// |
| 352 |
// WM_NOTIFY handler |
| 353 |
///////////////////////////////////////// |
| 354 |
|
| 355 |
BOOL FilterDlgFilterTab::OnNotify(HWND hDlg, WPARAM wParam, LPARAM lParam) |
| 356 |
{ |
| 357 |
NMHDR *pHdr = (NMHDR*)lParam; |
| 358 |
if (pHdr->code == LVN_KEYDOWN) { |
| 359 |
return Notify_Keydown(hDlg, lParam); |
| 360 |
} |
| 361 |
if (pHdr->code == LVN_ITEMCHANGED) { |
| 362 |
return Notify_ItemChanged(hDlg, lParam); |
| 363 |
} |
| 364 |
if (pHdr->code == NM_DBLCLK && pHdr->idFrom == IDC_FILTERDEF_FILTER_LIST) { |
| 365 |
return Notify_DblClick(hDlg, lParam); |
| 366 |
} |
| 367 |
return FALSE; |
| 368 |
} |
| 369 |
|
| 370 |
BOOL FilterDlgFilterTab::Notify_Keydown(HWND hDlg, LPARAM lParam) |
| 371 |
{ |
| 372 |
NMHDR *pHdr = (NMHDR*)lParam; |
| 373 |
|
| 374 |
if (pHdr->idFrom != IDC_FILTERDEF_FILTER_LIST) return FALSE; |
| 375 |
if (pHdr->code != LVN_KEYDOWN) return FALSE; |
| 376 |
HWND hList = pHdr->hwndFrom; |
| 377 |
|
| 378 |
NMLVKEYDOWN *pKd = (NMLVKEYDOWN*)lParam; |
| 379 |
if (pKd->wVKey != VK_DELETE) return TRUE; |
| 380 |
|
| 381 |
DeleteSelectedItem(hDlg); |
| 382 |
return TRUE; |
| 383 |
} |
| 384 |
|
| 385 |
void FilterDlgFilterTab::DeleteSelectedItem(HWND hDlg) |
| 386 |
{ |
| 387 |
HWND hList = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_LIST); |
| 388 |
|
| 389 |
int iSel = ListView_GetNextItem(hList, -1, LVNI_SELECTED); |
| 390 |
if (iSel < 0 ) return; |
| 391 |
|
| 392 |
LV_ITEM li; |
| 393 |
li.mask = LVIF_PARAM; |
| 394 |
li.iItem = iSel; |
| 395 |
li.iSubItem = 0; |
| 396 |
ListView_GetItem(hList, &li); |
| 397 |
VFStream *p = (VFStream*)li.lParam; |
| 398 |
ListView_DeleteItem(hList, iSel); |
| 399 |
delete p; |
| 400 |
|
| 401 |
// select altanative item |
| 402 |
li.mask = LVIF_STATE; |
| 403 |
li.iItem = (iSel == 0) ? 0 : iSel - 1; |
| 404 |
li.state = li.stateMask = LVIS_FOCUSED | LVIS_SELECTED; |
| 405 |
ListView_SetItem(hList, &li); |
| 406 |
} |
| 407 |
|
| 408 |
BOOL FilterDlgFilterTab::Notify_ItemChanged(HWND hDlg, LPARAM lParam) |
| 409 |
{ |
| 410 |
NMHDR *pHdr = (NMHDR*)lParam; |
| 411 |
NMLISTVIEW *pLv = (NMLISTVIEW*)lParam; |
| 412 |
if (pLv->uNewState & LVIS_FOCUSED) { |
| 413 |
|
| 414 |
HWND hUp = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_UP); |
| 415 |
HWND hDown = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_DOWN); |
| 416 |
|
| 417 |
EnableWindow(hUp, pLv->iItem > 0); |
| 418 |
EnableWindow(hDown, pLv->iItem < ListView_GetItemCount(pHdr->hwndFrom) - 1); |
| 419 |
} |
| 420 |
return TRUE; |
| 421 |
} |
| 422 |
|
| 423 |
BOOL FilterDlgFilterTab::Notify_DblClick(HWND hDlg, LPARAM lParam) |
| 424 |
{ |
| 425 |
NMLISTVIEW* pLv = (NMLISTVIEW*)lParam; |
| 426 |
HWND hList = GetDlgItem(hDlg, IDC_FILTERDEF_FILTER_LIST); |
| 427 |
|
| 428 |
int iSel = ListView_GetNextItem(hList, -1, LVNI_SELECTED); |
| 429 |
if (iSel < 0 ) return TRUE; |
| 430 |
|
| 431 |
LVITEM li; |
| 432 |
li.mask = LVIF_PARAM; |
| 433 |
li.iItem = iSel; |
| 434 |
li.iSubItem = 0; |
| 435 |
ListView_GetItem(hList, &li); |
| 436 |
|
| 437 |
VFStream *pStream = (VFStream*)li.lParam; |
| 438 |
if (pStream->UpdateParamWithDialog(g_hInstance, hDlg)) { |
| 439 |
// update value |
| 440 |
TString sValue; |
| 441 |
if (!pStream->ToString(&sValue)) return FALSE; |
| 442 |
|
| 443 |
li.mask = LVIF_TEXT; |
| 444 |
li.pszText= sValue.Get(); |
| 445 |
li.cchTextMax = _tcslen(li.pszText); |
| 446 |
li.iItem = iSel; |
| 447 |
li.iSubItem = 1; |
| 448 |
ListView_SetItem(hList, &li); |
| 449 |
|
| 450 |
} |
| 451 |
return TRUE; |
| 452 |
} |
| 453 |
|
| 454 |
///////////////////////////////////////// |
| 455 |
// ViewType tab |
| 456 |
///////////////////////////////////////// |
| 457 |
#ifdef COMMENT |
| 458 |
class FilterDlgViewTypeTab : public PropertyTab { |
| 459 |
FilterDefDlg *pDialog; |
| 460 |
public: |
| 461 |
FilterDlgViewTypeTab(FilterDefDlg *pDlg) : pDialog(pDlg), |
| 462 |
PropertyTab(IDD_FILTERDEF_VIEWTYPE, MSG_FILTERDEFPROPTTL_SRC, |
| 463 |
(DLGPROC)DefaultPageProc) {} |
| 464 |
|
| 465 |
void Init(HWND hDlg); |
| 466 |
BOOL Apply(HWND hDlg); |
| 467 |
}; |
| 468 |
|
| 469 |
void FilterDlgViewTypeTab::Init(HWND hDlg) |
| 470 |
{ |
| 471 |
HWND hViewType = GetDlgItem(hDlg, IDC_FILTERDEF_VIEW_TYPE); |
| 472 |
SendMessage(hViewType, CB_ADDSTRING, 0, (LPARAM)MSG_FILTEDEF_VIEW_TYPE_DEFAULT); |
| 473 |
SendMessage(hViewType, CB_ADDSTRING, 0, (LPARAM)MSG_FILTEDEF_VIEW_TYPE_PREV); |
| 474 |
SendMessage(hViewType, CB_ADDSTRING, 0, (LPARAM)MSG_FILTEDEF_VIEW_TYPE_POST); |
| 475 |
SendMessage(hViewType, CB_SETCURSEL, pDialog->pInfo->nViewType, 0); |
| 476 |
|
| 477 |
} |
| 478 |
|
| 479 |
BOOL FilterDlgViewTypeTab::Apply(HWND hDlg) |
| 480 |
{ |
| 481 |
HWND hViewType = GetDlgItem(hDlg, IDC_FILTERDEF_VIEW_TYPE); |
| 482 |
pDialog->pInfo->nViewType = SendMessage(hViewType, CB_GETCURSEL, 0, 0); |
| 483 |
return TRUE; |
| 484 |
} |
| 485 |
#endif |
| 486 |
///////////////////////////////////////// |
| 487 |
// Dialog popup |
| 488 |
///////////////////////////////////////// |
| 489 |
|
| 490 |
DWORD FilterDefDlg::Popup(HINSTANCE hInst, HWND hParent, VFInfo *pi, BOOL bNew) |
| 491 |
{ |
| 492 |
PropertyTab *pages[NUM_TAB_FILTERCTL]; |
| 493 |
FilterDlgSrcTab pgSrc(this); |
| 494 |
FilterDlgFilterTab pgFilter(this); |
| 495 |
// FilterDlgViewTypeTab pgViewType(this); |
| 496 |
|
| 497 |
pages[0] = &pgSrc; |
| 498 |
pages[1] = &pgFilter; |
| 499 |
// pages[2] = &pgViewType; |
| 500 |
|
| 501 |
pInfo = pi; |
| 502 |
|
| 503 |
// DWORD nStartPage = bNew ? 0 : 1; |
| 504 |
DWORD nStartPage = 1; |
| 505 |
PropertyPage pp; |
| 506 |
DWORD res = pp.Popup(hInst, hParent, pages, NUM_TAB_FILTERCTL, MSG_FILTERDEFDLG_TTL, MAKEINTRESOURCE(IDI_TOMBO), nStartPage); |
| 507 |
return res; |
| 508 |
} |
| 509 |
|