Subversion Repositories Kolibri OS

Rev

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

Rev 7331 Rev 7422
Line 1... Line -...
1
#define LINES_COUNT 13
-
 
2
#define MAX_LINE_CHARS 256
1
#define MAX_LINE_CHARS 256
Line 3... Line 2...
3
 
2
 
4
#define CHBOX 12
3
#define CHBOX 12
5
#define CHECKBOX_ID 50
4
#define CHECKBOX_ID 50
Line 6... Line 5...
6
unsigned char checkbox[sizeof(file "checkbox.raw")]= FROM "checkbox.raw";
5
unsigned char checkbox[sizeof(file "checkbox.raw")]= FROM "checkbox.raw";
7
 
6
 
Line 8... Line 7...
8
#define COL_BG_ACTIVE 0xFFE56B
7
#define COL_BG_ACTIVE 0xFFF0A9
9
#define COL_BG_INACTIVE 0xFFFFFF
8
#define COL_BG_INACTIVE 0xFFFFFF
10
 
9
 
Line 16... Line 15...
16
 
15
 
17
struct NOTE_LINE
16
struct NOTE_LINE
18
{
17
{
19
	bool state;
18
	bool state;
-
 
19
	char data[MAX_LINE_CHARS];
20
	char data[MAX_LINE_CHARS];
20
	void Delete();
Line -... Line 21...
-
 
21
};
-
 
22
 
-
 
23
void NOTE_LINE::Delete()
-
 
24
{
-
 
25
	state=false;
-
 
26
	data[0]=' ';
-
 
27
	data[1]=NULL;
21
};
28
}
22
 
29
 
23
//===================================================//
30
//===================================================//
24
//                                                   //
31
//                                                   //
25
//                       LIST                        //
32
//                       LIST                        //
Line 26... Line 33...
26
//                                                   //
33
//                                                   //
27
//===================================================//
-
 
28
 
34
//===================================================//
29
struct NOTES {
35
 
Line 30... Line 36...
30
	llist list;
36
struct NOTES : llist {
Line 31... Line 37...
31
	char txt_path[4096];
37
	char txt_path[4096];
32
	char txt_data[MAX_LINE_CHARS*LINES_COUNT];
38
	char txt_data[MAX_LINE_CHARS*LINES_COUNT];
33
 
39
 
34
	NOTE_LINE lines[LINES_COUNT]; 
40
	NOTE_LINE lines[LINES_COUNT]; 
35
 
41
 
36
	char edit_active;
42
	char edit_active;
37
	int OpenTxt();
43
	int OpenTxt();
Line 69... Line 75...
69
			}
75
			}
70
			if (linepos
76
			if (linepos
71
			linepos++;				
77
			linepos++;				
72
			i++;
78
			i++;
73
		}
79
		}
-
 
80
		while (item_n < LINES_COUNT)
-
 
81
		{
-
 
82
			//lines[item_n].Delete();
-
 
83
			item_n++;
-
 
84
		}
74
		list.count = item_n;
85
		count = LINES_COUNT;
75
		return 1;
86
		return 1;
76
	}
87
	}
77
}
88
}
Line 78... Line 89...
78
 
89
 
