Subversion Repositories Kolibri OS

Rev

Rev 7617 | Rev 7908 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7617 Rev 7648
1
#include "func.h"
1
#include "func.h"
2
#include "parser.h"
2
#include "parser.h"
3
#include "use_library.h"
3
#include "use_library.h"
4
 
4
 
5
const char header[] = "Graph";
5
const char header[] = "Graph";
6
const char empty_text[] = "No function loaded. Type file name and press Enter. ";
6
const char empty_text[] = "No function loaded. Type file name and press Enter. ";
7
const char er_file_not_found[] = "Cannot open file. ";
7
const char er_file_not_found[] = "Cannot open file. ";
8
const char str_filename[]="Filename:";
8
const char str_filename[]="Filename:";
9
const char str_editfile[]="Edit";
9
const char str_editfile[]="Edit";
10
 
10
 
11
// íà÷àëüíûå ðàçìåðû
11
// íà÷àëüíûå ðàçìåðû
12
#define WND_W 600
12
#define WND_W 600
13
#define WND_H 470
13
#define WND_H 470
14
 
14
 
15
#define LIGHTGREEN 0xff0000
15
#define LIGHTGREEN 0xff0000
16
#define WHITE 0xffffff
16
#define WHITE 0xffffff
17
#define BLACK 0x0
17
#define BLACK 0x0
18
#define LIGHTBLUE 0x0000ff
18
#define LIGHTBLUE 0x0000ff
19
#define LIGHTRED 0xff0000
19
#define LIGHTRED 0xff0000
20
 
20
 
21
// font colors
21
// font colors
22
#define BIGFONTCOLOR BLACK
22
#define BIGFONTCOLOR BLACK
23
#define SMALLFONTCOLOR BLACK
23
#define SMALLFONTCOLOR BLACK
24
 
24
 
25
#define THREE 3.0
25
#define THREE 3.0
26
// minimum space: 3 pixels
26
// minimum space: 3 pixels
27
 
27
 
28
#define BIG_HEIGHT 4.0
28
#define BIG_HEIGHT 4.0
29
#define SMALL_HEIGHT 2.0
29
#define SMALL_HEIGHT 2.0
30
#define TEXT_X 15.0
30
#define TEXT_X 15.0
31
// numeric format for output
31
// numeric format for output
32
#define FORMAT "%f"
32
#define FORMAT "%f"
33
// format for two coords
33
// format for two coords
34
#define FORMAT_COORD "(%f,%f)"
34
#define FORMAT_COORD "(%f,%f)"
35
// special value to text if enough space
35
// special value to text if enough space
36
#define FORMAT_TEST "0.00"
36
#define FORMAT_TEST "0.00"
37
 
37
 
38
#define DELTA_BIG 1.0
38
#define DELTA_BIG 1.0
39
#define DELTA_SMALL 0.1
39
#define DELTA_SMALL 0.1
40
 
40
 
41
double *points;
41
double *points;
42
Dword point_count = 0;
42
Dword point_count = 0;
43
double x1,y1,x2,y2;
43
double x1,y1,x2,y2;
44
char *funct = NULL;
44
char *funct = NULL;
45
 
45
 
46
char edit_path[1024];
46
char edit_path[256];
47
//Dword editbox_y = WND_H - 16, editbox_w = WND_W - 70;
47
edit_box mybox = {0,92,WND_H-16-32,0xffffff,0x94AECE,0,0x808080,0x10000000,
48
edit_box mybox = {0,9*8-5,WND_H - 16-32,0xffffff,0x94AECE,0,0x808080,0,sizeof(edit_path),0,(dword)&edit_path, 0, 0}; //100000000000010b}; 
-
 
49
 
48
	sizeof(edit_path)-1,0,(dword)&edit_path, 0, 0};
50
 
49
 
51
char *full_head;
50
char *full_head;
52
 
51
 
53
char *HugeBuf = NULL;
52
char *HugeBuf = NULL;
54
 
53
 
55
//char fuck[64] = "$this is a fucking marker$";
54
//char fuck[64] = "$this is a fucking marker$";
56
// ïàðàìåòðû êîìàíäíîé ñòðîêè
55
// ïàðàìåòðû êîìàíäíîé ñòðîêè
57
#ifdef AUTOBUILD
56
#ifdef AUTOBUILD
58
extern char params[1024];
57
extern char params[1024];
59
char params[1024];
58
char params[1024];
60
#else
59
#else
61
char params[1024] = "_FIND_ME_";
60
char params[1024] = "_FIND_ME_";
62
#endif
61
#endif
63
 
62
 
64
/*
63
/*
65
 
64
 
66
  fucking piece of shit
65
  fucking piece of shit
67
 
66
 
68
  */
67
  */
69
 
68
 
70
// constructor of TCoord
69
// constructor of TCoord
71
TCoord coord(double x, double y)
70
TCoord coord(double x, double y)
72
{
71
{
73
  TCoord r;
72
  TCoord r;
74
  r.x = x;
73
  r.x = x;
75
  r.y = y;
74
  r.y = y;
76
  return r;
75
  return r;
77
}
76
}
78
 
77
 
79
// move and scale mathematical coords to fit screen coords
78
// move and scale mathematical coords to fit screen coords
80
TCoord mat2Graf(TCoord c, TCoord scrMin, TCoord scrMax, TCoord mMin, TCoord mMax)
79
TCoord mat2Graf(TCoord c, TCoord scrMin, TCoord scrMax, TCoord mMin, TCoord mMax)
81
{
80
{
82
  TCoord r;
81
  TCoord r;
83
  if (c.x > mMax.x) 
82
  if (c.x > mMax.x) 
84
    c.x = mMax.x;
83
    c.x = mMax.x;
85
  if (c.x < mMin.x) 
84
  if (c.x < mMin.x) 
86
    c.x = mMin.x;
85
    c.x = mMin.x;
87
  if (c.y > mMax.y) 
86
  if (c.y > mMax.y) 
88
    c.y = mMax.y;
87
    c.y = mMax.y;
89
  if (c.y < mMin.y) 
88
  if (c.y < mMin.y) 
90
    c.y = mMin.y;
89
    c.y = mMin.y;
91
  r.x = (scrMax.x - scrMin.x) / (mMax.x - mMin.x) * (c.x - mMin.x) + scrMin.x;
90
  r.x = (scrMax.x - scrMin.x) / (mMax.x - mMin.x) * (c.x - mMin.x) + scrMin.x;
92
  r.y = (scrMax.y - scrMin.y) / (mMax.y - mMin.y) * (mMax.y - c.y) + scrMin.y;
91
  r.y = (scrMax.y - scrMin.y) / (mMax.y - mMin.y) * (mMax.y - c.y) + scrMin.y;
93
 
92
 
94
  return r;
93
  return r;
95
}
94
}
96
 
