The R Project SVN R

Rev

Rev 6509 | Rev 15268 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6509 Rev 8707
Line 179... Line 179...
179
	}
179
	}
180
}
180
}
181
 
181
 
182
char *askfilesave(char *title, char *default_name)
182
char *askfilesave(char *title, char *default_name)
183
{
183
{
-
 
184
    return askfilesavewithdir(title, default_name, NULL);
-
 
185
}
-
 
186
 
-
 
187
char *askfilesavewithdir(char *title, char *default_name, char *dir)
-
 
188
{
184
	int i;
189
	int i;
185
	OPENFILENAME ofn;
190
	OPENFILENAME ofn;
186
        char cwd[MAX_PATH];
191
        char cwd[MAX_PATH];
187
 
192
 
188
	if (! default_name)
193
	if (! default_name)
Line 199... Line 204...
199
	ofn.nFilterIndex    = 0;
204
	ofn.nFilterIndex    = 0;
200
	ofn.lpstrFile       = strbuf;
205
	ofn.lpstrFile       = strbuf;
201
	ofn.nMaxFile        = _MAX_PATH;
206
	ofn.nMaxFile        = _MAX_PATH;
202
	ofn.lpstrFileTitle  = NULL;
207
	ofn.lpstrFileTitle  = NULL;
203
	ofn.nMaxFileTitle   = _MAX_FNAME + _MAX_EXT;
208
	ofn.nMaxFileTitle   = _MAX_FNAME + _MAX_EXT;
-
 
209
	if(dir && strlen(dir) > 0)
-
 
210
	    ofn.lpstrInitialDir = dir;
-
 
211
	else {
204
        if (GetCurrentDirectory(MAX_PATH,cwd))
212
	    if (GetCurrentDirectory(MAX_PATH,cwd))
205
            ofn.lpstrInitialDir = cwd;
213
		ofn.lpstrInitialDir = cwd;
206
        else
214
	    else
207
            ofn.lpstrInitialDir = NULL;
215
		ofn.lpstrInitialDir = NULL;
-
 
216
	}
208
	ofn.lpstrTitle      = title;
217
	ofn.lpstrTitle      = title;
209
	ofn.Flags           = OFN_OVERWRITEPROMPT |
218
	ofn.Flags           = OFN_OVERWRITEPROMPT |
210
                              OFN_NOCHANGEDIR | OFN_HIDEREADONLY;
219
                              OFN_NOCHANGEDIR | OFN_HIDEREADONLY;
211
	ofn.nFileOffset     = 0;
220
	ofn.nFileOffset     = 0;
212
	ofn.nFileExtension  = 0;
221
	ofn.nFileExtension  = 0;
Line 385... Line 394...
385
	if (old) drawto(old);
394
	if (old) drawto(old);
386
 
395
 
387
	return d->hit;
396
	return d->hit;
388
}
397
}
389
 
398
 
390
static window init_askstr_dialog(char *title, char *question, 
399
static window init_askstr_dialog(char *title, char *question,
391
				 char *default_str)
400
				 char *default_str)
392
{
401
{
393
	window win;
402
	window win;
394
	dialog_data *d;
403
	dialog_data *d;
395
	int tw, bw, h, middle;
404
	int tw, bw, h, middle;
Line 412... Line 421...
412
	d->question = newlabel(question, rect(10,h,tw+4,h*2+2),
421
	d->question = newlabel(question, rect(10,h,tw+4,h*2+2),
413
			AlignLeft);
422
			AlignLeft);
414
	if (title == FINDDIR_TITLE) {
423
	if (title == FINDDIR_TITLE) {
415
	    bw = strwidth(SystemFont, BROWSE_STRING) * 3/2;
424
	    bw = strwidth(SystemFont, BROWSE_STRING) * 3/2;
416
	    d->text = newfield(default_str, rect(10,h*4,tw+4-bw,h*3/2));
425
	    d->text = newfield(default_str, rect(10,h*4,tw+4-bw,h*3/2));
417
	    newbutton(BROWSE_STRING, rect(20+tw-bw, h*4-2, bw, h+10), 
426
	    newbutton(BROWSE_STRING, rect(20+tw-bw, h*4-2, bw, h+10),
418
		      browse_button);
427
		      browse_button);
419
	}
428
	}
420
	else if (title == PASSWORD_TITLE)
429
	else if (title == PASSWORD_TITLE)
421
		d->text = newpassword(default_str, rect(10,h*4,tw+4,h*3/2));
430
		d->text = newpassword(default_str, rect(10,h*4,tw+4,h*3/2));
422
	else
431
	else