Falcon64  V10R1
CImageLoader Class Reference

Class to handle keeping track of images that are extracted from source files and copied to the batch image collection folder. More...

#include <ImageLoader.h>

Inheritance diagram for CImageLoader:
[legend]
Collaboration diagram for CImageLoader:
[legend]

Public Member Functions

 CImageLoader (CWnd *pGenericModelessDialog)
 
 ~CImageLoader ()
 
void AttachDialog (CWnd *pGenericModelessDialog)
 Attach a dialog to the loader. More...
 
void Checkpoint2ILF ()
 Writes out the state variables to the ILF control record. More...
 
void Commit2ILF (BOOL bSave)
 Writes out the state variables to the commit variables in the ILF control record. Should be called at batch save time, only. More...
 
void DeleteImageCollection ()
 Delete all files in the designated batch image collection directory. More...
 
BOOL DisplayCollectionImage (long lFile, int iPage, BOOL bDisplayNow=TRUE)
 Open and display an image in the collection directory. More...
 
BOOL DisplayImage ()
 Display image defined by m_lFileCurrent and m_lPageCurrent. More...
 
BOOL EnterPageDisplayNext ()
 Current batch page written to queue. Commit page variables to ILF and fetch next image. More...
 
BOOL FindNextSerialNumber ()
 Find the highest file serial number in the collection and assign that number plus 1. More...
 
BOOL FtFromIlf (long lFile, BOOL bSerialize=TRUE, BOOL bIsStagingDirectory=FALSE)
 Initialize uninitialized new file tracker records from an allocated and filled in TControlILF and a file list. More...
 
BOOL GetImageInfo (CString &sReport, BOOL bIgnoreEOF=FALSE)
 Return an image information and statistics report formatted for display in a control with embedded CRLF. More...
 
BOOL IsSetFT (int iFile, int iPage)
 Check if the specific image in the file has been converted according to the tracker. More...
 
BOOL ListFirst ()
 Load first image from the first file in the list. More...
 
BOOL ListLast ()
 Load the first image from the last file in the list. More...
 
BOOL MakeReadyILF ()
 Using the current batch, load ILF and make ready for data entry. More...
 
BOOL NewFTListFromOpenDialog (char *&pszError, BOOL bMultiselect=TRUE)
 Create a new FT list using an open dialog. More...
 
BOOL NewFTListFromStagingDirectory (char *&pszError)
 Create a new FT list by using a directory list of the folder set as a staging directory in the imaging engine. Also displays current image. More...
 
BOOL NewILFFromStagingDirectory (char *&pszError)
 Create a new ILF with FT list from the staging directory. More...
 
BOOL NextFile ()
 Load first image of the next file in the list. More...
 
BOOL NextList ()
 Load and display next image in list. More...
 
BOOL PrevFile ()
 Load the first image of the previous file in the list. More...
 
BOOL PrevList ()
 Load and display previous image in list. More...
 
BOOL SameList ()
 Load and display the same image as last displayed. More...
 
BOOL SendHdibToViewer ()
 Takes the loaded HDIB and sends it to the viewer. More...
 
void SetFT (int iFile, int iPage)
 Set a particular image page in a file as converted. More...
 
void UpdateDirtyImageOnDisk ()
 If the image has been changed, update the image on disk. More...
 

Static Public Member Functions

static BOOL IsStagedFileExtension (const char *pszPath)
 Checks for a staged file with a .000 to .999 file extension. More...
 

Public Attributes

BOOL m_bBOF
 Last operation tried to read before the first image in the list. More...
 
BOOL m_bClearIfNoImage
 If at EOF, clear image instead of displaying it. This simulates hitting EOF while doing KFI. More...
 
BOOL m_bDisplayImageOnSeek
 If set to TRUE, the "list" API will call DisplayImage. Otherwise, these routines will just set up to call DisplayImage. More...
 
BOOL m_bEOF
 Last operation passed the last image (last file/last page) in the list. More...
 
BOOL m_bLoadDirectPerformed
 Set to TRUE if an image was loaded directly via file and page number (e.g., using the image coordinates in the record appendage). More...
 
BOOL m_bWrapFetch
 If set, allow next to wrap to first and prev to wrap from first to last. If FALSE, clear the image display. More...
 
long m_lFileCollection
 Last loaded collection file image. Invalidate if -1. Invalidated by non-collection load. More...
 
long m_lFileCount
 Count of files in the file tracker. More...
 
long m_lFileCurrent
 The file being tracked. -1 if no file assigned. More...
 
long m_lNextSerial
 Next serial number to be used for a fresh image. More...
 
long m_lPageCollection
 Last loaded collection file image. Invalidate if -1. Invalidated by non-collection load. More...
 
long m_lPageCurrent
 The page being displayed. -1 if no current page. More...
 
TFileTrackerm_pft
 A content-sized array for file tracker sturctures. More...
 
CGenericModelessDialogm_pgmdImageDisplayDialog
 Pointer to the dialog displaying the images. More...
 
CWnd * m_pWndPopup
 Pointer to parent window for pop-ups. More...
 
CString m_sUseInsteadOfOpenFileDialog
 Use this path for an auto-open of a file for NewFTListFromOpenDialog. More...
 
TImageLoadUp m_tImageLoadUp
 Immediate image source of last loaded image. More...
 
UINT m_uiOpenDialogResult
 An MBxxx result after a NewFTListFromOpenDialog or CImageTracker::GetNewFileList. All other times, consider it undefined. More...
 

Detailed Description

Class to handle keeping track of images that are extracted from source files and copied to the batch image collection folder.