95
 
97
// double-îáåðòêè
96
// double-îáåðòêè
98
void line_d( double x1, double y1, double x2, double y2)
97
void line_d( double x1, double y1, double x2, double y2)
99
{
98
{
100
   line(di(x1), di(y1), di(x2), di(y2));
99
   line(di(x1), di(y1), di(x2), di(y2));
101
}
100
}
102
 
101
 
103
void outtextxy_d( double x, double y, char * text, int len)
102
void outtextxy_d( double x, double y, char * text, int len)
104
{
103
{
105
   outtextxy(di(x), di(y), text, len);
104
   outtextxy(di(x), di(y), text, len);
106
}
105
}
107
 
106
 
108
// huge function to draw all the stuff except the function itself
107
// huge function to draw all the stuff except the function itself
109
void drawAxis( TCoord scrMin, TCoord scrMax, TCoord mMin, TCoord mMax)
108
void drawAxis( TCoord scrMin, TCoord scrMax, TCoord mMin, TCoord mMax)
110
{
109
{
111
  TCoord cZero={0.0,0.0},
110
  TCoord cZero={0.0,0.0},
112
	   gMin, gMax, gZero, step;
111
	   gMin, gMax, gZero, step;
113
  TCoord from, to;
112
  TCoord from, to;
114
  double i=0.0;
113
  double i=0.0;
115
  int j;
114
  int j;
116
  double xmin, xmin2, ymin, ymin2;
115
  double xmin, xmin2, ymin, ymin2;
117
  char buf[30]="";
116
  char buf[30]="";
118
 
117
 
119
 
118
 
120
// scr means Screen(bounding rect)
119
// scr means Screen(bounding rect)
121
// m   means Mathematical
120
// m   means Mathematical
122
// g   means Graphic(real screen position)
121
// g   means Graphic(real screen position)
123
 
122
 
124
  //rtlDebugOutString("draw axis called\n");
123
  //rtlDebugOutString("draw axis called\n");
125
 
124
 
126
  //format(debuf, 30, "test: %f,%f,%f,%f\n", 123.45, 1.0, -0.9, 12.57);
125
  //format(debuf, 30, "test: %f,%f,%f,%f\n", 123.45, 1.0, -0.9, 12.57);
127
  //rtlDebugOutString(debuf);
126
  //rtlDebugOutString(debuf);
128
 
127
 
129
  gMin = mat2Graf(mMin, scrMin, scrMax, mMin, mMax);
128
  gMin = mat2Graf(mMin, scrMin, scrMax, mMin, mMax);
130
  gMax = mat2Graf(mMax, scrMin, scrMax, mMin, mMax);
129
  gMax = mat2Graf(mMax, scrMin, scrMax, mMin, mMax);
131
  gZero = mat2Graf(cZero, scrMin, scrMax, mMin, mMax);
130
  gZero = mat2Graf(cZero, scrMin, scrMax, mMin, mMax);
132
 
131
 
133
  // clear
132
  // clear
134
 // setcolor(WHITE);
133
 // setcolor(WHITE);
135
 //rectangle(di(gMin.x), di(gMin.y), di(gMax.x), di(gMax.y));
134
 //rectangle(di(gMin.x), di(gMin.y), di(gMax.x), di(gMax.y));
136
  // ftopku
135
  // ftopku
137
 
136
 
138
  setcolor(BLACK);
137
  setcolor(BLACK);
139
  // osy X
138
  // osy X
140
  line_d(gMin.x, gZero.y ,gMax.x, gZero.y);
139
  line_d(gMin.x, gZero.y ,gMax.x, gZero.y);
141
  // osy Y
140
  // osy Y
142
  line_d(gZero.x, gMin.y, gZero.x, gMax.y);
141
  line_d(gZero.x, gMin.y, gZero.x, gMax.y);
143
  // bounding rect
142
  // bounding rect
144
  line_d(gMin.x, gMin.y, gMax.x, gMin.y);
143
  line_d(gMin.x, gMin.y, gMax.x, gMin.y);
145
  line_d(gMin.x, gMax.y, gMax.x, gMax.y);
144
  line_d(gMin.x, gMax.y, gMax.x, gMax.y);
146
 
145
 
147
  line_d(gMin.x, gMin.y, gMin.x, gMax.y);
146
  line_d(gMin.x, gMin.y, gMin.x, gMax.y);
148
  line_d(gMax.x, gMin.y, gMax.x, gMax.y);
147
  line_d(gMax.x, gMin.y, gMax.x, gMax.y);
149
 
148
 
150
  // coords of the rect : lower left
149
  // coords of the rect : lower left
151
  format(buf, 30, FORMAT_COORD, x1, y1);
150
  format(buf, 30, FORMAT_COORD, x1, y1);
152
  //rtlDebugOutString(buf);
151
  //rtlDebugOutString(buf);
153
  outtextxy_d(gMin.x, gMin.y + textheight(buf, 20), buf, 20);
152
  outtextxy_d(gMin.x, gMin.y + textheight(buf, 20), buf, 20);
154
  // upper left
153
  // upper left
155
  format(buf, 30, FORMAT_COORD, x1, y2);
154
  format(buf, 30, FORMAT_COORD, x1, y2);
156
  outtextxy_d(gMin.x, gMax.y - textheight(buf, 20), buf, 20);
155
  outtextxy_d(gMin.x, gMax.y - textheight(buf, 20), buf, 20);
157
  // lower right
156
  // lower right
158
  format(buf, 30, FORMAT_COORD, x2, y1);
157
  format(buf, 30, FORMAT_COORD, x2, y1);
159
  outtextxy_d(gMax.x - textwidth(buf, 20), gMin.y + textheight(buf, 20), buf, 20);
158
  outtextxy_d(gMax.x - textwidth(buf, 20), gMin.y + textheight(buf, 20), buf, 20);
160
  // upper right
159
  // upper right
161
  format(buf, 30, FORMAT_COORD, x2, y2);
160
  format(buf, 30, FORMAT_COORD, x2, y2);
162
  outtextxy_d(gMax.x - textwidth(buf, 20), gMax.y - textheight(buf, 20), buf, 20);
161
  outtextxy_d(gMax.x - textwidth(buf, 20), gMax.y - textheight(buf, 20), buf, 20);
163
 
162
 
164
  //rtlDebugOutString("some lines painted\n");
163
  //rtlDebugOutString("some lines painted\n");
165
 
164
 
166
 
165
 
167
  step.x = (mMax.x - mMin.x) / (scrMax.x - scrMin.x);
166
  step.x = (mMax.x - mMin.x) / (scrMax.x - scrMin.x);
168
  step.y = (mMax.y - mMin.y) / (scrMax.y - scrMin.y);
167
  step.y = (mMax.y - mMin.y) / (scrMax.y - scrMin.y);
169
 
168
 
170
// round values
169
// round values
171
  xmin = id(di((mMin.x / DELTA_BIG) * DELTA_BIG));
170
  xmin = id(di((mMin.x / DELTA_BIG) * DELTA_BIG));
172
  ymin = id(di((mMin.y / DELTA_BIG) * DELTA_BIG));
171
  ymin = id(di((mMin.y / DELTA_BIG) * DELTA_BIG));
173
 
172
 
174
  // (0,0)
173
  // (0,0)
175
 
174
 
176
  if ((x1 * x2 <= 0.0) && (y1 * y2 <= 0.0))
175
  if ((x1 * x2 <= 0.0) && (y1 * y2 <= 0.0))
177
  {
176
  {
178
	  from.x=0.0;
177
	  from.x=0.0;
179
	  from.y=0.0;
178
	  from.y=0.0;
180
	  from = mat2Graf(from, scrMin, scrMax, mMin, mMax);
179
	  from = mat2Graf(from, scrMin, scrMax, mMin, mMax);
181
	  setcolor(BLACK);
180
	  setcolor(BLACK);
182
	  format(buf, 30, FORMAT, 0.0);
181
	  format(buf, 30, FORMAT, 0.0);
183
	  outtextxy_d(from.x - textwidth(buf, 20), from.y + textheight(buf, 20), buf, 20);
182
	  outtextxy_d(from.x - textwidth(buf, 20), from.y + textheight(buf, 20), buf, 20);
184
  }
183
  }
185
 
184
 
186
 
185
 
187
  // big marks on X
186
  // big marks on X
188
  //settextstyle(0, 0, 1);
187
  //settextstyle(0, 0, 1);
189
  if (DELTA_BIG / step.x > THREE)
188
  if (DELTA_BIG / step.x > THREE)
190
  {
189
  {
191
    for (i = xmin; i <= mMax.x; i += DELTA_BIG)
190
    for (i = xmin; i <= mMax.x; i += DELTA_BIG)
192
    {
191
    {
193
	  if (i != 0.0)
192
	  if (i != 0.0)
194
	  {
193
	  {
195
		  from.x = i;
194
		  from.x = i;
196
		  to.x = from.x;
195
		  to.x = from.x;
197
		  from.y = -BIG_HEIGHT * step.y;
196
		  from.y = -BIG_HEIGHT * step.y;
198
		  to.y = BIG_HEIGHT * step.y;
197
		  to.y = BIG_HEIGHT * step.y;
199
		  from = mat2Graf(from, scrMin, scrMax, mMin, mMax);
198
		  from = mat2Graf(from, scrMin, scrMax, mMin, mMax);
200
		  to = mat2Graf(to, scrMin, scrMax, mMin, mMax);
199
		  to = mat2Graf(to, scrMin, scrMax, mMin, mMax);
201
		  setcolor(BLACK);
200
		  setcolor(BLACK);
202
		  line_d(from.x, from.y, to.x, to.y);
201
		  line_d(from.x, from.y, to.x, to.y);
203
		  // write number
202
		  // write number
204
		  format(buf, 30, FORMAT, i);
203
		  format(buf, 30, FORMAT, i);
205
		  // if it fits in the GAP, then write it
204
		  // if it fits in the GAP, then write it
206
		  if (from.y > scrMin.y && (DELTA_BIG > (textwidth(buf, 20) + 1.0) * step.x))
205
		  if (from.y > scrMin.y && (DELTA_BIG > (textwidth(buf, 20) + 1.0) * step.x))
207
		  {
206
		  {
208
			   setcolor(BIGFONTCOLOR);
207
			   setcolor(BIGFONTCOLOR);
209
			   outtextxy_d(from.x - textwidth(buf, 20) / 2.0, to.y - textheight(buf, 20), buf, 20);
208
			   outtextxy_d(from.x - textwidth(buf, 20) / 2.0, to.y - textheight(buf, 20), buf, 20);
210
		  }
209
		  }
211
	  }
210
	  }
212
    }
211
    }
213
  }
212
  }
214
  //rtlDebugOutString("big marks x painted\n");
213
  //rtlDebugOutString("big marks x painted\n");
215
 
214
 
216
  // big marks on Y
215
  // big marks on Y
217
  if (DELTA_BIG / step.y > THREE)
216
  if (DELTA_BIG / step.y > THREE)
218
  {
217
  {
219
    for (i = ymin; i <= mMax.y; i += DELTA_BIG)
218
    for (i = ymin; i <= mMax.y; i += DELTA_BIG)
220
    {
219
    {
221
	  if (i != 0.0)
220
	  if (i != 0.0)
222
	  {
221
	  {
223
		  from.y = i;
222
		  from.y = i;
224
		  to.y = from.y;
223
		  to.y = from.y;
225
		  from.x = -BIG_HEIGHT * step.x;
224
		  from.x = -BIG_HEIGHT * step.x;
226
		  to.x = BIG_HEIGHT * step.x;
225
		  to.x = BIG_HEIGHT * step.x;
227
		  from = mat2Graf(from, scrMin, scrMax, mMin, mMax);
226
		  from = mat2Graf(from, scrMin, scrMax, mMin, mMax);
228
		  to = mat2Graf(to, scrMin, scrMax, mMin, mMax);
227
		  to = mat2Graf(to, scrMin, scrMax, mMin, mMax);
229
		  setcolor(BLACK);
228
		  setcolor(BLACK);
230
		  line_d(from.x, from.y, to.x, to.y);
229
		  line_d(from.x, from.y, to.x, to.y);
231
		  format(buf, 30, FORMAT, i);
230
		  format(buf, 30, FORMAT, i);
232
		  if (from.x > scrMin.x && (DELTA_BIG > textheight(buf, 20) * step.y))
231
		  if (from.x > scrMin.x && (DELTA_BIG > textheight(buf, 20) * step.y))
233
		  {
232
		  {
234
			   setcolor(BIGFONTCOLOR);
233
			   setcolor(BIGFONTCOLOR);
235
			 outtextxy_d(from.x + TEXT_X, to.y - textheight(buf, 20) / 2.0, buf, 20);
234
			 outtextxy_d(from.x + TEXT_X, to.y - textheight(buf, 20) / 2.0, buf, 20);
236
		  }
235
		  }
237
	  }
236
	  }
238
    }
237
    }
239
  }
238
  }
240
 
239
 
241
  xmin2 = id(di(mMin.x / DELTA_SMALL)) * DELTA_SMALL;
240
  xmin2 = id(di(mMin.x / DELTA_SMALL)) * DELTA_SMALL;
242
  ymin2 = id(di(mMin.y / DELTA_SMALL)) * DELTA_SMALL;
241
  ymin2 = id(di(mMin.y / DELTA_SMALL)) * DELTA_SMALL;
243
 
242
 
244
  if (DELTA_SMALL / step.x  > THREE)
243
  if (DELTA_SMALL / step.x  > THREE)
245
  {
244
  {
246
    j = di((( - xmin + xmin2 ) / DELTA_SMALL));
245
    j = di((( - xmin + xmin2 ) / DELTA_SMALL));
247
    for (i = xmin2; i <= mMax.x; i += DELTA_SMALL, j++)
246
    for (i = xmin2; i <= mMax.x; i += DELTA_SMALL, j++)
248
    {
247
    {
249
      if (j % 10 == 0)
248
      if (j % 10 == 0)
250
      {
249
      {
251
      // we need to skip every tenth mark, to avoid overwriting big marks
250
      // we need to skip every tenth mark, to avoid overwriting big marks
252
		j = 0;
251
		j = 0;
253
		continue;
252
		continue;
254
      }
253
      }
255
      from.x = i;
254
      from.x = i;
256
      to.x = from.x;
255
      to.x = from.x;
257
      from.y = -SMALL_HEIGHT * step.y;
256
      from.y = -SMALL_HEIGHT * step.y;
258
      to.y = SMALL_HEIGHT * step.y;
257
      to.y = SMALL_HEIGHT * step.y;
259
      from = mat2Graf(from, scrMin, scrMax, mMin, mMax);
258
      from = mat2Graf(from, scrMin, scrMax, mMin, mMax);
260
	  to = mat2Graf(to, scrMin, scrMax, mMin, mMax);
259
	  to = mat2Graf(to, scrMin, scrMax, mMin, mMax);
261
      setcolor(BLACK);
260
      setcolor(BLACK);
262
      line_d(from.x, from.y, to.x, to.y);
261
      line_d(from.x, from.y, to.x, to.y);
263
      format(buf, 30, FORMAT, i);
262
      format(buf, 30, FORMAT, i);
264
	  
263
	  
265
      if (from.y > scrMin.y && (DELTA_SMALL > textwidth(buf, 20) * step.x))
264
      if (from.y > scrMin.y && (DELTA_SMALL > textwidth(buf, 20) * step.x))
266
      {
265
      {
267
		setcolor(SMALLFONTCOLOR);
266
		setcolor(SMALLFONTCOLOR);
268
		outtextxy_d(from.x - textwidth(buf, 20) / 2.0, to.y - textheight(buf, 20), buf, 20);
267
		outtextxy_d(from.x - textwidth(buf, 20) / 2.0, to.y - textheight(buf, 20), buf, 20);
269
      }
268
      }
270
	  
269
	  
271
 
270
 
272
    }
271
    }
273
      
272
      
274
  }
273
  }
275
 
274
 
276
  // finally small marks on Y
275
  // finally small marks on Y
277
  if (DELTA_SMALL / step.y > THREE)
276
  if (DELTA_SMALL / step.y > THREE)
278
  {
277
  {
279
    //rtlDebugOutString("really small marks y painted\n");
278
    //rtlDebugOutString("really small marks y painted\n");
280
    j = di((( - ymin + ymin2) / DELTA_SMALL));
279
    j = di((( - ymin + ymin2) / DELTA_SMALL));
281
    for (i = ymin2; i <= mMax.y; i += DELTA_SMALL, j++)
280
    for (i = ymin2; i <= mMax.y; i += DELTA_SMALL, j++)
282
    {
281
    {
283
      if (j % 10 == 0)
282
      if (j % 10 == 0)
284
      {
283
      {
285
      // we need to skip every tenth, to avoid overwriting
284
      // we need to skip every tenth, to avoid overwriting
286
		j = 0;
285
		j = 0;
287
		continue;
286
		continue;
288
      }
287
      }
289
      from.y = i;
288
      from.y = i;
290
      to.y = from.y;
289
      to.y = from.y;
291
      from.x = -SMALL_HEIGHT * step.x;
290
      from.x = -SMALL_HEIGHT * step.x;
292
      to.x = SMALL_HEIGHT * step.x;
291
      to.x = SMALL_HEIGHT * step.x;
293
      from = mat2Graf(from, scrMin, scrMax, mMin, mMax);
292
      from = mat2Graf(from, scrMin, scrMax, mMin, mMax);
294
      to = mat2Graf(to, scrMin, scrMax, mMin, mMax);
293
      to = mat2Graf(to, scrMin, scrMax, mMin, mMax);
295
      setcolor(BLACK);
294
      setcolor(BLACK);
296
      line_d(from.x, from.y, to.x, to.y);
295
      line_d(from.x, from.y, to.x, to.y);
297
      format(buf, 30, FORMAT, i);
296
      format(buf, 30, FORMAT, i);
298
      if (from.x > scrMin.x && (DELTA_SMALL > textheight(buf, 20) * step.y))
297
      if (from.x > scrMin.x && (DELTA_SMALL > textheight(buf, 20) * step.y))
299
      {
298
      {
300
       	setcolor(SMALLFONTCOLOR);
299
       	setcolor(SMALLFONTCOLOR);
301
       	outtextxy_d(from.x + TEXT_X, from.y - textheight(buf, 20) / 2.0, buf, 20);
300
       	outtextxy_d(from.x + TEXT_X, from.y - textheight(buf, 20) / 2.0, buf, 20);
302
      }
301
      }
303
    }
302
    }
304
  }
303
  }
305
 
304
 
306
}
305
}
307
 
