Subversion Repositories Kolibri OS

Rev

Rev 7246 | Rev 7422 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7246 Rev 7274
Line 18... Line 18...
18
#endif
18
#endif
Line 19... Line 19...
19
 
19
 
20
#include "../lib/gui/tabs.h"
20
#include "../lib/gui/tabs.h"
21
#include "../lib/gui/more_less_box.h"
21
#include "../lib/gui/more_less_box.h"
-
 
22
#include "../lib/gui/checkbox.h"
-
 
23
#include "../lib/gui/child_window.h"
Line 22... Line 24...
22
#include "../lib/gui/checkbox.h"
24
#include "../lib/gui/text_view_area.h"
23
 
25
 
24
:int last_free_button_id = 1000;
26
:int last_free_button_id = 1000;
25
:int GetFreeButtonId()
27
:int GetFreeButtonId()
Line 227... Line 229...
227
	ESBYTE[next_word_pointer] = NULL;
229
	ESBYTE[next_word_pointer] = NULL;
228
	WriteText(dword x, y, byte fontType, dword color, text_pointer);
230
	WriteText(dword x, y, byte fontType, dword color, text_pointer);
229
	ESBYTE[next_word_pointer] = '\n';
231
	ESBYTE[next_word_pointer] = '\n';
230
}
232
}
Line 231... Line -...
231
 
-
 
232
/*
-
 
233
We have a long text and need to show it in block.
-
 
234
Normal line break '\n' must be applied.
-
 
235
Long lines should be breaked by word. 
-
 
236
TODO: scroll
-
 
237
*/
-
 
238
:int DrawTextViewArea(int x,y,w,h, dword buf_start, bg_col, text_col)
-
 
239
{
-
 
240
	dword write_start;
-
 
241
	dword buf_end;
-
 
242
	int line_h = 15;
-
 
243
	int label_length_max;
-
 
244
	int write_length;
-
 
245
	bool end_found;
-
 
246
 
-
 
247
	write_start = buf_start;
-
 
248
	buf_end = strlen(buf_start) + buf_start;
-
 
249
	label_length_max  = w / 8; // 8 big font char width
-
 
250
 
-
 
251
	loop() 
-
 
252
	{
-
 
253
		if (bg_col!=-1) DrawBar(x, y, w+1, line_h, bg_col);
-
 
254
		end_found = false;
-
 
255
		write_length = strchr(write_start, '\n') - write_start; //search normal line break
-
 
256
		if (write_length > label_length_max) || (write_length<=0) //check its position: exceeds maximum line length or not found
-
 
257
		{ 
-
 
258
			if (buf_end - write_start < label_length_max) //check does current line the last
-
 
259
			{ 
-
 
260
				write_length = buf_end - write_start;
-
 
261
				end_found = true;
-
 
262
			}
-
 
263
			else
-
 
264
			{
-
 
265
				for (write_length=label_length_max; write_length>0; write_length--) { //search for white space to make the line break
-
 
266
					if (ESBYTE[write_start+write_length] == ' ') {
-
 
267
						end_found = true;
-
 
268
						break;
-
 
269
					}
-
 
270
				}
-
 
271
			} 
-
 
272
			if (end_found != true) write_length = label_length_max; //no white space, so we write label_length_max
-
 
273
		}
-
 
274
		ESI = write_length; //set text length attribute for WriteText()
-
 
275
		WriteText(x, y, 0x10, text_col, write_start);
-
 
276
		// if (editpos >= write_start-buf_start) && (editpos <= write_start-buf_start + write_length) {
-
 
277
		// 	WriteTextB(-write_start+buf_start+editpos * 8 + x - 5 +1, y, 0x90, 0xFF0000, "|");
-
 
278
		// }
-
 
279
		write_start += write_length + 1;
-
 
280
		y += line_h;
-
 
281
		if (write_start >= buf_end) break;
-
 
282
	}
-
 
283
	if (bg_col!=-1) DrawBar(x,y,w+1,h-y+line_h-4,bg_col);
-
 
284
	return y+line_h;
-
 
285
}
-
 
286
 
-
 
287
 
233
 
288
//this function increase falue and return it
234
//this function increase falue and return it
289
//useful for list of controls which goes one after one
235
//useful for list of controls which goes one after one
290
:struct incn
236
:struct incn
291
{
237
{