Definition at line 28 of file ImageLoader.h.

Constructor & Destructor Documentation

CImageLoader::CImageLoader ( CWnd *  pGenericModelessDialog)

Definition at line 33 of file ImageLoader.cpp.

References AttachDialog(), FALSE, ILUP_NONE, m_bBOF, m_bClearIfNoImage, m_bDisplayImageOnSeek, m_bEOF, m_bLoadDirectPerformed, m_bWrapFetch, m_lFileCollection, m_lFileCount, m_lFileCurrent, m_lNextSerial, m_lPageCollection, m_lPageCurrent, m_pft, m_tImageLoadUp, and TRUE.

Here is the call graph for this function:

CImageLoader::~CImageLoader ( )

Definition at line 52 of file ImageLoader.cpp.

References CIlfIo::Deallocate(), m_bEOF, m_pft, and CIlfIo::ms_pcAllocation.

Here is the call graph for this function:

Member Function Documentation

void CImageLoader::AttachDialog ( CWnd *  pGenericModelessDialog)

Attach a dialog to the loader.

Use once the KS or ZD is created to allow ILF access.

Parameters
[in]pGenericModelessDialog- Dialog to use for processing and popup. Set to NULL to detach.

Definition at line 75 of file ImageLoader.cpp.

References m_pgmdImageDisplayDialog, m_pWndPopup, and CIlfIo::ms_pWndPopup.

Referenced by CImageLoader(), CFalcon32AddOn::KSClose(), CFalcon32AddOn::KSShowWindow(), CFalcon32AddOn::ZDClose(), and CFalcon32AddOn::ZDShowWindow().

Here is the caller graph for this function:

void CImageLoader::Checkpoint2ILF ( )

Writes out the state variables to the ILF control record.

Checkpoints the change to the change to the ILF.

Should succeed, but gives no error reportin.

Definition at line 143 of file ImageLoader.cpp.

References ctl, TYPE_ILF_CONTROL::lFileCurrent, TYPE_ILF_CONTROL::lNextSerial, TYPE_ILF_CONTROL::lPageCurrent, m_lFileCurrent, m_lNextSerial, m_lPageCurrent, CIlfIo::ms_iIndexDisplayedILF, CIlfIo::ms_pcAllocation, CIlfIo::ms_pCtl, and CIlfIo::PageCommit().

Referenced by EnterPageDisplayNext(), and CFalcon32AddOn::ScanMatchOrLoad().

Here is the call graph for this function:

Here is the caller graph for this function:

void CImageLoader::Commit2ILF ( BOOL  bSave)

Writes out the state variables to the commit variables in the ILF control record. Should be called at batch save time, only.

Commits the final session state variables to the ILF.

Parameters
[in]bSave- Indicate whether the batch is being saved.
Usage:
Call at batch save time. Do not call if cancelling the batch.

Definition at line 166 of file ImageLoader.cpp.

References CIlfIo::BatchCommit(), ctl, TYPE_ILF_CONTROL::ILF_SAFE_SHUTDOWN, TYPE_ILF_CONTROL::lFileCurrent, TYPE_ILF_CONTROL::lFileCurrentCommit, TYPE_ILF_CONTROL::lNextSerial, TYPE_ILF_CONTROL::lPageCurrent, TYPE_ILF_CONTROL::lPageCurrentCommit, m_lFileCurrent, m_lNextSerial, m_lPageCurrent, CIlfIo::ms_pcAllocation, and CIlfIo::ms_pCtl.

Referenced by CImageTracker::CloseAndCancel(), and CImageTracker::CloseAndSave().

Here is the call graph for this function:

Here is the caller graph for this function:

void CImageLoader::DeleteImageCollection ( )

Delete all files in the designated batch image collection directory.

Definition at line 1468 of file ImageLoader.cpp.

References BOOL, FALSE, g_pCImagingEngine, and CImagingState::GetImageCollectionDirectory().

Referenced by CTestDialog::OnBnClickedButtonCleanTest().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::DisplayCollectionImage ( long  lFile,
int  iPage,
BOOL  bDisplayNow = TRUE 
)

Open and display an image in the collection directory.

Read an image from the collection and optionally place it in the viewer.

Note
This routine does not use the FT list. It sets a flag to allow reloading an image where code assumes the last FT image was shown. The variables m_lFileCurrent and m_lPageCurrent are not modified, making this safe for paging use.
Usage:
Uses SendHDIBToViewer to display. If not displaying, caller must use this routine before doing any other FT list actions.
Return values
TRUE- Success.
FALSE- Failed to load or display the image (as applicable). Check the imaging engine m_szError for more information.
Parameters
lFile- A value between 1 and 9999 specifying the file serial number.
iPage- A value between 0 and 255 specifying the page of the image in the file.
bDisplayNow- Use to override, if TRUE (default) the current m_bDisplayImageOnSeek setting for just this call.

Definition at line 998 of file ImageLoader.cpp.

References BOOL, CImagingEngine::Decode(), FALSE, g_pCImagingEngine, CImagingEngine::GetF3TPathToImageCollectionDirectory(), CImagingEngine::GetFalcon32TIFFInfo(), ILUP_COLLECTION, ILUP_NONE, CImageInfo::lCountPages, m_bDisplayImageOnSeek, m_bLoadDirectPerformed, m_lFileCollection, m_lPageCollection, CImagingEngine::m_szError, m_tImageLoadUp, SendHdibToViewer(), TRUE, and UpdateDirtyImageOnDisk().

