~ubuntu-branches/ubuntu/trusty/cuneiform/trusty

« back to all changes in this revision

Viewing changes to cuneiform_src/Kern/rblock/sources/winc/_dlldummy.c

  • Committer: Bazaar Package Importer
  • Author(s): Jakub Wilk, c-assert.diff, slovenian-slv.diff
  • Date: 2011-01-26 21:53:07 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20110126215307-62x61mcesr607qb7
Tags: 1.0.0+dfsg-2
* Upload to unstable.
* Explicitly build-depend on pkg-config. Thanks to Stefano Rivera for the
  bug report.
* Add Vcs-* fields.
* Use the standard C assert() macro, rather than custom Cuneiform one.
  [c-assert.diff]
* Pass CFLAGS, CXXFLAGS and LDFLAGS (get from dpkg-buildflags) to cmake
  (closes: #608345). Thanks to Sami Liedes for the bug report.
  + Build depend on dpkg-dev (>= 1.15.7).
* Pass --parallel to dh.
  + Bump debhelper minimum version to 7.4.10.
* Update debian/copyright to the latest DEP-5 version.
* Bump year in debian/copyright.
* Explicitly link to GraphicsMagick (rather than via the ImageMagick
  compatibility layer).
* Don't ship /usr/lib/cuneiform/*.so symlinks. These libraries are
  considered private, at least until #598616 is fixed.
* Rename some private variables in debian/rules to make them lowercase.
* Update patch headers.
* Provide proper ‘build-arch’ and ‘build-indep’ targets in debian/rules.
* Document input format in the manual page (closes: #572061). Thanks to
  Janusz S. Bień for the bug report.
* Use ‘slv’ (rather than ‘slo’) as language code for Slovenian.
  [slovenian-slv.diff]
* Fix package description: Slovenian is supported, Slovak is not.
* Improve documentation of the language (-l) option (closes: #602512).
  Thanks to Jari Aalto for the bug report.
* Install reasons file for vrms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
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
 
 
 
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
 */
58
56
 
59
57
/****************************************************************************
60
58
 *                                                                          *
67
65
 *                                                                          *
68
66
 ***************************************************************************/
69
67
 
70
 
/*# include <conio.h>*/
71
68
# include <stdio.h>
72
69
# include <stdlib.h>
73
70
# include <string.h>
74
 
/*# include <dos.h>*/
75
71
 
 
72
#include "cttypes.h"
76
73
# include "layout.h"
77
74
# include "extract.h"
78
75
 
80
77
#include "minmax.h"
81
78
 
82
79
# if defined (LT_DEBUG) || defined (SE_DEBUG)
83
 
//# include <graph.h>
84
80
 
85
 
# define SCREEN_MEMORY     ((BYTE *) 0xA0000)
 
81
# define SCREEN_MEMORY     ((uchar *) 0xA0000)
86
82
# define SCREEN_WIDTH      1500
87
83
# define SCREEN_HEIGHT     1500
88
84
# define SCREEN_BYTE_WIDTH (SCREEN_WIDTH / 8)
112
108
# define KEY_F10        '\104'
113
109
 
114
110
# define NUMBER_TO_COLOR(n) ((n) % 6 + 1) // n -> [1..7]
115
 
// ������ �� �� � [0..7] ? (�� � [0..15] ?)
 
111
// почему бы не в [0..7] ? (не в [0..15] ?)
116
112
 
117
 
BLOCK   * pDebugBlock    = NULL;
 
113
BLOCK * pDebugBlock = NULL;
118
114
RECTANGLE rDebugRect;
119
 
int       xDebugVertLine = -1;
 
115
int xDebugVertLine = -1;
120
116
 
121
 
static BOOL bGraphicsModeWasChanged = FALSE;
 
117
static Bool bGraphicsModeWasChanged = FALSE;
122
118
 
123
119
void LT_GraphicsOpen (void) // "bGraphicsModeWasChanged=ON"
124
120
{
125
 
    if (! bGraphicsModeWasChanged)
126
 
    {
127
 
        bGraphicsModeWasChanged = TRUE;
128
 
        _setvideomode (_VRES16COLOR); //_setvideomode=={}; :)
129
 
    }
 
121
        if (! bGraphicsModeWasChanged)
 
122
        {
 
123
                bGraphicsModeWasChanged = TRUE;
 
124
                _setvideomode (_VRES16COLOR); //_setvideomode=={}; :)
 
125
        }
130
126
}
131
127
 
132
128
void LT_GraphicsClose (void) // "bGraphicsModeWasChanged=OFF"
133
129
{
134
 
    if (bGraphicsModeWasChanged)
135
 
    {
136
 
        _setvideomode (_DEFAULTMODE); //_setvideomode �����!
137
 
        bGraphicsModeWasChanged = FALSE;
138
 
    }
 
130
        if (bGraphicsModeWasChanged)
 
131
        {
 
132
                _setvideomode (_DEFAULTMODE); //_setvideomode пуста!
 
133
                bGraphicsModeWasChanged = FALSE;
 
134
        }
139
135
}
140
136
 
141
137
void LT_GraphicsClearScreen (void)
142
138
{
143
 
    _clearscreen (_GCLEARSCREEN); // �������� ��������
 
139
        _clearscreen (_GCLEARSCREEN); // аргумент фиктивен
144
140
}
145
141
 
146
 
 
147
 
// �������� ��� ���������: �������� �� 50 ����. �� ������
 
142
// окошечко для просмотра: отступим на 50 пикс. от границ
148
143
# define VIEW_LEFT      (MAX_SCALING * 50)
149
144
# define VIEW_TOP       (MAX_SCALING * 50)
150
145
# define VIEW_RIGHT     (MAX_SCALING * (SCREEN_WIDTH  - 50))
165
160
 
166
161
static void MatrixUpdate
167
162
(
168
 
    int  xLeft,
169
 
    int  yTop,
170
 
    int  nScaling,
171
 
    BYTE *pMatrix,
172
 
    int  nWidth,
173
 
    int  nHeight,
174
 
    BOOL bGrid,
175
 
    int  DrawingMode
 
163
                int xLeft,
 
164
                int yTop,
 
165
                int nScaling,
 
166
                uchar *pMatrix,
 
167
                int nWidth,
 
168
                int nHeight,
 
169
                Bool bGrid,
 
170
                int DrawingMode
176
171
)
177
172
{
178
 
    int x, y;
179
 
    int nFactor;
180
 
    static char OldMask [8];
181
 
    //1000 0001, 0100 0010, 0010 0100, 0001 1000, -//-
182
 
    // - ����� ���������� ��������� ������� ����� 'X':
183
 
    static char Mask [8] = { 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 };
184
 
 
185
 
    LT_GraphicsClearScreen ();
186
 
 
187
 
    if (nWidth == 0 || nHeight == 0 || pMatrix == NULL)
188
 
        return;
189
 
 
190
 
    // �� ���� �������� VIEW_WIDTH==1500-50*2==1400 (������ �� 1500 �� 50 � ���� ������),
191
 
    // � ��� (nWidth==PAGE_MATRIX_WIDTH) nFactor=1400/1024 =1;
192
 
    nFactor = MIN (VIEW_WIDTH / nWidth, VIEW_HEIGHT / nHeight);
193
 
 
194
 
    _setcolor (_COLOR_BACKGROUND);
195
 
 
196
 
//    _rectangle (_GBORDER, //�� �������� ������
197
 
//    //_rectangle (_GFILLINTERIOR,
198
 
//        // ������������ ���� nFactor...
199
 
//        (0          * nFactor - xLeft) / nScaling, //==0
200
 
//        (0          * nFactor - yTop)  / nScaling, //==0
201
 
//        (nWidth  * nFactor - xLeft) / nScaling,    //==1024
202
 
//        (nHeight * nFactor - yTop)  / nScaling);   //==1024
203
 
 
204
 
    switch (DrawingMode)
205
 
    {
206
 
        case MATRIX_DRAWING_NATIVE_MODE:
207
 
            for (x = 0; x < nWidth; x++)
208
 
            {
209
 
                for (y = 0; y < nHeight; y++) //from 0 to 1024...
210
 
                {
211
 
                    if (pMatrix [x + y * nWidth] == 0) // --//--
212
 
                    {
213
 
                        continue;
214
 
                    }
215
 
 
216
 
                    // NUMBER_TO_COLOR -- ��� ����������� � 1..7
217
 
                    // (��� ��� ��� ��������� ���������� PMC-������: root,dust,picture (1;2;4))
218
 
                    _setcolor
219
 
                        (NUMBER_TO_COLOR (pMatrix [x + y * nWidth] & 0xFF) & 7);
220
 
//                    _rectangle (_GFILLINTERIOR,
221
 
//                        (x       * nFactor - xLeft) / nScaling,
222
 
//                        (y       * nFactor - yTop)  / nScaling,
223
 
//                        ((x + 1) * nFactor - xLeft) / nScaling,
224
 
//                        ((y + 1) * nFactor - yTop)  / nScaling);
225
 
                    // ����� -- ��� ���-� ������ ��-��
226
 
                    // � PAGE_COMP_FACTOR ��� (XY_(UN)COMPRESS)
227
 
                    _rectangle (_GBORDER,
228
 
                        XY_UNCOMPRESS( (x       * nFactor - xLeft) / nScaling ),
229
 
                        XY_UNCOMPRESS( (y       * nFactor - yTop)  / nScaling ),
230
 
                        XY_UNCOMPRESS( ((x + 1) * nFactor - xLeft) / nScaling ),
231
 
                        XY_UNCOMPRESS( ((y + 1) * nFactor - yTop)  / nScaling )
232
 
                               );
233
 
                        // nFactor ������ (������?) == 1
234
 
                }
235
 
            }
236
 
            break;
237
 
 
238
 
        case MATRIX_DRAWING_MASK_MODE:
239
 
            _setcolor (_COLOR_GREEN);
240
 
 
241
 
            for (x = 0; x < nWidth; x++)
242
 
            {
243
 
                for (y = 0; y < nHeight; y++)
244
 
                {
245
 
                    if (pMatrix [x + y * nWidth] & MDCF_COLOR)
246
 
                    {
247
 
                        _rectangle (_GFILLINTERIOR,
248
 
                            (x       * nFactor - xLeft) / nScaling,
249
 
                            (y       * nFactor - yTop)  / nScaling,
250
 
                            ((x + 1) * nFactor - xLeft) / nScaling,
251
 
                            ((y + 1) * nFactor - yTop)  / nScaling);
252
 
                    }
253
 
                }
254
 
            }
255
 
 
256
 
            _getfillmask (OldMask);
257
 
            _setfillmask (Mask);
258
 
            _setcolor (_COLOR_BLACK);
259
 
 
260
 
            for (x = 0; x < nWidth; x++)
261
 
            {
262
 
                for (y = 0; y < nHeight; y++)
263
 
                {
264
 
                    if (pMatrix [x + y * nWidth] & MDCF_MASK)
265
 
                    {
266
 
                        _rectangle (_GFILLINTERIOR,
267
 
                            (x       * nFactor - xLeft) / nScaling,
268
 
                            (y       * nFactor - yTop)  / nScaling,
269
 
                            ((x + 1) * nFactor - xLeft) / nScaling,
270
 
                            ((y + 1) * nFactor - yTop)  / nScaling);
271
 
                    }
272
 
                }
273
 
            }
274
 
 
275
 
            _setfillmask (OldMask);
276
 
            break;
277
 
    }
278
 
 
279
 
    if (! bGrid)
280
 
        return;
281
 
 
282
 
    // ��������� �����. ���������� ��������� -- "���������".
283
 
    _setcolor (_COLOR_GRAY);
284
 
 
285
 
    for (x = 0; x < nWidth + 1; x++)
286
 
    {
287
 
        _moveto (
288
 
            (x          * nFactor - xLeft) / nScaling,
289
 
            (0          * nFactor - yTop)  / nScaling);
290
 
        _lineto (
291
 
            (x          * nFactor - xLeft) / nScaling,
292
 
            (nHeight * nFactor - yTop)  / nScaling);
293
 
    }
294
 
 
295
 
    for (y = 0; y < nHeight + 1; y++)
296
 
    {
297
 
        _moveto (
298
 
            (0      * nFactor - xLeft) / nScaling,
299
 
            (y      * nFactor - yTop)  / nScaling);
300
 
        _lineto (
301
 
            (nWidth * nFactor - xLeft) / nScaling,
302
 
            (y      * nFactor - yTop)  / nScaling);
303
 
    }
 
173
        int x, y;
 
174
        int nFactor;
 
175
        static char OldMask [8];
 
176
        //1000 0001, 0100 0010, 0010 0100, 0001 1000, -//-
 
177
        // - такая построчная развертка битовой буквы 'X':
 
178
        static char Mask [8] = {0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81};
 
179
 
 
180
        LT_GraphicsClearScreen ();
 
181
 
 
182
        if (nWidth == 0 || nHeight == 0 || pMatrix == NULL)
 
183
        return;
 
184
 
 
185
        // на деле получаем VIEW_WIDTH==1500-50*2==1400 (отступ от 1500 по 50 с двух сторон),
 
186
        // и при (nWidth==PAGE_MATRIX_WIDTH) nFactor=1400/1024 =1;
 
187
        nFactor = MIN (VIEW_WIDTH / nWidth, VIEW_HEIGHT / nHeight);
 
188
 
 
189
        _setcolor (_COLOR_BACKGROUND);
 
190
 
 
191
        //    _rectangle (_GBORDER, //не заливать границ
 
192
        //    //_rectangle (_GFILLINTERIOR,
 
193
        //        // оригинальный учет nFactor...
 
194
        //        (0          * nFactor - xLeft) / nScaling, //==0
 
195
        //        (0          * nFactor - yTop)  / nScaling, //==0
 
196
        //        (nWidth  * nFactor - xLeft) / nScaling,    //==1024
 
197
        //        (nHeight * nFactor - yTop)  / nScaling);   //==1024
 
198
 
 
199
        switch (DrawingMode)
 
200
        {
 
201
                case MATRIX_DRAWING_NATIVE_MODE:
 
202
                for (x = 0; x < nWidth; x++)
 
203
                {
 
204
                        for (y = 0; y < nHeight; y++) //from 0 to 1024...
 
205
                        {
 
206
                                if (pMatrix [x + y * nWidth] == 0) // --//--
 
207
                                {
 
208
                                        continue;
 
209
                                }
 
210
 
 
211
                                // NUMBER_TO_COLOR -- это отображение в 1..7
 
212
                                // (что как раз покрывает комбинацию PMC-флагов: root,dust,picture (1;2;4))
 
213
                                _setcolor
 
214
                                (NUMBER_TO_COLOR (pMatrix [x + y * nWidth] & 0xFF) & 7);
 
215
                                //                    _rectangle (_GFILLINTERIOR,
 
216
                                //                        (x       * nFactor - xLeft) / nScaling,
 
217
                                //                        (y       * nFactor - yTop)  / nScaling,
 
218
                                //                        ((x + 1) * nFactor - xLeft) / nScaling,
 
219
                                //                        ((y + 1) * nFactor - yTop)  / nScaling);
 
220
                                // точка -- это рез-т сжатия пр-ка
 
221
                                // в PAGE_COMP_FACTOR раз (XY_(UN)COMPRESS)
 
222
                                _rectangle (_GBORDER,
 
223
                                                XY_UNCOMPRESS( (x * nFactor - xLeft) / nScaling ),
 
224
                                                XY_UNCOMPRESS( (y * nFactor - yTop) / nScaling ),
 
225
                                                XY_UNCOMPRESS( ((x + 1) * nFactor - xLeft) / nScaling ),
 
226
                                                XY_UNCOMPRESS( ((y + 1) * nFactor - yTop) / nScaling )
 
227
                                );
 
228
                                // nFactor обычно (всегда?) == 1
 
229
                        }
 
230
                }
 
231
                break;
 
232
 
 
233
                case MATRIX_DRAWING_MASK_MODE:
 
234
                _setcolor (_COLOR_GREEN);
 
235
 
 
236
                for (x = 0; x < nWidth; x++)
 
237
                {
 
238
                        for (y = 0; y < nHeight; y++)
 
239
                        {
 
240
                                if (pMatrix [x + y * nWidth] & MDCF_COLOR)
 
241
                                {
 
242
                                        _rectangle (_GFILLINTERIOR,
 
243
                                                        (x * nFactor - xLeft) / nScaling,
 
244
                                                        (y * nFactor - yTop) / nScaling,
 
245
                                                        ((x + 1) * nFactor - xLeft) / nScaling,
 
246
                                                        ((y + 1) * nFactor - yTop) / nScaling);
 
247
                                }
 
248
                        }
 
249
                }
 
250
 
 
251
                _getfillmask (OldMask);
 
252
                _setfillmask (Mask);
 
253
                _setcolor (_COLOR_BLACK);
 
254
 
 
255
                for (x = 0; x < nWidth; x++)
 
256
                {
 
257
                        for (y = 0; y < nHeight; y++)
 
258
                        {
 
259
                                if (pMatrix [x + y * nWidth] & MDCF_MASK)
 
260
                                {
 
261
                                        _rectangle (_GFILLINTERIOR,
 
262
                                                        (x * nFactor - xLeft) / nScaling,
 
263
                                                        (y * nFactor - yTop) / nScaling,
 
264
                                                        ((x + 1) * nFactor - xLeft) / nScaling,
 
265
                                                        ((y + 1) * nFactor - yTop) / nScaling);
 
266
                                }
 
267
                        }
 
268
                }
 
269
 
 
270
                _setfillmask (OldMask);
 
271
                break;
 
272
        }
 
273
 
 
274
        if (! bGrid)
 
275
        return;
 
276
 
 
277
        // рисование сетки. нормальное состояние -- "выключено".
 
278
        _setcolor (_COLOR_GRAY);
 
279
 
 
280
        for (x = 0; x < nWidth + 1; x++)
 
281
        {
 
282
                _moveto (
 
283
                                (x * nFactor - xLeft) / nScaling,
 
284
                                (0 * nFactor - yTop) / nScaling);
 
285
                _lineto (
 
286
                                (x * nFactor - xLeft) / nScaling,
 
287
                                (nHeight * nFactor - yTop) / nScaling);
 
288
        }
 
289
 
 
290
        for (y = 0; y < nHeight + 1; y++)
 
291
        {
 
292
                _moveto (
 
293
                                (0 * nFactor - xLeft) / nScaling,
 
294
                                (y * nFactor - yTop) / nScaling);
 
295
                _lineto (
 
296
                                (nWidth * nFactor - xLeft) / nScaling,
 
297
                                (y * nFactor - yTop) / nScaling);
 
298
        }
304
299
}
305
300
 
306
301
static void BlockRectangle (BLOCK *p, short fill,
307
 
                            int xLeft, int yTop, int nScaling)
 
302
                int xLeft, int yTop, int nScaling)
308
303
{
309
 
    switch (p -> Type)
310
 
    {
311
 
        case BLOCK_NULL:
312
 
            return;
313
 
 
314
 
        case BLOCK_PICTURE:
315
 
        case BLOCK_TEXT:
316
 
            _rectangle (fill,
317
 
                (p -> Rect.xLeft   - xLeft) / nScaling,
318
 
                (p -> Rect.yTop    - yTop)  / nScaling,
319
 
                (p -> Rect.xRight  - xLeft) / nScaling,
320
 
                (p -> Rect.yBottom - yTop)  / nScaling);
321
 
            break;
322
 
 
323
 
        case BLOCK_HORZ_SEPARATOR:
324
 
        case BLOCK_VERT_SEPARATOR:
325
 
            _setcolor (_COLOR_BACKGROUND);
326
 
            _rectangle (_GBORDER,
327
 
                (p -> Rect.xLeft   - xLeft) / nScaling,
328
 
                (p -> Rect.yTop    - yTop)  / nScaling,
329
 
                (p -> Rect.xRight  - xLeft) / nScaling,
330
 
                (p -> Rect.yBottom - yTop)  / nScaling);
331
 
            break;
332
 
 
333
 
        case BLOCK_RECT_SEPARATOR:
334
 
            _setcolor (_COLOR_YELLOW);
335
 
            _rectangle (_GBORDER,
336
 
                (p -> Rect.xLeft   - xLeft) / nScaling + 3,
337
 
                (p -> Rect.yTop    - yTop)  / nScaling + 3,
338
 
                (p -> Rect.xRight  - xLeft) / nScaling - 3,
339
 
                (p -> Rect.yBottom - yTop)  / nScaling - 3);
340
 
            break;
341
 
    }
 
304
        switch (p -> Type)
 
305
        {
 
306
                case BLOCK_NULL:
 
307
                return;
 
308
 
 
309
                case BLOCK_PICTURE:
 
310
                case BLOCK_TEXT:
 
311
                _rectangle (fill,
 
312
                                (p -> Rect.xLeft - xLeft) / nScaling,
 
313
                                (p -> Rect.yTop - yTop) / nScaling,
 
314
                                (p -> Rect.xRight - xLeft) / nScaling,
 
315
                                (p -> Rect.yBottom - yTop) / nScaling);
 
316
                break;
 
317
 
 
318
                case BLOCK_HORZ_SEPARATOR:
 
319
                case BLOCK_VERT_SEPARATOR:
 
320
                _setcolor (_COLOR_BACKGROUND);
 
321
                _rectangle (_GBORDER,
 
322
                                (p -> Rect.xLeft - xLeft) / nScaling,
 
323
                                (p -> Rect.yTop - yTop) / nScaling,
 
324
                                (p -> Rect.xRight - xLeft) / nScaling,
 
325
                                (p -> Rect.yBottom - yTop) / nScaling);
 
326
                break;
 
327
 
 
328
                case BLOCK_RECT_SEPARATOR:
 
329
                _setcolor (_COLOR_YELLOW);
 
330
                _rectangle (_GBORDER,
 
331
                                (p -> Rect.xLeft - xLeft) / nScaling + 3,
 
332
                                (p -> Rect.yTop - yTop) / nScaling + 3,
 
333
                                (p -> Rect.xRight - xLeft) / nScaling - 3,
 
334
                                (p -> Rect.yBottom - yTop) / nScaling - 3);
 
335
                break;
 
336
        }
342
337
}
343
338
 
344
339
# define SEPOUT_LINE     0
346
341
# define SEPOUT_DASH_2   2
347
342
 
348
343
static void SeparatorOutput (SEPARATOR *pSep,
349
 
                             int nColor, int OutputMode,
350
 
                             int xLeft, int yTop, int nScaling)
 
344
                int nColor, int OutputMode,
 
345
                int xLeft, int yTop, int nScaling)
351
346
{
352
 
    if (pSep == NULL)
353
 
        return;
354
 
 
355
 
    _setcolor (nColor);
356
 
 
357
 
    switch (OutputMode)
358
 
    {
359
 
        case SEPOUT_LINE:   break;
360
 
        case SEPOUT_DASH_1: _setlinestyle (0xf0f0); break;
361
 
        case SEPOUT_DASH_2: _setlinestyle (0x0f0f); break;
362
 
    }
363
 
 
364
 
    switch (pSep -> Type)
365
 
    {
366
 
        default:
367
 
            break;
368
 
 
369
 
        case SEP_VERT:
370
 
        case SEP_HORZ:
371
 
            _moveto ((pSep -> xBegin - xLeft) / nScaling,
372
 
                     (pSep -> yBegin - yTop)  / nScaling);
373
 
            _lineto ((pSep -> xEnd   - xLeft) / nScaling,
374
 
                     (pSep -> yEnd   - yTop)  / nScaling);
375
 
            break;
376
 
 
377
 
        case SEP_RECT:
378
 
            _rectangle (_GBORDER,
379
 
                        (pSep -> xBegin - xLeft) / nScaling + 3,
380
 
                        (pSep -> yBegin - yTop)  / nScaling + 3,
381
 
                        (pSep -> xEnd   - xLeft) / nScaling - 3,
382
 
                        (pSep -> yEnd   - yTop)  / nScaling - 3);
383
 
            break;
384
 
    }
385
 
 
386
 
    _setlinestyle (0xffff);
 
347
        if (pSep == NULL)
 
348
        return;
 
349
 
 
350
        _setcolor (nColor);
 
351
 
 
352
        switch (OutputMode)
 
353
        {
 
354
                case SEPOUT_LINE: break;
 
355
                case SEPOUT_DASH_1: _setlinestyle (0xf0f0); break;
 
356
                case SEPOUT_DASH_2: _setlinestyle (0x0f0f); break;
 
357
        }
 
358
 
 
359
        switch (pSep -> Type)
 
360
        {
 
361
                default:
 
362
                break;
 
363
 
 
364
                case SEP_VERT:
 
365
                case SEP_HORZ:
 
366
                _moveto ((pSep -> xBegin - xLeft) / nScaling,
 
367
                                (pSep -> yBegin - yTop) / nScaling);
 
368
                _lineto ((pSep -> xEnd - xLeft) / nScaling,
 
369
                                (pSep -> yEnd - yTop) / nScaling);
 
370
                break;
 
371
 
 
372
                case SEP_RECT:
 
373
                _rectangle (_GBORDER,
 
374
                                (pSep -> xBegin - xLeft) / nScaling + 3,
 
375
                                (pSep -> yBegin - yTop) / nScaling + 3,
 
376
                                (pSep -> xEnd - xLeft) / nScaling - 3,
 
377
                                (pSep -> yEnd - yTop) / nScaling - 3);
 
378
                break;
 
379
        }
 
380
 
 
381
        _setlinestyle (0xffff);
387
382
}
388
383
 
389
384
static void SeparatorsOutput (int xLeft, int yTop, int nScaling)
390
385
{
391
 
    int i;
392
 
    int nColor;
393
 
 
394
 
    for (i = 0; i < nSeps; i++)
395
 
    {
396
 
        switch (pSeps [i].Type)
397
 
        {
398
 
            default:        continue;
399
 
            case SEP_VERT:  nColor = 15; break;
400
 
            case SEP_HORZ:  nColor = 15; break;
401
 
            case SEP_RECT:  nColor = 14; break;
402
 
        }
403
 
 
404
 
        SeparatorOutput (&pSeps[i], nColor, SEPOUT_LINE, xLeft, yTop, nScaling);
405
 
    }
 
386
        int i;
 
387
        int nColor;
 
388
 
 
389
        for (i = 0; i < nSeps; i++)
 
390
        {
 
391
                switch (pSeps [i].Type)
 
392
                {
 
393
                        default: continue;
 
394
                        case SEP_VERT: nColor = 15; break;
 
395
                        case SEP_HORZ: nColor = 15; break;
 
396
                        case SEP_RECT: nColor = 14; break;
 
397
                }
 
398
 
 
399
                SeparatorOutput (&pSeps[i], nColor, SEPOUT_LINE, xLeft, yTop, nScaling);
 
400
        }
406
401
}
407
402
 
408
403
static void RootsUpdate (int xLeft, int yTop, int nScaling)
409
404
{
410
 
    ROOT *pRoot;
411
 
 
412
 
    LT_GraphicsClearScreen ();
413
 
 
414
 
    for (pRoot = pRoots; pRoot < pAfterRoots; pRoot++)
415
 
    {
416
 
        int nColor = _COLOR_DGRAY;
417
 
 
418
 
        if (pRoot -> bType & ROOT_LETTER)       nColor |= 1; //=>BLUE
419
 
        if (pRoot -> bType & ROOT_RECOGNIZED)   nColor |= 2; //=>GREEN
420
 
        if (IS_LAYOUT_DUST (*pRoot))            nColor |= 4; //=>RED
421
 
 
422
 
        if (pRoot -> bType & ROOT_DEBUG)        nColor = _COLOR_YELLOW;
423
 
 
424
 
        _setcolor (nColor);
425
 
 
426
 
        _rectangle (_GBORDER, //_GFILLINTERIOR,
427
 
            (pRoot -> xColumn - xLeft) / nScaling,
428
 
            (pRoot -> yRow    - yTop)  / nScaling,
429
 
            (pRoot -> xColumn + pRoot ->nWidth  - 1 - xLeft) / nScaling,
430
 
            (pRoot -> yRow    + pRoot ->nHeight - 1 - yTop)  / nScaling);
431
 
    }
432
 
 
433
 
    SeparatorsOutput (xLeft, yTop, nScaling);
 
405
        ROOT *pRoot;
 
406
 
 
407
        LT_GraphicsClearScreen ();
 
408
 
 
409
        for (pRoot = pRoots; pRoot < pAfterRoots; pRoot++)
 
410
        {
 
411
                int nColor = _COLOR_DGRAY;
 
412
 
 
413
                if (pRoot -> bType & ROOT_LETTER) nColor |= 1; //=>BLUE
 
414
                if (pRoot -> bType & ROOT_RECOGNIZED) nColor |= 2; //=>GREEN
 
415
                if (IS_LAYOUT_DUST (*pRoot)) nColor |= 4; //=>RED
 
416
 
 
417
                if (pRoot -> bType & ROOT_DEBUG) nColor = _COLOR_YELLOW;
 
418
 
 
419
                _setcolor (nColor);
 
420
 
 
421
                _rectangle (_GBORDER, //_GFILLINTERIOR,
 
422
                                (pRoot -> xColumn - xLeft) / nScaling,
 
423
                                (pRoot -> yRow - yTop) / nScaling,
 
424
                                (pRoot -> xColumn + pRoot ->nWidth - 1 - xLeft) / nScaling,
 
425
                                (pRoot -> yRow + pRoot ->nHeight - 1 - yTop) / nScaling);
 
426
        }
 
427
 
 
428
        SeparatorsOutput (xLeft, yTop, nScaling);
434
429
}
435
430
 
436
431
static void RootStripsUpdate (int xLeft, int yTop, int nScaling)
437
432
{
438
 
    int iStrip;
439
 
    ROOT *pRoot;
440
 
    int nShift;
441
 
 
442
 
    LT_GraphicsClearScreen ();
443
 
 
444
 
    for (iStrip = 0; iStrip < nRootStrips; iStrip++)
445
 
    {
446
 
        _setcolor (NUMBER_TO_COLOR (iStrip) | 8);
447
 
        nShift = (iStrip % 3) * 2;
448
 
 
449
 
        _moveto
450
 
        (
451
 
            0,
452
 
            (iStrip * nRootStripsStep + nRootStripsOffset
453
 
                - yTop) / nScaling + 1
454
 
        );
455
 
 
456
 
        _lineto
457
 
        (
458
 
            SCREEN_WIDTH,
459
 
            (iStrip * nRootStripsStep + nRootStripsOffset
460
 
                - yTop) / nScaling + 1
461
 
        );
462
 
 
463
 
        _moveto
464
 
        (
465
 
            0,
466
 
            ((iStrip + 1) * nRootStripsStep + nRootStripsOffset
467
 
                - yTop) / nScaling - 1
468
 
        );
469
 
 
470
 
        _lineto
471
 
        (
472
 
            SCREEN_WIDTH,
473
 
            ((iStrip + 1) * nRootStripsStep + nRootStripsOffset
474
 
                - yTop) / nScaling - 1
475
 
        );
476
 
 
477
 
        if (pRootStrips [iStrip].pBegin == NULL)
478
 
            continue;
479
 
 
480
 
        for (pRoot = pRootStrips [iStrip].pBegin;
481
 
                 pRoot <= pRootStrips [iStrip].pEnd;
482
 
                     pRoot++)
483
 
        {
484
 
            _rectangle (_GBORDER,
485
 
                (pRoot -> xColumn
486
 
                    - xLeft) / nScaling + nShift,
487
 
                (pRoot -> yRow
488
 
                    - yTop)  / nScaling + nShift,
489
 
                (pRoot -> xColumn + pRoot -> nWidth  - 1
490
 
                    - xLeft) / nScaling + nShift,
491
 
                (pRoot -> yRow    + pRoot -> nHeight - 1
492
 
                    - yTop)  / nScaling + nShift);
493
 
        }
494
 
/*
495
 
        for (pRoot = pRoots; pRoot < pAfterRoots; pRoot++)
496
 
        {
497
 
            if ((pRoot -> yRow
498
 
                 - nRootStripsOffset) / nRootStripsStep > iStrip
499
 
                 ||
500
 
                (pRoot -> yRow + pRoot -> nHeight - 1
501
 
                 - nRootStripsOffset) / nRootStripsStep < iStrip)
502
 
            {
503
 
                continue;
504
 
            }
505
 
 
506
 
            _rectangle (_GBORDER,
507
 
                (pRoot -> xColumn
508
 
                    - xLeft) / nScaling + nShift,
509
 
                (pRoot -> yRow
510
 
                    - yTop)  / nScaling + nShift,
511
 
                (pRoot -> xColumn + pRoot -> nWidth  - 1
512
 
                    - xLeft) / nScaling + nShift,
513
 
                (pRoot -> yRow    + pRoot -> nHeight - 1
514
 
                    - yTop)  / nScaling + nShift);
515
 
        }
516
 
*/
517
 
    }
 
433
        int iStrip;
 
434
        ROOT *pRoot;
 
435
        int nShift;
 
436
 
 
437
        LT_GraphicsClearScreen ();
 
438
 
 
439
        for (iStrip = 0; iStrip < nRootStrips; iStrip++)
 
440
        {
 
441
                _setcolor (NUMBER_TO_COLOR (iStrip) | 8);
 
442
                nShift = (iStrip % 3) * 2;
 
443
 
 
444
                _moveto
 
445
                (
 
446
                                0,
 
447
                                (iStrip * nRootStripsStep + nRootStripsOffset
 
448
                                                - yTop) / nScaling + 1
 
449
                );
 
450
 
 
451
                _lineto
 
452
                (
 
453
                                SCREEN_WIDTH,
 
454
                                (iStrip * nRootStripsStep + nRootStripsOffset
 
455
                                                - yTop) / nScaling + 1
 
456
                );
 
457
 
 
458
                _moveto
 
459
                (
 
460
                                0,
 
461
                                ((iStrip + 1) * nRootStripsStep + nRootStripsOffset
 
462
                                                - yTop) / nScaling - 1
 
463
                );
 
464
 
 
465
                _lineto
 
466
                (
 
467
                                SCREEN_WIDTH,
 
468
                                ((iStrip + 1) * nRootStripsStep + nRootStripsOffset
 
469
                                                - yTop) / nScaling - 1
 
470
                );
 
471
 
 
472
                if (pRootStrips [iStrip].pBegin == NULL)
 
473
                continue;
 
474
 
 
475
                for (pRoot = pRootStrips [iStrip].pBegin;
 
476
                                pRoot <= pRootStrips [iStrip].pEnd;
 
477
                                pRoot++)
 
478
                {
 
479
                        _rectangle (_GBORDER,
 
480
                                        (pRoot -> xColumn
 
481
                                                        - xLeft) / nScaling + nShift,
 
482
                                        (pRoot -> yRow
 
483
                                                        - yTop) / nScaling + nShift,
 
484
                                        (pRoot -> xColumn + pRoot -> nWidth - 1
 
485
                                                        - xLeft) / nScaling + nShift,
 
486
                                        (pRoot -> yRow + pRoot -> nHeight - 1
 
487
                                                        - yTop) / nScaling + nShift);
 
488
                }
 
489
                /*
 
490
                 for (pRoot = pRoots; pRoot < pAfterRoots; pRoot++)
 
491
                 {
 
492
                 if ((pRoot -> yRow
 
493
                 - nRootStripsOffset) / nRootStripsStep > iStrip
 
494
                 ||
 
495
                 (pRoot -> yRow + pRoot -> nHeight - 1
 
496
                 - nRootStripsOffset) / nRootStripsStep < iStrip)
 
497
                 {
 
498
                 continue;
 
499
                 }
 
500
 
 
501
                 _rectangle (_GBORDER,
 
502
                 (pRoot -> xColumn
 
503
                 - xLeft) / nScaling + nShift,
 
504
                 (pRoot -> yRow
 
505
                 - yTop)  / nScaling + nShift,
 
506
                 (pRoot -> xColumn + pRoot -> nWidth  - 1
 
507
                 - xLeft) / nScaling + nShift,
 
508
                 (pRoot -> yRow    + pRoot -> nHeight - 1
 
509
                 - yTop)  / nScaling + nShift);
 
510
                 }
 
511
                 */
 
512
        }
518
513
}
519
514
 
520
515
static void PageMatrixUpdate (int xLeft, int yTop, int nScaling)
521
516
{
522
 
    MatrixUpdate
523
 
    (
524
 
        xLeft,
525
 
        yTop,
526
 
        nScaling,
527
 
        PageMatrix,
528
 
        PAGE_MATRIX_WIDTH,  // 1024
529
 
        PAGE_MATRIX_HEIGHT, // 1024 (������� �����)
530
 
        FALSE, // BOOL bGrid
531
 
        MATRIX_DRAWING_NATIVE_MODE // ����� ���������, ���� �� ���� (18.10.01)
532
 
    );
 
517
        MatrixUpdate
 
518
        (
 
519
                        xLeft,
 
520
                        yTop,
 
521
                        nScaling,
 
522
                        PageMatrix,
 
523
                        PAGE_MATRIX_WIDTH, // 1024
 
524
                        PAGE_MATRIX_HEIGHT, // 1024 (квадрат такой)
 
525
                        FALSE, // Bool bGrid
 
526
                        MATRIX_DRAWING_NATIVE_MODE // режим рисования, один из двух (18.10.01)
 
527
        );
533
528
}
534
529
 
535
530
static void BlocksUpdate (int xLeft, int yTop, int nScaling)
536
531
{
537
 
    BLOCK *p;
538
 
    ROOT *pRoot;
539
 
    int  nColor;
540
 
 
541
 
    LT_GraphicsClearScreen ();
542
 
 
543
 
    for (p = pBlocksList; p != NULL; p = p -> pNext)
544
 
    {
545
 
        nColor = NUMBER_TO_COLOR (p -> nNumber) |
546
 
                 (((p -> uFlags & BF_NOT_BREAK_BLOCK) != 0) << 3);
547
 
 
548
 
        _setcolor (nColor);
549
 
        BlockRectangle (p, _GBORDER, xLeft, yTop, nScaling);
550
 
 
551
 
        SeparatorOutput (p -> pUpSep,    nColor, SEPOUT_DASH_1, xLeft, yTop, nScaling);
552
 
        SeparatorOutput (p -> pDownSep,  nColor, SEPOUT_DASH_2, xLeft, yTop, nScaling);
553
 
        SeparatorOutput (p -> pLeftSep,  nColor, SEPOUT_DASH_1, xLeft, yTop, nScaling);
554
 
        SeparatorOutput (p -> pRightSep, nColor, SEPOUT_DASH_2, xLeft, yTop, nScaling);
555
 
    }
556
 
 
557
 
    for (pRoot = pRoots; pRoot < pAfterRoots; pRoot++)
558
 
    {
559
 
        if (pRoot -> nBlock == REMOVED_BLOCK_NUMBER)
560
 
        {
561
 
/*
562
 
            _setcolor (14);
563
 
 
564
 
            _rectangle (_GBORDER,
565
 
                (pRoot -> xColumn - xLeft) / nScaling,
566
 
                (pRoot -> yRow    - yTop)  / nScaling,
567
 
                (pRoot -> xColumn + pRoot ->nWidth  - 1
568
 
                                        - xLeft) / nScaling,
569
 
                (pRoot -> yRow    + pRoot ->nHeight - 1
570
 
                                        - yTop)  / nScaling);
571
 
*/
572
 
        }
573
 
        else
574
 
        {
575
 
            if (pRoot -> nBlock == DUST_BLOCK_NUMBER)
576
 
                _setcolor (_COLOR_BACKGROUND);
577
 
            else
578
 
                _setcolor (NUMBER_TO_COLOR (pRoot -> nBlock));
579
 
 
580
 
            _rectangle (_GBORDER,//_GFILLINTERIOR,
581
 
                (pRoot -> xColumn - xLeft) / nScaling,
582
 
                (pRoot -> yRow    - yTop)  / nScaling,
583
 
                (pRoot -> xColumn + pRoot ->nWidth  - 1
584
 
                                        - xLeft) / nScaling,
585
 
                (pRoot -> yRow    + pRoot ->nHeight - 1
586
 
                                        - yTop)  / nScaling);
587
 
        }
588
 
    }
 
532
        BLOCK *p;
 
533
        ROOT *pRoot;
 
534
        int nColor;
 
535
 
 
536
        LT_GraphicsClearScreen ();
 
537
 
 
538
        for (p = pBlocksList; p != NULL; p = p -> pNext)
 
539
        {
 
540
                nColor = NUMBER_TO_COLOR (p -> nNumber) |
 
541
                (((p -> uFlags & BF_NOT_BREAK_BLOCK) != 0) << 3);
 
542
 
 
543
                _setcolor (nColor);
 
544
                BlockRectangle (p, _GBORDER, xLeft, yTop, nScaling);
 
545
 
 
546
                SeparatorOutput (p -> pUpSep, nColor, SEPOUT_DASH_1, xLeft, yTop, nScaling);
 
547
                SeparatorOutput (p -> pDownSep, nColor, SEPOUT_DASH_2, xLeft, yTop, nScaling);
 
548
                SeparatorOutput (p -> pLeftSep, nColor, SEPOUT_DASH_1, xLeft, yTop, nScaling);
 
549
                SeparatorOutput (p -> pRightSep, nColor, SEPOUT_DASH_2, xLeft, yTop, nScaling);
 
550
        }
 
551
 
 
552
        for (pRoot = pRoots; pRoot < pAfterRoots; pRoot++)
 
553
        {
 
554
                if (pRoot -> nBlock == REMOVED_BLOCK_NUMBER)
 
555
                {
 
556
                        /*
 
557
                         _setcolor (14);
 
558
 
 
559
                         _rectangle (_GBORDER,
 
560
                         (pRoot -> xColumn - xLeft) / nScaling,
 
561
                         (pRoot -> yRow    - yTop)  / nScaling,
 
562
                         (pRoot -> xColumn + pRoot ->nWidth  - 1
 
563
                         - xLeft) / nScaling,
 
564
                         (pRoot -> yRow    + pRoot ->nHeight - 1
 
565
                         - yTop)  / nScaling);
 
566
                         */
 
567
                }
 
568
                else
 
569
                {
 
570
                        if (pRoot -> nBlock == DUST_BLOCK_NUMBER)
 
571
                        _setcolor (_COLOR_BACKGROUND);
 
572
                        else
 
573
                        _setcolor (NUMBER_TO_COLOR (pRoot -> nBlock));
 
574
 
 
575
                        _rectangle (_GBORDER,//_GFILLINTERIOR,
 
576
                                        (pRoot -> xColumn - xLeft) / nScaling,
 
577
                                        (pRoot -> yRow - yTop) / nScaling,
 
578
                                        (pRoot -> xColumn + pRoot ->nWidth - 1
 
579
                                                        - xLeft) / nScaling,
 
580
                                        (pRoot -> yRow + pRoot ->nHeight - 1
 
581
                                                        - yTop) / nScaling);
 
582
                }
 
583
        }
589
584
}
590
585
 
591
586
static void HystogramUpdate (int xLeft, int yTop, int nScaling)
592
587
{
593
 
    char szBuffer [32];
594
 
    int i;
595
 
    int nMaxValue;
596
 
    int iMaxColumn;
597
 
    struct textsettings ts;
598
 
    int nCharHeight;
 
588
        char szBuffer [32];
 
589
        int i;
 
590
        int nMaxValue;
 
591
        int iMaxColumn;
 
592
        struct textsettings ts;
 
593
        int nCharHeight;
599
594
        ROOT *pRoot;//Rom
600
595
 
601
 
    LT_GraphicsClearScreen ();
 
596
        LT_GraphicsClearScreen ();
602
597
 
603
 
    nMaxValue  = 0;
604
 
    iMaxColumn = 0;
 
598
        nMaxValue = 0;
 
599
        iMaxColumn = 0;
605
600
 
606
601
        /**/
607
602
        for (pRoot = pRoots; pRoot < pAfterRoots; pRoot++)
608
 
    {
 
603
        {
609
604
                if(pRoot->nBlock == pDebugBlock->nNumber)
610
605
                {
611
606
                        int nColor = 8;
612
607
 
613
 
                        if (pRoot -> bType & ROOT_LETTER)       nColor |= 1;
614
 
                        if (pRoot -> bType & ROOT_RECOGNIZED)   nColor |= 2;
615
 
                        if (IS_LAYOUT_DUST (*pRoot))            nColor |= 4;
 
608
                        if (pRoot -> bType & ROOT_LETTER) nColor |= 1;
 
609
                        if (pRoot -> bType & ROOT_RECOGNIZED) nColor |= 2;
 
610
                        if (IS_LAYOUT_DUST (*pRoot)) nColor |= 4;
616
611
 
617
 
                        if (pRoot -> bType & ROOT_DEBUG)        nColor = 14;
 
612
                        if (pRoot -> bType & ROOT_DEBUG) nColor = 14;
618
613
 
619
614
                        _setcolor (nColor);
620
615
 
621
616
                        _rectangle (_GFILLINTERIOR,
622
 
                                (pRoot -> xColumn - xLeft) / nScaling,
623
 
                                (pRoot -> yRow    - yTop)  / nScaling,
624
 
                                (pRoot -> xColumn + pRoot ->nWidth  - 1 - xLeft) / nScaling,
625
 
                                (pRoot -> yRow    + pRoot ->nHeight - 1 - yTop)  / nScaling);
 
617
                                        (pRoot -> xColumn - xLeft) / nScaling,
 
618
                                        (pRoot -> yRow - yTop) / nScaling,
 
619
                                        (pRoot -> xColumn + pRoot ->nWidth - 1 - xLeft) / nScaling,
 
620
                                        (pRoot -> yRow + pRoot ->nHeight - 1 - yTop) / nScaling);
626
621
                }
627
 
    }
 
622
        }
628
623
        /**/
629
624
 
630
 
    for (i = 0; i < nHystColumns; i++)
631
 
    {
632
 
        if (nMaxValue < pHystogram [i])
633
 
        {
634
 
            nMaxValue  = pHystogram [i];
635
 
            iMaxColumn = i;
636
 
        }
637
 
    }
638
 
 
639
 
    if (nMaxValue < 10)
640
 
        nMaxValue = 10;
641
 
 
642
 
    _gettextsettings (&ts);
643
 
 
644
 
    for (i = 0; i < nHystColumns; i++)
645
 
    {
646
 
        if (pHystogram [i] == 0)
647
 
        {
648
 
/*
649
 
            _setcolor (12);
650
 
 
651
 
            _rectangle (_GFILLINTERIOR,
652
 
                (i * VIEW_WIDTH / nHystColumns + VIEW_LEFT
653
 
                                                     - xLeft) / nScaling,
654
 
                (VIEW_TOP
655
 
                                                     - yTop)  / nScaling,
656
 
                ((i + 1) * VIEW_WIDTH / nHystColumns + VIEW_LEFT
657
 
                                                     - xLeft) / nScaling,
658
 
                (VIEW_BOTTOM
659
 
                                                     - yTop)  / nScaling);
660
 
*/
661
 
        }
662
 
        else
663
 
        {
664
 
            _setcolor (_COLOR_BLUE);
665
 
 
666
 
            _rectangle (_GFILLINTERIOR,
667
 
                (i * VIEW_WIDTH / nHystColumns + VIEW_LEFT
668
 
                                                     - xLeft) / nScaling,
669
 
                (VIEW_BOTTOM - pHystogram [i] * VIEW_HEIGHT / nMaxValue
670
 
                                                     - yTop)  / nScaling,
671
 
                ((i + 1) * VIEW_WIDTH / nHystColumns + VIEW_LEFT
672
 
                                                     - xLeft) / nScaling,
673
 
                (VIEW_BOTTOM
674
 
                                                     - yTop)  / nScaling);
675
 
        }
676
 
    }
677
 
 
678
 
    _setcolor (_COLOR_RED);
679
 
 
680
 
    _moveto (((xDebugVertLine - pDebugBlock -> Rect.xLeft)
681
 
                  * VIEW_WIDTH / nHystColumns
682
 
                        + VIEW_WIDTH / nHystColumns / 2
683
 
                        + VIEW_LEFT
684
 
                        - xLeft) / nScaling, 0);
685
 
    _lineto (((xDebugVertLine - pDebugBlock -> Rect.xLeft)
686
 
                  * VIEW_WIDTH / nHystColumns
687
 
                        + VIEW_WIDTH / nHystColumns / 2
688
 
                        + VIEW_LEFT
689
 
                        - xLeft) / nScaling, SCREEN_HEIGHT);
690
 
 
691
 
    _setcolor (_COLOR_BACKGROUND);
692
 
    _settextalign (_RIGHT, _TOP);
693
 
    nCharHeight = VIEW_HEIGHT / 10 / nScaling / 2;
694
 
    _setcharsize (nCharHeight, nCharHeight / 2);
695
 
 
696
 
    for (i = 0; i < nMaxValue - nMaxValue / 20; i += MAX (nMaxValue / 10, 1))
697
 
    {
698
 
        _moveto ((VIEW_LEFT                                 - xLeft)/ nScaling,
699
 
                 (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling);
700
 
        _lineto ((VIEW_RIGHT                                - xLeft)/ nScaling,
701
 
                 (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling);
702
 
 
703
 
        if (i != 0)
704
 
        {
705
 
            sprintf (szBuffer, "%d\n", i);
706
 
            _grtext ((VIEW_LEFT - xLeft) / nScaling,
707
 
                (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling,
708
 
                 szBuffer);
709
 
        }
710
 
    }
711
 
 
712
 
    sprintf (szBuffer, "%d\n", nMaxValue);
713
 
    _grtext ((VIEW_LEFT - xLeft) / nScaling,
714
 
             (VIEW_TOP  - yTop)  / nScaling,
715
 
             szBuffer);
716
 
 
717
 
    _rectangle (_GBORDER,
718
 
                (VIEW_LEFT   - xLeft) / nScaling,
719
 
                (VIEW_TOP    - yTop)  / nScaling,
720
 
                (VIEW_RIGHT  - xLeft) / nScaling,
721
 
                (VIEW_BOTTOM - yTop)  / nScaling);
722
 
 
723
 
    _setcharsize (ts.height, ts.width);
 
625
        for (i = 0; i < nHystColumns; i++)
 
626
        {
 
627
                if (nMaxValue < pHystogram [i])
 
628
                {
 
629
                        nMaxValue = pHystogram [i];
 
630
                        iMaxColumn = i;
 
631
                }
 
632
        }
 
633
 
 
634
        if (nMaxValue < 10)
 
635
        nMaxValue = 10;
 
636
 
 
637
        _gettextsettings (&ts);
 
638
 
 
639
        for (i = 0; i < nHystColumns; i++)
 
640
        {
 
641
                if (pHystogram [i] == 0)
 
642
                {
 
643
                        /*
 
644
                         _setcolor (12);
 
645
 
 
646
                         _rectangle (_GFILLINTERIOR,
 
647
                         (i * VIEW_WIDTH / nHystColumns + VIEW_LEFT
 
648
                         - xLeft) / nScaling,
 
649
                         (VIEW_TOP
 
650
                         - yTop)  / nScaling,
 
651
                         ((i + 1) * VIEW_WIDTH / nHystColumns + VIEW_LEFT
 
652
                         - xLeft) / nScaling,
 
653
                         (VIEW_BOTTOM
 
654
                         - yTop)  / nScaling);
 
655
                         */
 
656
                }
 
657
                else
 
658
                {
 
659
                        _setcolor (_COLOR_BLUE);
 
660
 
 
661
                        _rectangle (_GFILLINTERIOR,
 
662
                                        (i * VIEW_WIDTH / nHystColumns + VIEW_LEFT
 
663
                                                        - xLeft) / nScaling,
 
664
                                        (VIEW_BOTTOM - pHystogram [i] * VIEW_HEIGHT / nMaxValue
 
665
                                                        - yTop) / nScaling,
 
666
                                        ((i + 1) * VIEW_WIDTH / nHystColumns + VIEW_LEFT
 
667
                                                        - xLeft) / nScaling,
 
668
                                        (VIEW_BOTTOM
 
669
                                                        - yTop) / nScaling);
 
670
                }
 
671
        }
 
672
 
 
673
        _setcolor (_COLOR_RED);
 
674
 
 
675
        _moveto (((xDebugVertLine - pDebugBlock -> Rect.xLeft)
 
676
                                        * VIEW_WIDTH / nHystColumns
 
677
                                        + VIEW_WIDTH / nHystColumns / 2
 
678
                                        + VIEW_LEFT
 
679
                                        - xLeft) / nScaling, 0);
 
680
        _lineto (((xDebugVertLine - pDebugBlock -> Rect.xLeft)
 
681
                                        * VIEW_WIDTH / nHystColumns
 
682
                                        + VIEW_WIDTH / nHystColumns / 2
 
683
                                        + VIEW_LEFT
 
684
                                        - xLeft) / nScaling, SCREEN_HEIGHT);
 
685
 
 
686
        _setcolor (_COLOR_BACKGROUND);
 
687
        _settextalign (_RIGHT, _TOP);
 
688
        nCharHeight = VIEW_HEIGHT / 10 / nScaling / 2;
 
689
        _setcharsize (nCharHeight, nCharHeight / 2);
 
690
 
 
691
        for (i = 0; i < nMaxValue - nMaxValue / 20; i += MAX (nMaxValue / 10, 1))
 
692
        {
 
693
                _moveto ((VIEW_LEFT - xLeft)/ nScaling,
 
694
                                (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling);
 
695
                _lineto ((VIEW_RIGHT - xLeft)/ nScaling,
 
696
                                (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling);
 
697
 
 
698
                if (i != 0)
 
699
                {
 
700
                        sprintf (szBuffer, "%d\n", i);
 
701
                        _grtext ((VIEW_LEFT - xLeft) / nScaling,
 
702
                                        (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling,
 
703
                                        szBuffer);
 
704
                }
 
705
        }
 
706
 
 
707
        sprintf (szBuffer, "%d\n", nMaxValue);
 
708
        _grtext ((VIEW_LEFT - xLeft) / nScaling,
 
709
                        (VIEW_TOP - yTop) / nScaling,
 
710
                        szBuffer);
 
711
 
 
712
        _rectangle (_GBORDER,
 
713
                        (VIEW_LEFT - xLeft) / nScaling,
 
714
                        (VIEW_TOP - yTop) / nScaling,
 
715
                        (VIEW_RIGHT - xLeft) / nScaling,
 
716
                        (VIEW_BOTTOM - yTop) / nScaling);
 
717
 
 
718
        _setcharsize (ts.height, ts.width);
724
719
}
725
720
 
726
721
static void SpecialCuttingUpdate (int xLeft, int yTop, int nScaling)
727
722
{
728
 
    int i;
729
 
    int nWidth  = pDebugBlock -> Rect.xRight  - pDebugBlock -> Rect.xLeft + 1;
730
 
    int nHeight = pDebugBlock -> Rect.yBottom - pDebugBlock -> Rect.yTop  + 1;
731
 
    int nFactor;
732
 
 
733
 
    LT_GraphicsClearScreen ();
734
 
 
735
 
    if (nWidth == 0 || nHeight == 0)
736
 
        return;
737
 
 
738
 
    nFactor = MIN (VIEW_WIDTH / nWidth, VIEW_HEIGHT / nHeight);
739
 
 
740
 
    _setcolor (_COLOR_BLUE);
741
 
    _rectangle
742
 
    (
743
 
        _GBORDER,
744
 
        0,
745
 
        0,
746
 
        ((nWidth  - 1) * nFactor - xLeft) / nScaling,
747
 
        ((nHeight - 1) * nFactor - yTop)  / nScaling
748
 
    );
749
 
 
750
 
    for (i = 0; i < nHystColumns; i++)
751
 
    {
752
 
        if (pHystBottoms [i] == -1)
753
 
            continue;
754
 
 
755
 
        if (pDebugBlock -> pHorzHystogram [pHystTops [i] - 1] == 0)
756
 
            _setcolor (_COLOR_RED);
757
 
        else
758
 
            _setcolor (_COLOR_BLUE);
759
 
 
760
 
        _rectangle
761
 
        (
762
 
            _GFILLINTERIOR,
763
 
            (i                * nFactor - xLeft) / nScaling,
764
 
            (pHystTops [i]    * nFactor - yTop)  / nScaling,
765
 
            ((i + 1)          * nFactor - xLeft) / nScaling - 1,
766
 
            (pHystBottoms [i] * nFactor - yTop)  / nScaling
767
 
        );
768
 
    }
 
723
        int i;
 
724
        int nWidth = pDebugBlock -> Rect.xRight - pDebugBlock -> Rect.xLeft + 1;
 
725
        int nHeight = pDebugBlock -> Rect.yBottom - pDebugBlock -> Rect.yTop + 1;
 
726
        int nFactor;
 
727
 
 
728
        LT_GraphicsClearScreen ();
 
729
 
 
730
        if (nWidth == 0 || nHeight == 0)
 
731
        return;
 
732
 
 
733
        nFactor = MIN (VIEW_WIDTH / nWidth, VIEW_HEIGHT / nHeight);
 
734
 
 
735
        _setcolor (_COLOR_BLUE);
 
736
        _rectangle
 
737
        (
 
738
                        _GBORDER,
 
739
                        0,
 
740
                        0,
 
741
                        ((nWidth - 1) * nFactor - xLeft) / nScaling,
 
742
                        ((nHeight - 1) * nFactor - yTop) / nScaling
 
743
        );
 
744
 
 
745
        for (i = 0; i < nHystColumns; i++)
 
746
        {
 
747
                if (pHystBottoms [i] == -1)
 
748
                continue;
 
749
 
 
750
                if (pDebugBlock -> pHorzHystogram [pHystTops [i] - 1] == 0)
 
751
                _setcolor (_COLOR_RED);
 
752
                else
 
753
                _setcolor (_COLOR_BLUE);
 
754
 
 
755
                _rectangle
 
756
                (
 
757
                                _GFILLINTERIOR,
 
758
                                (i * nFactor - xLeft) / nScaling,
 
759
                                (pHystTops [i] * nFactor - yTop) / nScaling,
 
760
                                ((i + 1) * nFactor - xLeft) / nScaling - 1,
 
761
                                (pHystBottoms [i] * nFactor - yTop) / nScaling
 
762
                );
 
763
        }
769
764
}
770
765
 
771
766
static void SB_MatrixUpdate (int xLeft, int yTop, int nScaling)
772
767
{
773
 
    int nFactor;
774
 
    ROOT *pRoot;
775
 
 
776
 
    nFactor = MIN (VIEW_WIDTH / nSB_Width, VIEW_HEIGHT / nSB_Height);
777
 
 
778
 
    MatrixUpdate
779
 
    (
780
 
        xLeft,
781
 
        yTop,
782
 
        nScaling,
783
 
        pSB_Matrix,
784
 
        nSB_Width,
785
 
        nSB_Height,
786
 
        TRUE,
787
 
        MATRIX_DRAWING_NATIVE_MODE
788
 
    );
789
 
 
790
 
    _setcolor (NUMBER_TO_COLOR (1) | 8);
791
 
 
792
 
    for (pRoot = pDebugBlock -> pRoots; pRoot != NULL; pRoot = pRoot -> u1.pNext)
793
 
    {
794
 
        _rectangle (_GFILLINTERIOR,
795
 
            ((pRoot -> xColumn
796
 
                - pDebugBlock -> Rect.xLeft)  * nFactor/ nSB_CellWidth
797
 
                - xLeft) / nScaling,
798
 
            ((pRoot -> yRow
799
 
                - pDebugBlock -> Rect.yTop)   * nFactor/ nSB_CellHeight
800
 
                - yTop)  / nScaling,
801
 
            ((pRoot -> xColumn + pRoot -> nWidth  - 1
802
 
                - pDebugBlock -> Rect.xLeft)  * nFactor/ nSB_CellWidth
803
 
                - xLeft) / nScaling,
804
 
            ((pRoot -> yRow    + pRoot -> nHeight - 1
805
 
                - pDebugBlock -> Rect.yTop)   * nFactor/ nSB_CellHeight
806
 
                - yTop)  / nScaling);
807
 
    }
 
768
        int nFactor;
 
769
        ROOT *pRoot;
 
770
 
 
771
        nFactor = MIN (VIEW_WIDTH / nSB_Width, VIEW_HEIGHT / nSB_Height);
 
772
 
 
773
        MatrixUpdate
 
774
        (
 
775
                        xLeft,
 
776
                        yTop,
 
777
                        nScaling,
 
778
                        pSB_Matrix,
 
779
                        nSB_Width,
 
780
                        nSB_Height,
 
781
                        TRUE,
 
782
                        MATRIX_DRAWING_NATIVE_MODE
 
783
        );
 
784
 
 
785
        _setcolor (NUMBER_TO_COLOR (1) | 8);
 
786
 
 
787
        for (pRoot = pDebugBlock -> pRoots; pRoot != NULL; pRoot = pRoot -> u1.pNext)
 
788
        {
 
789
                _rectangle (_GFILLINTERIOR,
 
790
                                ((pRoot -> xColumn
 
791
                                                                - pDebugBlock -> Rect.xLeft) * nFactor/ nSB_CellWidth
 
792
                                                - xLeft) / nScaling,
 
793
                                ((pRoot -> yRow
 
794
                                                                - pDebugBlock -> Rect.yTop) * nFactor/ nSB_CellHeight
 
795
                                                - yTop) / nScaling,
 
796
                                ((pRoot -> xColumn + pRoot -> nWidth - 1
 
797
                                                                - pDebugBlock -> Rect.xLeft) * nFactor/ nSB_CellWidth
 
798
                                                - xLeft) / nScaling,
 
799
                                ((pRoot -> yRow + pRoot -> nHeight - 1
 
800
                                                                - pDebugBlock -> Rect.yTop) * nFactor/ nSB_CellHeight
 
801
                                                - yTop) / nScaling);
 
802
        }
808
803
}
809
804
 
810
805
static void WSB_HystogramUpdate
811
806
(
812
 
    int xLeft,
813
 
    int yTop,
814
 
    int nScaling,
815
 
    int * pWSB_Hyst,
816
 
    int nMaxValue
 
807
                int xLeft,
 
808
                int yTop,
 
809
                int nScaling,
 
810
                int * pWSB_Hyst,
 
811
                int nMaxValue
817
812
)
818
813
{
819
 
    int i;
820
 
    char szBuffer [32];
821
 
    struct textsettings ts;
822
 
    int nCharHeight;
823
 
 
824
 
    LT_GraphicsClearScreen ();
825
 
 
826
 
    _setcolor (_COLOR_RED);
827
 
 
828
 
    for (i = 0; i < nWSB_Points; i++)
829
 
    {
830
 
        _rectangle (_GFILLINTERIOR,
831
 
            (pWSB_Points [i].xBegin * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
832
 
                                                    - xLeft) / nScaling,
833
 
            (VIEW_TOP
834
 
                                                    - yTop)  / nScaling,
835
 
            (pWSB_Points [i].xEnd   * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
836
 
                                                    - xLeft) / nScaling,
837
 
            (VIEW_BOTTOM
838
 
                                                    - yTop)  / nScaling);
839
 
    }
840
 
 
841
 
    _gettextsettings (&ts);
842
 
 
843
 
    for (i = 0; i < nWSB_HystColumns; i++)
844
 
    {
845
 
        if (pWSB_Hyst [i] == 0)
846
 
            continue;
847
 
 
848
 
        if (i / 20 % 2 == 0)
849
 
            _setcolor (_COLOR_GREEN);
850
 
        else
851
 
            _setcolor (_COLOR_BLUE);
852
 
 
853
 
        _rectangle (_GFILLINTERIOR,
854
 
            (i * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
855
 
                                                    - xLeft) / nScaling,
856
 
            (VIEW_BOTTOM - pWSB_Hyst [i] * VIEW_HEIGHT / nMaxValue
857
 
                                                    - yTop)  / nScaling,
858
 
            ((i + 1) * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
859
 
                                                    - xLeft) / nScaling,
860
 
            (VIEW_BOTTOM
861
 
                                                    - yTop)  / nScaling);
862
 
    }
863
 
 
864
 
    _setcolor (_COLOR_BACKGROUND);
865
 
    _settextalign (_RIGHT, _TOP);
866
 
    nCharHeight = VIEW_HEIGHT / 16 / nScaling / 2;
867
 
    _setcharsize (nCharHeight, nCharHeight / 2);
868
 
 
869
 
    for (i = 0; i < nMaxValue - nMaxValue / 32; i += MAX(nMaxValue / 16,1))
870
 
    {
871
 
        _moveto ((VIEW_LEFT                                 - xLeft)/ nScaling,
872
 
                 (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling);
873
 
        _lineto ((VIEW_RIGHT                                - xLeft)/ nScaling,
874
 
                 (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling);
875
 
 
876
 
        if (i != 0)
877
 
        {
878
 
            sprintf (szBuffer, "%d\n", i);
879
 
            _grtext ((VIEW_LEFT - xLeft) / nScaling,
880
 
                (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling,
881
 
                 szBuffer);
882
 
        }
883
 
    }
884
 
 
885
 
    sprintf (szBuffer, "%d\n", nMaxValue);
886
 
    _grtext ((VIEW_LEFT - xLeft) / nScaling,
887
 
             (VIEW_TOP  - yTop)  / nScaling,
888
 
             szBuffer);
889
 
 
890
 
    _rectangle (_GBORDER,
891
 
                (VIEW_LEFT   - xLeft) / nScaling,
892
 
                (VIEW_TOP    - yTop)  / nScaling,
893
 
                (VIEW_RIGHT  - xLeft) / nScaling,
894
 
                (VIEW_BOTTOM - yTop)  / nScaling);
895
 
 
896
 
    _setcharsize (ts.height, ts.width);
897
 
 
898
 
    _setcolor (_COLOR_BLACK);
899
 
 
900
 
    for (i = 0; i < nWSB_Points; i++)
901
 
    {
902
 
        _moveto
903
 
        (
904
 
            (pWSB_Points [i].xMain * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
905
 
                                                    - xLeft) / nScaling,
906
 
            (VIEW_TOP
907
 
                                                    - yTop)  / nScaling
908
 
        );
909
 
        _lineto
910
 
        (
911
 
            (pWSB_Points [i].xMain * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
912
 
                                                    - xLeft) / nScaling,
913
 
            (VIEW_BOTTOM
914
 
                                                    - yTop)  / nScaling
915
 
        );
916
 
 
917
 
        if (pWSB_Hyst == pWSB_Hyst2)
918
 
        {
919
 
            _moveto
920
 
            (
921
 
                (pWSB_Points [i].xBegin * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
922
 
                                                        - xLeft) / nScaling,
923
 
                (VIEW_BOTTOM - pWSB_Points [i].yMin     * VIEW_HEIGHT / nMaxValue
924
 
                                                        - yTop)  / nScaling
925
 
            );
926
 
            _lineto
927
 
            (
928
 
                (pWSB_Points [i].xEnd  * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
929
 
                                                        - xLeft) / nScaling,
930
 
                (VIEW_BOTTOM - pWSB_Points [i].yMin     * VIEW_HEIGHT / nMaxValue
931
 
                                                        - yTop)  / nScaling
932
 
            );
933
 
 
934
 
            _moveto
935
 
            (
936
 
                (pWSB_Points [i].xBegin * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
937
 
                                                        - xLeft) / nScaling,
938
 
                (VIEW_BOTTOM - pWSB_Points [i].yMax     * VIEW_HEIGHT / nMaxValue
939
 
                                                        - yTop)  / nScaling
940
 
            );
941
 
            _lineto
942
 
            (
943
 
                (pWSB_Points [i].xEnd  * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
944
 
                                                        - xLeft) / nScaling,
945
 
                (VIEW_BOTTOM - pWSB_Points [i].yMax     * VIEW_HEIGHT / nMaxValue
946
 
                                                        - yTop)  / nScaling
947
 
            );
948
 
 
949
 
            _moveto
950
 
            (
951
 
                (pWSB_Points [i].xBegin * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
952
 
                                                        - xLeft) / nScaling,
953
 
                (VIEW_BOTTOM - pWSB_Points [i].yAverage * VIEW_HEIGHT / nMaxValue
954
 
                                                        - yTop)  / nScaling
955
 
            );
956
 
            _lineto
957
 
            (
958
 
                (pWSB_Points [i].xEnd  * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
959
 
                                                        - xLeft) / nScaling,
960
 
                (VIEW_BOTTOM - pWSB_Points [i].yAverage * VIEW_HEIGHT / nMaxValue
961
 
                                                        - yTop)  / nScaling
962
 
            );
963
 
        }
964
 
    }
 
814
        int i;
 
815
        char szBuffer [32];
 
816
        struct textsettings ts;
 
817
        int nCharHeight;
 
818
 
 
819
        LT_GraphicsClearScreen ();
 
820
 
 
821
        _setcolor (_COLOR_RED);
 
822
 
 
823
        for (i = 0; i < nWSB_Points; i++)
 
824
        {
 
825
                _rectangle (_GFILLINTERIOR,
 
826
                                (pWSB_Points [i].xBegin * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
827
                                                - xLeft) / nScaling,
 
828
                                (VIEW_TOP
 
829
                                                - yTop) / nScaling,
 
830
                                (pWSB_Points [i].xEnd * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
831
                                                - xLeft) / nScaling,
 
832
                                (VIEW_BOTTOM
 
833
                                                - yTop) / nScaling);
 
834
        }
 
835
 
 
836
        _gettextsettings (&ts);
 
837
 
 
838
        for (i = 0; i < nWSB_HystColumns; i++)
 
839
        {
 
840
                if (pWSB_Hyst [i] == 0)
 
841
                continue;
 
842
 
 
843
                if (i / 20 % 2 == 0)
 
844
                _setcolor (_COLOR_GREEN);
 
845
                else
 
846
                _setcolor (_COLOR_BLUE);
 
847
 
 
848
                _rectangle (_GFILLINTERIOR,
 
849
                                (i * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
850
                                                - xLeft) / nScaling,
 
851
                                (VIEW_BOTTOM - pWSB_Hyst [i] * VIEW_HEIGHT / nMaxValue
 
852
                                                - yTop) / nScaling,
 
853
                                ((i + 1) * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
854
                                                - xLeft) / nScaling,
 
855
                                (VIEW_BOTTOM
 
856
                                                - yTop) / nScaling);
 
857
        }
 
858
 
 
859
        _setcolor (_COLOR_BACKGROUND);
 
860
        _settextalign (_RIGHT, _TOP);
 
861
        nCharHeight = VIEW_HEIGHT / 16 / nScaling / 2;
 
862
        _setcharsize (nCharHeight, nCharHeight / 2);
 
863
 
 
864
        for (i = 0; i < nMaxValue - nMaxValue / 32; i += MAX(nMaxValue / 16,1))
 
865
        {
 
866
                _moveto ((VIEW_LEFT - xLeft)/ nScaling,
 
867
                                (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling);
 
868
                _lineto ((VIEW_RIGHT - xLeft)/ nScaling,
 
869
                                (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling);
 
870
 
 
871
                if (i != 0)
 
872
                {
 
873
                        sprintf (szBuffer, "%d\n", i);
 
874
                        _grtext ((VIEW_LEFT - xLeft) / nScaling,
 
875
                                        (VIEW_BOTTOM - i * VIEW_HEIGHT / nMaxValue - yTop) / nScaling,
 
876
                                        szBuffer);
 
877
                }
 
878
        }
 
879
 
 
880
        sprintf (szBuffer, "%d\n", nMaxValue);
 
881
        _grtext ((VIEW_LEFT - xLeft) / nScaling,
 
882
                        (VIEW_TOP - yTop) / nScaling,
 
883
                        szBuffer);
 
884
 
 
885
        _rectangle (_GBORDER,
 
886
                        (VIEW_LEFT - xLeft) / nScaling,
 
887
                        (VIEW_TOP - yTop) / nScaling,
 
888
                        (VIEW_RIGHT - xLeft) / nScaling,
 
889
                        (VIEW_BOTTOM - yTop) / nScaling);
 
890
 
 
891
        _setcharsize (ts.height, ts.width);
 
892
 
 
893
        _setcolor (_COLOR_BLACK);
 
894
 
 
895
        for (i = 0; i < nWSB_Points; i++)
 
896
        {
 
897
                _moveto
 
898
                (
 
899
                                (pWSB_Points [i].xMain * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
900
                                                - xLeft) / nScaling,
 
901
                                (VIEW_TOP
 
902
                                                - yTop) / nScaling
 
903
                );
 
904
                _lineto
 
905
                (
 
906
                                (pWSB_Points [i].xMain * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
907
                                                - xLeft) / nScaling,
 
908
                                (VIEW_BOTTOM
 
909
                                                - yTop) / nScaling
 
910
                );
 
911
 
 
912
                if (pWSB_Hyst == pWSB_Hyst2)
 
913
                {
 
914
                        _moveto
 
915
                        (
 
916
                                        (pWSB_Points [i].xBegin * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
917
                                                        - xLeft) / nScaling,
 
918
                                        (VIEW_BOTTOM - pWSB_Points [i].yMin * VIEW_HEIGHT / nMaxValue
 
919
                                                        - yTop) / nScaling
 
920
                        );
 
921
                        _lineto
 
922
                        (
 
923
                                        (pWSB_Points [i].xEnd * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
924
                                                        - xLeft) / nScaling,
 
925
                                        (VIEW_BOTTOM - pWSB_Points [i].yMin * VIEW_HEIGHT / nMaxValue
 
926
                                                        - yTop) / nScaling
 
927
                        );
 
928
 
 
929
                        _moveto
 
930
                        (
 
931
                                        (pWSB_Points [i].xBegin * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
932
                                                        - xLeft) / nScaling,
 
933
                                        (VIEW_BOTTOM - pWSB_Points [i].yMax * VIEW_HEIGHT / nMaxValue
 
934
                                                        - yTop) / nScaling
 
935
                        );
 
936
                        _lineto
 
937
                        (
 
938
                                        (pWSB_Points [i].xEnd * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
939
                                                        - xLeft) / nScaling,
 
940
                                        (VIEW_BOTTOM - pWSB_Points [i].yMax * VIEW_HEIGHT / nMaxValue
 
941
                                                        - yTop) / nScaling
 
942
                        );
 
943
 
 
944
                        _moveto
 
945
                        (
 
946
                                        (pWSB_Points [i].xBegin * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
947
                                                        - xLeft) / nScaling,
 
948
                                        (VIEW_BOTTOM - pWSB_Points [i].yAverage * VIEW_HEIGHT / nMaxValue
 
949
                                                        - yTop) / nScaling
 
950
                        );
 
951
                        _lineto
 
952
                        (
 
953
                                        (pWSB_Points [i].xEnd * VIEW_WIDTH / nWSB_HystColumns + VIEW_LEFT
 
954
                                                        - xLeft) / nScaling,
 
955
                                        (VIEW_BOTTOM - pWSB_Points [i].yAverage * VIEW_HEIGHT / nMaxValue
 
956
                                                        - yTop) / nScaling
 
957
                        );
 
958
                }
 
959
        }
965
960
}
966
961
 
967
962
static void WSB_Hystogram_1_Update (int xLeft, int yTop, int nScaling)
968
963
{
969
 
    int i;
970
 
    int nMaxValue;
971
 
 
972
 
    nMaxValue = 0;
973
 
 
974
 
    for (i = 0; i < nWSB_HystColumns; i++)
975
 
    {
976
 
        if (nMaxValue < pWSB_Hyst1 [i])
977
 
            nMaxValue  = pWSB_Hyst1 [i];
978
 
    }
979
 
 
980
 
    if (nMaxValue < 10)
981
 
        nMaxValue = 10;
982
 
 
983
 
    WSB_HystogramUpdate (xLeft, yTop, nScaling, pWSB_Hyst1, nMaxValue);
 
964
        int i;
 
965
        int nMaxValue;
 
966
 
 
967
        nMaxValue = 0;
 
968
 
 
969
        for (i = 0; i < nWSB_HystColumns; i++)
 
970
        {
 
971
                if (nMaxValue < pWSB_Hyst1 [i])
 
972
                nMaxValue = pWSB_Hyst1 [i];
 
973
        }
 
974
 
 
975
        if (nMaxValue < 10)
 
976
        nMaxValue = 10;
 
977
 
 
978
        WSB_HystogramUpdate (xLeft, yTop, nScaling, pWSB_Hyst1, nMaxValue);
984
979
}
985
980
 
986
981
static void WSB_Hystogram_2_Update (int xLeft, int yTop, int nScaling)
987
982
{
988
 
    WSB_HystogramUpdate (xLeft, yTop, nScaling, pWSB_Hyst2, nPageHeight);
 
983
        WSB_HystogramUpdate (xLeft, yTop, nScaling, pWSB_Hyst2, nPageHeight);
989
984
}
990
985
 
991
986
static void WSB_PointsUpdate (int xLeft, int yTop, int nScaling)
992
987
{
993
 
    int i;
994
 
 
995
 
    BlocksUpdate (xLeft, yTop, nScaling);
996
 
 
997
 
    _setcolor (_COLOR_RED);
998
 
 
999
 
    for (i = 0; i < nWSB_Points; i++)
1000
 
    {
1001
 
        _moveto
1002
 
        (
1003
 
            (pWSB_Points [i].xMain + xWSB_HystOffset - xLeft) / nScaling,
1004
 
            0
1005
 
        );
1006
 
 
1007
 
        _lineto
1008
 
        (
1009
 
            (pWSB_Points [i].xMain + xWSB_HystOffset - xLeft) / nScaling,
1010
 
            SCREEN_HEIGHT
1011
 
        );
1012
 
    }
 
988
        int i;
 
989
 
 
990
        BlocksUpdate (xLeft, yTop, nScaling);
 
991
 
 
992
        _setcolor (_COLOR_RED);
 
993
 
 
994
        for (i = 0; i < nWSB_Points; i++)
 
995
        {
 
996
                _moveto
 
997
                (
 
998
                                (pWSB_Points [i].xMain + xWSB_HystOffset - xLeft) / nScaling,
 
999
                                0
 
1000
                );
 
1001
 
 
1002
                _lineto
 
1003
                (
 
1004
                                (pWSB_Points [i].xMain + xWSB_HystOffset - xLeft) / nScaling,
 
1005
                                SCREEN_HEIGHT
 
1006
                );
 
1007
        }
1013
1008
}
1014
1009
 
1015
1010
static void PictureRemovingConditionsUpdate (int xLeft, int yTop, int nScaling)
1016
1011
{
1017
 
    int nFactor;
1018
 
    ROOT *pRoot;
1019
 
    BYTE *pMatrix;
1020
 
    int  nWidth;
1021
 
    int  nHeight;
1022
 
    int  xSrc, ySrc, xDst, yDst;
1023
 
 
1024
 
    LPOINT    TopLeft, TopRight, BottomLeft, BottomRight;
1025
 
    RECTANGLE rReal;
1026
 
 
1027
 
    nWidth  = rDebugRect.xRight  - rDebugRect.xLeft + 1;
1028
 
    nHeight = rDebugRect.yBottom - rDebugRect.yTop  + 1;
1029
 
    pMatrix = malloc (nWidth * nHeight);
1030
 
    memset (pMatrix, MDCF_NULL, nWidth * nHeight);
1031
 
 
1032
 
    if (pMatrix == NULL)
1033
 
        ErrorNoEnoughMemory ("in LTGRAPH.C,PictureRemovingConditionsUpdate,part 1");
1034
 
 
1035
 
    nFactor = MIN (VIEW_WIDTH / nWidth, VIEW_HEIGHT / nHeight);
1036
 
 
1037
 
    for (ySrc = rDebugRect.yTop, yDst = 0;
1038
 
             ySrc <= rDebugRect.yBottom;
1039
 
                 ySrc++, yDst++)
1040
 
    {
1041
 
        for (xSrc = rDebugRect.xLeft, xDst = 0;
1042
 
                xSrc <= rDebugRect.xRight;
1043
 
                    xSrc++, xDst++)
1044
 
        {
1045
 
            if (PageMatrix [ySrc * PAGE_MATRIX_WIDTH + xSrc] & PMC_DEBUG1)
1046
 
                pMatrix [yDst * nWidth + xDst] |= MDCF_COLOR;
1047
 
 
1048
 
            if (PageMatrix [ySrc * PAGE_MATRIX_WIDTH + xSrc] & PMC_PICTURE)
1049
 
                pMatrix [yDst * nWidth + xDst] |= MDCF_MASK;
1050
 
        }
1051
 
    }
1052
 
 
1053
 
    MatrixUpdate
1054
 
    (
1055
 
        xLeft,
1056
 
        yTop,
1057
 
        nScaling,
1058
 
        pMatrix,
1059
 
        nWidth,
1060
 
        nHeight,
1061
 
        TRUE,
1062
 
        MATRIX_DRAWING_MASK_MODE
1063
 
    );
1064
 
 
1065
 
    _setcolor (_COLOR_DGREEN);
1066
 
 
1067
 
    for (pRoot = pDebugBlock -> pRoots; pRoot != NULL; pRoot = pRoot -> u1.pNext)
1068
 
    {
1069
 
        RECTANGLE r;
1070
 
 
1071
 
        r.xLeft = pRoot -> xColumn;
1072
 
        r.yTop  = pRoot -> yRow;
1073
 
 
1074
 
        REAL_XY (r.xLeft, r.yTop);
1075
 
 
1076
 
        r.xRight  = r.xLeft + pRoot -> nWidth  - 1;
1077
 
        r.yBottom = r.yTop  + pRoot -> nHeight - 1;
1078
 
 
1079
 
        _rectangle (_GFILLINTERIOR,
1080
 
            ((r.xLeft
1081
 
                - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
1082
 
                * nFactor / PAGE_COMP_FACTOR
1083
 
                - xLeft) / nScaling,
1084
 
            ((r.yTop
1085
 
                - (rDebugRect.yTop  << PAGE_COMP_SHIFT))
1086
 
                * nFactor / PAGE_COMP_FACTOR
1087
 
                - yTop)  / nScaling,
1088
 
            ((r.xRight
1089
 
                - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
1090
 
                * nFactor / PAGE_COMP_FACTOR
1091
 
                - xLeft) / nScaling,
1092
 
            ((r.yBottom
1093
 
                - (rDebugRect.yTop  << PAGE_COMP_SHIFT))
1094
 
                * nFactor / PAGE_COMP_FACTOR
1095
 
                - yTop)  / nScaling);
1096
 
    }
1097
 
 
1098
 
    // Get rectangle of block in real coordinates
1099
 
 
1100
 
    TopLeft.x     = pDebugBlock -> Rect.xLeft;
1101
 
    TopLeft.y     = pDebugBlock -> Rect.yTop;
1102
 
    TopRight.x    = pDebugBlock -> Rect.xRight;
1103
 
    TopRight.y    = pDebugBlock -> Rect.yTop;
1104
 
    BottomLeft.x  = pDebugBlock -> Rect.xLeft;
1105
 
    BottomLeft.y  = pDebugBlock -> Rect.yBottom;
1106
 
    BottomRight.x = pDebugBlock -> Rect.xRight;
1107
 
    BottomRight.y = pDebugBlock -> Rect.yBottom;
1108
 
 
1109
 
    REAL_XY (TopLeft.x    , TopLeft.y);
1110
 
    REAL_XY (TopRight.x   , TopRight.y);
1111
 
    REAL_XY (BottomLeft.x , BottomLeft.y);
1112
 
    REAL_XY (BottomRight.x, BottomRight.y);
1113
 
 
1114
 
    rReal.xLeft   = MIN (TopLeft.x, BottomLeft.x);
1115
 
    rReal.yTop    = MIN (TopLeft.y, TopRight.y);
1116
 
    rReal.xRight  = MAX (TopRight.x, BottomRight.x);
1117
 
    rReal.yBottom = MAX (BottomLeft.y, BottomRight.y);
1118
 
 
1119
 
    _setcolor (_COLOR_RED);
1120
 
 
1121
 
    _moveto
1122
 
    (
1123
 
        ((TopLeft.x
1124
 
            - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
1125
 
            * nFactor / PAGE_COMP_FACTOR
1126
 
            - xLeft) / nScaling,
1127
 
        ((TopLeft.y
1128
 
            - (rDebugRect.yTop  << PAGE_COMP_SHIFT))
1129
 
            * nFactor / PAGE_COMP_FACTOR
1130
 
            - yTop)  / nScaling
1131
 
    );
1132
 
 
1133
 
    _lineto
1134
 
    (
1135
 
        ((TopRight.x
1136
 
            - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
1137
 
            * nFactor / PAGE_COMP_FACTOR
1138
 
            - xLeft) / nScaling,
1139
 
        ((TopRight.y
1140
 
            - (rDebugRect.yTop  << PAGE_COMP_SHIFT))
1141
 
            * nFactor / PAGE_COMP_FACTOR
1142
 
            - yTop)  / nScaling
1143
 
    );
1144
 
 
1145
 
    _lineto
1146
 
    (
1147
 
        ((BottomRight.x
1148
 
            - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
1149
 
            * nFactor / PAGE_COMP_FACTOR
1150
 
            - xLeft) / nScaling,
1151
 
        ((BottomRight.y
1152
 
            - (rDebugRect.yTop  << PAGE_COMP_SHIFT))
1153
 
            * nFactor / PAGE_COMP_FACTOR
1154
 
            - yTop)  / nScaling
1155
 
    );
1156
 
 
1157
 
    _lineto
1158
 
    (
1159
 
        ((BottomLeft.x
1160
 
            - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
1161
 
            * nFactor / PAGE_COMP_FACTOR
1162
 
            - xLeft) / nScaling,
1163
 
        ((BottomLeft.y
1164
 
            - (rDebugRect.yTop  << PAGE_COMP_SHIFT))
1165
 
            * nFactor / PAGE_COMP_FACTOR
1166
 
            - yTop)  / nScaling
1167
 
    );
1168
 
 
1169
 
    _lineto
1170
 
    (
1171
 
        ((BottomLeft.x
1172
 
            - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
1173
 
            * nFactor / PAGE_COMP_FACTOR
1174
 
            - xLeft) / nScaling,
1175
 
        ((BottomLeft.y
1176
 
            - (rDebugRect.yTop  << PAGE_COMP_SHIFT))
1177
 
            * nFactor / PAGE_COMP_FACTOR
1178
 
            - yTop)  / nScaling
1179
 
    );
1180
 
 
1181
 
    _lineto
1182
 
    (
1183
 
        ((TopLeft.x
1184
 
            - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
1185
 
            * nFactor / PAGE_COMP_FACTOR
1186
 
            - xLeft) / nScaling,
1187
 
        ((TopLeft.y
1188
 
            - (rDebugRect.yTop  << PAGE_COMP_SHIFT))
1189
 
            * nFactor / PAGE_COMP_FACTOR
1190
 
            - yTop)  / nScaling
1191
 
    );
1192
 
 
1193
 
    _setcolor (_COLOR_BLUE);
1194
 
 
1195
 
    _rectangle (_GBORDER,
1196
 
        ((rReal.xLeft
1197
 
            - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
1198
 
            * nFactor / PAGE_COMP_FACTOR
1199
 
            - xLeft) / nScaling,
1200
 
        ((rReal.yTop
1201
 
            - (rDebugRect.yTop  << PAGE_COMP_SHIFT))
1202
 
            * nFactor / PAGE_COMP_FACTOR
1203
 
            - yTop)  / nScaling,
1204
 
        ((rReal.xRight
1205
 
            - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
1206
 
            * nFactor / PAGE_COMP_FACTOR
1207
 
            - xLeft) / nScaling,
1208
 
        ((rReal.yBottom
1209
 
            - (rDebugRect.yTop  << PAGE_COMP_SHIFT))
1210
 
            * nFactor / PAGE_COMP_FACTOR
1211
 
            - yTop)  / nScaling);
1212
 
 
1213
 
    free (pMatrix);
 
1012
        int nFactor;
 
1013
        ROOT *pRoot;
 
1014
        uchar *pMatrix;
 
1015
        int nWidth;
 
1016
        int nHeight;
 
1017
        int xSrc, ySrc, xDst, yDst;
 
1018
 
 
1019
        LPOINT TopLeft, TopRight, BottomLeft, BottomRight;
 
1020
        RECTANGLE rReal;
 
1021
 
 
1022
        nWidth = rDebugRect.xRight - rDebugRect.xLeft + 1;
 
1023
        nHeight = rDebugRect.yBottom - rDebugRect.yTop + 1;
 
1024
        pMatrix = malloc (nWidth * nHeight);
 
1025
        memset (pMatrix, MDCF_NULL, nWidth * nHeight);
 
1026
 
 
1027
        if (pMatrix == NULL)
 
1028
        ErrorNoEnoughMemory ("in LTGRAPH.C,PictureRemovingConditionsUpdate,part 1");
 
1029
 
 
1030
        nFactor = MIN (VIEW_WIDTH / nWidth, VIEW_HEIGHT / nHeight);
 
1031
 
 
1032
        for (ySrc = rDebugRect.yTop, yDst = 0;
 
1033
                        ySrc <= rDebugRect.yBottom;
 
1034
                        ySrc++, yDst++)
 
1035
        {
 
1036
                for (xSrc = rDebugRect.xLeft, xDst = 0;
 
1037
                                xSrc <= rDebugRect.xRight;
 
1038
                                xSrc++, xDst++)
 
1039
                {
 
1040
                        if (PageMatrix [ySrc * PAGE_MATRIX_WIDTH + xSrc] & PMC_DEBUG1)
 
1041
                        pMatrix [yDst * nWidth + xDst] |= MDCF_COLOR;
 
1042
 
 
1043
                        if (PageMatrix [ySrc * PAGE_MATRIX_WIDTH + xSrc] & PMC_PICTURE)
 
1044
                        pMatrix [yDst * nWidth + xDst] |= MDCF_MASK;
 
1045
                }
 
1046
        }
 
1047
 
 
1048
        MatrixUpdate
 
1049
        (
 
1050
                        xLeft,
 
1051
                        yTop,
 
1052
                        nScaling,
 
1053
                        pMatrix,
 
1054
                        nWidth,
 
1055
                        nHeight,
 
1056
                        TRUE,
 
1057
                        MATRIX_DRAWING_MASK_MODE
 
1058
        );
 
1059
 
 
1060
        _setcolor (_COLOR_DGREEN);
 
1061
 
 
1062
        for (pRoot = pDebugBlock -> pRoots; pRoot != NULL; pRoot = pRoot -> u1.pNext)
 
1063
        {
 
1064
                RECTANGLE r;
 
1065
 
 
1066
                r.xLeft = pRoot -> xColumn;
 
1067
                r.yTop = pRoot -> yRow;
 
1068
 
 
1069
                REAL_XY (r.xLeft, r.yTop);
 
1070
 
 
1071
                r.xRight = r.xLeft + pRoot -> nWidth - 1;
 
1072
                r.yBottom = r.yTop + pRoot -> nHeight - 1;
 
1073
 
 
1074
                _rectangle (_GFILLINTERIOR,
 
1075
                                ((r.xLeft
 
1076
                                                                - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
 
1077
                                                * nFactor / PAGE_COMP_FACTOR
 
1078
                                                - xLeft) / nScaling,
 
1079
                                ((r.yTop
 
1080
                                                                - (rDebugRect.yTop << PAGE_COMP_SHIFT))
 
1081
                                                * nFactor / PAGE_COMP_FACTOR
 
1082
                                                - yTop) / nScaling,
 
1083
                                ((r.xRight
 
1084
                                                                - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
 
1085
                                                * nFactor / PAGE_COMP_FACTOR
 
1086
                                                - xLeft) / nScaling,
 
1087
                                ((r.yBottom
 
1088
                                                                - (rDebugRect.yTop << PAGE_COMP_SHIFT))
 
1089
                                                * nFactor / PAGE_COMP_FACTOR
 
1090
                                                - yTop) / nScaling);
 
1091
        }
 
1092
 
 
1093
        // Get rectangle of block in real coordinates
 
1094
 
 
1095
        TopLeft.x = pDebugBlock -> Rect.xLeft;
 
1096
        TopLeft.y = pDebugBlock -> Rect.yTop;
 
1097
        TopRight.x = pDebugBlock -> Rect.xRight;
 
1098
        TopRight.y = pDebugBlock -> Rect.yTop;
 
1099
        BottomLeft.x = pDebugBlock -> Rect.xLeft;
 
1100
        BottomLeft.y = pDebugBlock -> Rect.yBottom;
 
1101
        BottomRight.x = pDebugBlock -> Rect.xRight;
 
1102
        BottomRight.y = pDebugBlock -> Rect.yBottom;
 
1103
 
 
1104
        REAL_XY (TopLeft.x , TopLeft.y);
 
1105
        REAL_XY (TopRight.x , TopRight.y);
 
1106
        REAL_XY (BottomLeft.x , BottomLeft.y);
 
1107
        REAL_XY (BottomRight.x, BottomRight.y);
 
1108
 
 
1109
        rReal.xLeft = MIN (TopLeft.x, BottomLeft.x);
 
1110
        rReal.yTop = MIN (TopLeft.y, TopRight.y);
 
1111
        rReal.xRight = MAX (TopRight.x, BottomRight.x);
 
1112
        rReal.yBottom = MAX (BottomLeft.y, BottomRight.y);
 
1113
 
 
1114
        _setcolor (_COLOR_RED);
 
1115
 
 
1116
        _moveto
 
1117
        (
 
1118
                        ((TopLeft.x
 
1119
                                                        - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
 
1120
                                        * nFactor / PAGE_COMP_FACTOR
 
1121
                                        - xLeft) / nScaling,
 
1122
                        ((TopLeft.y
 
1123
                                                        - (rDebugRect.yTop << PAGE_COMP_SHIFT))
 
1124
                                        * nFactor / PAGE_COMP_FACTOR
 
1125
                                        - yTop) / nScaling
 
1126
        );
 
1127
 
 
1128
        _lineto
 
1129
        (
 
1130
                        ((TopRight.x
 
1131
                                                        - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
 
1132
                                        * nFactor / PAGE_COMP_FACTOR
 
1133
                                        - xLeft) / nScaling,
 
1134
                        ((TopRight.y
 
1135
                                                        - (rDebugRect.yTop << PAGE_COMP_SHIFT))
 
1136
                                        * nFactor / PAGE_COMP_FACTOR
 
1137
                                        - yTop) / nScaling
 
1138
        );
 
1139
 
 
1140
        _lineto
 
1141
        (
 
1142
                        ((BottomRight.x
 
1143
                                                        - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
 
1144
                                        * nFactor / PAGE_COMP_FACTOR
 
1145
                                        - xLeft) / nScaling,
 
1146
                        ((BottomRight.y
 
1147
                                                        - (rDebugRect.yTop << PAGE_COMP_SHIFT))
 
1148
                                        * nFactor / PAGE_COMP_FACTOR
 
1149
                                        - yTop) / nScaling
 
1150
        );
 
1151
 
 
1152
        _lineto
 
1153
        (
 
1154
                        ((BottomLeft.x
 
1155
                                                        - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
 
1156
                                        * nFactor / PAGE_COMP_FACTOR
 
1157
                                        - xLeft) / nScaling,
 
1158
                        ((BottomLeft.y
 
1159
                                                        - (rDebugRect.yTop << PAGE_COMP_SHIFT))
 
1160
                                        * nFactor / PAGE_COMP_FACTOR
 
1161
                                        - yTop) / nScaling
 
1162
        );
 
1163
 
 
1164
        _lineto
 
1165
        (
 
1166
                        ((BottomLeft.x
 
1167
                                                        - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
 
1168
                                        * nFactor / PAGE_COMP_FACTOR
 
1169
                                        - xLeft) / nScaling,
 
1170
                        ((BottomLeft.y
 
1171
                                                        - (rDebugRect.yTop << PAGE_COMP_SHIFT))
 
1172
                                        * nFactor / PAGE_COMP_FACTOR
 
1173
                                        - yTop) / nScaling
 
1174
        );
 
1175
 
 
1176
        _lineto
 
1177
        (
 
1178
                        ((TopLeft.x
 
1179
                                                        - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
 
1180
                                        * nFactor / PAGE_COMP_FACTOR
 
1181
                                        - xLeft) / nScaling,
 
1182
                        ((TopLeft.y
 
1183
                                                        - (rDebugRect.yTop << PAGE_COMP_SHIFT))
 
1184
                                        * nFactor / PAGE_COMP_FACTOR
 
1185
                                        - yTop) / nScaling
 
1186
        );
 
1187
 
 
1188
        _setcolor (_COLOR_BLUE);
 
1189
 
 
1190
        _rectangle (_GBORDER,
 
1191
                        ((rReal.xLeft
 
1192
                                                        - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
 
1193
                                        * nFactor / PAGE_COMP_FACTOR
 
1194
                                        - xLeft) / nScaling,
 
1195
                        ((rReal.yTop
 
1196
                                                        - (rDebugRect.yTop << PAGE_COMP_SHIFT))
 
1197
                                        * nFactor / PAGE_COMP_FACTOR
 
1198
                                        - yTop) / nScaling,
 
1199
                        ((rReal.xRight
 
1200
                                                        - (rDebugRect.xLeft << PAGE_COMP_SHIFT))
 
1201
                                        * nFactor / PAGE_COMP_FACTOR
 
1202
                                        - xLeft) / nScaling,
 
1203
                        ((rReal.yBottom
 
1204
                                                        - (rDebugRect.yTop << PAGE_COMP_SHIFT))
 
1205
                                        * nFactor / PAGE_COMP_FACTOR
 
1206
                                        - yTop) / nScaling);
 
1207
 
 
1208
        free (pMatrix);
1214
1209
}
1215
1210
 
1216
1211
void ColumnChart
1217
1212
(
1218
 
    int xLeft,
1219
 
    int yTop,
1220
 
    int xRight,
1221
 
    int yBottom,
1222
 
    int *pArray,
1223
 
    int nColumns
 
1213
                int xLeft,
 
1214
                int yTop,
 
1215
                int xRight,
 
1216
                int yBottom,
 
1217
                int *pArray,
 
1218
                int nColumns
1224
1219
)
1225
1220
{
1226
 
    int i;
1227
 
    int nBiggest;
1228
 
    struct textsettings ts;
1229
 
    int dxTextOffset;
1230
 
    int dyTextOffset;
1231
 
    char szTextBuffer [32];
1232
 
 
1233
 
    _setcolor (_COLOR_BACKGROUND);
1234
 
 
1235
 
    if (nColumns == 0 || pArray == NULL)
1236
 
        ErrorInternal ("Bad data");
1237
 
 
1238
 
    nBiggest = pArray [0];
1239
 
 
1240
 
    for (i = 1; i < nColumns; i++)
1241
 
    {
1242
 
        if (pArray [i] > nBiggest)
1243
 
            nBiggest = pArray [i];
1244
 
    }
1245
 
 
1246
 
    if (nBiggest == 0)
1247
 
        return;
1248
 
 
1249
 
    _gettextsettings (&ts);
1250
 
    _setcharsize (ts.height / 2, ts.width / 2);
1251
 
    _settextalign (_CENTER, _HALF);
1252
 
 
1253
 
    dxTextOffset = (xRight - xLeft) / nColumns / 2,
1254
 
    dyTextOffset = ts.height / 2;
1255
 
 
1256
 
    for (i = 0; i < nColumns; i++)
1257
 
    {
1258
 
        _setcolor (NUMBER_TO_COLOR (i));
1259
 
 
1260
 
        _rectangle
1261
 
        (
1262
 
            _GFILLINTERIOR,
1263
 
            xLeft + i       * (xRight - xLeft) / nColumns,
1264
 
            yTop + (nBiggest - pArray [i]) * (yBottom - yTop) / nBiggest,
1265
 
            xLeft + (i + 1) * (xRight - xLeft) / nColumns,
1266
 
            yBottom
1267
 
        );
1268
 
 
1269
 
        _setcolor (_COLOR_BACKGROUND);
1270
 
 
1271
 
        _rectangle
1272
 
        (
1273
 
            _GBORDER,
1274
 
            xLeft + i       * (xRight - xLeft) / nColumns,
1275
 
            yTop + (nBiggest - pArray [i]) * (yBottom - yTop) / nBiggest,
1276
 
            xLeft + (i + 1) * (xRight - xLeft) / nColumns,
1277
 
            yBottom
1278
 
        );
1279
 
 
1280
 
        sprintf (szTextBuffer, "%d", pArray [i]);
1281
 
 
1282
 
        _grtext
1283
 
        (
1284
 
            xLeft + i * (xRight - xLeft) / nColumns + dxTextOffset,
1285
 
            yBottom                                 + dyTextOffset,
1286
 
            szTextBuffer
1287
 
        );
1288
 
    }
1289
 
 
1290
 
    _setcharsize (ts.height, ts.width);
 
1221
        int i;
 
1222
        int nBiggest;
 
1223
        struct textsettings ts;
 
1224
        int dxTextOffset;
 
1225
        int dyTextOffset;
 
1226
        char szTextBuffer [32];
 
1227
 
 
1228
        _setcolor (_COLOR_BACKGROUND);
 
1229
 
 
1230
        if (nColumns == 0 || pArray == NULL)
 
1231
        ErrorInternal ("Bad data");
 
1232
 
 
1233
        nBiggest = pArray [0];
 
1234
 
 
1235
        for (i = 1; i < nColumns; i++)
 
1236
        {
 
1237
                if (pArray [i] > nBiggest)
 
1238
                nBiggest = pArray [i];
 
1239
        }
 
1240
 
 
1241
        if (nBiggest == 0)
 
1242
        return;
 
1243
 
 
1244
        _gettextsettings (&ts);
 
1245
        _setcharsize (ts.height / 2, ts.width / 2);
 
1246
        _settextalign (_CENTER, _HALF);
 
1247
 
 
1248
        dxTextOffset = (xRight - xLeft) / nColumns / 2,
 
1249
        dyTextOffset = ts.height / 2;
 
1250
 
 
1251
        for (i = 0; i < nColumns; i++)
 
1252
        {
 
1253
                _setcolor (NUMBER_TO_COLOR (i));
 
1254
 
 
1255
                _rectangle
 
1256
                (
 
1257
                                _GFILLINTERIOR,
 
1258
                                xLeft + i * (xRight - xLeft) / nColumns,
 
1259
                                yTop + (nBiggest - pArray [i]) * (yBottom - yTop) / nBiggest,
 
1260
                                xLeft + (i + 1) * (xRight - xLeft) / nColumns,
 
1261
                                yBottom
 
1262
                );
 
1263
 
 
1264
                _setcolor (_COLOR_BACKGROUND);
 
1265
 
 
1266
                _rectangle
 
1267
                (
 
1268
                                _GBORDER,
 
1269
                                xLeft + i * (xRight - xLeft) / nColumns,
 
1270
                                yTop + (nBiggest - pArray [i]) * (yBottom - yTop) / nBiggest,
 
1271
                                xLeft + (i + 1) * (xRight - xLeft) / nColumns,
 
1272
                                yBottom
 
1273
                );
 
1274
 
 
1275
                sprintf (szTextBuffer, "%d", pArray [i]);
 
1276
 
 
1277
                _grtext
 
1278
                (
 
1279
                                xLeft + i * (xRight - xLeft) / nColumns + dxTextOffset,
 
1280
                                yBottom + dyTextOffset,
 
1281
                                szTextBuffer
 
1282
                );
 
1283
        }
 
1284
 
 
1285
        _setcharsize (ts.height, ts.width);
1291
1286
}
1292
1287
 
1293
1288
# define B2SX(x) (((x) * nFactor - xLeft) / nScaling)
1295
1290
 
1296
1291
static void DD_RemovingConditionsUpdate (int xLeft, int yTop, int nScaling)
1297
1292
{
1298
 
    int  nFactor;
1299
 
    ROOT *pRoot;
1300
 
    int  nBlockWidth, nBlockHeight;
1301
 
    int  nMatrixWidth, nMatrixHeight;
1302
 
    RECTANGLE rGrid;
1303
 
    int  nCellWidth, nCellHeight;
1304
 
    int  x, y;
1305
 
    struct textsettings ts;
1306
 
 
1307
 
    extern int DQD_Matrix [];
1308
 
    extern int DSD_Matrix [];
1309
 
 
1310
 
    LT_GraphicsClearScreen ();
1311
 
 
1312
 
    nBlockWidth  = pDebugBlock -> Rect.xRight  - pDebugBlock -> Rect.xLeft + 1;
1313
 
    nBlockHeight = pDebugBlock -> Rect.yBottom - pDebugBlock -> Rect.yTop  + 1;
1314
 
 
1315
 
    nFactor = MIN (VIEW_WIDTH / 2 /nBlockWidth, VIEW_HEIGHT / nBlockHeight);
1316
 
 
1317
 
    nMatrixWidth  = rDebugRect.xRight  - rDebugRect.xLeft + 1;
1318
 
    nMatrixHeight = rDebugRect.yBottom - rDebugRect.yTop  + 1;
1319
 
 
1320
 
    rGrid.xLeft   = B2SX (0);
1321
 
    rGrid.yTop    = B2SY (0);
1322
 
    rGrid.xRight  = B2SX (nBlockWidth  - 1);
1323
 
    rGrid.yBottom = B2SY (nBlockHeight - 1);
1324
 
 
1325
 
    nCellWidth  = (rGrid.xRight  - rGrid.xLeft + 1) / nMatrixWidth;
1326
 
    nCellHeight = (rGrid.yBottom - rGrid.yTop  + 1) / nMatrixHeight;
1327
 
 
1328
 
    for (pRoot = pDebugBlock -> pRoots; pRoot != NULL; pRoot = pRoot -> u1.pNext)
1329
 
    {
1330
 
        RECTANGLE r;
1331
 
 
1332
 
        r.xLeft   = pRoot -> xColumn;
1333
 
        r.yTop    = pRoot -> yRow;
1334
 
        r.xRight  = r.xLeft + pRoot -> nWidth  - 1;
1335
 
        r.yBottom = r.yTop  + pRoot -> nHeight - 1;
1336
 
 
1337
 
        _setcolor (IS_LAYOUT_DUST (*pRoot) ? _COLOR_GREEN : _COLOR_DGREEN);
1338
 
 
1339
 
        _rectangle (_GFILLINTERIOR,
1340
 
            B2SX (r.xLeft   - pDebugBlock -> Rect.xLeft),
1341
 
            B2SY (r.yTop    - pDebugBlock -> Rect.yTop),
1342
 
            B2SX (r.xRight  - pDebugBlock -> Rect.xLeft),
1343
 
            B2SY (r.yBottom - pDebugBlock -> Rect.yTop));
1344
 
    }
1345
 
 
1346
 
    _setcolor (_COLOR_BACKGROUND);
1347
 
 
1348
 
    for (x = 1; x < nMatrixWidth; x++)
1349
 
    {
1350
 
        _moveto (rGrid.xLeft + x * nCellWidth, rGrid.yTop);
1351
 
        _lineto (rGrid.xLeft + x * nCellWidth, rGrid.yBottom);
1352
 
    }
1353
 
 
1354
 
    for (y = 1; y < nMatrixHeight; y++)
1355
 
    {
1356
 
        _moveto (rGrid.xLeft,  rGrid.yTop + y * nCellHeight);
1357
 
        _lineto (rGrid.xRight, rGrid.yTop + y * nCellHeight);
1358
 
    }
1359
 
 
1360
 
    _rectangle (_GBORDER, rGrid.xLeft, rGrid.yTop, rGrid.xRight, rGrid.yBottom);
1361
 
 
1362
 
    _gettextsettings (&ts);
1363
 
    _setcharsize (ts.height / 2, ts.width / 2);
1364
 
    _settextalign (_CENTER, _HALF);
1365
 
 
1366
 
    for (x = 0; x < nMatrixWidth; x++)
1367
 
    {
1368
 
        for (y = 0; y < nMatrixHeight; y++)
1369
 
        {
1370
 
            char szTextBuffer [16];
1371
 
 
1372
 
            if (DQD_Matrix [x + y * nMatrixWidth] == 0)
1373
 
                continue;
1374
 
 
1375
 
            _setcolor (_COLOR_BLACK);
1376
 
 
1377
 
            _rectangle
1378
 
            (
1379
 
                _GFILLINTERIOR,
1380
 
                rGrid.xLeft + x * nCellWidth  + nCellWidth  / 2 - ts.width * 2,
1381
 
                rGrid.yTop  + y * nCellHeight + nCellHeight / 2 - ts.height / 3,
1382
 
                rGrid.xLeft + x * nCellWidth  + nCellWidth  / 2 + ts.width * 2,
1383
 
                rGrid.yTop  + y * nCellHeight + nCellHeight / 2 + ts.height / 3
1384
 
            );
1385
 
 
1386
 
            sprintf (szTextBuffer, "%d %d",
1387
 
                         DQD_Matrix [x + y * nMatrixWidth],
1388
 
                         DSD_Matrix [x + y * nMatrixWidth]);
1389
 
 
1390
 
            _setcolor (_COLOR_BACKGROUND);
1391
 
 
1392
 
            _grtext
1393
 
            (
1394
 
                rGrid.xLeft + x * nCellWidth  + nCellWidth  / 2,
1395
 
                rGrid.yTop  + y * nCellHeight + nCellHeight / 2,
1396
 
                szTextBuffer
1397
 
            );
1398
 
        }
1399
 
    }
1400
 
 
1401
 
    _setcharsize (ts.height, ts.width);
1402
 
 
1403
 
    ColumnChart
1404
 
    (
1405
 
        SCREEN_WIDTH  * 6 / 10,
1406
 
        SCREEN_HEIGHT * 1 / 10,
1407
 
        SCREEN_WIDTH  * 9 / 10,
1408
 
        SCREEN_HEIGHT * 4 / 10,
1409
 
        DQD_Matrix,
1410
 
        nMatrixWidth * nMatrixHeight
1411
 
    );
1412
 
 
1413
 
    ColumnChart
1414
 
    (
1415
 
        SCREEN_WIDTH  * 6 / 10,
1416
 
        SCREEN_HEIGHT * 6 / 10,
1417
 
        SCREEN_WIDTH  * 9 / 10,
1418
 
        SCREEN_HEIGHT * 9 / 10,
1419
 
        DSD_Matrix,
1420
 
        nMatrixWidth * nMatrixHeight
1421
 
    );
 
1293
        int nFactor;
 
1294
        ROOT *pRoot;
 
1295
        int nBlockWidth, nBlockHeight;
 
1296
        int nMatrixWidth, nMatrixHeight;
 
1297
        RECTANGLE rGrid;
 
1298
        int nCellWidth, nCellHeight;
 
1299
        int x, y;
 
1300
        struct textsettings ts;
 
1301
 
 
1302
        extern int DQD_Matrix [];
 
1303
        extern int DSD_Matrix [];
 
1304
 
 
1305
        LT_GraphicsClearScreen ();
 
1306
 
 
1307
        nBlockWidth = pDebugBlock -> Rect.xRight - pDebugBlock -> Rect.xLeft + 1;
 
1308
        nBlockHeight = pDebugBlock -> Rect.yBottom - pDebugBlock -> Rect.yTop + 1;
 
1309
 
 
1310
        nFactor = MIN (VIEW_WIDTH / 2 /nBlockWidth, VIEW_HEIGHT / nBlockHeight);
 
1311
 
 
1312
        nMatrixWidth = rDebugRect.xRight - rDebugRect.xLeft + 1;
 
1313
        nMatrixHeight = rDebugRect.yBottom - rDebugRect.yTop + 1;
 
1314
 
 
1315
        rGrid.xLeft = B2SX (0);
 
1316
        rGrid.yTop = B2SY (0);
 
1317
        rGrid.xRight = B2SX (nBlockWidth - 1);
 
1318
        rGrid.yBottom = B2SY (nBlockHeight - 1);
 
1319
 
 
1320
        nCellWidth = (rGrid.xRight - rGrid.xLeft + 1) / nMatrixWidth;
 
1321
        nCellHeight = (rGrid.yBottom - rGrid.yTop + 1) / nMatrixHeight;
 
1322
 
 
1323
        for (pRoot = pDebugBlock -> pRoots; pRoot != NULL; pRoot = pRoot -> u1.pNext)
 
1324
        {
 
1325
                RECTANGLE r;
 
1326
 
 
1327
                r.xLeft = pRoot -> xColumn;
 
1328
                r.yTop = pRoot -> yRow;
 
1329
                r.xRight = r.xLeft + pRoot -> nWidth - 1;
 
1330
                r.yBottom = r.yTop + pRoot -> nHeight - 1;
 
1331
 
 
1332
                _setcolor (IS_LAYOUT_DUST (*pRoot) ? _COLOR_GREEN : _COLOR_DGREEN);
 
1333
 
 
1334
                _rectangle (_GFILLINTERIOR,
 
1335
                                B2SX (r.xLeft - pDebugBlock -> Rect.xLeft),
 
1336
                                B2SY (r.yTop - pDebugBlock -> Rect.yTop),
 
1337
                                B2SX (r.xRight - pDebugBlock -> Rect.xLeft),
 
1338
                                B2SY (r.yBottom - pDebugBlock -> Rect.yTop));
 
1339
        }
 
1340
 
 
1341
        _setcolor (_COLOR_BACKGROUND);
 
1342
 
 
1343
        for (x = 1; x < nMatrixWidth; x++)
 
1344
        {
 
1345
                _moveto (rGrid.xLeft + x * nCellWidth, rGrid.yTop);
 
1346
                _lineto (rGrid.xLeft + x * nCellWidth, rGrid.yBottom);
 
1347
        }
 
1348
 
 
1349
        for (y = 1; y < nMatrixHeight; y++)
 
1350
        {
 
1351
                _moveto (rGrid.xLeft, rGrid.yTop + y * nCellHeight);
 
1352
                _lineto (rGrid.xRight, rGrid.yTop + y * nCellHeight);
 
1353
        }
 
1354
 
 
1355
        _rectangle (_GBORDER, rGrid.xLeft, rGrid.yTop, rGrid.xRight, rGrid.yBottom);
 
1356
 
 
1357
        _gettextsettings (&ts);
 
1358
        _setcharsize (ts.height / 2, ts.width / 2);
 
1359
        _settextalign (_CENTER, _HALF);
 
1360
 
 
1361
        for (x = 0; x < nMatrixWidth; x++)
 
1362
        {
 
1363
                for (y = 0; y < nMatrixHeight; y++)
 
1364
                {
 
1365
                        char szTextBuffer [16];
 
1366
 
 
1367
                        if (DQD_Matrix [x + y * nMatrixWidth] == 0)
 
1368
                        continue;
 
1369
 
 
1370
                        _setcolor (_COLOR_BLACK);
 
1371
 
 
1372
                        _rectangle
 
1373
                        (
 
1374
                                        _GFILLINTERIOR,
 
1375
                                        rGrid.xLeft + x * nCellWidth + nCellWidth / 2 - ts.width * 2,
 
1376
                                        rGrid.yTop + y * nCellHeight + nCellHeight / 2 - ts.height / 3,
 
1377
                                        rGrid.xLeft + x * nCellWidth + nCellWidth / 2 + ts.width * 2,
 
1378
                                        rGrid.yTop + y * nCellHeight + nCellHeight / 2 + ts.height / 3
 
1379
                        );
 
1380
 
 
1381
                        sprintf (szTextBuffer, "%d %d",
 
1382
                                        DQD_Matrix [x + y * nMatrixWidth],
 
1383
                                        DSD_Matrix [x + y * nMatrixWidth]);
 
1384
 
 
1385
                        _setcolor (_COLOR_BACKGROUND);
 
1386
 
 
1387
                        _grtext
 
1388
                        (
 
1389
                                        rGrid.xLeft + x * nCellWidth + nCellWidth / 2,
 
1390
                                        rGrid.yTop + y * nCellHeight + nCellHeight / 2,
 
1391
                                        szTextBuffer
 
1392
                        );
 
1393
                }
 
1394
        }
 
1395
 
 
1396
        _setcharsize (ts.height, ts.width);
 
1397
 
 
1398
        ColumnChart
 
1399
        (
 
1400
                        SCREEN_WIDTH * 6 / 10,
 
1401
                        SCREEN_HEIGHT * 1 / 10,
 
1402
                        SCREEN_WIDTH * 9 / 10,
 
1403
                        SCREEN_HEIGHT * 4 / 10,
 
1404
                        DQD_Matrix,
 
1405
                        nMatrixWidth * nMatrixHeight
 
1406
        );
 
1407
 
 
1408
        ColumnChart
 
1409
        (
 
1410
                        SCREEN_WIDTH * 6 / 10,
 
1411
                        SCREEN_HEIGHT * 6 / 10,
 
1412
                        SCREEN_WIDTH * 9 / 10,
 
1413
                        SCREEN_HEIGHT * 9 / 10,
 
1414
                        DSD_Matrix,
 
1415
                        nMatrixWidth * nMatrixHeight
 
1416
        );
1422
1417
}
1423
1418
static void ShowBlock (int xLeft, int yTop, int nScaling)
1424
1419
{
1425
 
    ROOT *pRoot;
1426
 
    int nFactor;
1427
 
    int nBlockWidth,nBlockHeight;
1428
 
    RECTANGLE rGrid;
1429
 
    char szTextBuffer [80];
1430
 
 
1431
 
    nBlockWidth  = pDebugBlock -> Rect.xRight  - pDebugBlock -> Rect.xLeft + 1;
1432
 
    nBlockHeight = pDebugBlock -> Rect.yBottom - pDebugBlock -> Rect.yTop  + 1;
1433
 
 
1434
 
    nFactor = MIN (VIEW_WIDTH / 2 /nBlockWidth, VIEW_HEIGHT / nBlockHeight);
1435
 
 
1436
 
    LT_GraphicsClearScreen ();
1437
 
 
1438
 
    for (pRoot = pDebugBlock -> pRoots; pRoot != NULL; pRoot = pRoot -> u1.pNext)
1439
 
    {
1440
 
        RECTANGLE r;
1441
 
 
1442
 
        r.xLeft   = pRoot -> xColumn;
1443
 
        r.yTop    = pRoot -> yRow;
1444
 
        r.xRight  = r.xLeft + pRoot -> nWidth  - 1;
1445
 
        r.yBottom = r.yTop  + pRoot -> nHeight - 1;
1446
 
 
1447
 
        _setcolor (IS_LAYOUT_DUST (*pRoot) ? _COLOR_GREEN : _COLOR_DGREEN);
1448
 
 
1449
 
        _rectangle (_GFILLINTERIOR,
1450
 
            B2SX (r.xLeft   - pDebugBlock -> Rect.xLeft),
1451
 
            B2SY (r.yTop    - pDebugBlock -> Rect.yTop),
1452
 
            B2SX (r.xRight  - pDebugBlock -> Rect.xLeft),
1453
 
            B2SY (r.yBottom - pDebugBlock -> Rect.yTop));
1454
 
    }
1455
 
    _setcolor(_COLOR_BACKGROUND);
1456
 
 
1457
 
    rGrid.xLeft   = B2SX (0);
1458
 
    rGrid.yTop    = B2SY (0);
1459
 
    rGrid.xRight  = B2SX (nBlockWidth  - 1);
1460
 
    rGrid.yBottom = B2SY (nBlockHeight - 1);
1461
 
 
1462
 
    _rectangle (_GBORDER, rGrid.xLeft, rGrid.yTop, rGrid.xRight, rGrid.yBottom);
1463
 
 
1464
 
            sprintf (szTextBuffer, "Number:%i", pDebugBlock->nNumber);
1465
 
            _grtext
1466
 
            (
1467
 
                rGrid.xLeft ,
1468
 
                rGrid.yBottom+15,
1469
 
                szTextBuffer
1470
 
            );
1471
 
 
 
1420
        ROOT *pRoot;
 
1421
        int nFactor;
 
1422
        int nBlockWidth,nBlockHeight;
 
1423
        RECTANGLE rGrid;
 
1424
        char szTextBuffer [80];
 
1425
 
 
1426
        nBlockWidth = pDebugBlock -> Rect.xRight - pDebugBlock -> Rect.xLeft + 1;
 
1427
        nBlockHeight = pDebugBlock -> Rect.yBottom - pDebugBlock -> Rect.yTop + 1;
 
1428
 
 
1429
        nFactor = MIN (VIEW_WIDTH / 2 /nBlockWidth, VIEW_HEIGHT / nBlockHeight);
 
1430
 
 
1431
        LT_GraphicsClearScreen ();
 
1432
 
 
1433
        for (pRoot = pDebugBlock -> pRoots; pRoot != NULL; pRoot = pRoot -> u1.pNext)
 
1434
        {
 
1435
                RECTANGLE r;
 
1436
 
 
1437
                r.xLeft = pRoot -> xColumn;
 
1438
                r.yTop = pRoot -> yRow;
 
1439
                r.xRight = r.xLeft + pRoot -> nWidth - 1;
 
1440
                r.yBottom = r.yTop + pRoot -> nHeight - 1;
 
1441
 
 
1442
                _setcolor (IS_LAYOUT_DUST (*pRoot) ? _COLOR_GREEN : _COLOR_DGREEN);
 
1443
 
 
1444
                _rectangle (_GFILLINTERIOR,
 
1445
                                B2SX (r.xLeft - pDebugBlock -> Rect.xLeft),
 
1446
                                B2SY (r.yTop - pDebugBlock -> Rect.yTop),
 
1447
                                B2SX (r.xRight - pDebugBlock -> Rect.xLeft),
 
1448
                                B2SY (r.yBottom - pDebugBlock -> Rect.yTop));
 
1449
        }
 
1450
        _setcolor(_COLOR_BACKGROUND);
 
1451
 
 
1452
        rGrid.xLeft = B2SX (0);
 
1453
        rGrid.yTop = B2SY (0);
 
1454
        rGrid.xRight = B2SX (nBlockWidth - 1);
 
1455
        rGrid.yBottom = B2SY (nBlockHeight - 1);
 
1456
 
 
1457
        _rectangle (_GBORDER, rGrid.xLeft, rGrid.yTop, rGrid.xRight, rGrid.yBottom);
 
1458
 
 
1459
        sprintf (szTextBuffer, "Number:%i", pDebugBlock->nNumber);
 
1460
        _grtext
 
1461
        (
 
1462
                        rGrid.xLeft ,
 
1463
                        rGrid.yBottom+15,
 
1464
                        szTextBuffer
 
1465
        );
1472
1466
 
1473
1467
}
1474
1468
 
1475
1469
static BLOCK *pBlocksListBegin;
1476
 
static int    oBlockNext;
 
1470
static int oBlockNext;
1477
1471
 
1478
1472
static void BlocksListUpdate (int xLeft, int yTop, int nScaling)
1479
1473
{
1480
 
    BLOCK *p;
1481
 
    int nBlock;
1482
 
 
1483
 
    struct textsettings ts;
1484
 
    int x, y;
1485
 
    char szTextBuffer [128];
1486
 
 
1487
 
    LT_GraphicsClearScreen ();
1488
 
 
1489
 
    _gettextsettings (&ts);
1490
 
    _setcharsize (ts.height / 2, ts.width / 2);
1491
 
    _settextalign (_CENTER, _HALF);
1492
 
 
1493
 
    for (nBlock = 1, p = pBlocksListBegin;
1494
 
             p != NULL;
1495
 
                 p = *(BLOCK **) ((BYTE *) p + oBlockNext), nBlock++)
1496
 
    {
1497
 
        _setcolor (NUMBER_TO_COLOR (p -> nNumber));
1498
 
        BlockRectangle (p, _GBORDER, xLeft, yTop, nScaling);
1499
 
 
1500
 
        x = ((p -> Rect.xLeft + p -> Rect.xRight)  / 2 - xLeft) / nScaling;
1501
 
        y = ((p -> Rect.yTop  + p -> Rect.yBottom) / 2 - yTop)  / nScaling;
1502
 
 
1503
 
        _setcolor (_COLOR_BACKGROUND);
1504
 
        sprintf (szTextBuffer, "%d", nBlock);
1505
 
        if(p->nUserNum)
1506
 
           sprintf(szTextBuffer, "%d/%d", nBlock,p->nUserNum);
1507
 
        _grtext (x, y, szTextBuffer);
1508
 
    }
1509
 
 
1510
 
    _setcharsize (ts.height, ts.width);
 
1474
        BLOCK *p;
 
1475
        int nBlock;
 
1476
 
 
1477
        struct textsettings ts;
 
1478
        int x, y;
 
1479
        char szTextBuffer [128];
 
1480
 
 
1481
        LT_GraphicsClearScreen ();
 
1482
 
 
1483
        _gettextsettings (&ts);
 
1484
        _setcharsize (ts.height / 2, ts.width / 2);
 
1485
        _settextalign (_CENTER, _HALF);
 
1486
 
 
1487
        for (nBlock = 1, p = pBlocksListBegin;
 
1488
                        p != NULL;
 
1489
                        p = *(BLOCK **) ((uchar *) p + oBlockNext), nBlock++)
 
1490
        {
 
1491
                _setcolor (NUMBER_TO_COLOR (p -> nNumber));
 
1492
                BlockRectangle (p, _GBORDER, xLeft, yTop, nScaling);
 
1493
 
 
1494
                x = ((p -> Rect.xLeft + p -> Rect.xRight) / 2 - xLeft) / nScaling;
 
1495
                y = ((p -> Rect.yTop + p -> Rect.yBottom) / 2 - yTop) / nScaling;
 
1496
 
 
1497
                _setcolor (_COLOR_BACKGROUND);
 
1498
                sprintf (szTextBuffer, "%d", nBlock);
 
1499
                if(p->nUserNum)
 
1500
                sprintf(szTextBuffer, "%d/%d", nBlock,p->nUserNum);
 
1501
                _grtext (x, y, szTextBuffer);
 
1502
        }
 
1503
 
 
1504
        _setcharsize (ts.height, ts.width);
1511
1505
}
1512
1506
/************** ATAL 940414
1513
1507
 
1514
 
static void TreeUpdate (int xLeft, int yTop, int nScaling)
1515
 
{
1516
 
    BLOCK *p, *q;
1517
 
    int i;
1518
 
    struct textsettings ts;
1519
 
    int x1, y1;
1520
 
    int x2, y2;
1521
 
    char szTextBuffer [128];
1522
 
 
1523
 
    LT_GraphicsClearScreen ();
1524
 
 
1525
 
    for (p = pBlocksList; p != NULL; p = p -> pNext)
1526
 
    {
1527
 
        _setcolor (NUMBER_TO_COLOR (p -> nNumber));
1528
 
        BlockRectangle (p, _GBORDER, xLeft, yTop, nScaling);
1529
 
 
1530
 
        x1 = ((p -> Rect.xLeft + p -> Rect.xRight)  / 2 - xLeft) / nScaling;
1531
 
        y1 = ((p -> Rect.yTop  + p -> Rect.yBottom) / 2 - yTop)  / nScaling;
1532
 
 
1533
 
        for (i = 0; i < p -> nChildren; i++)
1534
 
        {
1535
 
            q = p -> pChildren [i];
1536
 
 
1537
 
            x2 = ((q -> Rect.xLeft + q -> Rect.xRight)  / 2 - xLeft) / nScaling;
1538
 
            y2 = ((q -> Rect.yTop  + q -> Rect.yBottom) / 2 - yTop)  / nScaling;
1539
 
            _moveto (x1, y1);
1540
 
            _lineto (x2, y2);
1541
 
        }
1542
 
    }
1543
 
 
1544
 
    _gettextsettings (&ts);
1545
 
    _setcharsize (ts.height / 2, ts.width / 2);
1546
 
    _settextalign (_LEFT, _BASE);
1547
 
    _setcolor (15);
1548
 
 
1549
 
    for (p = pBlocksList; p != NULL; p = p -> pNext)
1550
 
    {
1551
 
        x1 = ((p -> Rect.xLeft + p -> Rect.xRight)  / 2 - xLeft) / nScaling;
1552
 
        y1 = ((p -> Rect.yTop  + p -> Rect.yBottom) / 2 - yTop)  / nScaling;
1553
 
        sprintf (szTextBuffer, "%d", p -> nParents);
1554
 
        _grtext (x1, y1, szTextBuffer);
1555
 
    }
1556
 
 
1557
 
    _setcharsize (ts.height, ts.width);
1558
 
}
1559
 
*************************/
 
1508
 static void TreeUpdate (int xLeft, int yTop, int nScaling)
 
1509
 {
 
1510
 BLOCK *p, *q;
 
1511
 int i;
 
1512
 struct textsettings ts;
 
1513
 int x1, y1;
 
1514
 int x2, y2;
 
1515
 char szTextBuffer [128];
 
1516
 
 
1517
 LT_GraphicsClearScreen ();
 
1518
 
 
1519
 for (p = pBlocksList; p != NULL; p = p -> pNext)
 
1520
 {
 
1521
 _setcolor (NUMBER_TO_COLOR (p -> nNumber));
 
1522
 BlockRectangle (p, _GBORDER, xLeft, yTop, nScaling);
 
1523
 
 
1524
 x1 = ((p -> Rect.xLeft + p -> Rect.xRight)  / 2 - xLeft) / nScaling;
 
1525
 y1 = ((p -> Rect.yTop  + p -> Rect.yBottom) / 2 - yTop)  / nScaling;
 
1526
 
 
1527
 for (i = 0; i < p -> nChildren; i++)
 
1528
 {
 
1529
 q = p -> pChildren [i];
 
1530
 
 
1531
 x2 = ((q -> Rect.xLeft + q -> Rect.xRight)  / 2 - xLeft) / nScaling;
 
1532
 y2 = ((q -> Rect.yTop  + q -> Rect.yBottom) / 2 - yTop)  / nScaling;
 
1533
 _moveto (x1, y1);
 
1534
 _lineto (x2, y2);
 
1535
 }
 
1536
 }
 
1537
 
 
1538
 _gettextsettings (&ts);
 
1539
 _setcharsize (ts.height / 2, ts.width / 2);
 
1540
 _settextalign (_LEFT, _BASE);
 
1541
 _setcolor (15);
 
1542
 
 
1543
 for (p = pBlocksList; p != NULL; p = p -> pNext)
 
1544
 {
 
1545
 x1 = ((p -> Rect.xLeft + p -> Rect.xRight)  / 2 - xLeft) / nScaling;
 
1546
 y1 = ((p -> Rect.yTop  + p -> Rect.yBottom) / 2 - yTop)  / nScaling;
 
1547
 sprintf (szTextBuffer, "%d", p -> nParents);
 
1548
 _grtext (x1, y1, szTextBuffer);
 
1549
 }
 
1550
 
 
1551
 _setcharsize (ts.height, ts.width);
 
1552
 }
 
1553
 *************************/
1560
1554
 
1561
1555
static void BlocksOrderUpdate (int xLeft, int yTop, int nScaling)
1562
1556
{
1563
 
    BLOCK *p;
1564
 
    struct textsettings ts;
1565
 
    int x, y;
1566
 
    char szTextBuffer [128];
1567
 
 
1568
 
    LT_GraphicsClearScreen ();
1569
 
 
1570
 
    _gettextsettings (&ts);
1571
 
    _setcharsize (ts.height / 2, ts.width / 2);
1572
 
    _settextalign (_CENTER, _HALF);
1573
 
 
1574
 
    for (p = pBlocksList; p != NULL; p = p -> pNext)
1575
 
    {
1576
 
        _setcolor (NUMBER_TO_COLOR (p -> nNumber));
1577
 
        BlockRectangle (p, _GBORDER, xLeft, yTop, nScaling);
1578
 
 
1579
 
        if (p -> Type == BLOCK_TEXT || p -> Type == BLOCK_PICTURE)
1580
 
        {
1581
 
            x = ((p -> Rect.xLeft + p -> Rect.xRight)  / 2 - xLeft) / nScaling;
1582
 
            y = ((p -> Rect.yTop  + p -> Rect.yBottom) / 2 - yTop)  / nScaling;
1583
 
 
1584
 
            _setcolor (_COLOR_BACKGROUND);
1585
 
            sprintf (szTextBuffer, "%d", p -> nNumber);
1586
 
            if(p->nUserNum)
1587
 
           sprintf(szTextBuffer, "%d/%d", p -> nNumber,p->nUserNum);
1588
 
 
1589
 
            _grtext (x, y, szTextBuffer);
1590
 
        }
1591
 
    }
1592
 
 
1593
 
    _setcharsize (ts.height, ts.width);
 
1557
        BLOCK *p;
 
1558
        struct textsettings ts;
 
1559
        int x, y;
 
1560
        char szTextBuffer [128];
 
1561
 
 
1562
        LT_GraphicsClearScreen ();
 
1563
 
 
1564
        _gettextsettings (&ts);
 
1565
        _setcharsize (ts.height / 2, ts.width / 2);
 
1566
        _settextalign (_CENTER, _HALF);
 
1567
 
 
1568
        for (p = pBlocksList; p != NULL; p = p -> pNext)
 
1569
        {
 
1570
                _setcolor (NUMBER_TO_COLOR (p -> nNumber));
 
1571
                BlockRectangle (p, _GBORDER, xLeft, yTop, nScaling);
 
1572
 
 
1573
                if (p -> Type == BLOCK_TEXT || p -> Type == BLOCK_PICTURE)
 
1574
                {
 
1575
                        x = ((p -> Rect.xLeft + p -> Rect.xRight) / 2 - xLeft) / nScaling;
 
1576
                        y = ((p -> Rect.yTop + p -> Rect.yBottom) / 2 - yTop) / nScaling;
 
1577
 
 
1578
                        _setcolor (_COLOR_BACKGROUND);
 
1579
                        sprintf (szTextBuffer, "%d", p -> nNumber);
 
1580
                        if(p->nUserNum)
 
1581
                        sprintf(szTextBuffer, "%d/%d", p -> nNumber,p->nUserNum);
 
1582
 
 
1583
                        _grtext (x, y, szTextBuffer);
 
1584
                }
 
1585
        }
 
1586
 
 
1587
        _setcharsize (ts.height, ts.width);
1594
1588
}
1595
1589
 
1596
1590
static void CurrentStringUpdate (int xLeft, int yTop, int nScaling)
1597
1591
{
1598
 
    ROOT *pRoot;
1599
 
    int i;
1600
 
    unsigned old_style;
1601
 
 
1602
 
    LT_GraphicsClearScreen ();
1603
 
 
1604
 
    for (i = 0; i < String.nLetters; i++)
1605
 
    {
1606
 
        pRoot = pRoots + String.pLettersList [i];
1607
 
 
1608
 
        _setcolor ((pRoot -> bType & ROOT_SPECIAL_LETTER) ? _COLOR_BACKGROUND : _COLOR_GREEN);
1609
 
        _rectangle (_GFILLINTERIOR,
1610
 
            (pRoot -> xColumn                       - xLeft) / nScaling,
1611
 
            (pRoot -> yRow                          - yTop)  / nScaling,
1612
 
            (pRoot -> xColumn + pRoot ->nWidth  - 1 - xLeft) / nScaling,
1613
 
            (pRoot -> yRow    + pRoot ->nHeight - 1 - yTop)  / nScaling);
1614
 
    }
1615
 
 
1616
 
    _setcolor (_COLOR_GREEN);
1617
 
 
1618
 
    for (i = 0; i < String.nDust; i++)
1619
 
    {
1620
 
        pRoot = pRoots + String.pDustList [i];
1621
 
 
1622
 
        _rectangle (_GBORDER,
1623
 
            (pRoot -> xColumn                        - xLeft) / nScaling - 1,
1624
 
            (pRoot -> yRow                           - yTop)  / nScaling - 1,
1625
 
            (pRoot -> xColumn + pRoot -> nWidth  - 1 - xLeft) / nScaling + 1,
1626
 
            (pRoot -> yRow    + pRoot -> nHeight - 1 - yTop)  / nScaling + 1);
1627
 
    }
1628
 
 
1629
 
    old_style = _getlinestyle ();
1630
 
    _setlinestyle (0xcccc);
1631
 
 
1632
 
    _moveto ((String.xLeft  - xLeft) / nScaling,
1633
 
             (String.yMin   - yTop)  / nScaling);
1634
 
    _lineto ((String.xRight - xLeft) / nScaling,
1635
 
             (String.yMin   - yTop)  / nScaling);
1636
 
 
1637
 
    _moveto ((String.xLeft  - xLeft) / nScaling,
1638
 
             (String.yMax   - yTop)  / nScaling);
1639
 
    _lineto ((String.xRight - xLeft) / nScaling,
1640
 
             (String.yMax   - yTop)  / nScaling);
1641
 
    _setlinestyle (old_style);
1642
 
 
1643
 
    _setcolor (_COLOR_RED);
1644
 
    _rectangle (_GBORDER,
1645
 
                (String.xLeft   - xLeft) / nScaling,
1646
 
                (String.yTop    - yTop)  / nScaling,
1647
 
                (String.xRight  - xLeft) / nScaling,
1648
 
                (String.yBottom - yTop)  / nScaling);
1649
 
 
1650
 
    _setcolor (_COLOR_BACKGROUND);
1651
 
    _moveto ((String.xLeft         - xLeft) / nScaling,
1652
 
             (String.yMiddleTop    - yTop)  / nScaling);
1653
 
    _lineto ((String.xRight        - xLeft) / nScaling,
1654
 
             (String.yMiddleTop    - yTop)  / nScaling);
1655
 
 
1656
 
    _moveto ((String.xLeft         - xLeft) / nScaling,
1657
 
             (String.yMiddleBottom - yTop)  / nScaling);
1658
 
    _lineto ((String.xRight        - xLeft) / nScaling,
1659
 
             (String.yMiddleBottom - yTop)  / nScaling);
 
1592
        ROOT *pRoot;
 
1593
        int i;
 
1594
        unsigned old_style;
 
1595
 
 
1596
        LT_GraphicsClearScreen ();
 
1597
 
 
1598
        for (i = 0; i < String.nLetters; i++)
 
1599
        {
 
1600
                pRoot = pRoots + String.pLettersList [i];
 
1601
 
 
1602
                _setcolor ((pRoot -> bType & ROOT_SPECIAL_LETTER) ? _COLOR_BACKGROUND : _COLOR_GREEN);
 
1603
                _rectangle (_GFILLINTERIOR,
 
1604
                                (pRoot -> xColumn - xLeft) / nScaling,
 
1605
                                (pRoot -> yRow - yTop) / nScaling,
 
1606
                                (pRoot -> xColumn + pRoot ->nWidth - 1 - xLeft) / nScaling,
 
1607
                                (pRoot -> yRow + pRoot ->nHeight - 1 - yTop) / nScaling);
 
1608
        }
 
1609
 
 
1610
        _setcolor (_COLOR_GREEN);
 
1611
 
 
1612
        for (i = 0; i < String.nDust; i++)
 
1613
        {
 
1614
                pRoot = pRoots + String.pDustList [i];
 
1615
 
 
1616
                _rectangle (_GBORDER,
 
1617
                                (pRoot -> xColumn - xLeft) / nScaling - 1,
 
1618
                                (pRoot -> yRow - yTop) / nScaling - 1,
 
1619
                                (pRoot -> xColumn + pRoot -> nWidth - 1 - xLeft) / nScaling + 1,
 
1620
                                (pRoot -> yRow + pRoot -> nHeight - 1 - yTop) / nScaling + 1);
 
1621
        }
 
1622
 
 
1623
        old_style = _getlinestyle ();
 
1624
        _setlinestyle (0xcccc);
 
1625
 
 
1626
        _moveto ((String.xLeft - xLeft) / nScaling,
 
1627
                        (String.yMin - yTop) / nScaling);
 
1628
        _lineto ((String.xRight - xLeft) / nScaling,
 
1629
                        (String.yMin - yTop) / nScaling);
 
1630
 
 
1631
        _moveto ((String.xLeft - xLeft) / nScaling,
 
1632
                        (String.yMax - yTop) / nScaling);
 
1633
        _lineto ((String.xRight - xLeft) / nScaling,
 
1634
                        (String.yMax - yTop) / nScaling);
 
1635
        _setlinestyle (old_style);
 
1636
 
 
1637
        _setcolor (_COLOR_RED);
 
1638
        _rectangle (_GBORDER,
 
1639
                        (String.xLeft - xLeft) / nScaling,
 
1640
                        (String.yTop - yTop) / nScaling,
 
1641
                        (String.xRight - xLeft) / nScaling,
 
1642
                        (String.yBottom - yTop) / nScaling);
 
1643
 
 
1644
        _setcolor (_COLOR_BACKGROUND);
 
1645
        _moveto ((String.xLeft - xLeft) / nScaling,
 
1646
                        (String.yMiddleTop - yTop) / nScaling);
 
1647
        _lineto ((String.xRight - xLeft) / nScaling,
 
1648
                        (String.yMiddleTop - yTop) / nScaling);
 
1649
 
 
1650
        _moveto ((String.xLeft - xLeft) / nScaling,
 
1651
                        (String.yMiddleBottom - yTop) / nScaling);
 
1652
        _lineto ((String.xRight - xLeft) / nScaling,
 
1653
                        (String.yMiddleBottom - yTop) / nScaling);
1660
1654
}
1661
1655
 
1662
1656
static void StringsUpdate (int xLeft, int yTop, int nScaling)
1663
1657
{
1664
 
    STRING *pString;
1665
 
    ROOT        *pRoot;
1666
 
    int nString;
1667
 
    int nColor;
1668
 
    int nDustShift;
1669
 
    int i;
1670
 
    unsigned old_style;
1671
 
 
1672
 
    LT_GraphicsClearScreen ();
1673
 
 
1674
 
    for (pString = pStringsUpList, nString = 0;
1675
 
             pString != NULL;
1676
 
                 pString = pString -> pDown, nString++)
1677
 
    {
1678
 
        nColor     = NUMBER_TO_COLOR (nString);
1679
 
        nDustShift = 2 * (nString % 6 + 1);
1680
 
 
1681
 
        _setcolor (nColor + 8);
1682
 
        _rectangle (_GBORDER,
1683
 
                    (pString -> xLeft   - xLeft) / nScaling,
1684
 
                    (pString -> yTop    - yTop)  / nScaling,
1685
 
                    (pString -> xRight  - xLeft) / nScaling,
1686
 
                    (pString -> yBottom - yTop)  / nScaling);
1687
 
 
1688
 
        for (i = 0; i < pString -> nLetters; i++)
1689
 
        {
1690
 
            pRoot = pRoots + pString -> pLettersList [i];
1691
 
            _setcolor ((pRoot -> bType & ROOT_SPECIAL_LETTER) ? _COLOR_BACKGROUND : nColor);
1692
 
            _rectangle (_GFILLINTERIOR,
1693
 
                (pRoot -> xColumn - xLeft) / nScaling + nDustShift,
1694
 
                (pRoot -> yRow    - yTop)  / nScaling,
1695
 
                (pRoot -> xColumn + pRoot ->nWidth  - 1
1696
 
                                        - xLeft) / nScaling + nDustShift,
1697
 
                (pRoot -> yRow    + pRoot ->nHeight - 1
1698
 
                                        - yTop)  / nScaling);
1699
 
        }
1700
 
 
1701
 
        _setcolor (nColor + 8);
1702
 
 
1703
 
        for (i = 0; i < pString -> nDust; i++)
1704
 
        {
1705
 
            pRoot = pRoots + pString -> pDustList [i];
1706
 
 
1707
 
            if (pRoot -> bType & ROOT_USED)
1708
 
                continue;
1709
 
 
1710
 
            _rectangle (_GBORDER,
1711
 
                (pRoot -> xColumn - xLeft) / nScaling + nDustShift,
1712
 
                (pRoot -> yRow    - yTop)  / nScaling,
1713
 
                (pRoot -> xColumn + pRoot ->nWidth - 1
1714
 
                                        - xLeft) / nScaling + nDustShift,
1715
 
                (pRoot -> yRow    + pRoot ->nHeight - 1
1716
 
                                        - yTop)  / nScaling);
1717
 
        }
1718
 
 
1719
 
        _setcolor (_COLOR_BACKGROUND);
1720
 
 
1721
 
        for (i = 0; i < pString -> nDust; i++)
1722
 
        {
1723
 
            pRoot = pRoots + pString -> pDustList [i];
1724
 
 
1725
 
            if (pRoot -> bType & ROOT_USED)
1726
 
                continue;
1727
 
 
1728
 
            _rectangle (_GBORDER,
1729
 
                (pRoot -> xColumn - xLeft) / nScaling,
1730
 
                (pRoot -> yRow    - yTop)  / nScaling,
1731
 
                (pRoot -> xColumn + pRoot ->nWidth - 1
1732
 
                                        - xLeft) / nScaling,
1733
 
                (pRoot -> yRow    + pRoot ->nHeight - 1
1734
 
                                        - yTop)  / nScaling);
1735
 
        }
1736
 
 
1737
 
        _setcolor (nColor + 8);
1738
 
 
1739
 
        old_style = _getlinestyle ();
1740
 
        _setlinestyle (0xcccc);
1741
 
 
1742
 
        _moveto ((pString -> xLeft  - xLeft) / nScaling,
1743
 
                 (pString -> yMin   - yTop)  / nScaling);
1744
 
        _lineto ((pString -> xRight - xLeft) / nScaling,
1745
 
                 (pString -> yMin   - yTop)  / nScaling);
1746
 
 
1747
 
        _moveto ((pString -> xLeft  - xLeft) / nScaling,
1748
 
                 (pString -> yMax   - yTop)  / nScaling);
1749
 
        _lineto ((pString -> xRight - xLeft) / nScaling,
1750
 
                 (pString -> yMax   - yTop)  / nScaling);
1751
 
        _setlinestyle (old_style);
1752
 
 
1753
 
        _setcolor (_COLOR_RED);
1754
 
        _rectangle (_GBORDER,
1755
 
                    (pString -> xLeft   - xLeft) / nScaling,
1756
 
                    (pString -> yTop    - yTop)  / nScaling,
1757
 
                    (pString -> xRight  - xLeft) / nScaling,
1758
 
                    (pString -> yBottom - yTop)  / nScaling);
1759
 
 
1760
 
        _setcolor (_COLOR_BACKGROUND);
1761
 
        _moveto ((pString -> xLeft         - xLeft) / nScaling,
1762
 
                 (pString -> yMiddleTop    - yTop)  / nScaling);
1763
 
        _lineto ((pString -> xRight        - xLeft) / nScaling,
1764
 
                 (pString -> yMiddleTop    - yTop)  / nScaling);
1765
 
 
1766
 
        _moveto ((pString -> xLeft         - xLeft) / nScaling,
1767
 
                 (pString -> yMiddleBottom - yTop)  / nScaling);
1768
 
        _lineto ((pString -> xRight        - xLeft) / nScaling,
1769
 
                 (pString -> yMiddleBottom - yTop)  / nScaling);
1770
 
    }
1771
 
 
1772
 
    SeparatorsOutput (xLeft, yTop, nScaling);
 
1658
        STRING *pString;
 
1659
        ROOT *pRoot;
 
1660
        int nString;
 
1661
        int nColor;
 
1662
        int nDustShift;
 
1663
        int i;
 
1664
        unsigned old_style;
 
1665
 
 
1666
        LT_GraphicsClearScreen ();
 
1667
 
 
1668
        for (pString = pStringsUpList, nString = 0;
 
1669
                        pString != NULL;
 
1670
                        pString = pString -> pDown, nString++)
 
1671
        {
 
1672
                nColor = NUMBER_TO_COLOR (nString);
 
1673
                nDustShift = 2 * (nString % 6 + 1);
 
1674
 
 
1675
                _setcolor (nColor + 8);
 
1676
                _rectangle (_GBORDER,
 
1677
                                (pString -> xLeft - xLeft) / nScaling,
 
1678
                                (pString -> yTop - yTop) / nScaling,
 
1679
                                (pString -> xRight - xLeft) / nScaling,
 
1680
                                (pString -> yBottom - yTop) / nScaling);
 
1681
 
 
1682
                for (i = 0; i < pString -> nLetters; i++)
 
1683
                {
 
1684
                        pRoot = pRoots + pString -> pLettersList [i];
 
1685
                        _setcolor ((pRoot -> bType & ROOT_SPECIAL_LETTER) ? _COLOR_BACKGROUND : nColor);
 
1686
                        _rectangle (_GFILLINTERIOR,
 
1687
                                        (pRoot -> xColumn - xLeft) / nScaling + nDustShift,
 
1688
                                        (pRoot -> yRow - yTop) / nScaling,
 
1689
                                        (pRoot -> xColumn + pRoot ->nWidth - 1
 
1690
                                                        - xLeft) / nScaling + nDustShift,
 
1691
                                        (pRoot -> yRow + pRoot ->nHeight - 1
 
1692
                                                        - yTop) / nScaling);
 
1693
                }
 
1694
 
 
1695
                _setcolor (nColor + 8);
 
1696
 
 
1697
                for (i = 0; i < pString -> nDust; i++)
 
1698
                {
 
1699
                        pRoot = pRoots + pString -> pDustList [i];
 
1700
 
 
1701
                        if (pRoot -> bType & ROOT_USED)
 
1702
                        continue;
 
1703
 
 
1704
                        _rectangle (_GBORDER,
 
1705
                                        (pRoot -> xColumn - xLeft) / nScaling + nDustShift,
 
1706
                                        (pRoot -> yRow - yTop) / nScaling,
 
1707
                                        (pRoot -> xColumn + pRoot ->nWidth - 1
 
1708
                                                        - xLeft) / nScaling + nDustShift,
 
1709
                                        (pRoot -> yRow + pRoot ->nHeight - 1
 
1710
                                                        - yTop) / nScaling);
 
1711
                }
 
1712
 
 
1713
                _setcolor (_COLOR_BACKGROUND);
 
1714
 
 
1715
                for (i = 0; i < pString -> nDust; i++)
 
1716
                {
 
1717
                        pRoot = pRoots + pString -> pDustList [i];
 
1718
 
 
1719
                        if (pRoot -> bType & ROOT_USED)
 
1720
                        continue;
 
1721
 
 
1722
                        _rectangle (_GBORDER,
 
1723
                                        (pRoot -> xColumn - xLeft) / nScaling,
 
1724
                                        (pRoot -> yRow - yTop) / nScaling,
 
1725
                                        (pRoot -> xColumn + pRoot ->nWidth - 1
 
1726
                                                        - xLeft) / nScaling,
 
1727
                                        (pRoot -> yRow + pRoot ->nHeight - 1
 
1728
                                                        - yTop) / nScaling);
 
1729
                }
 
1730
 
 
1731
                _setcolor (nColor + 8);
 
1732
 
 
1733
                old_style = _getlinestyle ();
 
1734
                _setlinestyle (0xcccc);
 
1735
 
 
1736
                _moveto ((pString -> xLeft - xLeft) / nScaling,
 
1737
                                (pString -> yMin - yTop) / nScaling);
 
1738
                _lineto ((pString -> xRight - xLeft) / nScaling,
 
1739
                                (pString -> yMin - yTop) / nScaling);
 
1740
 
 
1741
                _moveto ((pString -> xLeft - xLeft) / nScaling,
 
1742
                                (pString -> yMax - yTop) / nScaling);
 
1743
                _lineto ((pString -> xRight - xLeft) / nScaling,
 
1744
                                (pString -> yMax - yTop) / nScaling);
 
1745
                _setlinestyle (old_style);
 
1746
 
 
1747
                _setcolor (_COLOR_RED);
 
1748
                _rectangle (_GBORDER,
 
1749
                                (pString -> xLeft - xLeft) / nScaling,
 
1750
                                (pString -> yTop - yTop) / nScaling,
 
1751
                                (pString -> xRight - xLeft) / nScaling,
 
1752
                                (pString -> yBottom - yTop) / nScaling);
 
1753
 
 
1754
                _setcolor (_COLOR_BACKGROUND);
 
1755
                _moveto ((pString -> xLeft - xLeft) / nScaling,
 
1756
                                (pString -> yMiddleTop - yTop) / nScaling);
 
1757
                _lineto ((pString -> xRight - xLeft) / nScaling,
 
1758
                                (pString -> yMiddleTop - yTop) / nScaling);
 
1759
 
 
1760
                _moveto ((pString -> xLeft - xLeft) / nScaling,
 
1761
                                (pString -> yMiddleBottom - yTop) / nScaling);
 
1762
                _lineto ((pString -> xRight - xLeft) / nScaling,
 
1763
                                (pString -> yMiddleBottom - yTop) / nScaling);
 
1764
        }
 
1765
 
 
1766
        SeparatorsOutput (xLeft, yTop, nScaling);
1773
1767
}
1774
1768
 
1775
1769
static void StringsForwardOrderUpdate (int xLeft, int yTop, int nScaling)
1776
1770
{
1777
 
    STRING *p;
1778
 
    int nString;
1779
 
 
1780
 
    struct textsettings ts;
1781
 
    int x, y;
1782
 
    char szTextBuffer [128];
1783
 
 
1784
 
    LT_GraphicsClearScreen ();
1785
 
 
1786
 
    _gettextsettings (&ts);
1787
 
    _setcharsize (ts.height / 2, ts.width / 2);
1788
 
    _settextalign (_CENTER, _HALF);
1789
 
 
1790
 
    for (nString = 1, p = pStringsList; p != NULL; p = p -> pNext, nString++)
1791
 
    {
1792
 
        _setcolor (p -> uFlags & SF_NEED_DELETE ? _COLOR_BACKGROUND : NUMBER_TO_COLOR (nString));
1793
 
        _rectangle (_GBORDER,
1794
 
                    (p -> xLeft   - xLeft) / nScaling,
1795
 
                    (p -> yTop    - yTop)  / nScaling,
1796
 
                    (p -> xRight  - xLeft) / nScaling,
1797
 
                    (p -> yBottom - yTop)  / nScaling);
1798
 
 
1799
 
        x = ((p -> xLeft + p -> xRight)  / 2 - xLeft) / nScaling;
1800
 
        y = ((p -> yTop  + p -> yBottom) / 2 - yTop)  / nScaling;
1801
 
 
1802
 
        _setcolor (_COLOR_BACKGROUND);
1803
 
        sprintf (szTextBuffer, "%d", nString);
1804
 
        _grtext (x, y, szTextBuffer);
1805
 
    }
1806
 
 
1807
 
    _setcharsize (ts.height, ts.width);
 
1771
        STRING *p;
 
1772
        int nString;
 
1773
 
 
1774
        struct textsettings ts;
 
1775
        int x, y;
 
1776
        char szTextBuffer [128];
 
1777
 
 
1778
        LT_GraphicsClearScreen ();
 
1779
 
 
1780
        _gettextsettings (&ts);
 
1781
        _setcharsize (ts.height / 2, ts.width / 2);
 
1782
        _settextalign (_CENTER, _HALF);
 
1783
 
 
1784
        for (nString = 1, p = pStringsList; p != NULL; p = p -> pNext, nString++)
 
1785
        {
 
1786
                _setcolor (p -> uFlags & SF_NEED_DELETE ? _COLOR_BACKGROUND : NUMBER_TO_COLOR (nString));
 
1787
                _rectangle (_GBORDER,
 
1788
                                (p -> xLeft - xLeft) / nScaling,
 
1789
                                (p -> yTop - yTop) / nScaling,
 
1790
                                (p -> xRight - xLeft) / nScaling,
 
1791
                                (p -> yBottom - yTop) / nScaling);
 
1792
 
 
1793
                x = ((p -> xLeft + p -> xRight) / 2 - xLeft) / nScaling;
 
1794
                y = ((p -> yTop + p -> yBottom) / 2 - yTop) / nScaling;
 
1795
 
 
1796
                _setcolor (_COLOR_BACKGROUND);
 
1797
                sprintf (szTextBuffer, "%d", nString);
 
1798
                _grtext (x, y, szTextBuffer);
 
1799
        }
 
1800
 
 
1801
        _setcharsize (ts.height, ts.width);
1808
1802
}
1809
1803
 
1810
1804
static void StringsBackwardOrderUpdate (int xLeft, int yTop, int nScaling)
1811
1805
{
1812
 
    STRING *p;
1813
 
    int nString;
1814
 
 
1815
 
    struct textsettings ts;
1816
 
    int x, y;
1817
 
    char szTextBuffer [128];
1818
 
 
1819
 
    LT_GraphicsClearScreen ();
1820
 
 
1821
 
    _gettextsettings (&ts);
1822
 
    _setcharsize (ts.height / 2, ts.width / 2);
1823
 
    _settextalign (_CENTER, _HALF);
1824
 
 
1825
 
    for (nString = 1, p = pStringsListEnd; p != NULL; p = p -> pPrev, nString++)
1826
 
    {
1827
 
        _setcolor (p -> uFlags & SF_NEED_DELETE ? _COLOR_BACKGROUND : NUMBER_TO_COLOR (nString));
1828
 
        _rectangle (_GBORDER,
1829
 
                    (p -> xLeft   - xLeft) / nScaling,
1830
 
                    (p -> yTop    - yTop)  / nScaling,
1831
 
                    (p -> xRight  - xLeft) / nScaling,
1832
 
                    (p -> yBottom - yTop)  / nScaling);
1833
 
 
1834
 
        x = ((p -> xLeft + p -> xRight)  / 2 - xLeft) / nScaling;
1835
 
        y = ((p -> yTop  + p -> yBottom) / 2 - yTop)  / nScaling;
1836
 
 
1837
 
        _setcolor (_COLOR_BACKGROUND);
1838
 
        sprintf (szTextBuffer, "%d", nString);
1839
 
        _grtext (x, y, szTextBuffer);
1840
 
    }
1841
 
 
1842
 
    _setcharsize (ts.height, ts.width);
 
1806
        STRING *p;
 
1807
        int nString;
 
1808
 
 
1809
        struct textsettings ts;
 
1810
        int x, y;
 
1811
        char szTextBuffer [128];
 
1812
 
 
1813
        LT_GraphicsClearScreen ();
 
1814
 
 
1815
        _gettextsettings (&ts);
 
1816
        _setcharsize (ts.height / 2, ts.width / 2);
 
1817
        _settextalign (_CENTER, _HALF);
 
1818
 
 
1819
        for (nString = 1, p = pStringsListEnd; p != NULL; p = p -> pPrev, nString++)
 
1820
        {
 
1821
                _setcolor (p -> uFlags & SF_NEED_DELETE ? _COLOR_BACKGROUND : NUMBER_TO_COLOR (nString));
 
1822
                _rectangle (_GBORDER,
 
1823
                                (p -> xLeft - xLeft) / nScaling,
 
1824
                                (p -> yTop - yTop) / nScaling,
 
1825
                                (p -> xRight - xLeft) / nScaling,
 
1826
                                (p -> yBottom - yTop) / nScaling);
 
1827
 
 
1828
                x = ((p -> xLeft + p -> xRight) / 2 - xLeft) / nScaling;
 
1829
                y = ((p -> yTop + p -> yBottom) / 2 - yTop) / nScaling;
 
1830
 
 
1831
                _setcolor (_COLOR_BACKGROUND);
 
1832
                sprintf (szTextBuffer, "%d", nString);
 
1833
                _grtext (x, y, szTextBuffer);
 
1834
        }
 
1835
 
 
1836
        _setcharsize (ts.height, ts.width);
1843
1837
}
1844
1838
 
1845
1839
static void StringsUpOrderUpdate (int xLeft, int yTop, int nScaling)
1846
1840
{
1847
 
    STRING *p;
1848
 
    int nString;
1849
 
 
1850
 
    struct textsettings ts;
1851
 
    int x, y;
1852
 
    char szTextBuffer [128];
1853
 
 
1854
 
    LT_GraphicsClearScreen ();
1855
 
 
1856
 
    _gettextsettings (&ts);
1857
 
    _setcharsize (ts.height / 2, ts.width / 2);
1858
 
    _settextalign (_CENTER, _HALF);
1859
 
 
1860
 
    for (nString = 1, p = pStringsUpList; p != NULL; p = p -> pDown, nString++)
1861
 
    {
1862
 
        _setcolor (p -> uFlags & SF_NEED_DELETE ? _COLOR_BACKGROUND : NUMBER_TO_COLOR (nString));
1863
 
        _rectangle (_GBORDER,
1864
 
                    (p -> xLeft   - xLeft) / nScaling,
1865
 
                    (p -> yTop    - yTop)  / nScaling,
1866
 
                    (p -> xRight  - xLeft) / nScaling,
1867
 
                    (p -> yBottom - yTop)  / nScaling);
1868
 
 
1869
 
        x = ((p -> xLeft + p -> xRight)  / 2 - xLeft) / nScaling;
1870
 
        y = ((p -> yTop  + p -> yBottom) / 2 - yTop)  / nScaling;
1871
 
 
1872
 
        _setcolor (_COLOR_BACKGROUND);
1873
 
        sprintf (szTextBuffer, "%d", nString);
1874
 
        _grtext (x, y, szTextBuffer);
1875
 
    }
1876
 
 
1877
 
    _setcharsize (ts.height, ts.width);
 
1841
        STRING *p;
 
1842
        int nString;
 
1843
 
 
1844
        struct textsettings ts;
 
1845
        int x, y;
 
1846
        char szTextBuffer [128];
 
1847
 
 
1848
        LT_GraphicsClearScreen ();
 
1849
 
 
1850
        _gettextsettings (&ts);
 
1851
        _setcharsize (ts.height / 2, ts.width / 2);
 
1852
        _settextalign (_CENTER, _HALF);
 
1853
 
 
1854
        for (nString = 1, p = pStringsUpList; p != NULL; p = p -> pDown, nString++)
 
1855
        {
 
1856
                _setcolor (p -> uFlags & SF_NEED_DELETE ? _COLOR_BACKGROUND : NUMBER_TO_COLOR (nString));
 
1857
                _rectangle (_GBORDER,
 
1858
                                (p -> xLeft - xLeft) / nScaling,
 
1859
                                (p -> yTop - yTop) / nScaling,
 
1860
                                (p -> xRight - xLeft) / nScaling,
 
1861
                                (p -> yBottom - yTop) / nScaling);
 
1862
 
 
1863
                x = ((p -> xLeft + p -> xRight) / 2 - xLeft) / nScaling;
 
1864
                y = ((p -> yTop + p -> yBottom) / 2 - yTop) / nScaling;
 
1865
 
 
1866
                _setcolor (_COLOR_BACKGROUND);
 
1867
                sprintf (szTextBuffer, "%d", nString);
 
1868
                _grtext (x, y, szTextBuffer);
 
1869
        }
 
1870
 
 
1871
        _setcharsize (ts.height, ts.width);
1878
1872
}
1879
1873
 
1880
1874
static void StringsDownOrderUpdate (int xLeft, int yTop, int nScaling)
1881
1875
{
1882
 
    STRING *p;
1883
 
    int nString;
1884
 
 
1885
 
    struct textsettings ts;
1886
 
    int x, y;
1887
 
    char szTextBuffer [128];
1888
 
 
1889
 
    LT_GraphicsClearScreen ();
1890
 
 
1891
 
    _gettextsettings (&ts);
1892
 
    _setcharsize (ts.height / 2, ts.width / 2);
1893
 
    _settextalign (_CENTER, _HALF);
1894
 
 
1895
 
    for (nString = 1, p = pStringsDownList; p != NULL; p = p -> pUp, nString++)
1896
 
    {
1897
 
        _setcolor (p -> uFlags & SF_NEED_DELETE ? _COLOR_BACKGROUND : NUMBER_TO_COLOR (nString));
1898
 
        _rectangle (_GBORDER,
1899
 
                    (p -> xLeft   - xLeft) / nScaling,
1900
 
                    (p -> yTop    - yTop)  / nScaling,
1901
 
                    (p -> xRight  - xLeft) / nScaling,
1902
 
                    (p -> yBottom - yTop)  / nScaling);
1903
 
 
1904
 
        x = ((p -> xLeft + p -> xRight)  / 2 - xLeft) / nScaling;
1905
 
        y = ((p -> yTop  + p -> yBottom) / 2 - yTop)  / nScaling;
1906
 
 
1907
 
        _setcolor (_COLOR_BACKGROUND);
1908
 
        sprintf (szTextBuffer, "%d", nString);
1909
 
        _grtext (x, y, szTextBuffer);
1910
 
    }
1911
 
 
1912
 
    _setcharsize (ts.height, ts.width);
 
1876
        STRING *p;
 
1877
        int nString;
 
1878
 
 
1879
        struct textsettings ts;
 
1880
        int x, y;
 
1881
        char szTextBuffer [128];
 
1882
 
 
1883
        LT_GraphicsClearScreen ();
 
1884
 
 
1885
        _gettextsettings (&ts);
 
1886
        _setcharsize (ts.height / 2, ts.width / 2);
 
1887
        _settextalign (_CENTER, _HALF);
 
1888
 
 
1889
        for (nString = 1, p = pStringsDownList; p != NULL; p = p -> pUp, nString++)
 
1890
        {
 
1891
                _setcolor (p -> uFlags & SF_NEED_DELETE ? _COLOR_BACKGROUND : NUMBER_TO_COLOR (nString));
 
1892
                _rectangle (_GBORDER,
 
1893
                                (p -> xLeft - xLeft) / nScaling,
 
1894
                                (p -> yTop - yTop) / nScaling,
 
1895
                                (p -> xRight - xLeft) / nScaling,
 
1896
                                (p -> yBottom - yTop) / nScaling);
 
1897
 
 
1898
                x = ((p -> xLeft + p -> xRight) / 2 - xLeft) / nScaling;
 
1899
                y = ((p -> yTop + p -> yBottom) / 2 - yTop) / nScaling;
 
1900
 
 
1901
                _setcolor (_COLOR_BACKGROUND);
 
1902
                sprintf (szTextBuffer, "%d", nString);
 
1903
                _grtext (x, y, szTextBuffer);
 
1904
        }
 
1905
 
 
1906
        _setcharsize (ts.height, ts.width);
1913
1907
}
1914
1908
 
1915
1909
static void RasterUpdate (int xLeft, int yTop, int nScaling)
1916
1910
{
1917
 
    int x, y;
1918
 
    int nStep;
1919
 
 
1920
 
    LT_GraphicsClearScreen ();
1921
 
 
1922
 
    nStep = MIN (FIELD_WIDTH / nRasterWidth, FIELD_HEIGHT / nRasterHeight);
1923
 
 
1924
 
    if (nStep == 0) nStep = 1;
1925
 
 
1926
 
    _setcolor (_COLOR_BACKGROUND);
1927
 
    _rectangle (_GFILLINTERIOR,
1928
 
                (0                     - xLeft) / nScaling,
1929
 
                (0                     - yTop)  / nScaling,
1930
 
                (nRasterWidth  * nStep - xLeft) / nScaling,
1931
 
                (nRasterHeight * nStep - yTop)  / nScaling);
1932
 
 
1933
 
    _setcolor (_COLOR_BLACK);
1934
 
 
1935
 
    for (x = 0; x < nRasterWidth; x++)
1936
 
    {
1937
 
        for (y = 0; y < nRasterHeight; y++)
1938
 
        {
1939
 
            if ((pRaster [y * nRasterByteWidth + x / 8] << x % 8) & 0x80)
1940
 
            {
1941
 
                _rectangle (_GFILLINTERIOR,
1942
 
                    (x       * nStep - xLeft) / nScaling,
1943
 
                    (y       * nStep - yTop)  / nScaling,
1944
 
                    ((x + 1) * nStep - xLeft) / nScaling,
1945
 
                    ((y + 1) * nStep - yTop)  / nScaling);
1946
 
            }
1947
 
        }
1948
 
    }
1949
 
 
1950
 
    _setcolor (_COLOR_GRAY);
1951
 
 
1952
 
    for (x = 0; x <= nRasterWidth; x++)
1953
 
    {
1954
 
        _moveto ((x * nStep             - xLeft) / nScaling,
1955
 
                 (0                     - yTop)  / nScaling);
1956
 
        _lineto ((x * nStep             - xLeft) / nScaling,
1957
 
                 (nRasterHeight * nStep - yTop)  / nScaling);
1958
 
    }
1959
 
 
1960
 
    for (y = 0; y <= nRasterHeight; y++)
1961
 
    {
1962
 
        _moveto ((0                    - xLeft) / nScaling,
1963
 
                 (y * nStep            - yTop)  / nScaling);
1964
 
        _lineto ((nRasterWidth * nStep - xLeft) / nScaling,
1965
 
                 (y * nStep            - yTop)  / nScaling);
1966
 
    }
 
1911
        int x, y;
 
1912
        int nStep;
 
1913
 
 
1914
        LT_GraphicsClearScreen ();
 
1915
 
 
1916
        nStep = MIN (FIELD_WIDTH / nRasterWidth, FIELD_HEIGHT / nRasterHeight);
 
1917
 
 
1918
        if (nStep == 0) nStep = 1;
 
1919
 
 
1920
        _setcolor (_COLOR_BACKGROUND);
 
1921
        _rectangle (_GFILLINTERIOR,
 
1922
                        (0 - xLeft) / nScaling,
 
1923
                        (0 - yTop) / nScaling,
 
1924
                        (nRasterWidth * nStep - xLeft) / nScaling,
 
1925
                        (nRasterHeight * nStep - yTop) / nScaling);
 
1926
 
 
1927
        _setcolor (_COLOR_BLACK);
 
1928
 
 
1929
        for (x = 0; x < nRasterWidth; x++)
 
1930
        {
 
1931
                for (y = 0; y < nRasterHeight; y++)
 
1932
                {
 
1933
                        if ((pRaster [y * nRasterByteWidth + x / 8] << x % 8) & 0x80)
 
1934
                        {
 
1935
                                _rectangle (_GFILLINTERIOR,
 
1936
                                                (x * nStep - xLeft) / nScaling,
 
1937
                                                (y * nStep - yTop) / nScaling,
 
1938
                                                ((x + 1) * nStep - xLeft) / nScaling,
 
1939
                                                ((y + 1) * nStep - yTop) / nScaling);
 
1940
                        }
 
1941
                }
 
1942
        }
 
1943
 
 
1944
        _setcolor (_COLOR_GRAY);
 
1945
 
 
1946
        for (x = 0; x <= nRasterWidth; x++)
 
1947
        {
 
1948
                _moveto ((x * nStep - xLeft) / nScaling,
 
1949
                                (0 - yTop) / nScaling);
 
1950
                _lineto ((x * nStep - xLeft) / nScaling,
 
1951
                                (nRasterHeight * nStep - yTop) / nScaling);
 
1952
        }
 
1953
 
 
1954
        for (y = 0; y <= nRasterHeight; y++)
 
1955
        {
 
1956
                _moveto ((0 - xLeft) / nScaling,
 
1957
                                (y * nStep - yTop) / nScaling);
 
1958
                _lineto ((nRasterWidth * nStep - xLeft) / nScaling,
 
1959
                                (y * nStep - yTop) / nScaling);
 
1960
        }
1967
1961
}
1968
1962
 
1969
1963
static void BreakingUpdate (int xLeft, int yTop, int nScaling)
1970
1964
{
1971
 
    int x, y;
1972
 
    int nStep;
1973
 
 
1974
 
    LT_GraphicsClearScreen ();
1975
 
 
1976
 
    nStep = MIN (FIELD_WIDTH / nRasterWidth, FIELD_HEIGHT / nRasterHeight);
1977
 
 
1978
 
    if (nStep == 0)
1979
 
        nStep = 1;
1980
 
 
1981
 
    _setcolor (_COLOR_BACKGROUND);
1982
 
    _rectangle (_GFILLINTERIOR,
1983
 
                (0                     - xLeft) / nScaling,
1984
 
                (0                     - yTop)  / nScaling,
1985
 
                (nRasterWidth  * nStep - xLeft) / nScaling,
1986
 
                (nRasterHeight * nStep - yTop)  / nScaling);
1987
 
 
1988
 
    for (x = 0; x < nRasterWidth; x++)
1989
 
    {
1990
 
        for (y = 0; y < nRasterHeight; y++)
1991
 
        {
1992
 
            if ((pRaster [y * nRasterByteWidth + x / 8] << x % 8) & 0x80)
1993
 
                _setcolor (_COLOR_BLACK);
1994
 
            else if (y == yRasterBreakLine)
1995
 
                _setcolor (_COLOR_RED);
1996
 
            else if (y >= yRasterUpBreakLimit && y <= yRasterDownBreakLimit)
1997
 
                _setcolor (_COLOR_YELLOW);
1998
 
            else
1999
 
                continue;
2000
 
 
2001
 
            _rectangle (_GFILLINTERIOR,
2002
 
                (x       * nStep - xLeft) / nScaling,
2003
 
                (y       * nStep - yTop)  / nScaling,
2004
 
                ((x + 1) * nStep - xLeft) / nScaling,
2005
 
                ((y + 1) * nStep - yTop)  / nScaling);
2006
 
        }
2007
 
    }
2008
 
 
2009
 
    _setcolor (_COLOR_GRAY);
2010
 
 
2011
 
    for (x = 0; x <= nRasterWidth; x++)
2012
 
    {
2013
 
        _moveto ((x * nStep             - xLeft) / nScaling,
2014
 
                 (0                     - yTop)  / nScaling);
2015
 
        _lineto ((x * nStep             - xLeft) / nScaling,
2016
 
                 (nRasterHeight * nStep - yTop)  / nScaling);
2017
 
    }
2018
 
 
2019
 
    for (y = 0; y <= nRasterHeight; y++)
2020
 
    {
2021
 
        _moveto ((0                    - xLeft) / nScaling,
2022
 
                 (y * nStep            - yTop)  / nScaling);
2023
 
        _lineto ((nRasterWidth * nStep - xLeft) / nScaling,
2024
 
                 (y * nStep            - yTop)  / nScaling);
2025
 
    }
2026
 
 
2027
 
    _setcolor (_COLOR_BLUE);
2028
 
 
2029
 
    for (y = 0; y <= nRasterHeight; y++)
2030
 
    {
2031
 
        _rectangle (_GFILLINTERIOR,
2032
 
            ((nRasterWidth + 1) * nStep - xLeft) / nScaling,
2033
 
            (y                  * nStep - yTop)  / nScaling,
2034
 
            ((aRasterHystogram [y] + nRasterWidth + 1)
2035
 
                                * nStep - xLeft) / nScaling,
2036
 
            ((y + 1)            * nStep - yTop)  / nScaling);
2037
 
    }
2038
 
}
2039
 
 
2040
 
void LT_GraphicsTitle (char *pTitle)
2041
 
{
2042
 
//    _setcolor (_COLOR_BACKGROUND);
2043
 
    _setcolor (_COLOR_TEXT);
2044
 
    _settextalign (_CENTER, _HALF); // _HALF("_HALPH")==_CENTER
2045
 
    _grtext (320, 450, pTitle);
2046
 
}
2047
 
 
2048
 
/* ����� ������� ����� � "_graphics.c";
2049
 
int LT_Getch (void)
2050
 
{
2051
 
char c;
2052
 
    if((c=getch())=='d'){
2053
 
        void break_point_data (char * c);
2054
 
        static char stop_here_byte=0;
2055
 
        static unsigned short int * stop_here_check=0;
2056
 
 
2057
 
         break_point_data(&stop_here_byte);
2058
 
        stop_here_byte++; break_point_data(0);
2059
 
        }
2060
 
    return ((int)c);
2061
 
}
2062
 
*/
2063
 
 
2064
 
static int yCurrentTop  = 0;
 
1965
        int x, y;
 
1966
        int nStep;
 
1967
 
 
1968
        LT_GraphicsClearScreen ();
 
1969
 
 
1970
        nStep = MIN (FIELD_WIDTH / nRasterWidth, FIELD_HEIGHT / nRasterHeight);
 
1971
 
 
1972
        if (nStep == 0)
 
1973
        nStep = 1;
 
1974
 
 
1975
        _setcolor (_COLOR_BACKGROUND);
 
1976
        _rectangle (_GFILLINTERIOR,
 
1977
                        (0 - xLeft) / nScaling,
 
1978
                        (0 - yTop) / nScaling,
 
1979
                        (nRasterWidth * nStep - xLeft) / nScaling,
 
1980
                        (nRasterHeight * nStep - yTop) / nScaling);
 
1981
 
 
1982
        for (x = 0; x < nRasterWidth; x++)
 
1983
        {
 
1984
                for (y = 0; y < nRasterHeight; y++)
 
1985
                {
 
1986
                        if ((pRaster [y * nRasterByteWidth + x / 8] << x % 8) & 0x80)
 
1987
                        _setcolor (_COLOR_BLACK);
 
1988
                        else if (y == yRasterBreakLine)
 
1989
                        _setcolor (_COLOR_RED);
 
1990
                        else if (y >= yRasterUpBreakLimit && y <= yRasterDownBreakLimit)
 
1991
                        _setcolor (_COLOR_YELLOW);
 
1992
                        else
 
1993
                        continue;
 
1994
 
 
1995
                        _rectangle (_GFILLINTERIOR,
 
1996
                                        (x * nStep - xLeft) / nScaling,
 
1997
                                        (y * nStep - yTop) / nScaling,
 
1998
                                        ((x + 1) * nStep - xLeft) / nScaling,
 
1999
                                        ((y + 1) * nStep - yTop) / nScaling);
 
2000
                }
 
2001
        }
 
2002
 
 
2003
        _setcolor (_COLOR_GRAY);
 
2004
 
 
2005
        for (x = 0; x <= nRasterWidth; x++)
 
2006
        {
 
2007
                _moveto ((x * nStep - xLeft) / nScaling,
 
2008
                                (0 - yTop) / nScaling);
 
2009
                _lineto ((x * nStep - xLeft) / nScaling,
 
2010
                                (nRasterHeight * nStep - yTop) / nScaling);
 
2011
        }
 
2012
 
 
2013
        for (y = 0; y <= nRasterHeight; y++)
 
2014
        {
 
2015
                _moveto ((0 - xLeft) / nScaling,
 
2016
                                (y * nStep - yTop) / nScaling);
 
2017
                _lineto ((nRasterWidth * nStep - xLeft) / nScaling,
 
2018
                                (y * nStep - yTop) / nScaling);
 
2019
        }
 
2020
 
 
2021
        _setcolor (_COLOR_BLUE);
 
2022
 
 
2023
        for (y = 0; y <= nRasterHeight; y++)
 
2024
        {
 
2025
                _rectangle (_GFILLINTERIOR,
 
2026
                                ((nRasterWidth + 1) * nStep - xLeft) / nScaling,
 
2027
                                (y * nStep - yTop) / nScaling,
 
2028
                                ((aRasterHystogram [y] + nRasterWidth + 1)
 
2029
                                                * nStep - xLeft) / nScaling,
 
2030
                                ((y + 1) * nStep - yTop) / nScaling);
 
2031
        }
 
2032
}
 
2033
 
 
2034
void LT_GraphicsTitle (const char *pTitle)
 
2035
{
 
2036
        //    _setcolor (_COLOR_BACKGROUND);
 
2037
        _setcolor (_COLOR_TEXT);
 
2038
        _settextalign (_CENTER, _HALF); // _HALF("_HALPH")==_CENTER
 
2039
        _grtext (320, 450, pTitle);
 
2040
}
 
2041
 
 
2042
/* новый вариант живет в "_graphics.c";
 
2043
 int LT_Getch (void)
 
2044
 {
 
2045
 char c;
 
2046
 if((c=getch())=='d'){
 
2047
 void break_point_data (char * c);
 
2048
 static char stop_here_byte=0;
 
2049
 static unsigned short int * stop_here_check=0;
 
2050
 
 
2051
 break_point_data(&stop_here_byte);
 
2052
 stop_here_byte++; break_point_data(0);
 
2053
 }
 
2054
 return ((int)c);
 
2055
 }
 
2056
 */
 
2057
 
 
2058
static int yCurrentTop = 0;
2065
2059
static int xCurrentLeft = 0;
2066
2060
static int nCurrentScaling = MAX_SCALING;
2067
 
//��� ��� MAX_SCALING, ��� � MIN_SCALING, ==1,
2068
 
// ����� ����� �������, ��� nCurrentScaling==1
 
2061
//так как MAX_SCALING, как и MIN_SCALING, ==1,
 
2062
// можно смело считать, что nCurrentScaling==1
2069
2063
 
2070
2064
static void ScreenOutput (const char *pTitle,
2071
 
                     void (*pProcUpdate) (int xLeft, int yTop, int nScaling))
 
2065
                void (*pProcUpdate) (int xLeft, int yTop, int nScaling))
2072
2066
{
2073
 
    int nWidth   = 3000;
2074
 
    int nHeight  = 3000;
2075
 
 
2076
 
    BOOL bNeedUpdateScreen = TRUE;
2077
 
 
2078
 
    for (;;)
2079
 
    {
2080
 
        if (bNeedUpdateScreen)
2081
 
        {
2082
 
            (*pProcUpdate) (xCurrentLeft, yCurrentTop, nCurrentScaling);
2083
 
            LT_GraphicsTitle (pTitle);
2084
 
        }
2085
 
 
2086
 
        do
2087
 
        {
2088
 
            switch (LT_Getch ())
2089
 
            {
2090
 
                case ' ':
2091
 
                    return;
2092
 
 
2093
 
                case KEY_LEFT:
2094
 
                    if (xCurrentLeft > 0)
2095
 
                    {
2096
 
                        xCurrentLeft -= SCREEN_WIDTH / STEPS * nCurrentScaling;
2097
 
                        bNeedUpdateScreen = TRUE;
2098
 
                    }
2099
 
                    break;
2100
 
 
2101
 
                case KEY_RIGHT:
2102
 
                    /*
2103
 
                    if (xCurrentLeft + SCREEN_WIDTH / STEPS * nCurrentScaling < nWidth)
2104
 
                    */
2105
 
 
2106
 
                    if (xCurrentLeft < nWidth)
2107
 
                    {
2108
 
                        xCurrentLeft += SCREEN_WIDTH / STEPS * nCurrentScaling;
2109
 
                        bNeedUpdateScreen = TRUE;
2110
 
                    }
2111
 
                    break;
2112
 
 
2113
 
                case KEY_UP:
2114
 
                    if (yCurrentTop > 0)
2115
 
                    {
2116
 
                        yCurrentTop -= SCREEN_HEIGHT / STEPS * nCurrentScaling;
2117
 
                        bNeedUpdateScreen = TRUE;
2118
 
                    }
2119
 
                    break;
2120
 
 
2121
 
                case KEY_DOWN:
2122
 
                    /*
2123
 
                    if (yCurrentTop + SCREEN_HEIGHT / STEPS * nCurrentScaling < nHeight)
2124
 
                    */
2125
 
 
2126
 
                    if (yCurrentTop < nHeight)
2127
 
                    {
2128
 
                        yCurrentTop += SCREEN_HEIGHT / STEPS * nCurrentScaling;
2129
 
                        bNeedUpdateScreen = TRUE;
2130
 
                    }
2131
 
                    break;
2132
 
 
2133
 
                case KEY_F1:
2134
 
                    if (nCurrentScaling != MIN_SCALING)
2135
 
                    {
2136
 
//                      yCurrentTop      = 0;
2137
 
//                      xCurrentLeft     = 0;
2138
 
                        nCurrentScaling  /= 2;
2139
 
                        bNeedUpdateScreen = TRUE;
2140
 
                    }
2141
 
                    break;
2142
 
 
2143
 
                case KEY_F2:
2144
 
                    if (nCurrentScaling != MAX_SCALING)
2145
 
                    {
2146
 
//                      yCurrentTop      = 0;
2147
 
//                      xCurrentLeft     = 0;
2148
 
                        nCurrentScaling  *= 2;
2149
 
                        bNeedUpdateScreen = TRUE;
2150
 
                    }
2151
 
                    break;
2152
 
 
2153
 
                case KEY_F10:
 
2067
        int nWidth = 3000;
 
2068
        int nHeight = 3000;
 
2069
 
 
2070
        Bool bNeedUpdateScreen = TRUE;
 
2071
 
 
2072
        for (;;)
 
2073
        {
 
2074
                if (bNeedUpdateScreen)
 
2075
                {
 
2076
                        (*pProcUpdate) (xCurrentLeft, yCurrentTop, nCurrentScaling);
 
2077
                        LT_GraphicsTitle (pTitle);
 
2078
                }
 
2079
 
 
2080
                do
 
2081
                {
 
2082
                        switch (LT_Getch ())
 
2083
                        {
 
2084
                                case ' ':
 
2085
                                return;
 
2086
 
 
2087
                                case KEY_LEFT:
 
2088
                                if (xCurrentLeft > 0)
 
2089
                                {
 
2090
                                        xCurrentLeft -= SCREEN_WIDTH / STEPS * nCurrentScaling;
 
2091
                                        bNeedUpdateScreen = TRUE;
 
2092
                                }
 
2093
                                break;
 
2094
 
 
2095
                                case KEY_RIGHT:
 
2096
                                /*
 
2097
                                 if (xCurrentLeft + SCREEN_WIDTH / STEPS * nCurrentScaling < nWidth)
 
2098
                                 */
 
2099
 
 
2100
                                if (xCurrentLeft < nWidth)
 
2101
                                {
 
2102
                                        xCurrentLeft += SCREEN_WIDTH / STEPS * nCurrentScaling;
 
2103
                                        bNeedUpdateScreen = TRUE;
 
2104
                                }
 
2105
                                break;
 
2106
 
 
2107
                                case KEY_UP:
 
2108
                                if (yCurrentTop > 0)
 
2109
                                {
 
2110
                                        yCurrentTop -= SCREEN_HEIGHT / STEPS * nCurrentScaling;
 
2111
                                        bNeedUpdateScreen = TRUE;
 
2112
                                }
 
2113
                                break;
 
2114
 
 
2115
                                case KEY_DOWN:
 
2116
                                /*
 
2117
                                 if (yCurrentTop + SCREEN_HEIGHT / STEPS * nCurrentScaling < nHeight)
 
2118
                                 */
 
2119
 
 
2120
                                if (yCurrentTop < nHeight)
 
2121
                                {
 
2122
                                        yCurrentTop += SCREEN_HEIGHT / STEPS * nCurrentScaling;
 
2123
                                        bNeedUpdateScreen = TRUE;
 
2124
                                }
 
2125
                                break;
 
2126
 
 
2127
                                case KEY_F1:
 
2128
                                if (nCurrentScaling != MIN_SCALING)
 
2129
                                {
 
2130
                                        //                      yCurrentTop      = 0;
 
2131
                                        //                      xCurrentLeft     = 0;
 
2132
                                        nCurrentScaling /= 2;
 
2133
                                        bNeedUpdateScreen = TRUE;
 
2134
                                }
 
2135
                                break;
 
2136
 
 
2137
                                case KEY_F2:
 
2138
                                if (nCurrentScaling != MAX_SCALING)
 
2139
                                {
 
2140
                                        //                      yCurrentTop      = 0;
 
2141
                                        //                      xCurrentLeft     = 0;
 
2142
                                        nCurrentScaling *= 2;
 
2143
                                        bNeedUpdateScreen = TRUE;
 
2144
                                }
 
2145
                                break;
 
2146
 
 
2147
                                case KEY_F10:
2154
2148
# ifdef LT_DEBUG
2155
 
                    LT_DebugGraphicsLevel = 0;
 
2149
                                LT_DebugGraphicsLevel = 0;
2156
2150
# endif
2157
2151
# ifdef SE_DEBUG
2158
 
                    SE_DebugGraphicsLevel = 0;
 
2152
                                SE_DebugGraphicsLevel = 0;
2159
2153
# endif
2160
 
                    return;
 
2154
                                return;
2161
2155
 
2162
 
                default:
2163
 
                    bNeedUpdateScreen = FALSE;
2164
 
                    break;
2165
 
            }
2166
 
        }
2167
 
        while (!bNeedUpdateScreen);
2168
 
    }
 
2156
                                default:
 
2157
                                bNeedUpdateScreen = FALSE;
 
2158
                                break;
 
2159
                        }
 
2160
                }
 
2161
                while (!bNeedUpdateScreen);
 
2162
        }
2169
2163
}
2170
2164
 
2171
2165
void LT_GraphicsRootsOutput (const char *pTitle)
2172
2166
{
2173
 
    ScreenOutput (pTitle, RootsUpdate);
 
2167
        ScreenOutput (pTitle, RootsUpdate);
2174
2168
}
2175
2169
 
2176
2170
void LT_GraphicsRootStripsOutput (char *pTitle)
2177
2171
{
2178
 
    ScreenOutput (pTitle, RootStripsUpdate);
 
2172
        ScreenOutput (pTitle, RootStripsUpdate);
2179
2173
}
2180
2174
 
2181
2175
void LT_GraphicsPageMatrixOutput (char *pTitle)
2182
2176
{
2183
 
    ScreenOutput (pTitle, PageMatrixUpdate);
 
2177
        ScreenOutput (pTitle, PageMatrixUpdate);
2184
2178
}
2185
2179
 
2186
2180
void LT_GraphicsBlocksOutput (const char *pTitle)
2187
2181
{
2188
 
    BlocksSetRootsNumbers ();
2189
 
 
2190
 
    ScreenOutput (pTitle, BlocksUpdate);
2191
 
 
2192
 
//  if (pBlocksList != NULL)
2193
 
//      BlocksSetRandomRootsNumbers ();
 
2182
        BlocksSetRootsNumbers ();
 
2183
 
 
2184
        ScreenOutput (pTitle, BlocksUpdate);
 
2185
 
 
2186
        //  if (pBlocksList != NULL)
 
2187
        //      BlocksSetRandomRootsNumbers ();
2194
2188
}
2195
2189
 
2196
2190
void LT_GraphicsHystogramOutput (const char *pTitle)
2197
2191
{
2198
 
    ScreenOutput (pTitle, HystogramUpdate);
 
2192
        ScreenOutput (pTitle, HystogramUpdate);
2199
2193
}
2200
2194
 
2201
2195
void LT_GraphicsSpecialCuttingOutput (char *pTitle)
2202
2196
{
2203
 
    ScreenOutput (pTitle, SpecialCuttingUpdate);
 
2197
        ScreenOutput (pTitle, SpecialCuttingUpdate);
2204
2198
}
2205
2199
 
2206
2200
void LT_GraphicsSB_MatrixOutput (char *pTitle)
2207
2201
{
2208
 
    ScreenOutput (pTitle, SB_MatrixUpdate);
 
2202
        ScreenOutput (pTitle, SB_MatrixUpdate);
2209
2203
}
2210
2204
 
2211
2205
void LT_GraphicsWSB_Hystogram_1_Output (char *pTitle)
2212
2206
{
2213
 
    ScreenOutput (pTitle, WSB_Hystogram_1_Update);
 
2207
        ScreenOutput (pTitle, WSB_Hystogram_1_Update);
2214
2208
}
2215
2209
 
2216
2210
void LT_GraphicsWSB_Hystogram_2_Output (char *pTitle)
2217
2211
{
2218
 
    ScreenOutput (pTitle, WSB_Hystogram_2_Update);
 
2212
        ScreenOutput (pTitle, WSB_Hystogram_2_Update);
2219
2213
}
2220
2214
 
2221
2215
void LT_GraphicsWSB_PointsOutput (char *pTitle)
2222
2216
{
2223
 
    BlocksSetRootsNumbers ();
2224
 
    ScreenOutput (pTitle, WSB_PointsUpdate);
 
2217
        BlocksSetRootsNumbers ();
 
2218
        ScreenOutput (pTitle, WSB_PointsUpdate);
2225
2219
}
2226
2220
 
2227
2221
void LT_GraphicsPictureRemovingConditionsOutput (char * pTitle)
2228
2222
{
2229
 
    ScreenOutput (pTitle, PictureRemovingConditionsUpdate);
 
2223
        ScreenOutput (pTitle, PictureRemovingConditionsUpdate);
2230
2224
}
2231
2225
 
2232
2226
void LT_GraphicsDD_RemovingConditionsOutput (char * pTitle)
2233
2227
{
2234
 
    ScreenOutput (pTitle, DD_RemovingConditionsUpdate);
 
2228
        ScreenOutput (pTitle, DD_RemovingConditionsUpdate);
2235
2229
}
2236
2230
 
2237
2231
void LT_GraphicsHighEmbeddingBlocksListOutput (char *pTitle)
2238
2232
{
2239
 
    BLOCK Dummy;
 
2233
        BLOCK Dummy;
2240
2234
 
2241
 
    pBlocksListBegin = pHighEmbeddingBlocksList;
2242
 
    oBlockNext       = (BYTE *) &Dummy.pLowerEmbedding - (BYTE *) &Dummy;
2243
 
    ScreenOutput (pTitle, BlocksListUpdate);
 
2235
        pBlocksListBegin = pHighEmbeddingBlocksList;
 
2236
        oBlockNext = (uchar *) &Dummy.pLowerEmbedding - (uchar *) &Dummy;
 
2237
        ScreenOutput (pTitle, BlocksListUpdate);
2244
2238
}
2245
2239
 
2246
2240
void LT_GraphicsLowEmbeddingBlocksListOutput (char *pTitle)
2247
2241
{
2248
 
    BLOCK Dummy;
 
2242
        BLOCK Dummy;
2249
2243
 
2250
 
    pBlocksListBegin = pLowEmbeddingBlocksList;
2251
 
    oBlockNext       = (BYTE *) &Dummy.pHigherEmbedding - (BYTE *) &Dummy;
2252
 
    ScreenOutput (pTitle, BlocksListUpdate);
 
2244
        pBlocksListBegin = pLowEmbeddingBlocksList;
 
2245
        oBlockNext = (uchar *) &Dummy.pHigherEmbedding - (uchar *) &Dummy;
 
2246
        ScreenOutput (pTitle, BlocksListUpdate);
2253
2247
}
2254
2248
 
2255
2249
void LT_GraphicsLeftBlocksListOutput (char *pTitle)
2256
2250
{
2257
 
    BLOCK Dummy;
 
2251
        BLOCK Dummy;
2258
2252
 
2259
 
    pBlocksListBegin = pLeftBlocksList;
2260
 
    oBlockNext       = (BYTE *) &Dummy.pRight - (BYTE *) &Dummy;
2261
 
    ScreenOutput (pTitle, BlocksListUpdate);
 
2253
        pBlocksListBegin = pLeftBlocksList;
 
2254
        oBlockNext = (uchar *) &Dummy.pRight - (uchar *) &Dummy;
 
2255
        ScreenOutput (pTitle, BlocksListUpdate);
2262
2256
}
2263
2257
 
2264
2258
void LT_GraphicsRightBlocksListOutput (char *pTitle)
2265
2259
{
2266
 
    BLOCK Dummy;
 
2260
        BLOCK Dummy;
2267
2261
 
2268
 
    pBlocksListBegin = pRightBlocksList;
2269
 
    oBlockNext       = (BYTE *) &Dummy.pLeft - (BYTE *) &Dummy;
2270
 
    ScreenOutput (pTitle, BlocksListUpdate);
 
2262
        pBlocksListBegin = pRightBlocksList;
 
2263
        oBlockNext = (uchar *) &Dummy.pLeft - (uchar *) &Dummy;
 
2264
        ScreenOutput (pTitle, BlocksListUpdate);
2271
2265
}
2272
2266
 
2273
2267
void LT_GraphicsTopBlocksListOutput (char *pTitle)
2274
2268
{
2275
 
    BLOCK Dummy;
 
2269
        BLOCK Dummy;
2276
2270
 
2277
 
    pBlocksListBegin = pTopBlocksList;
2278
 
    oBlockNext       = (BYTE *) &Dummy.pDown - (BYTE *) &Dummy;
2279
 
    ScreenOutput (pTitle, BlocksListUpdate);
 
2271
        pBlocksListBegin = pTopBlocksList;
 
2272
        oBlockNext = (uchar *) &Dummy.pDown - (uchar *) &Dummy;
 
2273
        ScreenOutput (pTitle, BlocksListUpdate);
2280
2274
}
2281
2275
 
2282
2276
void LT_GraphicsBottomBlocksListOutput (char *pTitle)
2283
2277
{
2284
 
    BLOCK Dummy;
 
2278
        BLOCK Dummy;
2285
2279
 
2286
 
    pBlocksListBegin = pBottomBlocksList;
2287
 
    oBlockNext       = (BYTE *) &Dummy.pUp - (BYTE *) &Dummy;
2288
 
    ScreenOutput (pTitle, BlocksListUpdate);
 
2280
        pBlocksListBegin = pBottomBlocksList;
 
2281
        oBlockNext = (uchar *) &Dummy.pUp - (uchar *) &Dummy;
 
2282
        ScreenOutput (pTitle, BlocksListUpdate);
2289
2283
}
2290
2284
 
2291
2285
/********** ATAL 940414
2292
 
void LT_GraphicsTreeOutput (char *pTitle)
2293
 
{
2294
 
    ScreenOutput (pTitle, TreeUpdate);
2295
 
}
2296
 
****************/
 
2286
 void LT_GraphicsTreeOutput (char *pTitle)
 
2287
 {
 
2288
 ScreenOutput (pTitle, TreeUpdate);
 
2289
 }
 
2290
 ****************/
2297
2291
 
2298
2292
void LT_GraphicsBlocksOrderOutput (char *pTitle)
2299
2293
{
2300
 
    ScreenOutput (pTitle, BlocksOrderUpdate);
 
2294
        ScreenOutput (pTitle, BlocksOrderUpdate);
2301
2295
}
2302
2296
 
2303
2297
void LT_GraphicsCurrentStringOutput (const char *pTitle)
2304
2298
{
2305
 
    ScreenOutput (pTitle, CurrentStringUpdate);
 
2299
        ScreenOutput (pTitle, CurrentStringUpdate);
2306
2300
}
2307
2301
 
2308
2302
void LT_GraphicsStringsOutput (const char *pTitle)
2309
2303
{
2310
 
    ScreenOutput (pTitle, StringsUpdate);
 
2304
        ScreenOutput (pTitle, StringsUpdate);
2311
2305
}
2312
2306
 
2313
2307
void LT_GraphicsStringsForwardOrderOutput (const char *pTitle)
2314
2308
{
2315
 
    ScreenOutput (pTitle, StringsForwardOrderUpdate);
 
2309
        ScreenOutput (pTitle, StringsForwardOrderUpdate);
2316
2310
}
2317
2311
 
2318
2312
void LT_GraphicsStringsBackwardOrderOutput (const char *pTitle)
2319
2313
{
2320
 
    ScreenOutput (pTitle, StringsBackwardOrderUpdate);
 
2314
        ScreenOutput (pTitle, StringsBackwardOrderUpdate);
2321
2315
}
2322
2316
 
2323
2317
void LT_GraphicsStringsUpOrderOutput (const char *pTitle)
2324
2318
{
2325
 
    ScreenOutput (pTitle, StringsUpOrderUpdate);
 
2319
        ScreenOutput (pTitle, StringsUpOrderUpdate);
2326
2320
}
2327
2321
 
2328
2322
void LT_GraphicsStringsDownOrderOutput (const char *pTitle)
2329
2323
{
2330
 
    ScreenOutput (pTitle, StringsDownOrderUpdate);
 
2324
        ScreenOutput (pTitle, StringsDownOrderUpdate);
2331
2325
}
2332
2326
 
2333
2327
void LT_GraphicsRasterOutput (const char *pTitle)
2334
2328
{
2335
 
    ScreenOutput (pTitle, RasterUpdate);
 
2329
        ScreenOutput (pTitle, RasterUpdate);
2336
2330
}
2337
2331
 
2338
2332
void LT_GraphicsBreakingOutput (const char *pTitle)
2339
2333
{
2340
 
    ScreenOutput (pTitle, BreakingUpdate);
 
2334
        ScreenOutput (pTitle, BreakingUpdate);
2341
2335
}
2342
2336
 
2343
2337
void LT_GraphicsBlockOutput2 (char *pTitle)
2344
2338
{
2345
 
    ROOT *pRoot;
2346
 
 
2347
 
    pTitle = pTitle;
2348
 
 
2349
 
    _setcolor (NUMBER_TO_COLOR (pDebugBlock -> nNumber) | 8);
2350
 
 
2351
 
    BlockRectangle (pDebugBlock, _GBORDER,
2352
 
                    xCurrentLeft, yCurrentTop, nCurrentScaling);
2353
 
 
2354
 
    for (pRoot = pDebugBlock -> pRoots; pRoot != NULL; pRoot = pRoot -> u1.pNext)
2355
 
    {
2356
 
        _rectangle (_GFILLINTERIOR,
2357
 
            (pRoot -> xColumn
2358
 
                - xCurrentLeft) / nCurrentScaling,
2359
 
            (pRoot -> yRow
2360
 
                - yCurrentTop)  / nCurrentScaling,
2361
 
            (pRoot -> xColumn + pRoot -> nWidth  - 1
2362
 
                - xCurrentLeft) / nCurrentScaling,
2363
 
            (pRoot -> yRow    + pRoot -> nHeight - 1
2364
 
                - yCurrentTop)  / nCurrentScaling);
2365
 
    }
2366
 
 
2367
 
    _setcolor (_COLOR_RED);
2368
 
    _moveto ((xDebugVertLine - xCurrentLeft) / nCurrentScaling, 0);
2369
 
    _lineto ((xDebugVertLine - xCurrentLeft) / nCurrentScaling, SCREEN_HEIGHT);
2370
 
 
2371
 
    LT_GraphicsTitle (pTitle);
 
2339
        ROOT *pRoot;
 
2340
 
 
2341
        pTitle = pTitle;
 
2342
 
 
2343
        _setcolor (NUMBER_TO_COLOR (pDebugBlock -> nNumber) | 8);
 
2344
 
 
2345
        BlockRectangle (pDebugBlock, _GBORDER,
 
2346
                        xCurrentLeft, yCurrentTop, nCurrentScaling);
 
2347
 
 
2348
        for (pRoot = pDebugBlock -> pRoots; pRoot != NULL; pRoot = pRoot -> u1.pNext)
 
2349
        {
 
2350
                _rectangle (_GFILLINTERIOR,
 
2351
                                (pRoot -> xColumn
 
2352
                                                - xCurrentLeft) / nCurrentScaling,
 
2353
                                (pRoot -> yRow
 
2354
                                                - yCurrentTop) / nCurrentScaling,
 
2355
                                (pRoot -> xColumn + pRoot -> nWidth - 1
 
2356
                                                - xCurrentLeft) / nCurrentScaling,
 
2357
                                (pRoot -> yRow + pRoot -> nHeight - 1
 
2358
                                                - yCurrentTop) / nCurrentScaling);
 
2359
        }
 
2360
 
 
2361
        _setcolor (_COLOR_RED);
 
2362
        _moveto ((xDebugVertLine - xCurrentLeft) / nCurrentScaling, 0);
 
2363
        _lineto ((xDebugVertLine - xCurrentLeft) / nCurrentScaling, SCREEN_HEIGHT);
 
2364
 
 
2365
        LT_GraphicsTitle (pTitle);
2372
2366
}
2373
2367
 
2374
2368
void LT_GraphicsPictureRemovingConditionsOutput2 (char *pTitle)
2375
2369
{
2376
 
    PictureRemovingConditionsUpdate (0, 0, MAX_SCALING);
2377
 
    LT_GraphicsTitle (pTitle);
 
2370
        PictureRemovingConditionsUpdate (0, 0, MAX_SCALING);
 
2371
        LT_GraphicsTitle (pTitle);
2378
2372
}
2379
2373
void LT_ShowBlock (char *pTitle)
2380
2374
{
2381
 
    ShowBlock(0, 0, MAX_SCALING);
2382
 
    LT_GraphicsTitle (pTitle);
 
2375
        ShowBlock(0, 0, MAX_SCALING);
 
2376
        LT_GraphicsTitle (pTitle);
2383
2377
}
2384
2378
 
2385
2379
void LT_GraphicsDD_RemovingConditionsOutput2 (char *pTitle)
2386
2380
{
2387
 
    DD_RemovingConditionsUpdate (0, 0, MAX_SCALING);
2388
 
    LT_GraphicsTitle (pTitle);
 
2381
        DD_RemovingConditionsUpdate (0, 0, MAX_SCALING);
 
2382
        LT_GraphicsTitle (pTitle);
2389
2383
}
2390
2384
 
2391
2385
void LT_GraphicsLinearRemovingConditionsOutput2 (char *pTitle)
2392
2386
{
2393
 
    int xLeft, yTop, nScaling;
2394
 
    char szTextBuffer [32];
2395
 
    BLOCK *p = pDebugBlock;
2396
 
 
2397
 
    xLeft    = xCurrentLeft;
2398
 
    yTop     = yCurrentTop;
2399
 
    nScaling = nCurrentScaling;
2400
 
 
2401
 
    // ������������ �����, ��� xCurrentLeft � yCurrentTop
2402
 
    // ����� ���� ���������� �� ����...
2403
 
    xCurrentLeft    = p -> Rect.xLeft - 1;
2404
 
    yCurrentTop     = p -> Rect.yTop  - 1;
2405
 
    nCurrentScaling = MIN_SCALING;
2406
 
 
2407
 
    LT_GraphicsClearScreen ();
2408
 
    LT_GraphicsBlockOutput2 (pTitle);
2409
 
 
2410
 
    xCurrentLeft    = xLeft;
2411
 
    yCurrentTop     = yTop;
2412
 
    nCurrentScaling = nScaling;
2413
 
 
2414
 
    sprintf (szTextBuffer,
2415
 
             "%d+%d+%d=%d "
2416
 
             "W %d H %d H/W %5.2f W/H %5.2f\n",
2417
 
                p -> nLetters,
2418
 
                p -> nRoots - p -> nLetters - p -> nDust,
2419
 
                p -> nDust,
2420
 
                p -> nRoots,
2421
 
                p -> Rect.xRight  - p -> Rect.xLeft + 1,
2422
 
                p -> Rect.yBottom - p -> Rect.yTop  + 1,
2423
 
                (double) (p -> Rect.yBottom - p -> Rect.yTop  + 1) /
2424
 
                            (p -> Rect.xRight  - p -> Rect.xLeft + 1),
2425
 
                (double) (p -> Rect.xRight  - p -> Rect.xLeft + 1) /
2426
 
                            (p -> Rect.yBottom - p -> Rect.yTop  + 1)
2427
 
            );
2428
 
 
2429
 
    LT_GraphicsTitle (szTextBuffer);
 
2387
        int xLeft, yTop, nScaling;
 
2388
        char szTextBuffer [32];
 
2389
        BLOCK *p = pDebugBlock;
 
2390
 
 
2391
        xLeft = xCurrentLeft;
 
2392
        yTop = yCurrentTop;
 
2393
        nScaling = nCurrentScaling;
 
2394
 
 
2395
        // единственное место, где xCurrentLeft и yCurrentTop
 
2396
        // имеют шанс отличиться от нуля...
 
2397
        xCurrentLeft = p -> Rect.xLeft - 1;
 
2398
        yCurrentTop = p -> Rect.yTop - 1;
 
2399
        nCurrentScaling = MIN_SCALING;
 
2400
 
 
2401
        LT_GraphicsClearScreen ();
 
2402
        LT_GraphicsBlockOutput2 (pTitle);
 
2403
 
 
2404
        xCurrentLeft = xLeft;
 
2405
        yCurrentTop = yTop;
 
2406
        nCurrentScaling = nScaling;
 
2407
 
 
2408
        sprintf (szTextBuffer,
 
2409
                        "%d+%d+%d=%d "
 
2410
                        "W %d H %d H/W %5.2f W/H %5.2f\n",
 
2411
                        p -> nLetters,
 
2412
                        p -> nRoots - p -> nLetters - p -> nDust,
 
2413
                        p -> nDust,
 
2414
                        p -> nRoots,
 
2415
                        p -> Rect.xRight - p -> Rect.xLeft + 1,
 
2416
                        p -> Rect.yBottom - p -> Rect.yTop + 1,
 
2417
                        (double) (p -> Rect.yBottom - p -> Rect.yTop + 1) /
 
2418
                        (p -> Rect.xRight - p -> Rect.xLeft + 1),
 
2419
                        (double) (p -> Rect.xRight - p -> Rect.xLeft + 1) /
 
2420
                        (p -> Rect.yBottom - p -> Rect.yTop + 1)
 
2421
        );
 
2422
 
 
2423
        LT_GraphicsTitle (szTextBuffer);
2430
2424
}
2431
2425
# endif
2432
2426
 
2433
2427
// Pit 11-21-94 04:56pm
2434
2428
#include "edp.h"
2435
 
INT maxx,minx,maxy,miny;
2436
 
INT scale;
2437
 
 
2438
 
static void part_minmax(DP * part)
2439
 
{
2440
 
DP * p;
2441
 
for(p=part->first;p;p++){
2442
 
      part_minmax(p);
2443
 
      if(p==part->last)break;
2444
 
       }
2445
 
 
2446
 
for(p=part;p;p=p->next){
2447
 
      if(maxx<p->x+p->w) maxx=p->x+p->w;
2448
 
      if(minx>p->x     ) minx=p->x;
2449
 
      if(maxy<p->y+p->h) maxy=p->y+p->h;
2450
 
      if(miny>p->y     ) miny=p->y;
2451
 
      }
 
2429
int16_t maxx, minx, maxy, miny;
 
2430
int16_t scale;
 
2431
 
 
2432
static void part_minmax(DP * part) {
 
2433
        DP * p;
 
2434
        for (p = part->first; p; p++) {
 
2435
                part_minmax(p);
 
2436
                if (p == part->last)
 
2437
                        break;
 
2438
        }
 
2439
 
 
2440
        for (p = part; p; p = p->next) {
 
2441
                if (maxx < p->x + p->w)
 
2442
                        maxx = p->x + p->w;
 
2443
                if (minx > p->x)
 
2444
                        minx = p->x;
 
2445
                if (maxy < p->y + p->h)
 
2446
                        maxy = p->y + p->h;
 
2447
                if (miny > p->y)
 
2448
                        miny = p->y;
 
2449
        }
2452
2450
}
2453
2451
 
2454
 
static void part_graph(DP * part,INT level){
2455
 
DP * p;
2456
 
 
2457
 
for(p=part->first; p;p++){
2458
 
      part_graph(p,level+1);
2459
 
      _setcolor((p-part->first)%8+7);
2460
 
       if(p->type&HOR){
2461
 
         if(p->parent && p->parent->type&(VERT|TERM) &&
2462
 
            p->parent->y && p->parent->h){
2463
 
        _moveto ((p->x - minx)/scale,p->parent->y/scale);
2464
 
        _lineto ((p->x - minx)/scale,(p->parent->y + p->parent->h)/scale);
2465
 
        _moveto ((p->x - minx + p->w)/scale,p->parent->y/scale);
2466
 
        _lineto ((p->x - minx + p->w)/scale,(p->parent->y + p->parent->h)/scale);
2467
 
         }
2468
 
         else{
2469
 
        _moveto ((p->x - minx)/scale,0);
2470
 
        _lineto ((p->x - minx)/scale,(maxy-miny)/scale);
2471
 
        _moveto ((p->x - minx + p->w)/scale,0);
2472
 
        _lineto ((p->x - minx + p->w)/scale,(maxy-miny)/scale);
2473
 
         }
2474
 
 
2475
 
       }
2476
 
       else if(p->type&(VERT|TERM)){
2477
 
         if(p->parent && p->parent->type&(HOR) &&
2478
 
            p->parent->x && p->parent->w){
2479
 
        _moveto (p->parent->x/scale               ,(p->y - miny)/scale);
2480
 
        _lineto ((p->parent->x+p->parent->w)/scale,(p->y - miny)/scale);
2481
 
        _moveto (p->parent->x/scale               ,(p->y - miny + p->h)/scale);
2482
 
        _lineto ((p->parent->x+p->parent->w)/scale,(p->y - miny + p->h)/scale);
2483
 
            }
2484
 
        else{
2485
 
        _moveto (0,           (p->y - miny)/scale);
2486
 
        _lineto ((maxx-minx)/scale,(p->y - miny)/scale);
2487
 
        _moveto (0,           (p->y - miny + p->h)/scale);
2488
 
        _lineto ((maxx-minx)/scale,(p->y - miny + p->h)/scale);
 
2452
static void part_graph(DP * part, int16_t level) {
 
2453
        DP * p;
 
2454
 
 
2455
        for (p = part->first; p; p++) {
 
2456
                part_graph(p, level + 1);
 
2457
                _setcolor((p - part->first) % 8 + 7);
 
2458
                if (p->type & HOR) {
 
2459
                        if (p->parent && p->parent->type & (VERT | TERM) && p->parent->y
 
2460
                                        && p->parent->h) {
 
2461
                                _moveto((p->x - minx) / scale, p->parent->y / scale);
 
2462
                                _lineto((p->x - minx) / scale, (p->parent->y + p->parent->h)
 
2463
                                                / scale);
 
2464
                                _moveto((p->x - minx + p->w) / scale, p->parent->y / scale);
 
2465
                                _lineto((p->x - minx + p->w) / scale, (p->parent->y
 
2466
                                                + p->parent->h) / scale);
 
2467
                        } else {
 
2468
                                _moveto((p->x - minx) / scale, 0);
 
2469
                                _lineto((p->x - minx) / scale, (maxy - miny) / scale);
 
2470
                                _moveto((p->x - minx + p->w) / scale, 0);
 
2471
                                _lineto((p->x - minx + p->w) / scale, (maxy - miny) / scale);
 
2472
                        }
 
2473
 
 
2474
                } else if (p->type & (VERT | TERM)) {
 
2475
                        if (p->parent && p->parent->type & (HOR) && p->parent->x
 
2476
                                        && p->parent->w) {
 
2477
                                _moveto(p->parent->x / scale, (p->y - miny) / scale);
 
2478
                                _lineto((p->parent->x + p->parent->w) / scale, (p->y - miny)
 
2479
                                                / scale);
 
2480
                                _moveto(p->parent->x / scale, (p->y - miny + p->h) / scale);
 
2481
                                _lineto((p->parent->x + p->parent->w) / scale, (p->y - miny
 
2482
                                                + p->h) / scale);
 
2483
                        } else {
 
2484
                                _moveto(0, (p->y - miny) / scale);
 
2485
                                _lineto((maxx - minx) / scale, (p->y - miny) / scale);
 
2486
                                _moveto(0, (p->y - miny + p->h) / scale);
 
2487
                                _lineto((maxx - minx) / scale, (p->y - miny + p->h) / scale);
 
2488
                        }
 
2489
                }
 
2490
                if (p == part->last)
 
2491
                        break;
2489
2492
        }
2490
 
       }
2491
 
       if(p==part->last)break;
2492
 
      }
2493
2493
}
2494
2494