Talk:Education Project/Effort/Improve Scanner Use

From Apache OpenOffice Wiki
Jump to: navigation, search

valeuf: I was looking ImpTwain and Twain ... Some things are quite strange :

  • We find double method some times : by example SelectSource.

ericb: unlike in C language, methods can be overloaded in C++, means different number of parameters. The call will help to choose the right method.


  • nCurState define the state of the scan. But this variable take number. (between 1 and 6). So we don't know the meaning of this number ! (I devine that more the number is high more the process is advance. By example if no scanner are opening nCurState is 1. After for selectSource it's 3 ... ). In TwainHandler we have just key word : mdSMOpen, mDSEnabled and so... It look the same thing than nCurState.

ericb: you're right. nCurState is pretty unreadable, and an enumeration should have been used instead, to improve readability. If I'm not wrong, the nCurState values are used to identify the different possible steps when a scanning is performed. pl will tell me more

Looking at AppControler.h in the SDK, we have a better organisation :

/* States */
#define STATE_PRETW				10
#define	STATE_DSMLOADED			20
#define	STATE_DSMOPEN			30
#define	STATE_DSLOADED			35
#define	STATE_DSOPEN			40
#define	STATE_DSENABLED			50
#define	STATE_XFERREADY			60
#define STATE_XFER				70
#define STATE_DSCLOSED  		80

And I'd suggest to prefer such implementation, more readable

Ericb 13:52, 30 March 2008 (CEST)

Personal tools