Referenced by CFormatImageDisplayDialog::OnBnClickedButtonDeleteSample(), CFormatImageDisplayDialog::OnBnClickedButtonNextSample(), CFakeBatchModelessDialog::OnBnClickedButtonReopen(), CFalcon32AddOn::OnPagingDisplayInitialScan(), CFalcon32AddOn::OnRecvVerifyModeTop(), and CFormatImageDisplayDialog::StartSession().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::DisplayImage ( )

Display image defined by m_lFileCurrent and m_lPageCurrent.

Read an image and place it in the viewer.

Coordinates copying staged files to collection. Decodes and creates files in the collection from source image files.

Note
This routine uses an FT list. File requests that don't use an FT must do the work manually.
Usage:
Set m_lFileCurrent and m_lPageCurrent and call this function. The function will clear the image in the viewer if at EOF/BOF, wrapping is off, and viewer clearing is on. Uses SendHDIBToViewer to do display.
Return values
TRUE- Success.
FALSE- Failed to load the image. Except for m_pft set to NULL, check the imaging engine m_szError for more information.

Definition at line 851 of file ImageLoader.cpp.

References BOOL, CImagingEngine::CopyStagedFileToBatchImageCollection(), CRYPTWITH_NONE, ctl, CImagingEngine::Decode(), CImageInfo::eCryptWith, CGenericModelessDialog::ExternalClearHDIB(), FALSE, CImageInfo::fEncrypted, T_FILETRACKER::fIsStagingDirectory, g_pCImagingEngine, CImagingEngine::GetF3TPathToImageCollectionDirectory(), CImagingEngine::GetFalcon32TIFFInfo(), CIlfIo::GetFullPath(), ILUP_COLLECTION, ILUP_NONE, ILUP_RAW, ILUP_STAGING, IsSetFT(), T_FILETRACKER::lCountPages, CImageInfo::lCountPages, T_FILETRACKER::lSerial, m_bClearIfNoImage, m_bEOF, m_bWrapFetch, m_lFileCollection, m_lFileCount, m_lFileCurrent, m_lPageCollection, m_lPageCurrent, m_pft, m_pgmdImageDisplayDialog, CImagingEngine::m_szError, m_tImageLoadUp, CIlfIo::ms_pcAllocation, CIlfIo::ms_pCtl, CImagingEngine::OpenUnconvertedImage(), CImagingEngine::OutputFalcon32TIFF(), CImagingEngine::SAVETO_IMAGECOLLECTION, SendHdibToViewer(), CImagingEngine::SetOcrControlData(), CImagingEngine::SetOcrData(), TRUE, and UpdateDirtyImageOnDisk().

Referenced by CImageTracker::DisplayGet(), CImageTracker::GetNextImageDoc(), ListFirst(), ListLast(), MakeReadyILF(), NewFTListFromOpenDialog(), NewFTListFromStagingDirectory(), NextFile(), NextList(), PrevFile(), PrevList(), and SameList().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::EnterPageDisplayNext ( )

Current batch page written to queue. Commit page variables to ILF and fetch next image.

Usage:
Call after displaying an image after queue is output. Image will be ready after this call completes successfully. Restartability such that the image displayed after this call completes will be achieved.
Return values
TRUE- An image has been loaded.
FALSE- No image is loaded, or image failed to load.

Definition at line 1501 of file ImageLoader.cpp.

References BOOL, Checkpoint2ILF(), FALSE, CIlfIo::ms_pcAllocation, and NextList().

Referenced by CImageTracker::CommitImageForCommittedBatchPage().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::FindNextSerialNumber ( )

Find the highest file serial number in the collection and assign that number plus 1.

Read the collection directory.

Find the highest serial number. Assign found + 1. MINIMUM is 0001.

Note
The likelihood of leaving enough spaces in the sequence to hit 9999 is poor. Most batch will have no more than a few hundred, and those will probably be fully entered. Even if a few sets are started and rejected, it won't add up to much.
Return values
TRUE- Value assigned.
FALSE- The count of 9999 exceeded! (Not bloody likely.)

Definition at line 197 of file ImageLoader.cpp.

References BOOL, FALSE, g_pCImagingEngine, CImagingState::GetImageCollectionDirectory(), m_lNextSerial, and TRUE.

Referenced by FtFromIlf(), NewFTListFromOpenDialog(), NewILFFromStagingDirectory(), and CFakeBatchModelessDialog::OnBnClickedOpenImage().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::FtFromIlf ( long  lFile,
BOOL  bSerialize = TRUE,
BOOL  bIsStagingDirectory = FALSE 
)

Initialize uninitialized new file tracker records from an allocated and filled in TControlILF and a file list.

Note
The first image is not displayed.
Parameters
[in]lFile- The number of the file in the list that is current.
[in]bSerialize- Assign serial numbers a newly created file tracker array. When copying an existing ILF into memory, this should be FALSE.
[in]bIsStagingDirectory- Default FALSE. Set to TRUE to specify that the directory in the ctl contains staged files (even if different than the system staging directory).
Usage:
Caller MUST have set the image collection directory.
Usage:
Caller MUST have set the staging directory.
Usage:
m_lPageCurrent needs to be set when an actual page number is known (when updating an existing batch). This is set to 0, here.
Usage:
The ILF must be allocated in memory, the TControlILF filled in and the file list in place.
Return values
TRUE- The file tracker is properly set up.
FALSE- A problem occurred and the file tracker array is not setup properly. Verify image collection and staging paths.

Definition at line 710 of file ImageLoader.cpp.

