~ubuntu-branches/debian/wheezy/cuneiform/wheezy

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rpic/sources/rectpic.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-07-10 17:58:10 UTC
  • Revision ID: james.westby@ubuntu.com-20090710175810-rqc89d2i3tki9m89
Tags: upstream-0.7.0+dfsg
ImportĀ upstreamĀ versionĀ 0.7.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) 1993-2008, Cognitive Technologies
 
3
All rights reserved.
 
4
 
 
5
ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½,
 
6
ļæ½ļæ½ļæ½ ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½:
 
7
 
 
8
      * ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½
 
9
        ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½
 
10
        ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½.
 
11
      * ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½/ļæ½ļæ½ļæ½ ļæ½
 
12
        ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½
 
13
        ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½
 
14
        ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½.
 
15
      * ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ Cognitive Technologies, ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½
 
16
        ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½/ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½
 
17
        ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½, ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½
 
18
        ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½.
 
19
 
 
20
ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½/ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ "ļæ½ļæ½ļæ½
 
21
ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½" ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½-ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½,
 
22
ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ ļæ½ļæ½
 
23
ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½. ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½
 
24
ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½/ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½
 
25
ļæ½ļæ½ŃØļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½
 
26
ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½
 
27
ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ (ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½,
 
28
ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½/ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½-ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½
 
29
ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ ļæ½/ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½,
 
30
ļæ½ļæ½ ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½), ļæ½ļæ½ ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½, ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½
 
31
ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½.
 
32
 
 
33
Redistribution and use in source and binary forms, with or without modification,
 
34
are permitted provided that the following conditions are met:
 
35
 
 
36
    * Redistributions of source code must retain the above copyright notice,
 
37
      this list of conditions and the following disclaimer.
 
38
    * Redistributions in binary form must reproduce the above copyright notice,
 
39
      this list of conditions and the following disclaimer in the documentation
 
40
      and/or other materials provided with the distribution.
 
41
    * Neither the name of the Cognitive Technologies nor the names of its
 
42
      contributors may be used to endorse or promote products derived from this
 
43
      software without specific prior written permission.
 
44
 
 
45
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 
46
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
47
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
48
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
 
49
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
50
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 
51
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
52
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 
53
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
54
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
55
*/
 
56
 
 
57
/*# include <windows.h>*/
 
58
# include <stdio.h>
 
59
 
 
60
#include "dpuma.h"
 
61
#include "pumadef.h"
 
62
#include "mainpic.h"
 
63
#include "cpage.h"
 
64
#include "ccom.h"
 
65
#include "rstr.h"
 
66
#include "rpic.h"
 
67
 
 
68
/************************ External Handles from DPUMA *************************/
 
69
extern Handle hShowCheckLetters;
 
70
/******************************************************************************/
 
71
 
 
72
 
 
73
////////////////////////////////////////////////////////////////////////////////
 
74
Bool32 CheckAreaForComps(Handle hCCOM, Handle hCCOM_big, Rect32 rect, Int32 Height, Word32 *Result1, Word32 *Result2)
 
