2 |
|
// |
3 |
|
// Douglas Thrift |
4 |
|
// |
5 |
< |
// $Id: ScanUtility.cxx,v 1.6 2003/08/21 06:29:24 douglas Exp $ |
5 |
> |
// $Id: ScanUtility.cxx,v 1.7 2003/08/22 06:30:14 douglas Exp $ |
6 |
|
|
7 |
|
#include "ScanUtility.h" |
8 |
|
|
14 |
|
|
15 |
|
sprintf(title, "%s - Scan Utility", programName.c_str()); |
16 |
|
loadDirs(); |
17 |
+ |
|
18 |
+ |
menu = LoadMenu(gui.instance, MAKEINTRESOURCE(IDR_SELECT)); |
19 |
+ |
popup = GetSubMenu(menu, 0); |
20 |
|
|
21 |
|
// start |
22 |
|
wizard[0].dwSize = sizeof(wizard[0]); |
43 |
|
wizard[1].lParam = number; |
44 |
|
wizard[1].pszHeaderTitle = "Select"; |
45 |
|
wizard[1].pszHeaderSubTitle = "Choose the scanned document to save."; |
46 |
+ |
|
47 |
+ |
// enter |
48 |
+ |
wizard[2].dwSize = sizeof(wizard[2]); |
49 |
+ |
wizard[2].dwFlags = PSP_DEFAULT | PSP_USEHICON | PSP_USETITLE | |
50 |
+ |
PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; |
51 |
+ |
wizard[2].hInstance = gui.instance; |
52 |
+ |
wizard[2].pszTemplate = MAKEINTRESOURCE(IDD_ENTER); |
53 |
+ |
wizard[2].hIcon = gui.icon; |
54 |
+ |
wizard[2].pszTitle = title; |
55 |
+ |
wizard[2].pfnDlgProc = enter; |
56 |
+ |
wizard[2].pszHeaderTitle = "Enter"; |
57 |
+ |
wizard[2].pszHeaderSubTitle = "Input the client information."; |
58 |
|
} |
59 |
|
|
60 |
|
ScanUtility::~ScanUtility() |
61 |
|
{ |
62 |
+ |
DestroyMenu(popup); |
63 |
+ |
DestroyMenu(menu); |
64 |
|
utilities.erase(number); |
65 |
|
saveDirs(); |
66 |
|
|
78 |
|
header.hwndParent = NULL; |
79 |
|
header.hInstance = gui.instance; |
80 |
|
header.pszIcon = MAKEINTRESOURCE(IDI_VTB_ICON); |
81 |
< |
header.nPages = 2; |
81 |
> |
header.nPages = 3; |
82 |
|
header.nStartPage = 0; |
83 |
|
header.ppsp = wizard; |
84 |
|
header.pszbmHeader = MAKEINTRESOURCE(IDB_VTB_BMP); |
395 |
|
ListView_SetImageList(GetDlgItem(parent, IDC_SELECT_SCANS), icons, |
396 |
|
LVSIL_SMALL); |
397 |
|
|
381 |
– |
int index = 0; |
382 |
– |
|
398 |
|
if (debug) cerr << "scans = {\n"; |
399 |
|
|
400 |
|
for (set<string>::iterator itor = scans.begin(); itor != scans.end(); |
409 |
|
LVITEM item; |
410 |
|
|
411 |
|
item.mask = LVIF_IMAGE | LVIF_TEXT; |
412 |
< |
item.iItem = index++; |
412 |
> |
item.iItem = 0; |
413 |
|
item.iSubItem = 0; |
399 |
– |
item.state = LVIS_SELECTED; |
400 |
– |
item.stateMask = LVIS_SELECTED; |
414 |
|
item.pszText = scan; |
415 |
|
item.iImage = info.iIcon; |
416 |
|
|
418 |
|
} |
419 |
|
|
420 |
|
if (debug) cerr << "}\n"; |
421 |
+ |
|
422 |
+ |
ListView_SetItemState(GetDlgItem(parent, IDC_SELECT_SCANS), 0, |
423 |
+ |
LVIS_SELECTED, LVIS_SELECTED); |
424 |
|
} |
425 |
|
} |
426 |
|
|
476 |
|
{ |
477 |
|
case WM_INITDIALOG: |
478 |
|
center(GetParent(dialog)); |
479 |
+ |
SendMessage(GetParent(dialog), WM_SETICON, ICON_BIG, LPARAM(gui.icon)); |
480 |
|
{ |
481 |
|
LPPROPSHEETPAGE page = LPPROPSHEETPAGE(l); |
482 |
|
map<unsigned, ScanUtility*>::iterator itor = |
487 |
|
{ |
488 |
|
ostringstream instructions; |
489 |
|
|
490 |
< |
instructions << "1.\tIf you need instructions, you should not be r" |
491 |
< |
<< "unning this program\n\tin Scan Utility mode.\n" |
492 |
< |
<< "2.\tOtherwise, go forth and scan.\n" |
493 |
< |
<< "3.\tThen come back and click Next.\n"; |
490 |
> |
instructions << "1. If you need instructions, you should not be ru" |
491 |
> |
<< "nning this program in Scan Utility mode.\n" |
492 |
> |
<< "2. Otherwise, go forth and scan.\n" |
493 |
> |
<< "3. Then come back and click Next.\n"; |
494 |
|
|
495 |
|
SetDlgItemText(dialog, IDC_START_INSTRUCTIONS, |
496 |
|
instructions.str().c_str()); |
563 |
|
windows.insert(pair<HWND, ScanUtility*>(dialog, itor->second)); |
564 |
|
} |
565 |
|
{ |
566 |
+ |
ostringstream select; |
567 |
+ |
|
568 |
+ |
select << "Select the scanned document that you need to be save."; |
569 |
+ |
|
570 |
+ |
SetDlgItemText(dialog, IDC_SELECT_TEXT, select.str().c_str()); |
571 |
+ |
} |
572 |
+ |
{ |
573 |
|
LVCOLUMN column; |
574 |
|
|
575 |
|
column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; |
584 |
|
case WM_NOTIFY: |
585 |
|
if (w == IDC_SELECT_SCANS) |
586 |
|
{ |
587 |
< |
switch (ListView_GetSelectedCount(GetDlgItem(dialog, |
588 |
< |
IDC_SELECT_SCANS))) |
587 |
> |
LPNMITEMACTIVATE ni = LPNMITEMACTIVATE(l); |
588 |
> |
|
589 |
> |
switch (ni->hdr.code) |
590 |
|
{ |
591 |
< |
case 1: |
592 |
< |
PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK | |
593 |
< |
PSWIZB_NEXT); |
591 |
> |
case NM_RCLICK: |
592 |
> |
{ |
593 |
> |
char scan[MAX_PATH]; |
594 |
> |
|
595 |
> |
ListView_GetItemText(GetDlgItem(dialog, IDC_SELECT_SCANS), |
596 |
> |
ni->iItem, 0, scan, MAX_PATH); |
597 |
> |
|
598 |
> |
SHELLEXECUTEINFO info; |
599 |
> |
|
600 |
> |
info.cbSize = sizeof(info); |
601 |
> |
info.fMask = SEE_MASK_INVOKEIDLIST; |
602 |
> |
info.hwnd = dialog; |
603 |
> |
info.lpVerb = "properties"; |
604 |
> |
info.lpFile = scan; |
605 |
> |
info.lpParameters = NULL; |
606 |
> |
info.lpDirectory = NULL; |
607 |
> |
info.nShow = SW_SHOWDEFAULT; |
608 |
> |
info.lpIDList = NULL; |
609 |
> |
|
610 |
> |
ShellExecuteEx(&info); |
611 |
> |
} |
612 |
|
break; |
613 |
< |
default: |
614 |
< |
PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK); |
613 |
> |
case NM_DBLCLK: |
614 |
> |
{ |
615 |
> |
char scan[MAX_PATH]; |
616 |
> |
|
617 |
> |
ListView_GetItemText(GetDlgItem(dialog, IDC_SELECT_SCANS), |
618 |
> |
ni->iItem, 0, scan, MAX_PATH); |
619 |
> |
ShellExecute(dialog, NULL, scan, NULL, NULL, |
620 |
> |
SW_SHOWDEFAULT); |
621 |
> |
} |
622 |
|
break; |
623 |
|
} |
624 |
|
} |
629 |
|
switch (nm->code) |
630 |
|
{ |
631 |
|
case PSN_SETACTIVE: |
632 |
< |
PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK); |
632 |
> |
PropSheet_SetWizButtons(GetParent(dialog), PSWIZB_BACK | |
633 |
> |
PSWIZB_NEXT); |
634 |
|
data->populate(dialog); |
635 |
|
break; |
636 |
|
case PSN_WIZBACK: |
637 |
|
ListView_DeleteAllItems(GetDlgItem(dialog, IDC_SELECT_SCANS)); |
638 |
|
break; |
639 |
|
case PSN_WIZNEXT: |
640 |
< |
// |
640 |
> |
{ |
641 |
> |
int index = ListView_GetNextItem(GetDlgItem(dialog, |
642 |
> |
IDC_SELECT_SCANS), -1, LVNI_SELECTED); |
643 |
> |
char scan[MAX_PATH]; |
644 |
> |
|
645 |
> |
ListView_GetItemText(GetDlgItem(dialog, IDC_SELECT_SCANS), |
646 |
> |
index, 0, scan, MAX_PATH); |
647 |
> |
|
648 |
> |
data->scan = scan; |
649 |
> |
} |
650 |
|
ListView_DeleteAllItems(GetDlgItem(dialog, IDC_SELECT_SCANS)); |
651 |
+ |
if (debug) cerr << "scan = " << data->scan << "\n"; |
652 |
+ |
ShellExecute(dialog, NULL, data->scan.c_str(), NULL, NULL, |
653 |
+ |
SW_SHOWDEFAULT); |
654 |
|
break; |
655 |
|
} |
656 |
|
} |
661 |
|
|
662 |
|
return FALSE; |
663 |
|
} |
664 |
+ |
|
665 |
+ |
INT_PTR ScanUtility::enter(HWND dialog, UINT msg, WPARAM w, LPARAM l) |
666 |
+ |
{ |
667 |
+ |
return FALSE; |
668 |
+ |
} |