int ScaleX = 0; // 96\82ð1\82Æ\82µ\82½\89æ\96Ê\82Ì\8ag\91å\97¦
int ScaleY = 0;
int generation = 0;
+int NumPrevWords = 1; // \89½\8cÂ\82Ü\82Å\91O\82Ì\92P\8cê\82ð\8fE\82¤\82©\81H
TCHAR ImageTextPath[256+40]; // OCR\97pimage filename or text filename
DWORD SaveImageTime;
__declspec(dllexport)
int WINAPI Config2( const struct TDCHConfig *cfg )
{
- DBW("Config2: %d %d %d %d", (int)cfg->ScaleX, (int)cfg->ScaleY, (int)cfg->UseAMODI, (int)ExtAMODI);
+ DBW("Config2: %d %d %d %d %d", (int)cfg->ScaleX, (int)cfg->ScaleY, (int)cfg->UseAMODI, (int)ExtAMODI, cfg->UseNumPrev ? cfg->NumPrevWords : 1);
MoveSend = cfg->MoveSend ? true : false;
MoveSent = false;
OnlyImage = cfg->OnlyImage;
ScaleX = cfg->ScaleX;
ScaleY = cfg->ScaleY;
+ NumPrevWords = cfg->UseNumPrev ? cfg->NumPrevWords : 1;
if (cfg->UseAMODI){
if (!ExtAMODI){
SYSTEMTIME t;
GetLocalTime(&t);
if (ExtAMODI){
- wsprintf(path+len, /*path_size-len,*/ _T("\\%04d-%02d-%02d-%02d%02d%02d-(%d,%d).bmp"),
- t.wYear, t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond, ptCursor.x, ptCursor.y);
+ wsprintf(path+len, /*path_size-len,*/ _T("\\%04d-%02d-%02d-%02d%02d%02d-(%d,%d)-n%d.bmp"),
+ t.wYear, t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond, ptCursor.x, ptCursor.y, NumPrevWords );
} else {
- wsprintf(path+len, /*path_size-len,*/ _T("\\amodi\\%04d-%02d-%02d-%02d%02d%02d.bmp"),
- t.wYear, t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond);
+ wsprintf(path+len, /*path_size-len,*/ _T("\\amodi\\%04d-%02d-%02d-%02d%02d%02d-n%d.bmp"),
+ t.wYear, t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond, NumPrevWords );
SendAMODI(WMCD_SETPOINT, (char*)&ptCursor, sizeof(ptCursor));
}
HANDLE fh = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
MODI.Layout layout = image.Layout;
bool outok = capture_page;
string prevWord = "";
+ string prevWord2 = "";
for (int j = 0; j < layout.Words.Count; j++)
{
MODI.Word word = (MODI.Word)layout.Words[j];
//incursor = true;
if (!outok)
{
- if (CursorPoint.X < rc.Left) {
- // cursorを飛び越えた
+ if (CursorPoint.X < rc.Left // cursorを飛び越えた
+ || (CursorPoint.X >= rc.Left && CursorPoint.X <= rc.Right) // cursorが矩形内
+ ){
outok = true;
curLocSet = true;
- if (prevWord.Length != 0) {
- tbText.AppendText(prevWord + " ");
- CurLoc = prevWord.Length + 1;
- }
- } else
- if (CursorPoint.X >= rc.Left && CursorPoint.X <= rc.Right){
- outok = true;
- curLocSet = true;
- if (prevWord.Length != 0) {
- tbText.AppendText(prevWord + " ");
- CurLoc = prevWord.Length + 1;
- }
- } else {
- prevWord = word.Text;
- }
+ if (prevWord.Length != 0) {
+ if (NumPrevWords >= 2 && prevWord2.Length != 0){
+ tbText.AppendText(prevWord2 + " " + prevWord + " ");
+ } else {
+ tbText.AppendText(prevWord + " ");
+ }
+ CurLoc = prevWord.Length + 1;
+ }
+ } else {
+ prevWord2 = prevWord;
+ prevWord = word.Text;
+ }
}
} else {
//incursor = false;
CursorPoint.X = int.Parse(m.Groups["x"].Value);
CursorPoint.Y = int.Parse(m.Groups["y"].Value);
}
+ r = new Regex(@"-n(?<n>\d+)");
+ m = r.Match(filename);
+ if (m.Success)
+ {
+ NumPrevWords = int.Parse(m.Groups["n"].Value);
+ }
}
//イベントハンドラ
p.Y = pt.y;
return p;
}
+ int NumPrevWords = 1;
// interface for external app
protected override void WndProc(ref Message m)
{