306
 
308
/*
307
/*
309
  ends fucking piece of shit
308
  ends fucking piece of shit
310
*/
309
*/
311
 
310
 
312
void drawFunction( function_t fi, TCoord scrMin, TCoord scrMax,
311
void drawFunction( function_t fi, TCoord scrMin, TCoord scrMax,
313
		   TCoord mMin, TCoord mMax, DWORD color)
312
		   TCoord mMin, TCoord mMax, DWORD color)
314
{
313
{
315
  double x;
314
  double x;
316
  double y;
315
  double y;
317
  int firstPoint = 1;
316
  int firstPoint = 1;
318
  TCoord p, p0 = {0.0, 0.0}, step;
317
  TCoord p, p0 = {0.0, 0.0}, step;
319
 
318
 
320
  drawAxis(scrMin, scrMax, mMin, mMax);
319
  drawAxis(scrMin, scrMax, mMin, mMax);
321
 
320
 
322
  setcolor(color);
321
  setcolor(color);
323
  step.x = (mMax.x - mMin.x) / (scrMax.x - scrMin.x);
322
  step.x = (mMax.x - mMin.x) / (scrMax.x - scrMin.x);
324
 
323
 
325
  for (x = mMin.x; x < mMax.x; x += step.x)
324
  for (x = mMin.x; x < mMax.x; x += step.x)
326
  {
325
  {
327
    y = fi(x);
326
    y = fi(x);
328
// function is defined here and gets in the range
327
// function is defined here and gets in the range
329
    if (1) // òóò áûëî óñëîâèå, ÷òî ôóíêöèÿ ïðàâèëüíî âû÷èñëåíà
328
    if (1) // òóò áûëî óñëîâèå, ÷òî ôóíêöèÿ ïðàâèëüíî âû÷èñëåíà
330
    {
329
    {
331
      if ((y > mMin.y) && (y < mMax.y))
330
      if ((y > mMin.y) && (y < mMax.y))
332
      {
331
      {
333
	      p = mat2Graf(coord(x, y), scrMin, scrMax, mMin, mMax);
332
	      p = mat2Graf(coord(x, y), scrMin, scrMax, mMin, mMax);
334
	// if it's our first point, only remember its coords
333
	// if it's our first point, only remember its coords
335
	// otherwise, draw a line_d from prev to current
334
	// otherwise, draw a line_d from prev to current
336
      	if (firstPoint == 0)
335
      	if (firstPoint == 0)
337
        {
336
        {
338
      	  line_d(p0.x, p0.y, p.x, p.y);
337
      	  line_d(p0.x, p0.y, p.x, p.y);
339
        }
338
        }
340
      	else
339
      	else
341
    	  firstPoint = 0;
340
    	  firstPoint = 0;
342
 
341
 
343
     	p0 = p;
342
     	p0 = p;
344
      }
343
      }
345
      else // too big/small
344
      else // too big/small
346
      {
345
      {
347
	      firstPoint = 1;
346
	      firstPoint = 1;
348
      }
347
      }
349
    }
348
    }
350
    else // no value
349
    else // no value
351
    {
350
    {
352
      firstPoint = 1;
351
      firstPoint = 1;
353
    }
352
    }
354
  }
353
  }
355
 
354
 
356
}
355
}
357
 