79
int NOTES::SaveTxt()
90
int NOTES::SaveTxt()
80
{
91
{
81
	int i;
92
	int i;
82
	dword tm;
93
	dword tm;
83
	strcpy(#txt_data, "notes");
94
	strcpy(#txt_data, "notes");
84
	for (i=0; i<=list.count; i++)
95
	for (i=0; i<=count; i++)
85
	{
96
	{
86
		if (lines[i].state==false) strcat(#txt_data, "\n- "); else strcat(#txt_data, "\n+ ");
97
		if (lines[i].state==false) strcat(#txt_data, "\n- "); else strcat(#txt_data, "\n+ ");
87
		tm = #lines[i].data;
98
		tm = #lines[i].data;
88
		strcat(#txt_data, #lines[i].data);
99
		strcat(#txt_data, #lines[i].data);
89
	}
100
	}
90
	WriteFile(0, strlen(#txt_data), #txt_data, #txt_path);
101
	WriteFile(0, strlen(#txt_data), #txt_data, #txt_path);
Line 91... Line -...
91
}
-
 
92
 
-
 
93
void NOTES::DeleteCurrentNode()
-
 
94
{
-
 
95
	return;
-
 
96
}
102
}
97
 
103
 
98
void NOTES::DrawList()
104
void NOTES::DrawList()
99
{
105
{
100
	int i;
106
	int i;
Line 101... Line 107...
101
	for (i=0; i
107
	for (i=0; i
102
}
108
}
103
 
109
 
104
 
110
 
105
dword NOTES::DrawLine(int line_n, draw_h) {
111
dword NOTES::DrawLine(int line_n, draw_h) {
106
	dword 
112
	dword 
107
		COL_BOTTOM_LINE=0xE8EFF4,
113
		COL_BOTTOM_LINE=0xE8EFF4,
-
 
114
		COL_BG,
108
		COL_BG,
115
		cur_text;
109
		cur_text;
116
	char line_text[4096];
110
	char line_text[4096];
117
	if (line_n<0) return;
Line 111... Line 118...
111
	if (line_n<0) return;
118
	x = 1;
Line 112... Line 119...
112
	if (line_n==list.cur_y) COL_BG = COL_BG_ACTIVE; else COL_BG = COL_BG_INACTIVE;
119
	if (line_n==cur_y) COL_BG = COL_BG_ACTIVE; else COL_BG = COL_BG_INACTIVE;
113
	DrawBar(list.x, line_n*list.item_h+list.y, RED_LINE_X, draw_h-1, COL_BG_INACTIVE);
120
	DrawBar(x, line_n*item_h+y, RED_LINE_X, draw_h-1, COL_BG_INACTIVE);
114
	DrawBar(list.x+RED_LINE_X+1, line_n*list.item_h+list.y, list.w-RED_LINE_X-1, draw_h-1, COL_BG);
121
	DrawBar(x+RED_LINE_X+1, line_n*item_h+y, w-RED_LINE_X-1, draw_h-1, COL_BG);
115
 
122
 
116
	cur_text = #lines[line_n].data;
123
	cur_text = #lines[line_n].data;
117
 
124
 
118
	if (draw_h!=list.item_h) 
125
	if (draw_h!=item_h) 
119
	{
126
	{
120
		COL_BOTTOM_LINE=COL_BG;
127
		COL_BOTTOM_LINE=COL_BG;
121
	}
128
	}
122
	else
129
	else
123
	{
130
	{
124
		DefineButton(RED_LINE_X-CHBOX/2+list.x, list.item_h*line_n+5+list.y, CHBOX-1,CHBOX-1, CHECKBOX_ID+line_n+BT_HIDE, 0); //checkbox
131
		DefineButton(RED_LINE_X-CHBOX/2+x, item_h*line_n+5+y, CHBOX-1,CHBOX-1, CHECKBOX_ID+line_n+BT_HIDE, 0); //checkbox
-
 
132
		_PutImage(RED_LINE_X-CHBOX/2+x, item_h*line_n+5+y, CHBOX,CHBOX, lines[line_n].state*CHBOX*CHBOX*3+#checkbox);
125
		_PutImage(RED_LINE_X-CHBOX/2+list.x, list.item_h*line_n+5+list.y, CHBOX,CHBOX, lines[line_n].state*CHBOX*CHBOX*3+#checkbox);
133
		if (cur_text) WriteText(x+RED_LINE_X+6, item_h*line_n+7+y, 0x80, lines[line_n].state*0x777777, cur_text);
126
		if (cur_text) WriteText(list.x+RED_LINE_X+6, list.item_h*line_n+7+list.y, 0x80, lines[line_n].state*0x777777, cur_text);
134
		if (lines[line_n].state == true) DrawBar(x+RED_LINE_X+6, item_h*line_n+11+y, strlen(cur_text)*6, 1, 0x444444); //strike