References BatchDirectory(), bch, T_FILETRACKER::ctl, ctl, FALSE, FindNextSerialNumber(), T_FILETRACKER::fIsStagingDirectory, FT_EYECATCHER, g_pCImagingEngine, i, TYPE_ILF_CONTROL::iCount, T_FILETRACKER::lSerial, m_bBOF, m_bEOF, m_lFileCount, m_lFileCurrent, m_lNextSerial, m_lPageCurrent, m_pft, CImageDisplayDialog::MakeStagingPath(), CIlfIo::ms_pcAllocation, CIlfIo::ms_pCtl, CIlfIo::ms_pFT, CImagingEngine::SetImageCollectionDirectory(), CImagingEngine::SetStagingDirectory(), TYPE_ILF_CONTROL::szPath, and TRUE.

Referenced by CIlfIo::BuildILF().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::GetImageInfo ( CString &  sReport,
BOOL  bIgnoreEOF = FALSE 
)

Return an image information and statistics report formatted for display in a control with embedded CRLF.

Return values
TRUE- Successfully formatted the report.
FALSE- Failed to get the report. Error in the report variable.
Parameters
[in]bIgnoreEOF- Default FALSE. Set TRUE to ignore the value of m_bEOF (to properly handle paging, verify mode images).
[out]sReport- CString reference that will receive the report or error message.

Definition at line 1082 of file ImageLoader.cpp.

References BOOL, CImageInfo::cbaData, CImageInfo::cbaTime, CImageInfo::cbOper, CRYPTWITH_NONE, CImageInfo::eCryptWith, FALSE, CImageInfo::fEncrypted, CImageInfo::ftWrite, g_pCImagingEngine, CImagingState::GetBmp(), CImagingEngine::GetEncryptionTypeString(), CImagingEngine::GetImageInfo(), CImagingEngine::GetOriginalPathLastConverted(), ILUP_COLLECTION, ILUP_RAW, ILUP_STAGING, CImageInfo::lBatchImageCollectionSerial, CImageInfo::lBitsPerPixel, CImageInfo::lCountPages, CImageInfo::lHeight, CImageInfo::lPage, CImageInfo::lResX, CImageInfo::lResY, CImageInfo::lTimeBitonal, CImageInfo::lTimeDecrypt, CImageInfo::lTimeEncrypt, CImageInfo::lTimeFalcon32Load, CImageInfo::lTimeGrey, CImageInfo::lTimeGrow, CImageInfo::lTimeLoad, CImageInfo::lWidth, m_bClearIfNoImage, m_bEOF, m_bWrapFetch, m_tImageLoadUp, TRUE, CImageInfo::ulTimeRecognition, and CImageInfo::usiCountRecognition.

Referenced by CFakeBatchModelessDialog::OnBnClickedButtonGetImageInfo(), and UpdateImageInfoTab().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::IsSetFT ( int  iFile,
int  iPage 
)

Check if the specific image in the file has been converted according to the tracker.

Check if a page indicator for a specific file is set to TRUE indicating the page has been converted and serialized.

Parameters
[in]iFile- File whose pages we are to check.
[in]iPage- Specific page in the file to check.
Return values
TRUE- Bit was on.
FALSE- Bit was off.

Definition at line 95 of file ImageLoader.cpp.

References T_FILETRACKER::cPageBits, FALSE, FT_MAX_PAGES, m_pft, CIlfIo::ms_pcAllocation, and s_ucNumberToBit.

Referenced by DisplayImage(), NewFTListFromOpenDialog(), and NewILFFromStagingDirectory().

Here is the caller graph for this function:

BOOL CImageLoader::IsStagedFileExtension ( const char *  pszPath)
static

Checks for a staged file with a .000 to .999 file extension.

Parameters
pszPath- Path to a file.
Return values
TRUE- File has an pure digit extension, signifing a staged file.
FALSE- File may be staged, but not due to the extension orthography.

Definition at line 2264 of file ImageLoader.cpp.

References FALSE, and TRUE.

Referenced by CIlfIo::GetFileListFromListbox(), and NewFTListFromOpenDialog().

Here is the caller graph for this function:

BOOL CImageLoader::ListFirst ( )

Load first image from the first file in the list.

This routine doesn't correspond to a data entry command and probably only has utility as some sort of image browser.

Return values
TRUE- If m_bDisplayImageOnSeek is TRUE, this is the return value from DisplayImage. Otherwise, it means success.
See also
DisplayImage for more information.
Return values
FALSE- Some failure, probably setup. It could also be a DisplayImage failure, so check ie.m_szError.

Definition at line 1305 of file ImageLoader.cpp.

References DisplayImage(), FALSE, m_bBOF, m_bDisplayImageOnSeek, m_bEOF, m_lFileCount, m_lFileCurrent, m_lPageCurrent, m_pft, CIlfIo::ms_pcAllocation, and TRUE.

Referenced by CFakeBatchModelessDialog::OnBnClickedButtonListFirst().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::ListLast ( )

Load the first image from the last file in the list.

This routine doesn't correspond to a data entry command and probably only has utility as some sort of image browser.

Return values
TRUE- If m_bDisplayImageOnSeek is TRUE, this is the return value from DisplayImage. Otherwise, it means success.
See also
DisplayImage for more information.
Return values
FALSE- Some failure, probably setup. It could also be a DisplayImage failure, so check ie.m_szError.

Definition at line 1339 of file ImageLoader.cpp.

References DisplayImage(), FALSE, g_pCImagingEngine, m_bBOF, m_bDisplayImageOnSeek, m_bEOF, m_lFileCount, m_lFileCurrent, m_lPageCurrent, m_pft, CIlfIo::ms_pcAllocation, and TRUE.