75
{
 
76
        CCOM_comp * comp;
 
77
        Word32 i;
 
78
        comp =  NULL;
 
79
 
 
80
        Rect16 rect1;
 
81
        Word32 key = 111;
 
82
        Word32 color = 23000;
 
83
 
 
84
        Handle MainWindowD=NULL;
 
85
    MainWindowD=LDPUMA_GetWindowHandle ("ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½");
 
86
    if(!MainWindowD)
 
87
       MainWindowD=LDPUMA_GetWindowHandle ("Main");
 
88
 
 
89
 
 
90
        *Result1 = 0;
 
91
        *Result2 = 0;
 
92
 
 
93
        if(!LDPUMA_Skip(hShowCheckLetters))
 
94
        {
 
95
                rect1.top = (Word16)rect.top;
 
96
                rect1.left = (Word16)rect.left;
 
97
                rect1.bottom = (Word16)rect.bottom;
 
98
                rect1.right = (Word16)rect.right;
 
99
                LDPUMA_DrawRect(MainWindowD, &rect1, 0, 23635, 4, key);
 
100
        }
 
101
 
 
102
//stepa_am
 
103
comp = CCOM_GetFirst(hCCOM_big,NULL);
 
104
        while (comp)
 
105
        {
 
106
                if(comp->h < Height/6) goto lNextComp_big;
 
107
                if(comp->h > Height*1.5) goto lNextComp_big;
 
108
                if(comp->upper < rect.top) goto lNextComp_big;
 
109
                if(comp->left < rect.left) goto lNextComp_big;
 
110
                if(comp->upper + comp->h > rect.bottom) goto lNextComp_big;
 
111
                if(comp->left + comp->w > rect.right) goto lNextComp_big;
 
112
                if((comp->h < Height/3 )&&(comp->upper < rect.top))goto lNextComp_big;
 
113
                for(i=0; i<nPics; i++)
 
114
                {
 
115
                        if ( (comp->upper >= pPics[i].upper)&&
 
116
                                 (comp->left >= pPics[i].left)&&
 
117
                                 (comp->upper + comp->h < pPics[i].upper + pPics[i].h)&&
 
118
                                 (comp->left + comp->w <= pPics[i].left + pPics[i].w))
 
119
                        {
 
120
                                goto lNextComp_big;
 
121
                        }
 
122
                }
 
123
 
 
124
                if((comp->h > Height*0.5)&&(comp->h < Height*1.5))
 
125
                {
 
126
                        (*Result1)++;
 
127
                        if(!LDPUMA_Skip(hShowCheckLetters))
 
128
                        {
 
129
                                rect1.left = comp->left;
 
130
                                rect1.top = comp->upper;
 
131
                                rect1.right = comp->left + comp->w;
 
132
                                rect1.bottom = comp->upper + comp->h;
 
133
                                LDPUMA_DrawRect(MainWindowD, &rect1, 0, color, 8, key);
 
134
                        }
 
135
                        goto lNextComp_big;
 
136
                }
 
137
 
 
138
                if((comp->h > Height/3*0.5)&&(comp->h < Height/3*1.5))
 
139
                {
 
140
                        (*Result2)++;
 
141
                        if(!LDPUMA_Skip(hShowCheckLetters))
 
142
                        {
 
143
                                rect1.left = comp->left;
 
144
                                rect1.top = comp->upper;
 
145
                                rect1.right = comp->left + comp->w;
 
146
                                rect1.bottom = comp->upper + comp->h;
 
147
                                LDPUMA_DrawRect(MainWindowD, &rect1, 0, color, 2, key);
 
148
                        }
 
149
                        goto lNextComp_big;
 
150
                }
 
151
 
 
152
lNextComp_big:
 
153
                comp = CCOM_GetNext(comp,NULL);
 
154
        }
 
155
//end stepa_am
 
156
 
 
157
        comp = CCOM_GetFirst(hCCOM,NULL);
 
158
        while (comp)
 
159
        {
 
160
                if(comp->h < Height/6) goto lNextComp;
 
161
                if(comp->h > Height*1.5) goto lNextComp;
 
162
                if(comp->upper < rect.top) goto lNextComp;
 
163
                if(comp->left < rect.left) goto lNextComp;
 
164
                if(comp->upper + comp->h > rect.bottom) goto lNextComp;
 
165
                if(comp->left + comp->w > rect.right) goto lNextComp;
 
166
                if((comp->h < Height/3 )&&(comp->upper < rect.top))goto lNextComp;
 
167
                for(i=0; i<nPics; i++)
 
168
                {
 
169
                        if ( (comp->upper >= pPics[i].upper)&&
 
170
                                 (comp->left >= pPics[i].left)&&
 
171
                                 (comp->upper + comp->h < pPics[i].upper + pPics[i].h)&&
 
172
                                 (comp->left + comp->w <= pPics[i].left + pPics[i].w))
 
173
                        {
 
174
                                goto lNextComp;
 
175
                        }
 
176
                }
 
177
 
 
178
                if((comp->h > Height*0.5)&&(comp->h < Height*1.5))
 
179
                {
 
180
                        (*Result1)++;
 
181
                        if(!LDPUMA_Skip(hShowCheckLetters))
 
182
                        {
 
183
                                rect1.left = comp->left;
 
184
                                rect1.top = comp->upper;
 
185
                                rect1.right = comp->left + comp->w;
 
186
                                rect1.bottom = comp->upper + comp->h;
 
187
                                LDPUMA_DrawRect(MainWindowD, &rect1, 0, color, 8, key);
 
188
                        }
 
189
                        goto lNextComp;
 
190
                }
 
191
 
 
192
                if((comp->h > Height/3*0.5)&&(comp->h < Height/3*1.5))
 
193
                {
 
194
                        (*Result2)++;
 
195
                        if(!LDPUMA_Skip(hShowCheckLetters))
 
196
                        {
 
197
                                rect1.left = comp->left;
 
198
                                rect1.top = comp->upper;
 
199
                                rect1.right = comp->left + comp->w;
 
200
                                rect1.bottom = comp->upper + comp->h;
 
201
                                LDPUMA_DrawRect(MainWindowD, &rect1, 0, color, 2, key);
 
202
                        }
 
203
                        goto lNextComp;
 
204
                }
 
205
 
 
206
lNextComp:
 
207
                comp = CCOM_GetNext(comp,NULL);
 
208
        }
 
209
 
 
210
        if(!LDPUMA_Skip(hShowCheckLetters))
 
211
        {
 
212
                LDPUMA_Console("RPIC_ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ ļæ½ļæ½ ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½ļæ½  \n");
 
213
                LDPUMA_WaitUserInput(hShowCheckLetters, MainWindowD);
 
214
                LDPUMA_DeleteRects(MainWindowD, key);
 
215
        }
 
216
 
 
217
        return TRUE;
 
218
}
 
