newfile - open real "new" template code when NEW file is requested.
previously, it doesn't open a new template code but modified one. now it's fixed.
This commit is contained in:
parent
2a19e99079
commit
5a4d2baaf3
|
@ -28,6 +28,7 @@ enventor_SOURCES = \
|
|||
build.c \
|
||||
tools.c \
|
||||
search.c \
|
||||
newfile.c \
|
||||
globals.c
|
||||
|
||||
enventor_LDADD = @ENVENTOR_LIBS@
|
||||
|
|
|
@ -927,3 +927,12 @@ edit_part_highlight_toggle(edit_data *ed, Eina_Bool msg)
|
|||
else
|
||||
stats_info_msg_update("Part Highlighting Disabled.");
|
||||
}
|
||||
|
||||
void
|
||||
edit_edc_reload(edit_data *ed, const char *edc_path)
|
||||
{
|
||||
config_edc_path_set(edc_path);
|
||||
edit_new(ed);
|
||||
edj_mgr_reload_need_set(EINA_TRUE);
|
||||
config_apply();
|
||||
}
|
||||
|
|
|
@ -36,25 +36,7 @@ edc_changed_cb(void *data, int type EINA_UNUSED, void *event)
|
|||
static Eina_Bool
|
||||
edc_proto_setup()
|
||||
{
|
||||
Eina_Bool success = EINA_TRUE;
|
||||
|
||||
char buf[PATH_MAX];
|
||||
snprintf(buf, sizeof(buf), "%s/.proto/proto.edc",
|
||||
elm_app_data_dir_get());
|
||||
|
||||
if (!ecore_file_exists(config_edc_path_get()))
|
||||
{
|
||||
EINA_LOG_INFO("No working edc file exists. Copy a proto.edc");
|
||||
success = eina_file_copy(buf, config_edc_path_get(),
|
||||
EINA_FILE_COPY_DATA, NULL, NULL);
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
EINA_LOG_ERR("Cannot find file! \"%s\"", buf);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
newfile_new(NULL, EINA_TRUE);
|
||||
build_edc();
|
||||
|
||||
return EINA_TRUE;
|
||||
|
|
|
@ -37,7 +37,6 @@ static void warning_no_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
void *event_info EINA_UNUSED);
|
||||
static void new_save_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED);
|
||||
static void edc_reload(menu_data *md, const char *edc_path);
|
||||
static void edc_file_save(menu_data *md);
|
||||
|
||||
static void
|
||||
|
@ -601,8 +600,7 @@ new_yes_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
menu_data *md = data;
|
||||
|
||||
edc_reload(md, PROTO_EDC_PATH);
|
||||
newfile_new(md->ed, EINA_FALSE);
|
||||
warning_close(md);
|
||||
menu_close(md);
|
||||
}
|
||||
|
@ -658,15 +656,6 @@ btn_effect_timer_cb(void *data)
|
|||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
static void
|
||||
edc_reload(menu_data *md, const char *edc_path)
|
||||
{
|
||||
config_edc_path_set(edc_path);
|
||||
edit_new(md->ed);
|
||||
edj_mgr_reload_need_set(EINA_TRUE);
|
||||
config_apply();
|
||||
}
|
||||
|
||||
static void
|
||||
warning_no_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_info EINA_UNUSED)
|
||||
|
@ -682,7 +671,7 @@ new_save_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
menu_data *md = data;
|
||||
|
||||
edit_save(md->ed);
|
||||
edc_reload(md, PROTO_EDC_PATH);
|
||||
newfile_new(md->ed, EINA_FALSE);
|
||||
warning_close(md);
|
||||
menu_close(md);
|
||||
}
|
||||
|
@ -692,7 +681,7 @@ new_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
menu_data *md = data;
|
||||
menu_edc_new(md);
|
||||
menu_edc_new();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -820,7 +809,7 @@ fileselector_load_done_cb(void *data, Evas_Object *obj, void *event_info)
|
|||
return;
|
||||
}
|
||||
|
||||
edc_reload(md, selected);
|
||||
edit_edc_reload(md->ed, selected);
|
||||
fileselector_close(md);
|
||||
menu_close(md);
|
||||
}
|
||||
|
@ -1023,7 +1012,7 @@ menu_edc_new()
|
|||
warning_layout_create(md, new_yes_btn_cb, new_save_btn_cb);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
edc_reload(md, PROTO_EDC_PATH);
|
||||
newfile_new(md->ed, EINA_FALSE);
|
||||
menu_close(md);
|
||||
|
||||
return EINA_FALSE;
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#include <Elementary.h>
|
||||
#include "common.h"
|
||||
|
||||
|
||||
void
|
||||
newfile_new(edit_data *ed, Eina_Bool init)
|
||||
{
|
||||
Eina_Bool success = EINA_TRUE;
|
||||
char buf[PATH_MAX];
|
||||
snprintf(buf, sizeof(buf), "%s/.proto/proto.edc",
|
||||
elm_app_data_dir_get());
|
||||
success = eina_file_copy(buf, config_edc_path_get(),
|
||||
EINA_FILE_COPY_DATA, NULL, NULL);
|
||||
if (!success)
|
||||
{
|
||||
EINA_LOG_ERR("Cannot find file! \"%s\"", buf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!init) edit_edc_reload(ed, PROTO_EDC_PATH);
|
||||
}
|
|
@ -19,4 +19,5 @@ EXTRA_DIST = common.h \
|
|||
syntax_helper.h \
|
||||
template_code.h \
|
||||
tools.h \
|
||||
newfile.h \
|
||||
search.h
|
||||
|
|
|
@ -27,5 +27,6 @@ typedef struct indent_s indent_data;
|
|||
#include "tools.h"
|
||||
#include "base_gui.h"
|
||||
#include "search.h"
|
||||
#include "newfile.h"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,3 +16,4 @@ void edit_template_insert(edit_data *ed);
|
|||
void edit_template_part_insert(edit_data *ed, Edje_Part_Type type);
|
||||
void edit_part_highlight_toggle(edit_data *ed, Eina_Bool msg);
|
||||
void edit_line_delete(edit_data *ed);
|
||||
void edit_edc_reload(edit_data *ed, const char *edc_path);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
void newfile_new(edit_data *ed, Eina_Bool init);
|
Loading…
Reference in New Issue