Referenced by CFakeBatchModelessDialog::OnBnClickedButtonListLast().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::MakeReadyILF ( )

Using the current batch, load ILF and make ready for data entry.

Warning
This function must be called instead of Load2MemoryILF (prev. Reset) so that it can update both ILF and FT values! Basic ILF and CImageLoader states are set.
Todo:
If ILF loaded, CImageLoader states are updated from the TControlILF record.
Return values
TRUE- Load up succeeded, or if no file, ILF load skipped normally. If m_bDisplayImageOnSeek is TRUE, the image was displayed after load up. EOF is an exceptable result for a batch rescue with images exhausted. Check m_bEOF.
FALSE- Load up failed. Could also mean that image failed to display but load up succeeded.
Note
Checkpoints are done when a batch page is sent to the queue; therefore, it would be the next image page in the list we need to display on queue rescue.
Commit is done only at save time. Two situations can exist: (1) No image (images exhausted) and (2) Unused image showing, that is, the image displayed needs to be re-displayed on update.
Usage:
ILF should exist. No pre-allocation of ILF memory.

Definition at line 761 of file ImageLoader.cpp.

References BatchDirectory(), bch, ctl, DisplayImage(), FALSE, g_pCImagingEngine, TYPE_ILF_CONTROL::iCount, TYPE_ILF_CONTROL::ILF_SAFE_SHUTDOWN, CIlfIo::IsILF(), TYPE_ILF_CONTROL::lFileCurrent, TYPE_ILF_CONTROL::lFileCurrentCommit, TYPE_ILF_CONTROL::lNextSerial, CIlfIo::Load2MemoryILF(), TYPE_ILF_CONTROL::lPageCurrent, TYPE_ILF_CONTROL::lPageCurrentCommit, m_bBOF, m_bDisplayImageOnSeek, m_bEOF, m_lFileCount, m_lFileCurrent, m_lNextSerial, m_lPageCurrent, m_pft, m_pWndPopup, CImagingEngine::m_szError, CIlfIo::ms_iIndexDisplayedILF, CIlfIo::ms_pcAllocation, CIlfIo::ms_pCtl, CIlfIo::ms_pFT, CImagingEngine::SetImageCollectionDirectory(), and TRUE.

Referenced by CImageTracker::GetNewFileList(), CFalcon32AddOn::OnBatchLoadSuccess(), and CFakeBatchModelessDialog::OnInitDialog().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::NewFTListFromOpenDialog ( char *&  pszError,
BOOL  bMultiselect = TRUE 
)

Create a new FT list using an open dialog.

Displays an open dialog and constructs a FT list.

It can be used to open a single image (as in format generator) or multiple images.

Todo:

Have to get the real staging directory instead of the test one.

Code hard codes "Sample" batch when creating ILF file.

Note
The FT list is serialized without regard to whether the images will ever be used. This will intermittantly result in gaps in the serialization names of files in the batch image collection.
Return values
TRUEif successful, else check pszError. Depending on m_bDisplayImageOnSeek, it will return TRUE is display succeeded or TRUE if successful getting ready to display the image.
Parameters
[out]pszError- Will contain a pointer to a string if the function returns FALSE. It is an imaging engine error or a "No Files Selected" message.
[in]bMultiselect- True (default) - Allow multiple images to be selected. False - Allow one image to be selected.
Usage:
To open one and only one specific file, call with m_sUseInsteadOfOpenFileDialog set to a full path. No wildcards allowed.
Usage:
Sets m_uiOpenDialogResult to simulate a dialog return value. Possible returns are IDOK, IDCANCEL, or IDABORT (error).
Unit Test:
TEST_FT_BITS - Define to test the SetFT and IsSetFT functions.

Definition at line 251 of file ImageLoader.cpp.

References CIlfIo::Allocate(), BOOL, compare(), T_FILETRACKER::ctl, ctl, CIlfIo::Deallocate(), DisplayImage(), FALSE, FindNextSerialNumber(), T_FILETRACKER::fIsStagingDirectory, FT_EYECATCHER, FT_MAX_PAGES, g_pCImagingEngine, CIlfIo::GetFileString(), i, TYPE_ILF_CONTROL::iBlocksize, TYPE_ILF_CONTROL::iCount, TYPE_ILF_CONTROL::iIndexBatchCommit, TYPE_ILF_CONTROL::iIndexPageCommit, TYPE_ILF_CONTROL::ILF_SAFE_SHUTDOWN, IsFile(), IsSetFT(), IsStagedFileExtension(), T_FILETRACKER::lSerial, m_bBOF, m_bDisplayImageOnSeek, m_bEOF, m_lFileCount, m_lFileCurrent, m_lNextSerial, m_lPageCurrent, m_pft, m_pWndPopup, m_sUseInsteadOfOpenFileDialog, CImagingEngine::m_szError, m_uiOpenDialogResult, CImageDisplayDialog::MakeStagingPath(), MAX_FILE_LIST, CIlfIo::ms_iIndexBatchCommitILF, CIlfIo::ms_iIndexDisplayedILF, CIlfIo::ms_iIndexPageCommitILF, CIlfIo::ms_pcAllocation, CIlfIo::ms_pCtl, CIlfIo::ms_pFT, CIlfIo::ms_pszFileList, CIlfIo::ms_pWndPopup, return, SetFT(), CImagingEngine::SetStagingDirectory(), TYPE_ILF_CONTROL::szPath, TRUE, and CIlfIo::WriteCompleteFile().