219
////////////////////////////////////////////////////////////////////////////////
 
220
 
 
221
 
 
222
////////////////////////////////////////////////////////////////////////////////
 
223
Bool32 SearchRectanglePictures(Handle hCCOM, Handle hCCOM_big,Handle hCPAGE)
 
224
{
 
225
        Word32 i,j;
 
226
        CCOM_comp pic;
 
227
        CCOM_comp * comp;
 
228
        Word16 pLocalHystogram[MaxHeightOfLetter];
 
229
        Word32 nLocalComps;
 
230
        Word32 MaxLocal, nMaxLocal;
 
231
        Word32 Result1, Result2, Result3, Result4, tmp1, tmp2;
 
232
        Rect32 rect;
 
233
        Int32 LengthTotal,LengthByIntervals;
 
234
        Handle BlockType;
 
235
        RecRaster rec;
 
236
        RecVersions vs;
 
237
        Int16 Language;
 
238
        RPIC_Comp_Rect CompRect;
 
239
 
 
240
 
 
241
        BlockType = CPAGE_GetInternalType("pic's to letters boxes");
 
242
 
 
243
        for(i=0; i<nPics; i++)
 
244
        {
 
245
                pic = pPics[i];
 
246
                my_upper  = pic.upper;
 
247
                my_left   = pic.left;
 
248
                my_bottom = pic.upper + pic.h;
 
249
                my_right  = pic.left + pic.w;
 
250
 
 
251
 
 
252
                //Additional parameter - local distribution of heights
 
253
                //in case of local fragment with different (from main) height
 
254
                nLocalComps = 0;
 
255
                for(j=0;j<MaxHeightOfLetter;j++)
 
256
                {
 
257
                        pLocalHystogram[j] = 0;
 
258
                }
 
259
 
 
260
//stepa_am
 
261
                comp = CCOM_GetFirst(hCCOM_big, &MyFiltrateIn);
 
262
                while(comp)
 
263
                {
 
264
                        if( (comp->h < MaxHeightOfLetter) && (comp->h > MinHeightOfLetter) )
 
265
                        {
 
266
                                pLocalHystogram[comp->h]++;
 
267
                                nLocalComps++;
 
268
                        }
 
269
                        comp = CCOM_GetNext(comp, &MyFiltrateIn);
 
270
                }
 
271
//end stepa_am
 
272
 
 
273
                comp = CCOM_GetFirst(hCCOM, &MyFiltrateIn);
 
274
                while(comp)
 
275
                {
 
276
                        if( (comp->h < MaxHeightOfLetter) && (comp->h > MinHeightOfLetter) )
 
277
                        {
 
278
                                pLocalHystogram[comp->h]++;
 
279
                                nLocalComps++;
 
280
                        }
 
281
                        comp = CCOM_GetNext(comp, &MyFiltrateIn);
 
282
                }
 
283
 
 
284
                if (nLocalComps!=0)
 
285
                {
 
286
                        MaxLocal = pLocalHystogram[0];
 
287
                        for(j=0;j<MaxHeightOfLetter;j++)
 
288
                        {
 
289
                                if(pLocalHystogram [j] > MaxLocal)
 
290
                                {
 
291
                                        MaxLocal = pLocalHystogram [j];
 
292
                                        nMaxLocal = j;
 
293
                                }
 
294
                        }
 
295
 
 
296
                        Result1 = 0;
 
297
                        Result2 = 0;
 
298
                        sprintf(tmp_str, " %i Result1 (must be 0)\n", Result1);
 
299
                        LDPUMA_FPuts(logFile_comp,tmp_str);
 
300
                        sprintf(tmp_str, " %i Result2 (must be 0)\n", Result2);
 
301
                        LDPUMA_FPuts(logFile_comp,tmp_str);
 
302
                        sprintf(tmp_str, " %i (nComps)\n", nComps);
 
303
                        LDPUMA_FPuts(logFile_comp,tmp_str);
 
304
 
 
305
//stepa_am
 
306
                        comp = CCOM_GetFirst(hCCOM_big, &MyFiltrateIn);
 
307
                        while(comp)
 
308
                        {
 
309
                                //sprintf(tmp_str, " %i  (comp)\n", comp);
 
310
                                //LDPUMA_FPuts(hFile,tmp_str);
 
311
                                if( (comp->h < MaxHeightOfLetter-1) && (comp->h > MinHeightOfLetter) )
 
312
                                {
 
313
 
 
314
                                        sprintf(tmp_str, " %i  (comp->h)\n", comp->h);
 
315
                                        LDPUMA_FPuts(logFile_comp,tmp_str);
 
316
                                        sprintf(tmp_str, " %i  (pHystogram[comp->h])\n", pHystogram[comp->h]);
 
317
                                        LDPUMA_FPuts(logFile_comp,tmp_str);
 
318
 
 
319
 
 
320
                                        //Result1 += OVERALL*pHystogram[comp->h];
 
321
                                        Result1 += pHystogram[comp->h]/20+pHystogram[comp->h-1]/20+pHystogram[comp->h+1]/20;
 
322
                                        if(comp->h - nMaxLocal < DIFFERENCE1)
 
323
                                        {
 
324
                                                //Result2 += LOCAL*pLocalHystogram[comp->h];
 
325
                                                Result2 += pLocalHystogram[comp->h]+pLocalHystogram[comp->h-1]+pLocalHystogram[comp->h+1];
 
326
                                        }
 
327
                                }
 
328
                                comp = CCOM_GetNext(comp, &MyFiltrateIn);
 
329
                        }
 
330
//end stepa_am
 
331
 
 
332
                        comp = CCOM_GetFirst(hCCOM, &MyFiltrateIn);
 
333
                        while(comp)
 
334
                        {
 
335
                                //sprintf(tmp_str, " %i  (comp)\n", comp);
 
336
                                //LDPUMA_FPuts(hFile,tmp_str);
 
337
                                if( (comp->h < MaxHeightOfLetter-1) && (comp->h > MinHeightOfLetter) )
 
338
                                {
 
339
 
 
340
                                        sprintf(tmp_str, " %i  (comp->h)\n", comp->h);
 
341
                                        LDPUMA_FPuts(logFile_comp,tmp_str);
 
342
                                        sprintf(tmp_str, " %i  (pHystogram[comp->h])\n", pHystogram[comp->h]);
 
343
                                        LDPUMA_FPuts(logFile_comp,tmp_str);
 
344
 
 
345
 
 
346
                                        //Result1 += OVERALL*pHystogram[comp->h];
 
347
                                        Result1 += pHystogram[comp->h]/20+pHystogram[comp->h-1]/20+pHystogram[comp->h+1]/20;
 
348
                                        if(comp->h - nMaxLocal < DIFFERENCE1)
 
349
                                        {
 
350
                                                //Result2 += LOCAL*pLocalHystogram[comp->h];
 
351
                                                Result2 += pLocalHystogram[comp->h]+pLocalHystogram[comp->h-1]+pLocalHystogram[comp->h+1];
 
352
                                        }
 
353
                                }
 
354
                                comp = CCOM_GetNext(comp, &MyFiltrateIn);
 
355
                        }
 
356
 
 
357
                        //Result1 = Result1/nComps;
 
358
                        Result1 = Result1/10;
 
359
                        //Result2 = Result2/nLocalComps;
 
360
                        Result2 = Result2/20;
 
361
 
 
362
                        sprintf(tmp_str , " Picture %i (i)\n", i);
 
363
                        LDPUMA_FPuts(logFile_comp,tmp_str);
 
364
                        sprintf(tmp_str, " %i (Result1)\n", Result1);
 
365
                        LDPUMA_FPuts(logFile_comp,tmp_str);
 
366
                        sprintf(tmp_str, " %i (Result2)\n", Result2);
 
367
                        LDPUMA_FPuts(logFile_comp,tmp_str);
 
368
 
 
369
                        if(Result1 + Result2 > CONDITION1)
 
370
                        {
 
371
                                DeleteFromPics(i);
 
372
                                //i--;
 
373
                                continue;
 
374
                        }
 
375
                }
 
376
 
 
377
                /**************************************************************************/
 
378
                /*                      Analys by comp's count of begins&ends             */
 
379
                /**************************************************************************/
 
380
 
 
381
                CCOM_USER_BLOCK uBlock;
 
382
                uBlock.code = CCOM_UB_BEGENDS;
 
383
                if( CCOM_GetUserBlock(&pPics[i], &uBlock) )
 
384
                {
 
385
                        if(*(Word8*)uBlock.data > 100)
 
386
                        {
 
387
                                continue;
 
388
                        }
 
389
                }
 
390
 
 
391
                /**************************************************************************/
 
392
                /*                      Analys by comp's intervals                        */
 
393
                /**************************************************************************/
 
394
 
 
395
                //CCOM_USER_BLOCK uBlock;
 
396
                uBlock.code = CCOM_UB_DENSITY;
 
397
                if( CCOM_GetUserBlock(&pPics[i], &uBlock) )
 
398
                {
 
399
                        LengthByIntervals = *(Int32*)uBlock.data;
 
400
                        LengthTotal = pPics[i].h * pPics[i].w;
 
401
 
 
402
                        if(LengthByIntervals==0)
 
403
                        {
 
404
                                return FALSE;
 
405
                        }
 
406
 
 
407
                        if(LengthTotal/LengthByIntervals > CONDITION2)
 
408
                        {
 
409
                                DeleteFromPics(i);
 
410
                                //i--;
 
411
                        }
 
412
                }
 
413
 
 
414
        }
 
415
 
 
416
        /************** final union all crossed and included pictures ******************/
 
417
        CCOM_comp common;
 
418
        for (i=0; i<nPics; i++)
 
419
        {
 
420
                if(pPics[i].large & CCOM_LR_KILLED)
 
421
                {
 
422
                        continue;
 
423
                }
 
424
                for (j=0; j<nPics; j++)
 
425
                {
 
426
                        if(pPics[j].large & CCOM_LR_KILLED)
 
427
                        {
 
428
                                continue;
 
429
                        }
 
430
                        if ( (pPics[i].upper  < pPics[j].upper)&&
 
431
                                (pPics[i].left   < pPics[j].left)&&
 
432
                                (pPics[i].left   + pPics[i].w > pPics[j].left + pPics[j].w)&&
 
433
                                (pPics[i].upper  + pPics[i].h > pPics[j].upper + pPics[j].h) )
 
434
                        {
 
435
                                if((pPics[i].type!=CCOM_CH_LETTER)||(pPics[j].type!=CCOM_CH_LETTER))
 
436
                                {
 
437
                                        pPics[i].type = CCOM_CH_MERGE;
 
438
                                }
 
439
                                DeleteFromPics (j);
 
440
                                //j--;
 
441
                        }
 
442
                }
 
443
        }
 
444
 
 
445
 
 
446
        for (i=0; i<nPics; i++)
 
447
        {
 
448
                if(pPics[i].large & CCOM_LR_KILLED)
 
449
                {
 
450
                        continue;
 
451
                }
 
452
                for (j=0; j<nPics; j++)
 
453
                {
 
454
                        if(pPics[j].large & CCOM_LR_KILLED)
 
455
                        {
 
456
                                continue;
 
457
                        }
 
458
                        if (i==j) continue;
 
459
                        if ( (pPics[i].upper  < pPics[j].upper + pPics[j].h)&&
 
460
                                (pPics[i].left   < pPics[j].left  + pPics[j].w)&&
 
461
                                (pPics[i].left  + pPics[i].w  > pPics[j].left)&&
 
462
                                (pPics[i].upper + pPics[i].h  > pPics[j].upper) )
 
463
                        {
 
464
                                common = pPics[i];
 
465
                                if (pPics[i].upper >= pPics[j].upper)
 
466
                                        common.upper = pPics[j].upper;
 
467
                                if (pPics[i].left >= pPics[j].left)
 
468
                                        common.left = pPics[j].left;
 
469
                                if (pPics[i].upper + pPics[i].h < pPics[j].upper + pPics[j].h)
 
470
                                        common.h = pPics[j].upper + pPics[j].h - pPics[i].upper;
 
471
                                if (pPics[i].left  + pPics[i].w < pPics[j].left + pPics[j].w)
 
472
                                        common.w = pPics[j].left + pPics[j].w - pPics[i].left;
 
473
                                common.h += pPics[i].upper - common.upper;
 
474
                                common.w += pPics[i].left  - common.left;
 
475
                                pPics[i] = common;
 
476
                                /*
 
477
                                if((pPics[i].type!=CCOM_CH_LETTER)||(pPics[j].type!=CCOM_CH_LETTER))
 
478
                                {
 
479
                                pPics[i].type = CCOM_CH_MERGE;
 
480
                                }
 
481
                                */
 
482
                                pPics[i].type = CCOM_CH_NOTLTR;
 
483
                                DeleteFromPics (j);
 
484
                                //j=0;
 
485
                                //i=0;
 
486
                        }
 
487
                }
 
488
        }
 
489
 
 
490
 
 
491
        for(i=0; i<nPics; i++)
 
492
        {
 
493
                if(pPics[i].large & CCOM_LR_KILLED)
 
494
                {
 
495
                        continue;
 
496
                }
 
497
                pic = pPics[i];
 
498
                my_upper  = pic.upper;
 
499
                my_left   = pic.left;
 
500
                my_bottom = pic.upper + pic.h;
 
501
                my_right  = pic.left + pic.w;
 
502
                /*
 
503
                Deleting from Pics, in case of Titles and "Bukvica", zero version,
 
504
                planing CHECK (by Oleg) for Letters in case of Bukvica, else check for
 
505
                comps with compatible heights in local area (horizontal).
 
506
                */
 
507
                if(pPics[i].scale <= 3)
 
508
                {
 
509
                        rect.top = pPics[i].upper;
 
510
                        rect.left = pPics[i].left + pPics[i].w;
 
511
                        rect.bottom = pPics[i].upper + pPics[i].h;
 
512
                        rect.right = pPics[i].left + pPics[i].w + pPics[i].h;
 
513
                        CheckAreaForComps(hCCOM,hCCOM_big, rect, nAverageHeight, &Result1, &Result2);
 
514
 
 
515
                        if( (Result1 > 10)&&(pPics[i].type != CCOM_CH_NOTLTR))
 
516
                        {
 
517
                                if( CCOM_GetRaster(&pPics[i], &rec) &&
 
518
                                        CCOM_GetLanguage(hCCOM, &Language) &&
 
519
                                        RSTR_RecogOneLetter (&rec, (Word8)(Language), &vs) )
 
520
                                {
 
521
 
 
522
                                        if( (vs.lnAltCnt > 0)&&
 
523
                                                (vs.Alt[0].Prob > 240)&&
 
524
                                                (vs.Alt[0].Code != 'i')&&
 
525
                                                (vs.Alt[0].Code != '1')&&
 
526
                                                (vs.Alt[0].Code != 'I')&&
 
527
                                                (vs.Alt[0].Code != 'l'))
 
528
                                        {
 
529
                                                pPics[i].type = CCOM_CH_LETTER;
 
530
                                                CompRect.upper = pPics[i].upper;
 
531
                                                CompRect.left = pPics[i].left;
 
532
                                                CompRect.h = pPics[i].h;
 
533
                                                CompRect.w = pPics[i].w;
 
534
                                                CPAGE_CreateBlock(hCPAGE, BlockType, 0, 0, &CompRect, sizeof(CompRect));
 
535
 
 
536
                                                DeleteFromPics(i);
 
537
                                                //i--;
 
538
                                                continue;
 
539
                                        }
 
540
                                }
 
541
                        }
 
542
 
 
543
 
 
544
                        rect.top = pPics[i].upper - (Int32)(0.3*(double)(pPics[i].h));
 
545
                        rect.left = pPics[i].left - 12*pPics[i].h;
 
546
                        rect.bottom = pPics[i].upper + (Int32)(1.3*(double)(pPics[i].h));
 
547
                        //rect.right = pPics[i].left + pPics[i].w;
 
548
                        rect.right = pPics[i].left;
 
549
                        CheckAreaForComps(hCCOM,hCCOM_big, rect, pPics[i].h, &Result1, &Result2);
 
550
                        if(Result2 > 7)
 
551
                        {
 
552
                                rect.top = pPics[i].upper - (Int32)(0.3*(double)(pPics[i].h));
 
553
                                rect.left = pPics[i].left - (Int32)(1.5*(double)(pPics[i].h));
 
554
                                rect.bottom = pPics[i].upper + (Int32)(1.3*(double)(pPics[i].h));
 
555
                                rect.right = pPics[i].left;
 
556
                                CheckAreaForComps(hCCOM,hCCOM_big, rect, pPics[i].h, &tmp1, &tmp2);
 
557
                                if(tmp2 == 0) Result2 = 0;
 
558
                        }
 
559
                        if((Result1 > 3)||(Result2 > 7))
 
560
                        {
 
561
                                pPics[i].type = CCOM_CH_LETTER;
 
562
                                CompRect.upper = pPics[i].upper;
 
563
                                CompRect.left = pPics[i].left;
 
564
                                CompRect.h = pPics[i].h;
 
565
                                CompRect.w = pPics[i].w;
 
566
                                CPAGE_CreateBlock(hCPAGE, BlockType, 0, 0, &CompRect, sizeof(CompRect));
 
567
 
 
568
                                DeleteFromPics(i);
 
569
                                //i--;
 
570
                                continue;
 
571
                        }
 
572
 
 
573
                        rect.top = pPics[i].upper - (Int32)(0.3*(double)(pPics[i].h));
 
574
                        rect.left = pPics[i].left + pPics[i].w;
 
575
                        rect.bottom = pPics[i].upper + (Int32)(1.3*(double)(pPics[i].h));
 
576
                        rect.right = pPics[i].left + pPics[i].w + 12*pPics[i].h;
 
577
                        CheckAreaForComps(hCCOM,hCCOM_big, rect, pPics[i].h, &Result3, &Result4);
 
578
                        if(Result4 > 0)
 
579
                        {
 
580
                                rect.top = pPics[i].upper - (Int32)(0.3*(double)(pPics[i].h));
 
581
                                rect.left = pPics[i].left + pPics[i].w;
 
582
                                rect.bottom = pPics[i].upper + (Int32)(1.3*(double)(pPics[i].h));
 
583
                                rect.right = pPics[i].left + pPics[i].w + (Int32)(1.5*(double)(pPics[i].h));
 
584
                                CheckAreaForComps(hCCOM,hCCOM_big ,rect, pPics[i].h, &tmp1, &tmp2);
 
585
                                if(tmp2 == 0) Result4 = 0;
 
586
                        }
 
587
                        if( (Result3 > 3) ||
 
588
                                (Result4 > 7) ||
 
589
                                (Result1 + Result3 > 3)||
 
590
                                (Result2 + Result4 > 7))
 
591
                        {
 
592
                                pPics[i].type = CCOM_CH_LETTER;
 
593
                                CompRect.upper = pPics[i].upper;
 
594
                                CompRect.left = pPics[i].left;
 
595
                                CompRect.h = pPics[i].h;
 
596
                                CompRect.w = pPics[i].w;
 
597
                                CPAGE_CreateBlock(hCPAGE, BlockType, 0, 0, &CompRect, sizeof(CompRect));
 
598
 
 
599
                                DeleteFromPics(i);
 
600
                                //i--;
 
601
                                continue;
 
602
                        }
 
603
                }
 
604
        }
 
605
 
 
606
        return TRUE;
 
607
}