#include #include #include #include #include #include #include "system/env.h"// Временно!!! #include "modules.h" #define DEFAULT_CONFIG "/sys/settings/table.ini" static char* env_key_config= "table_config"; bool table_not_saved = false; open_dialog* dlg_open; //для сохранить и сохранить как char* path_table_doc; table_dom_t* table_data; // IMPORT functions // config.c #include "config.h" // window.c #include "window.h" int main(int argc, char **argv){ int argv_offset = 1; int err_code; // load config if (!strcmp(argv[1], "-config") && argc >= 3){ argv_offset = 3; err_code = config_load(argv[2]); // load cmdline config if (err_code) { // send error and return return 0; } }else { uint32_t bufflen; // check env param err_code = get_env_info(env_key_config, &bufflen); if (err_code == 0) { // get env param char* buff = malloc(bufflen); if (buff == 0) return 0; err_code = get_env(env_key_config, buff, bufflen); if (err_code) { // send error and return return 0; } // load config err_code = config_load(buff); if (err_code) { // send error and return return 0; } }else{ //load default config err_code = config_load(DEFAULT_CONFIG); if (err_code) { // send error and return return 0; } } } dlg_open = kolibri_new_open_dialog(PROC_LIB_OPEN, 10, 10, 420, 320); // create opendialog struct dlg_open -> draw_window = &draw_window; OpenDialog_init(dlg_open); path_table_doc = malloc(4096); // check file name in cmdline if ((argc > argv_offset) && (argc == argv_offset + 1)){ // probe _ksys_debug_puts("table: open \""); _ksys_debug_puts(argv[argv_offset]); _ksys_debug_puts("\"\n"); // call modules for load table_dom }else{ // not file - new table _ksys_debug_puts("table: not open file\n"); // call table_lib for create default table_dom } selected_screen = SCREEN_BASE; _ksys_set_event_mask(KSYS_EVM_MOUSE_FILTER + KSYS_EVM_REDRAW + KSYS_EVM_KEY + KSYS_EVM_BUTTON + KSYS_EVM_MOUSE); bool end_loop = false; do { switch (_ksys_get_event()){ case KSYS_EVENT_NONE: break; case KSYS_EVENT_REDRAW: draw_window(); break; case KSYS_EVENT_MOUSE: end_loop = window_event_mouse(); break; case KSYS_EVENT_KEY: end_loop = window_event_key(_ksys_get_key()); break; case KSYS_EVENT_BUTTON: // Событие обработки кнопок end_loop = window_event_button(_ksys_get_button());// Получение кода нажатой кнопки. break; } if (end_loop && !table_not_saved) { // check non saved file }; }while(!end_loop); modules_exit(); return 0; }