Referenced by CImageTracker::GetNewFileList(), CFakeBatchModelessDialog::OnBnClickedButtonNewList(), CFormatImageDisplayDialog::OnBnClickedButtonNewSample(), and CFakeBatchModelessDialog::OnBnClickedButtonSingleFileList().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::NewFTListFromStagingDirectory ( char *&  pszError)

Create a new FT list by using a directory list of the folder set as a staging directory in the imaging engine. Also displays current image.

Calls NewILFFromStagingList, then if successful, it displays the first image.

Usage:
Set the image collection directory and the staging directory in the imaging engine before calling.
Return values
TRUE- Successful. Depending on m_bDisplayImageOnSeek, it will return TRUE is display succeeded or TRUE if successful getting ready to display the image.
FALSE- The operation failed. The error is reported in pszError.
Parameters
[out]pszError- If an error occurs, this will point to the imaging engine error area or a text constant.

Definition at line 677 of file ImageLoader.cpp.

References DisplayImage(), FALSE, g_pCImagingEngine, m_bDisplayImageOnSeek, CImagingEngine::m_szError, NewILFFromStagingDirectory(), and TRUE.

Referenced by CFakeBatchModelessDialog::OnBnClickedButtonStageList().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::NewILFFromStagingDirectory ( char *&  pszError)

Create a new ILF with FT list from the staging directory.

Reads the entire staging directory (find first/next) for .000 through .999 files and forms a standard ILF using them.

DOES NOT READ THE IMAGES.

Note
It is intended that the caller could store staged OCR files in the image collection directory and then make an ILF by storing image collection directory path as the staging directory.
Usage:
Set the image collection directory and the staging directory in the imaging engine before calling.
Return values
TRUE- Successful.
FALSE- The operation failed. The error is reported in pszError.
Note
The FT list is serialized without regard to whether the images will ever be used. This will intermittantly result in gaps in the serialization names of files in the batch image collection.
Parameters
[out]pszError- If an error occurs, this will point to the imaging engine error area or a text constant.
Unit Test:
TEST_FT_BITS - Define to test the SetFT and IsSetFT functions.

Definition at line 525 of file ImageLoader.cpp.

References CIlfIo::Allocate(), BOOL, T_FILETRACKER::ctl, ctl, CIlfIo::Deallocate(), FALSE, TYPE_WAYBILL_DATA::fCT_AssignImagesForKFI, TYPE_WAYBILL_DATA::fCT_PrerecordOCR, FindNextSerialNumber(), T_FILETRACKER::fIsStagingDirectory, FT_EYECATCHER, FT_MAX_PAGES, g_pCImagingEngine, CIlfIo::GetFileString(), CImagingState::GetImageCollectionDirectory(), CImagingState::GetStagingDirectoryBase(), CWaybillWaitingForWork::GetWaybill(), i, TYPE_ILF_CONTROL::iBlocksize, TYPE_ILF_CONTROL::iCount, TYPE_ILF_CONTROL::iIndexBatchCommit, TYPE_ILF_CONTROL::iIndexPageCommit, TYPE_ILF_CONTROL::ILF_SAFE_SHUTDOWN, IsSetFT(), CWaybillWaitingForWork::IsUsingWaybill(), T_FILETRACKER::lSerial, m_bBOF, m_bEOF, m_lFileCount, m_lFileCurrent, m_lNextSerial, m_lPageCurrent, m_pft, m_pWndPopup, CImagingEngine::m_szError, CWaybill::m_wd, CIlfIo::ms_iIndexBatchCommitILF, CIlfIo::ms_iIndexDisplayedILF, CIlfIo::ms_iIndexPageCommitILF, CIlfIo::ms_pcAllocation, CIlfIo::ms_pCtl, CIlfIo::ms_pFT, CIlfIo::ms_pWndPopup, SetFT(), TYPE_ILF_CONTROL::szDocumentMask, TYPE_WAYBILL_DATA::szIA_DocumentMask, TYPE_ILF_CONTROL::szPath, TRUE, and CIlfIo::WriteCompleteFile().

Referenced by NewFTListFromStagingDirectory().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::NextFile ( )

Load first image of the next file in the list.

This routine doesn't correspond to a data entry command and probably only has utility as some sort of image browser.

It does correspond to an operator issuing the next document command with no document mask.

Return values
bSuccess- This is the return value from DisplayImage.
See also
DisplayImage for more information.

Definition at line 1375 of file ImageLoader.cpp.

References DisplayImage(), FALSE, m_bBOF, m_bClearIfNoImage, m_bEOF, m_bLoadDirectPerformed, m_bWrapFetch, m_lFileCount, m_lFileCurrent, m_lPageCurrent, m_pft, CIlfIo::ms_pcAllocation, and TRUE.

Referenced by CFakeBatchModelessDialog::OnBnClickedButtonNextFile().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::NextList ( )

Load and display next image in list.

This is the routine that will handle the normal image to image progression during entry.

Return values
TRUE- If m_bDisplayImageOnSeek is TRUE, this is the return value from DisplayImage. Otherwise, it means success.
See also
DisplayImage for more information.
Return values
FALSE- Some failure, probably setup. It could also be a DisplayImage failure, so check ie.m_szError.

Definition at line 1155 of file ImageLoader.cpp.

References DisplayImage(), FALSE, m_bBOF, m_bClearIfNoImage, m_bDisplayImageOnSeek, m_bEOF, m_bLoadDirectPerformed, m_bWrapFetch, m_lFileCount, m_lFileCurrent, m_lPageCurrent, m_pft, CIlfIo::ms_iIndexDisplayedILF, CIlfIo::ms_pcAllocation, and TRUE.

Referenced by EnterPageDisplayNext(), CImageTracker::GetNextImage(), CFakeBatchModelessDialog::OnBnClickedButtonNextList(), and CFalcon32AddOn::ScanMatchOrLoad().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::PrevFile ( )

Load the first image of the previous file in the list.

This routine doesn't correspond to a data entry command and probably only has utility as some sort of image browser.

It does correspond to an operator issuing the previous document command with no document mask.

Return values
bSuccess- This is the return value from DisplayImage.
See also
DisplayImage for more information.

Definition at line 1425 of file ImageLoader.cpp.

References BOOL, DisplayImage(), FALSE, m_bBOF, m_bClearIfNoImage, m_bEOF, m_bLoadDirectPerformed, m_lFileCount, m_lFileCurrent, m_lPageCurrent, m_pft, CIlfIo::ms_pcAllocation, and TRUE.

Referenced by CFakeBatchModelessDialog::OnBnClickedButtonPrevFile().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::PrevList ( )

Load and display previous image in list.

This routine is to be assigned to an imaging command to fetch a replacement image during entry.

Return values
TRUE- If m_bDisplayImageOnSeek is TRUE, this is the return value from DisplayImage. Otherwise, it means success.
See also
DisplayImage for more information.
Return values
FALSE- Some failure, probably setup. It could also be a DisplayImage failure, so check ie.m_szError.

Definition at line 1208 of file ImageLoader.cpp.

References BOOL, DisplayImage(), FALSE, T_FILETRACKER::lCountPages, m_bBOF, m_bClearIfNoImage, m_bDisplayImageOnSeek, m_bEOF, m_bLoadDirectPerformed, m_bWrapFetch, m_lFileCount, m_lFileCurrent, m_lPageCurrent, m_pft, CIlfIo::ms_iIndexDisplayedILF, CIlfIo::ms_pcAllocation, and TRUE.

Referenced by CImageTracker::GetPrevImage(), CFakeBatchModelessDialog::OnBnClickedButtonPrevList(), and CFalcon32AddOn::ScanMatchOrLoad().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::SameList ( )

Load and display the same image as last displayed.

This routine is intended to reload the last image displayed before entering a paging mode.

Return values
TRUE- If m_bDisplayImageOnSeek is TRUE, this is the return value from DisplayImage. Otherwise, it means success.
See also
DisplayImage for more information.
Return values
FALSE- Some failure, probably setup. It could also be a DisplayImage failure, so check ie.m_szError.

Definition at line 1273 of file ImageLoader.cpp.

References DisplayImage(), FALSE, m_bBOF, m_bDisplayImageOnSeek, m_bEOF, m_lFileCount, m_lFileCurrent, m_lPageCurrent, m_pft, CIlfIo::ms_pcAllocation, and TRUE.

Referenced by CImageTracker::GetNextImageDoc(), CImageTracker::GetPrevImageDoc(), CFakeBatchModelessDialog::OnBnClickedButtonLoadagain(), and CFalcon32AddOn::ScanMatchOrLoad().

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CImageLoader::SendHdibToViewer ( )

Takes the loaded HDIB and sends it to the viewer.

Will update the file tracker for images associated with the file tracker.

See also
m_bLoadDirectPerformed.
Usage:
Expects the image to have been previous loaded and DIBified in the imaging engine.

Definition at line 1041 of file ImageLoader.cpp.

References CGenericModelessDialog::ExternalSetHDIB(), FALSE, g_pCImagingEngine, CImagingState::GetHDIB(), CImagingState::GetPageCount(), T_FILETRACKER::lCountPages, m_bLoadDirectPerformed, m_lFileCurrent, m_lPageCurrent, m_pft, m_pgmdImageDisplayDialog, CIlfIo::ms_pcAllocation, SetFT(), and TRUE.

Referenced by DisplayCollectionImage(), DisplayImage(), and CFakeBatchModelessDialog::OnBnClickedButtonSendHdib().

Here is the call graph for this function:

Here is the caller graph for this function:

void CImageLoader::SetFT ( int  iFile,
int  iPage 
)

Set a particular image page in a file as converted.

Set a bit representing a page in the TFileTracker to TRUE.

Checkpoints the file tracker change to the change to the ILF, but does not commit the current ILF or FT tracker variables to the ILF.

See also
Checkpoint2ILF.
Note
No API provided to set the bit to FALSE.
Parameters
[in]iFile- File whose pages we are to check.
[in]iPage- Specific page in the file to check.

Definition at line 121 of file ImageLoader.cpp.

References T_FILETRACKER::cPageBits, FT_MAX_PAGES, m_pft, CIlfIo::ms_pcAllocation, s_ucNumberToBit, and CIlfIo::WriteThruFT().

Referenced by NewFTListFromOpenDialog(), NewILFFromStagingDirectory(), and SendHdibToViewer().

Here is the call graph for this function:

Here is the caller graph for this function:

void CImageLoader::UpdateDirtyImageOnDisk ( )

If the image has been changed, update the image on disk.

Definition at line 824 of file ImageLoader.cpp.

References FALSE, g_pCImagingEngine, C_GdViewer::GetHBitmap(), CGenericModelessDialog::m_bDirty, m_pgmdImageDisplayDialog, CImageViewer::m_viewer, and CImagingEngine::ReoutputFalcon32TIFF().

Referenced by CImageTracker::CloseAndCancel(), CImageTracker::CloseAndSave(), CImageTracker::CloseAndStrand(), DisplayCollectionImage(), and DisplayImage().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

BOOL CImageLoader::m_bClearIfNoImage

If at EOF, clear image instead of displaying it. This simulates hitting EOF while doing KFI.

