Subversion Repositories Kolibri OS

Rev

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

Rev 7437 Rev 7444
Line 1... Line 1...
1
// Notes v1.0
1
// Notes v1.1
Line 2... Line 2...
2
 
2
 
3
#define MEMSIZE 0xDAE80
3
#define MEMSIZE 0xDAE80
Line 4... Line 4...
4
#include "..\lib\kolibri.h" 
4
#include "..\lib\kolibri.h" 
Line 45... Line 45...
45
edit_box notebox = {NULL,NULL,NULL,COL_BG_ACTIVE,0x94AECE,COL_BG_ACTIVE,0xffffff,0,
45
edit_box notebox = {NULL,NULL,NULL,COL_BG_ACTIVE,0x94AECE,COL_BG_ACTIVE,0xffffff,0,
46
	MAX_LINE_CHARS-1,NULL,#ed_mouse,ed_always_focus+ed_focus};
46
	MAX_LINE_CHARS-1,NULL,#ed_mouse,ed_always_focus+ed_focus};
47
dword lists[] = { 0xEAEAEA, 0xCDCDCD, 0xF0F0F0, 0xD8D8D8, 0 };
47
dword lists[] = { 0xEAEAEA, 0xCDCDCD, 0xF0F0F0, 0xD8D8D8, 0 };
Line 48... Line 48...
48
 
48
 
-
 
49
bool delete_active = false;
49
bool delete_active = false;
50
bool window_dragable = true;
Line 50... Line 51...
50
block delBtn;
51
block delBtn;
51
 
52
 
52
//===================================================//
53
//===================================================//
Line 60... Line 61...
60
	int btn;
61
	int btn;
61
	bool first_redraw=true;
62
	bool first_redraw=true;
62
	dword cur_line_offset;
63
	dword cur_line_offset;
63
	load_dll(boxlib, #box_lib_init,0);
64
	load_dll(boxlib, #box_lib_init,0);
Line -... Line 65...
-
 
65
 
-
 
66
	if (GetCpuFrequency()/1000000>=1000) window_dragable=true; else window_dragable=false;
64
	
67
	
Line 65... Line 68...
65
	if (param) notes.OpenTxt(#param); else notes.OpenTxt(abspath("notes.txt"));
68
	if (param) notes.OpenTxt(#param); else notes.OpenTxt(abspath("notes.txt"));
Line 66... Line 69...
66
 
69
 
Line 73... Line 76...
73
 
76
 
Line 74... Line 77...
74
			mouse.get();
77
			mouse.get();
Line 75... Line 78...
75
 
78
 
-
 
79
			if (delete_active) && (delBtn.hovered()) break;
Line 76... Line 80...
76
			if (delete_active) && (delBtn.hovered()) break;
80
 
77
 
81
			if (mouse.lkm) && (mouse.y
78
			if (mouse.lkm) && (mouse.y
82
				&& (window_dragable) EventDragWindow();
79
 
83
 
Line 157... Line 161...
157
}
161
}
Line 158... Line 162...
158
 
162
 
159
void draw_window()
163
void draw_window()
160
{
164
{
-
 
165
	int i;
161
	int i;
166
	if (window_dragable) 
-
 
167
		DefineUnDragableWindow(100,100,WIN_W, WIN_H);
-
 
168
	else 
162
	DefineUnDragableWindow(100,100,WIN_W, WIN_H);
169
		DefineDragableWindow(100,100,WIN_W, WIN_H);
163
	notes.SetSizes(RED_LINE_X+1, HEADER_HEIGHT, WIN_W-1, RED_LINE_X*LINES_COUNT, RED_LINE_X);
170
	notes.SetSizes(RED_LINE_X+1, HEADER_HEIGHT, WIN_W-1, RED_LINE_X*LINES_COUNT, RED_LINE_X);
164
	DrawRectangle3D(0,0,WIN_W,TITLE_H-1,0xBB6535, 0xCD6F3B);
171
	DrawRectangle3D(0,0,WIN_W,TITLE_H-1,0xBB6535, 0xCD6F3B);
165
	DrawRectangle3D(1,1,WIN_W-2,TITLE_H-3,0xEFBFA4, 0xDD8452);
172
	DrawRectangle3D(1,1,WIN_W-2,TITLE_H-3,0xEFBFA4, 0xDD8452);
166
	DrawBar(2,2,WIN_W-3,TITLE_H-4,0xE08C5E);
173
	DrawBar(2,2,WIN_W-3,TITLE_H-4,0xE08C5E);
Line 194... Line 201...
194
//                                                   //
201
//                                                   //
195
//===================================================//
202
//===================================================//
Line 196... Line 203...
196
 
203
 
197
void EventActivateLine(int line_n)
204
void EventActivateLine(int line_n)
198
{
205
{
199
	if (line_n<0) || (line_n>notes.count) return;
206
	if (line_n<0) || (line_n>=notes.count) return;
200
	notes.cur_y = line_n;
207
	notes.cur_y = line_n;
201
	notebox.text = notes.DrawLine(notes.cur_y, notes.item_h);
208
	notebox.text = notes.DrawLine(notes.cur_y, notes.item_h);
202
	EventListRedraw();
209
	EventListRedraw();
203
	DrawEditBoxN();
210
	DrawEditBoxN();