| Line 1... |
Line 1... |
| 1 |
/*
|
1 |
/*
|
| 2 |
* R : A Computer Language for Statistical Data Analysis
|
2 |
* R : A Computer Language for Statistical Data Analysis
|
| 3 |
* Copyright (C) 1999-2014 The R Core Team
|
3 |
* Copyright (C) 1999-2017 The R Core Team
|
| 4 |
*
|
4 |
*
|
| 5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
| 6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
| 7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
| 8 |
* (at your option) any later version.
|
8 |
* (at your option) any later version.
|
| Line 185... |
Line 185... |
| 185 |
|
185 |
|
| 186 |
setuserfilterW(L"R files (*.R)\0*.R\0S files (*.q, *.ssc, *.S)\0*.q;*.ssc;*.S\0All files (*.*)\0*.*\0\0");
|
186 |
setuserfilterW(L"R files (*.R)\0*.R\0S files (*.q, *.ssc, *.S)\0*.q;*.ssc;*.S\0All files (*.*)\0*.*\0\0");
|
| 187 |
wname = askfilesaveW(G_("Save script as"), "");
|
187 |
wname = askfilesaveW(G_("Save script as"), "");
|
| 188 |
if (wname) {
|
188 |
if (wname) {
|
| 189 |
char name[4*MAX_PATH+1];
|
189 |
char name[4*MAX_PATH+1];
|
| 190 |
wcstoutf8(name, wname, MAX_PATH);
|
190 |
wcstoutf8(name, wname, sizeof(name));
|
| 191 |
/* now check if it has an extension */
|
191 |
/* now check if it has an extension */
|
| 192 |
char *q = strchr(name, '.');
|
192 |
char *q = strchr(name, '.');
|
| 193 |
if(!q) strncat(name, ".R", 4*MAX_PATH);
|
193 |
if(!q) strncat(name, ".R", 4*MAX_PATH);
|
| 194 |
editor_save_file(c, name, CE_UTF8);
|
194 |
editor_save_file(c, name, CE_UTF8);
|
| 195 |
p->file = 1;
|
195 |
p->file = 1;
|
| Line 370... |
Line 370... |
| 370 |
}
|
370 |
}
|
| 371 |
|
371 |
|
| 372 |
static void editoropen(const char *default_name)
|
372 |
static void editoropen(const char *default_name)
|
| 373 |
{
|
373 |
{
|
| 374 |
wchar_t *wname;
|
374 |
wchar_t *wname;
|
| 375 |
char name[4*MAX_PATH], title[4*MAX_PATH];
|
375 |
char name[4*MAX_PATH + 1], title[4*MAX_PATH];
|
| 376 |
|
376 |
|
| 377 |
int i; textbox t; EditorData p;
|
377 |
int i; textbox t; EditorData p;
|
| 378 |
setuserfilterW(L"R files (*.R)\0*.R\0S files (*.q, *.ssc, *.S)\0*.q;*.ssc;*.S\0All files (*.*)\0*.*\0\0");
|
378 |
setuserfilterW(L"R files (*.R)\0*.R\0S files (*.q, *.ssc, *.S)\0*.q;*.ssc;*.S\0All files (*.*)\0*.*\0\0");
|
| 379 |
wname = askfilenameW(G_("Open script"), default_name); /* returns NULL if open dialog cancelled */
|
379 |
wname = askfilenameW(G_("Open script"), default_name); /* returns NULL if open dialog cancelled */
|
| 380 |
if (wname) {
|
380 |
if (wname) {
|
| 381 |
wcstoutf8(name, wname, MAX_PATH);
|
381 |
wcstoutf8(name, wname, sizeof(name));
|
| 382 |
/* check if file is already open in an editor. If so, close and open again */
|
382 |
/* check if file is already open in an editor. If so, close and open again */
|
| 383 |
for (i = 0; i < neditors; ++i) {
|
383 |
for (i = 0; i < neditors; ++i) {
|
| 384 |
t = getdata(REditors[i]);
|
384 |
t = getdata(REditors[i]);
|
| 385 |
p = getdata(t);
|
385 |
p = getdata(t);
|
| 386 |
if (!strcmp (name, p->filename)) {
|
386 |
if (!strcmp (name, p->filename)) {
|