Definition at line 46 of file ImageLoader.h.

Referenced by CImageLoader(), DisplayImage(), GetImageInfo(), CFakeBatchModelessDialog::ListButtonsOff(), CFakeBatchModelessDialog::ListButtonsOn(), NextFile(), NextList(), CFakeBatchModelessDialog::OnInitDialog(), PrevFile(), and PrevList().

BOOL CImageLoader::m_bDisplayImageOnSeek

If set to TRUE, the "list" API will call DisplayImage. Otherwise, these routines will just set up to call DisplayImage.

Definition at line 48 of file ImageLoader.h.

Referenced by CImageLoader(), CImageTracker::CommitImageForCommittedBatchPage(), DisplayCollectionImage(), CImageTracker::GetNextImage(), CImageTracker::GetNextImageDoc(), CImageTracker::GetPrevImage(), CImageTracker::GetPrevImageDoc(), CFalcon32AddOn::KSAssignNewScanFileInPaging(), CFakeBatchModelessDialog::ListButtonsOn(), ListFirst(), ListLast(), MakeReadyILF(), NewFTListFromOpenDialog(), NewFTListFromStagingDirectory(), NextList(), CFakeBatchModelessDialog::OnBnClickedButtonCommitPage(), CFormatImageDisplayDialog::OnBnClickedButtonDeleteSample(), CFakeBatchModelessDialog::OnBnClickedButtonGetNext(), CFakeBatchModelessDialog::OnBnClickedButtonListFirst(), CFakeBatchModelessDialog::OnBnClickedButtonListLast(), CFakeBatchModelessDialog::OnBnClickedButtonLoadagain(), CFakeBatchModelessDialog::OnBnClickedButtonNewList(), CFormatImageDisplayDialog::OnBnClickedButtonNewSample(), CFakeBatchModelessDialog::OnBnClickedButtonNextDoc(), CFakeBatchModelessDialog::OnBnClickedButtonNextFile(), CFakeBatchModelessDialog::OnBnClickedButtonNextList(), CFormatImageDisplayDialog::OnBnClickedButtonNextSample(), CFakeBatchModelessDialog::OnBnClickedButtonPageBack(), CFakeBatchModelessDialog::OnBnClickedButtonPrevDoc(), CFakeBatchModelessDialog::OnBnClickedButtonPrevFile(), CFakeBatchModelessDialog::OnBnClickedButtonPrevList(), CFakeBatchModelessDialog::OnBnClickedButtonReopen(), CFakeBatchModelessDialog::OnBnClickedButtonSeamlessMultifileDialog(), CFakeBatchModelessDialog::OnBnClickedButtonSingleFileList(), CFakeBatchModelessDialog::OnBnClickedButtonStageList(), CFakeBatchModelessDialog::OnBnClickedCheckDisplayOnSeek(), CFakeBatchModelessDialog::OnInitDialog(), CFalcon32AddOn::OnPagingDisplayInitialScan(), CFalcon32AddOn::OnRecvVerifyModeTop(), PrevList(), SameList(), CFalcon32AddOn::ScanMatchOrLoad(), and CFormatImageDisplayDialog::StartSession().

BOOL CImageLoader::m_bLoadDirectPerformed

Set to TRUE if an image was loaded directly via file and page number (e.g., using the image coordinates in the record appendage).

Definition at line 42 of file ImageLoader.h.

Referenced by CImageLoader(), DisplayCollectionImage(), NextFile(), NextList(), PrevFile(), PrevList(), and SendHdibToViewer().

BOOL CImageLoader::m_bWrapFetch

If set, allow next to wrap to first and prev to wrap from first to last. If FALSE, clear the image display.

Definition at line 43 of file ImageLoader.h.

Referenced by CImageLoader(), DisplayImage(), GetImageInfo(), CFakeBatchModelessDialog::ListButtonsOff(), CFakeBatchModelessDialog::ListButtonsOn(), NextFile(), NextList(), CFakeBatchModelessDialog::OnInitDialog(), and PrevList().

long CImageLoader::m_lFileCollection

Last loaded collection file image. Invalidate if -1. Invalidated by non-collection load.

Definition at line 50 of file ImageLoader.h.

Referenced by CImageLoader(), DisplayCollectionImage(), and DisplayImage().

long CImageLoader::m_lNextSerial
long CImageLoader::m_lPageCollection

Last loaded collection file image. Invalidate if -1. Invalidated by non-collection load.

Definition at line 51 of file ImageLoader.h.

Referenced by CImageLoader(), DisplayCollectionImage(), and DisplayImage().

CString CImageLoader::m_sUseInsteadOfOpenFileDialog

Use this path for an auto-open of a file for NewFTListFromOpenDialog.

Definition at line 47 of file ImageLoader.h.

Referenced by NewFTListFromOpenDialog(), and CFakeBatchModelessDialog::OnBnClickedOpenImage().

TImageLoadUp CImageLoader::m_tImageLoadUp

Immediate image source of last loaded image.

Definition at line 49 of file ImageLoader.h.

Referenced by CImageLoader(), DisplayCollectionImage(), DisplayImage(), and GetImageInfo().

UINT CImageLoader::m_uiOpenDialogResult

An MBxxx result after a NewFTListFromOpenDialog or CImageTracker::GetNewFileList. All other times, consider it undefined.

Definition at line 52 of file ImageLoader.h.

Referenced by CImageTracker::GetNewFileList(), NewFTListFromOpenDialog(), and CFormatImageDisplayDialog::OnBnClickedButtonNewSample().


The documentation for this class was generated from the following files: