Subversion Repositories Kolibri OS

Rev

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

Rev 7422 Rev 7434
Line 1... Line 1...
1
#define MAX_LINE_CHARS 256
1
#define MAX_LINE_CHARS 256
Line 2... Line 2...
2
 
2
 
3
#define CHBOX 12
3
#define CHBOX 12
4
#define CHECKBOX_ID 50
4
#define CHECKBOX_ID 50
Line 5... Line 5...
5
unsigned char checkbox[sizeof(file "checkbox.raw")]= FROM "checkbox.raw";
5
unsigned char checkbox[sizeof(file "img/checkbox.raw")]= FROM "img/checkbox.raw";
6
 
6
 
Line 7... Line 7...
7
#define COL_BG_ACTIVE 0xFFF0A9
7
#define COL_BG_ACTIVE 0xFFF0A9
Line 34... Line 34...
34
//===================================================//
34
//===================================================//
Line 35... Line 35...
35
 
35
 
36
struct NOTES : llist {
36
struct NOTES : llist {
37
	char txt_path[4096];
37
	char txt_path[4096];
-
 
38
	char txt_data[MAX_LINE_CHARS*LINES_COUNT];
Line 38... Line 39...
38
	char txt_data[MAX_LINE_CHARS*LINES_COUNT];
39
	bool txt_file_exists;
Line 39... Line 40...
39
 
40
 
40
	NOTE_LINE lines[LINES_COUNT]; 
41
	NOTE_LINE lines[LINES_COUNT]; 
41
 
42
 
42
	char edit_active;
-
 
43
	int OpenTxt();
43
	char edit_active;
44
	int SaveTxt();
44
	int OpenTxt();
45
	void DeleteNode();
45
	int SaveTxt();
Line 55... Line 55...
55
 
55
 
56
	strcpy(#txt_path, file_path);
56
	strcpy(#txt_path, file_path);
57
	ReadFile(0, 4096, #txt_data, #txt_path);
57
	ReadFile(0, 4096, #txt_data, #txt_path);
58
	if (!txt_data) || (strncmp(#txt_data, "notes", 5)!=0)
58
	if (!txt_data) || (strncmp(#txt_data, "notes", 5)!=0)
-
 
59
	{
59
	{
60
		txt_file_exists = false;
60
		notify("'Notes\nData file does not exists or is not valid' -tE");
61
		notify("'Notes\nData file does not exists or is not valid' -tE");
61
		return 0;
62
		return 0;
62
	}
63
	}
63
	else
64
	else
-
 
65
	{
64
	{
66
		txt_file_exists = true;
65
		i+=5; //skip "notes" indefinier
67
		i+=5; //skip "notes" indefinier
66
		while (txt_data[i]) 
68
		while (txt_data[i]) 
67
		{
69
		{
68
			if (txt_data[i]=='\n') {
70
			if (txt_data[i]=='\n') {
Line 96... Line 98...
96
	{
98
	{
97
		if (lines[i].state==false) strcat(#txt_data, "\n- "); else strcat(#txt_data, "\n+ ");
99
		if (lines[i].state==false) strcat(#txt_data, "\n- "); else strcat(#txt_data, "\n+ ");
98
		tm = #lines[i].data;
100
		tm = #lines[i].data;
99
		strcat(#txt_data, #lines[i].data);
101
		strcat(#txt_data, #lines[i].data);
100
	}
102
	}
-
 
103
	if (!txt_file_exists) CreateFile(0, 0, #txt_path);
101
	WriteFile(0, strlen(#txt_data), #txt_data, #txt_path);
104
	WriteFile(0, strlen(#txt_data), #txt_data, #txt_path);
102
}
105
}
Line 103... Line 106...
103
 
106
 
104
void NOTES::DrawList()
107
void NOTES::DrawList()