Exemplo n.º 1
0
static void editoropen(const char *default_name)
{
    wchar_t *wname;
    char name[4*MAX_PATH], title[4*MAX_PATH];

    int i; textbox t; EditorData p;
    setuserfilterW(L"R files (*.R)\0*.R\0S files (*.q, *.ssc, *.S)\0*.q;*.ssc;*.S\0All files (*.*)\0*.*\0\0");
    wname = askfilenameW(G_("Open script"), default_name); /* returns NULL if open dialog cancelled */
    if (wname) {
	wcstoutf8(name, wname, MAX_PATH);
	/* check if file is already open in an editor. If so, close and open again */
	for (i = 0; i < neditors; ++i) {
	    t = getdata(REditors[i]);
	    p = getdata(t);
	    if (!strcmp (name, p->filename)) {
		editorclose(REditors[i]);
		break;
	    }
	}
	reEnc2(name, title, MAX_PATH+1, CE_UTF8, CE_NATIVE, 3);
	Rgui_Edit(name, CE_UTF8, title, 0);
    } else show(RConsole);
}
Exemplo n.º 2
0
static void menueditorclose(control m)
{
    editor c = getdata(m);
    editorclose(c);
}