356
 
358
struct kosBDVK 
357
struct kosBDVK 
359
{
358
{
360
	Dword attrib;
359
	Dword attrib;
361
	Dword name_type;
360
	Dword name_type;
362
	Dword create_time;
361
	Dword create_time;
363
	Dword create_date;
362
	Dword create_date;
364
	Dword access_time;
363
	Dword access_time;
365
	Dword access_date;
364
	Dword access_date;
366
	Dword modify_time;
365
	Dword modify_time;
367
	Dword modify_date;
366
	Dword modify_date;
368
	Dword size_low;
367
	Dword size_low;
369
	Dword size_high;	
368
	Dword size_high;	
370
};
369
};
371
 
370
 
372
// èòîãîâàÿ âåðñèÿ ÷èòàëêè òåêñòîâûõ ôàéëîâ
371
// èòîãîâàÿ âåðñèÿ ÷èòàëêè òåêñòîâûõ ôàéëîâ
373
int load_points3()
372
int load_points3()
374
{
373
{
375
	kosFileInfo fileInfo;
374
	kosFileInfo fileInfo;
376
	kosBDVK bdvk;
375
	kosBDVK bdvk;
377
	int filePointer = 0;
376
	int filePointer = 0;
378
 
377
 
379
	int i,j,k;
378
	int i,j,k;
380
	double d;
379
	double d;
381
	Dword filesize, num_number;
380
	Dword filesize, num_number;
382
 
381
 
383
	double *p2;
-
 
384
 
-
 
385
	if (edit_path[0] == '\0')
-
 
386
		return 0;
382
	double *p2=0;
387
 
383
 
388
	// get file size
384
	// get file size
389
	strcpy(fileInfo.fileURL,edit_path);
385
	strcpy(fileInfo.fileURL,edit_path);
390
	fileInfo.OffsetLow = 0;
386
	fileInfo.OffsetLow = 0;
391
	fileInfo.OffsetHigh = 0;
387
	fileInfo.OffsetHigh = 0;
392
	fileInfo.dataCount = 0;
388
	fileInfo.dataCount = 0;
393
	fileInfo.rwMode = 5;
389
	fileInfo.rwMode = 5;
394
	fileInfo.bufferPtr = (Byte *)&bdvk;
390
	fileInfo.bufferPtr = (Byte *)&bdvk;
395
	Dword rr = kos_FileSystemAccess( &(fileInfo) ); // â CKosFile íåò îïðåäåëåíèÿ ðàçìåðà
391
	Dword rr = kos_FileSystemAccess( &(fileInfo) ); // â CKosFile íåò îïðåäåëåíèÿ ðàçìåðà
396
	sprintf(debuf, "getsize: %U\n", rr);
392
	sprintf(debuf, "getsize: %U\n", rr);
397
	rtlDebugOutString(debuf);
393
	rtlDebugOutString(debuf);
398
	if (rr != 0)
394
	if (rr != 0)
399
	{
395
	{
400
		kos_WriteTextToWindow(10,10,0,0x00,(char*)er_file_not_found,strlen(er_file_not_found));
396
		kos_WriteTextToWindow(10,10,0x90,0xFF0000,(char*)er_file_not_found,strlen(er_file_not_found));
401
		return 0;
397
		return 0;
402
	}
398
	}
403
 
399
 
404
	filesize = bdvk.size_low;
400
	filesize = bdvk.size_low;
405
	num_number = filesize / 2;
401
	num_number = filesize / 2;
406
 
402
 
407
	HugeBuf = (char *)allocmem(filesize + 1); // ðàçáèðàåì êàê ñòðîêó, îòñþäà òåðìèíàòîð \0
403
	HugeBuf = (char *)allocmem(filesize + 1); // ðàçáèðàåì êàê ñòðîêó, îòñþäà òåðìèíàòîð \0
408
 
404
 
409
	for (i=0;i
405
	for (i=0;i
410
		HugeBuf[i] = 0;
406
		HugeBuf[i] = 0;
411
 
407
 
412
	strcpy(fileInfo.fileURL,edit_path);
408
	strcpy(fileInfo.fileURL,edit_path);
413
	fileInfo.OffsetLow = 0;
409
	fileInfo.OffsetLow = 0;
414
 
410
 
415
	fileInfo.OffsetHigh = 0;
411
	fileInfo.OffsetHigh = 0;
416
	fileInfo.dataCount = filesize;
412
	fileInfo.dataCount = filesize;
417
	fileInfo.rwMode = 0;
413
	fileInfo.rwMode = 0;
418
	fileInfo.bufferPtr = (Byte *)HugeBuf;
414
	fileInfo.bufferPtr = (Byte *)HugeBuf;
419
	rr = kos_FileSystemAccess( &(fileInfo) );	// êàêàÿ-òî ïðîáëåìà ñ hands.dll, CKosFile íå ðàáîòàë
415
	rr = kos_FileSystemAccess( &(fileInfo) );	// êàêàÿ-òî ïðîáëåìà ñ hands.dll, CKosFile íå ðàáîòàë
420
		
416
		
421
	sprintf(debuf, "read3: %U\n", rr);
417
	sprintf(debuf, "read3: %U\n", rr);
422
	rtlDebugOutString(debuf);
418
	rtlDebugOutString(debuf);
423
 
419
 
424
	strcpy(full_head, header);
420
	strcpy(full_head, header);
425
	strcpy(full_head+strlen(full_head), " - ");
421
	strcpy(full_head+strlen(full_head), " - ");
426
	strcpy(full_head+strlen(full_head), edit_path);		// bad code
422
	strcpy(full_head+strlen(full_head), edit_path);		// bad code
427
 
423
 
428
	// à òåïåðü ðàçîáðàòüñÿ â ýòîì
424
	// à òåïåðü ðàçîáðàòüñÿ â ýòîì
429
 
425
 
430
	i=0;
426
	i=0;
431
	k=0;
427
	k=0;
432
	while (i < filesize)
428
	while (i < filesize)
433
	{
429
	{
434
 
430
 
435
		while (isalpha(HugeBuf[i]) && i
431
		while (isalpha(HugeBuf[i]) && i
436
		if (i == filesize) break;
432
		if (i == filesize) break;
437
		if (k==4 && HugeBuf[i] == '=')
433
		if (k==4 && HugeBuf[i] == '=')
438
		{
434
		{
439
			//sprintf(debuf,"function: %S",HugeBuf + i);
435
			//sprintf(debuf,"function: %S",HugeBuf + i);
440
			//rtlDebugOutString(debuf);
436
			//rtlDebugOutString(debuf);
441
			// we have a function here
437
			// we have a function here
442
			//HugeBuf[0] = ' ';
438
			//HugeBuf[0] = ' ';
443
			funct = HugeBuf + i + 1;
439
			funct = HugeBuf + i + 1;
444
			strcpy(full_head+strlen(full_head), ". Function y=");
440
			strcpy(full_head+strlen(full_head), ". Function y=");
445
			strcpy(full_head+strlen(full_head), funct);
441
			strcpy(full_head+strlen(full_head), funct);
446
			return 1;
442
			return 1;
447
		}
443
		}
448
 
444
 
449
		d = convert(HugeBuf+i, &j);
445
		d = convert(HugeBuf+i, &j);
450
		if (d == ERROR)
446
		if (d == ERROR)
451
		{
447
		{
452
			sprintf(debuf, "Error in input file, byte %U, count %U\n", i, k);
448
			sprintf(debuf, "Error in input file, byte %U, count %U\n", i, k);
453
			rtlDebugOutString(debuf);
449
			rtlDebugOutString(debuf);
454
			kos_WriteTextToWindow(10, 10, 0, 0x00, (char*)debuf, strlen(debuf));
450
			kos_WriteTextToWindow(10, 10, 0, 0x00, (char*)debuf, strlen(debuf));
455
			return 0;
451
			return 0;
456
		}
452
		}
457
		if (d == ERROR_END)
453
		if (d == ERROR_END)
458
		{
454
		{
459
			rtlDebugOutString("EOF :)!\n");
455
			rtlDebugOutString("EOF :)!\n");
460
			break;
456
			break;
461
		}
457
		}
462
		
458
		
463
		i+=j;
459
		i+=j;
464
		switch (k)
460
		switch (k)
465
		{
461
		{
466
		case 0:
462
		case 0:
467
			x1=d;
463
			x1=d;
468
			break;
464
			break;
469
		case 1:
465
		case 1:
470
			x2=d;
466
			x2=d;
471
			break;
467
			break;
472
		case 2:
468
		case 2:
473
			y1=d;
469
			y1=d;
474
			break;
470
			break;
475
		case 3:
471
		case 3:
476
			y2=d;
472
			y2=d;
477
			break;
473
			break;
478
		default:
474
		default:
479
			{
475
			{
480
				if (p2 == NULL)
476
				if (p2 == NULL)
481
					p2 = (double *)allocmem(num_number * 8);
477
					p2 = (double *)allocmem(num_number * 8);
482
				p2[k-4]=d;
478
				p2[k-4]=d;
483
			}
479
			}
484
		}
480
		}
485
		k++;
481
		k++;
486
	}
482
	}
487
//	format(debuf, 30, "(%f,%f)-(%f,%f)",x1,y1,x2,y2);
483
//	format(debuf, 30, "(%f,%f)-(%f,%f)",x1,y1,x2,y2);
488
//	rtlDebugOutString(debuf);
484
//	rtlDebugOutString(debuf);
489
	point_count=(k - 4)/2;
485
	point_count=(k - 4)/2;
490
 
486
 
491
	//
487
	//
492
	points = (double *)allocmem(point_count * 2 * 8);
488
	points = (double *)allocmem(point_count * 2 * 8);
493
	for (i = 0; i < point_count * 2; i++)
489
	for (i = 0; i < point_count * 2; i++)
494
		points[i] = p2[i];
490
		points[i] = p2[i];
495
	freemem(p2);
491
	freemem(p2);
496
//	sprintf(debuf, "count: %U\n", point_count);
492
//	sprintf(debuf, "count: %U\n", point_count);
497
//	rtlDebugOutString(debuf);
493
//	rtlDebugOutString(debuf);
498
	sprintf(debuf, ". Number of points: %U.", point_count);
494
	sprintf(debuf, ". Number of points: %U.", point_count);
499
	strcpy(full_head+strlen(full_head), debuf);
495
	strcpy(full_head+strlen(full_head), debuf);
500
	freemem(HugeBuf);
496
	freemem(HugeBuf);
501
	HugeBuf = NULL;
497
	HugeBuf = NULL;
502
	return 1;
498
	return 1;
503
}
499
}
504
 
500
 
505
void LaunchTinypad()
501
void LaunchTinypad()
506
{
502
{
507
	kosFileInfo fileInfo;
503
	kosFileInfo fileInfo;
508
 
504
 
509
	strcpy(fileInfo.fileURL,"/sys/tinypad");
505
	strcpy(fileInfo.fileURL,"/sys/tinypad");
510
	fileInfo.OffsetLow = 0;
506
	fileInfo.OffsetLow = 0;
511
	fileInfo.OffsetHigh = (Dword)edit_path;
507
	fileInfo.OffsetHigh = (Dword)edit_path;
512
	fileInfo.rwMode = 7;	// launch
508
	fileInfo.rwMode = 7;	// launch
513
	kos_FileSystemAccess(&fileInfo);
509
	kos_FileSystemAccess(&fileInfo);
514
 
510
 
515
}
511
}
516
 
512
 
517
// âû÷èñëèòü çàäàííóþ ôóíêöèþ èëè êóñî÷íî-ëèíåéíóþ ìåæäó òî÷êàìè
513
// âû÷èñëèòü çàäàííóþ ôóíêöèþ èëè êóñî÷íî-ëèíåéíóþ ìåæäó òî÷êàìè
518
double fu(double x)
514
double fu(double x)
519
{
515
{
520
	int i;
516
	int i;
521
	double res;
517
	double res;
522
 
518
 
523
	
519
	
524
	if (funct)
520
	if (funct)
525
	{
521
	{
526
		set_exp(funct,x); 
522
		set_exp(funct,x); 
527
		get_exp(&res);		// ïàðñèòü äëÿ êàæäîãî çíà÷åíèÿ õ? äà ÿ ñ óìà ñîøåë.
523
		get_exp(&res);		// ïàðñèòü äëÿ êàæäîãî çíà÷åíèÿ õ? äà ÿ ñ óìà ñîøåë.
528
		return res;
524
		return res;
529
	}
525
	}
530
 
526
 
531
	if (point_count == 0)
527
	if (point_count == 0)
532
	{
528
	{
533
		return 0.0;
529
		return 0.0;
534
	}
530
	}
535
 
531
 
536
	if (x <= points[0]) 
532
	if (x <= points[0]) 
537
		return points[1];
533
		return points[1];
538
	if (x >= points[(point_count-1) * 2])
534
	if (x >= points[(point_count-1) * 2])
539
		return points[(point_count-1) * 2 + 1];
535
		return points[(point_count-1) * 2 + 1];
540
 
536
 
541
	for (i = 0; i < point_count; i++)
537
	for (i = 0; i < point_count; i++)
542
	{
538
	{
543
		if ((x >= points[2 * i]) && (x < points[2 * (i + 1)]))
539
		if ((x >= points[2 * i]) && (x < points[2 * (i + 1)]))
544
			break;
540
			break;
545
	}
541
	}
546
 
542
 
547
	return (x - points[2 * i]) / (points[2 * (i + 1)] - points[2 * i])
543
	return (x - points[2 * i]) / (points[2 * (i + 1)] - points[2 * i])
548
		* (points[2 * (i + 1) + 1] - points[2 * i + 1]) + points[2 * i + 1];
544
		* (points[2 * (i + 1) + 1] - points[2 * i + 1]) + points[2 * i + 1];
549
 
545
 
550
}
546
}
551
 
547
 
552
void draw_window(void)
548
void draw_window(void)
553
{
549
{
554
	double xx0=0.0, yy0=0.0;
550
	double xx0=0.0, yy0=0.0;
555
	sProcessInfo info;
-
 
556
	Dword wi, he;
-
 
557
	void *p;
-
 
558
 
-
 
559
	for (int i = 0; i < 1024; i++)
-
 
560
		info.rawData[i] = 0;
-
 
561
	kos_ProcessInfo(&info, 0xFFFFFFFF);
-
 
562
 
-
 
563
	p = info.rawData + 42;			// magic
-
 
564
	wi = *(Dword *)(p);
-
 
565
	he = *(Dword *)((Byte *)p + 4);
-
 
566
 
-
 
567
	if (wi == 0) 
-
 
568
		wi = WND_W;
-
 
569
	if (he == 0)
-
 
570
		he = WND_H;
-
 
571
 
-
 
572
	mybox.top = he - 50;
-
 
573
	mybox.width = wi - mybox.left - 80;
-
 
574
 
551
 
575
	kos_WindowRedrawStatus(1);
552
	kos_WindowRedrawStatus(1);
576
	kos_DefineAndDrawWindow(10,40,WND_W,WND_H, 0x33,0xFFFFFF,0,0,(Dword)full_head);
553
	kos_DefineAndDrawWindow(100,80,WND_W,WND_H, 0x33,0xFFFFFF,0,0,(Dword)full_head);
-
 
554
	kos_WindowRedrawStatus(2);
-
 
555
 
-
 
556
	sProcessInfo info;
-
 
557
	kos_ProcessInfo(&info, 0xFFFFFFFF);
-
 
558
	int cWidth = info.processInfo.width - 9;
-
 
559
	int cHeight = info.processInfo.height - kos_GetSkinHeight() - 4;
-
 
560
 
-
 
561
	mybox.top = cHeight - 50;
577
	kos_WindowRedrawStatus(2);
562
	mybox.width = cWidth - mybox.left - 80;
578
 
563
 
579
	if (info.rawData[70]&0x04) return; //íè÷åãî íå äåëàòü åñëè îêíî ñõëîïíóòî â çàãîëîâîê
564
	if (info.processInfo.status_window&0x04) return; //draw nothing if window is rolled-up
580
 
565
 
581
	if (point_count == 0 && funct == NULL)
566
	if (point_count == 0 && funct == NULL)
582
	{
567
	{
583
		kos_WriteTextToWindow((wi - 6 * strlen(empty_text))/2,he/2,0,0x000000,(char *)empty_text,strlen(empty_text));
568
		kos_WriteTextToWindow((cWidth - 8 * strlen(empty_text))/2,cHeight/2-25,0x90,
-
 
569
			0x000000,(char *)empty_text,strlen(empty_text));
584
	}
570
	}
585
	else
571
	else
586
	{
572
	{
587
		drawFunction(&fu, coord(10, 20), coord(id(wi - 20), id(he - 70)),
573
		drawFunction(&fu, coord(10, 20), coord(id(cWidth - 20), id(cHeight - 70)),
588
							coord(x1,y1), coord(x2,y2), 0x00ff0000);
574
							coord(x1,y1), coord(x2,y2), 0x00ff0000);
589
 
575
 
590
	}
576
	}
591
 
577
 
592
	kos_WriteTextToWindow(4, mybox.top + 4, 0, 0, (char*)str_filename, strlen(str_filename));
-
 
593
 
578
	kos_WriteTextToWindow(15, mybox.top + 4, 0x90, 0x000000, (char*)str_filename, strlen(str_filename));
594
	if ((void*)edit_box_draw != NULL)
579
 
595
		edit_box_draw((DWORD)&mybox);
580
	edit_box_draw((DWORD)&mybox);
596
 
-
 
597
	kos_DefineButton(wi - 70, mybox.top, 50, 12, 5, 0xc0c0c0);
581
 
598
	kos_WriteTextToWindow(wi - 58, mybox.top + 4, 0, 0, (char*)str_editfile, strlen(str_editfile));
582
	kos_DefineButton(cWidth - 70, mybox.top, 50, 21, 5, 0xc0c0c0);
599
 
583
	kos_WriteTextToWindow(cWidth - 60, mybox.top + 4, 0x90, 0x000000, (char*)str_editfile,0);
600
}
584
}
601
 
585
 
602
void kos_Main()
586
void kos_Main()
603
{
587
{
604
	kos_InitHeap();
588
	kos_InitHeap();
605
	full_head = (char*)allocmem(300);
589
	full_head = (char*)allocmem(300);
606
	strcpy(full_head, "Graph");
590
	strcpy(full_head, "Graph");
607
	load_edit_box();
591
	load_edit_box();
608
	if (params[0]) // fuck[0] for debug
592
	if (params[0]) // fuck[0] for debug
609
	{
593
	{
610
		rtlDebugOutString("launched with params");
594
		rtlDebugOutString("launched with params");
611
		rtlDebugOutString((char*)params);
595
		rtlDebugOutString((char*)params);
612
		strcpy(edit_path, params);
596
		strcpy(edit_path, params);
613
		mybox.size=mybox.pos=strlen(edit_path);
597
		mybox.size=mybox.pos=strlen(edit_path);
614
		//rtlDebugOutString((char*)edit_path);
598
		//rtlDebugOutString((char*)edit_path);
615
		load_points3();
599
		load_points3();
616
	}
600
	}
617
	rtlDebugOutString("data loaded.\n");
601
	rtlDebugOutString("data loaded.\n");
618
	draw_window();
602
	draw_window();
619
	for (;;)
603
	for (;;)
620
	{
604
	{
621
		edit_box_mouse((dword)&mybox);
605
		edit_box_mouse((dword)&mybox);
622
		switch (kos_WaitForEvent())
606
		switch (kos_WaitForEvent())
623
		{
607
		{
624
		case 1:
608
		case 1:
625
			draw_window();
609
			draw_window();
626
			break;
610
			break;
627
		case 2:
611
		case 2:
628
			// key pressed, read it
612
			// key pressed, read it
629
			Byte keyCode;
613
			Byte keyCode;
630
			kos_GetKey(keyCode);
614
			kos_GetKey(keyCode);
631
 
615
 
632
			switch (keyCode)
616
			switch (keyCode)
633
				{
617
				{
634
					case 0x0D:
618
					case 0x0D:
635
							if (HugeBuf!=NULL)
619
							if (HugeBuf!=NULL)
636
							{
620
							{
637
								//sprintf(debuf, "freemem: HugeBuf = %X", HugeBuf);
621
								//sprintf(debuf, "freemem: HugeBuf = %X", HugeBuf);
638
								//rtlDebugOutString(debuf);
622
								//rtlDebugOutString(debuf);
639
								freemem((void*)HugeBuf);		// ÷òî çà áàã - ïîíÿòü íå ìîãó.
623
								freemem((void*)HugeBuf);		// ÷òî çà áàã - ïîíÿòü íå ìîãó.
640
								HugeBuf = NULL;
624
								HugeBuf = NULL;
641
								funct = NULL;
625
								funct = NULL;
642
							}
626
							}
643
							if (points!=NULL)
627
							if (points!=NULL)
644
							{
628
							{
645
								//sprintf(debuf, "freemem: points = %X", points);
629
								//sprintf(debuf, "freemem: points = %X", points);
646
								//rtlDebugOutString(debuf);
630
								//rtlDebugOutString(debuf);
647
								freemem((void*)points);		// è òóò. íó íå îáðàùàþñü ÿ ê ýòîìó óêàçàòåëþ, òîëüêî ïàìÿòü â íåãî
631
								freemem((void*)points);		// è òóò. íó íå îáðàùàþñü ÿ ê ýòîìó óêàçàòåëþ, òîëüêî ïàìÿòü â íåãî
648
														// ïîòîì ñíîâà âûäåëÿþ
632
														// ïîòîì ñíîâà âûäåëÿþ
649
								points = NULL;
633
								points = NULL;
650
							}
634
							}
651
							point_count = 0;
635
							point_count = 0;
652
							kos_DrawBar(10,10,200,20,0xFFFFFF); // ôîí äëÿ ñîîáùåíèé îá îøèáêàõ
636
							kos_DrawBar(10,10,200,20,0xFFFFFF); // ôîí äëÿ ñîîáùåíèé îá îøèáêàõ
653
							if (load_points3())
637
							if (load_points3())
654
								draw_window();
638
								draw_window();
655
							break;
639
							break;
656
					default:
640
					default:
657
						{
641
						{
658
							__asm
642
							__asm
659
							{
643
							{
660
								mov ah, keyCode
644
								mov ah, keyCode
661
							}
645
							}
662
							edit_box_key((dword)&mybox);
646
							edit_box_key((dword)&mybox);
663
						}
647
						}
664
				}
648
				}
665
			break;
649
			break;
666
 
650
 
667
 
651
 
668
		case 3:
652
		case 3:
669
			// button pressed; we have only one button, close
653
			// button pressed; we have only one button, close
670
			Dword button;
654
			Dword button;
671
			kos_GetButtonID(button);
655
			kos_GetButtonID(button);
672
			if (button == 1)
656
			if (button == 1)
673
				kos_ExitApp();
657
				kos_ExitApp();
674
			if (button == 5)
658
			if (button == 5)
675
				LaunchTinypad();
659
				LaunchTinypad();
676
		}
660
		}
677
	}
661
	}
678
}
662
}
679
>
663
>