int Rgui_Edit(const char *filename, int enc, const char *title, int modal) { editor c; EditorData p; if (neditors == MAXNEDITORS) { R_ShowMessage(G_("Maximum number of editors reached")); return 1; } c = neweditor(); if (!c) { R_ShowMessage(G_("Unable to create editor window")); return 1; } if (strlen(filename) > 0) { editor_load_file(c, filename, enc); editor_set_title(c, title); } else { editor_set_title(c, G_("Untitled")); } show(c); p = getdata(getdata(c)); p->stealconsole = modal; if (modal) { fix_editor_up = TRUE; eventloop(c); } return 0; }
void editor_modal_load(struct editor* editor, const char* path) { if ( editor_load_file(editor, path) ) editor_type_edit(editor); else editor->modal_error = true; }