ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/proj/trunk/VTBFileUtil2/ScanUtility.cxx
(Generate patch)

Comparing trunk/VTBFileUtil2/ScanUtility.cxx (file contents):
Revision 273 by douglas, 2003-08-20T23:29:24-07:00 vs.
Revision 274 by douglas, 2003-08-21T23:30:14-07:00

# Line 2 | Line 2
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  
# Line 14 | Line 14 | ScanUtility::ScanUtility()
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]);
# Line 40 | Line 43 | ScanUtility::ScanUtility()
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  
# Line 61 | Line 78 | void ScanUtility::run(void)
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);
# Line 378 | Line 395 | void ScanUtility::populate(HWND parent)
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();
# Line 394 | Line 409 | void ScanUtility::populate(HWND parent)
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  
# Line 405 | Line 418 | void ScanUtility::populate(HWND parent)
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  
# Line 460 | Line 476 | INT_PTR ScanUtility::start(HWND dialog,
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 =
# Line 470 | Line 487 | INT_PTR ScanUtility::start(HWND dialog,
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());
# Line 546 | Line 563 | INT_PTR ScanUtility::select(HWND dialog,
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;
# Line 560 | Line 584 | INT_PTR ScanUtility::select(HWND dialog,
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                  }
# Line 579 | Line 629 | INT_PTR ScanUtility::select(HWND dialog,
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                  }
# Line 598 | Line 661 | INT_PTR ScanUtility::select(HWND dialog,
661  
662          return FALSE;
663   }
664 +
665 + INT_PTR ScanUtility::enter(HWND dialog, UINT msg, WPARAM w, LPARAM l)
666 + {
667 +        return FALSE;
668 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines