Subversion Repositories Kolibri OS

Rev

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

Rev 7507 Rev 7516
Line 4... Line 4...
4
#include "func.h"
4
#include "func.h"
5
#include "parser.h"
5
#include "parser.h"
6
#include "calc.h"
6
#include "calc.h"
7
#include "use_library.h"
7
#include "use_library.h"
Line -... Line 8...
-
 
8
 
-
 
9
#ifdef AUTOBUILD
-
 
10
extern char params[1024];
-
 
11
#endif
-
 
12
char params[1024];
8
 
13
 
Line 9... Line 14...
9
#define TABLE_VERSION "0.99"
14
#define TABLE_VERSION "0.99.1"
10
 
15
 
11
// strings
16
// strings
12
const char *sFileSign = "KolibriTable File\n";
17
const char *sFileSign = "KolibriTable File\n";
Line 1041... Line 1046...
1041
			edit_box_key((dword)&cell_box);
1046
			edit_box_key((dword)&cell_box);
1042
			break;
1047
			break;
1043
	}
1048
	}
1044
}
1049
}
Line -... Line 1050...
-
 
1050
 
-
 
1051
void EventLoadFile()
-
 
1052
{
-
 
1053
	stop_edit();
-
 
1054
	int r = LoadFile(fname);
-
 
1055
	char *result;
-
 
1056
	if (r > 0) {
-
 
1057
		calculate_values();
-
 
1058
		sel_moved = 0;
-
 
1059
		draw_grid();
-
 
1060
		result = (char*)msg_load;
-
 
1061
	}
-
 
1062
	else if (r == -1) result = (char*)er_file_not_found;
-
 
1063
	else if (r == -2) result = (char*)er_format;
-
 
1064
	kos_AppRun("/sys/@notify", result);
-
 
1065
}
1045
 
1066
 
1046
void process_button()
1067
void process_button()
1047
{
1068
{
1048
	Dword button;
1069
	Dword button;
1049
	if (!kos_GetButtonID(button)) return;
1070
	if (!kos_GetButtonID(button)) return;
Line 1061... Line 1082...
1061
		stop_edit();
1082
		stop_edit();
1062
		if (SaveFile(fname)) kos_AppRun("/sys/@notify", (char*)msg_save);
1083
		if (SaveFile(fname)) kos_AppRun("/sys/@notify", (char*)msg_save);
1063
		break;
1084
		break;
Line 1064... Line 1085...
1064
 
1085
 
1065
	case LOAD_BUTTON:
-
 
1066
		stop_edit();
1086
	case LOAD_BUTTON:
1067
		int r = LoadFile(fname);
-
 
1068
		char *result;
-
 
1069
		if (r > 0) {
-
 
1070
			calculate_values();
-
 
1071
			sel_moved = 0;
-
 
1072
			draw_grid();
-
 
1073
			result = (char*)msg_load;
-
 
1074
		}
-
 
1075
		else if (r == -1) result = (char*)er_file_not_found;
-
 
1076
		else if (r == -2) result = (char*)er_format;
-
 
1077
		kos_AppRun("/sys/@notify", result);
1087
		EventLoadFile();
1078
		break;
1088
		break;
1079
	}
1089
	}
1080
	if (button >= COL_HEAD_BUTTON    &&    button < ROW_HEAD_BUTTON)
1090
	if (button >= COL_HEAD_BUTTON    &&    button < ROW_HEAD_BUTTON)
1081
	{
1091
	{
Line 1100... Line 1110...
1100
void kos_Main()
1110
void kos_Main()
1101
{
1111
{
1102
	kos_InitHeap();
1112
	kos_InitHeap();
1103
	load_edit_box();
1113
	load_edit_box();
1104
	init();
1114
	init();
-
 
1115
	if (params[0]) {
-
 
1116
		strcpy(fname, params);
-
 
1117
		file_box.size = file_box.pos = strlen(fname);
-
 
1118
		EventLoadFile();
-
 
1119
	}
1105
	kos_SetMaskForEvents(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);	
1120
	kos_SetMaskForEvents(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);	
1106
	for (;;)
1121
	for (;;)
1107
	{
1122
	{
1108
		switch (kos_WaitForEvent())
1123
		switch (kos_WaitForEvent())
1109
		{
1124
		{