[Rd] Additional file filter for Windows text editor Open/Save dialogues.

From: Jonathan Swinton <jonathan_at_swintons.net>
Date: Tue, 16 Oct 2007 10:00:43 +0100

I propose the following very simple patch to src\gnuwin32\editor.c. Its purpose is to allow vignette files, specifically .Snw and .Rnw suffixes, to be an available filter in the Open and Save dialogues of the R GUI text editor.

I have successfully built and tested this against R 2.5.0, and found it useful.

Although the patch is against the current r-devel, I cannot currently build that (because of a failure to build Rblas.dll, FWIW, and no doubt all my fault for not reading the right bit of the manual). However it seems to me unlikely that this patch would be the victim of such version differences, and I think it better to offer it now; I am unlikely to be able to troubleshoot my r-devel build for a long time if at all.

Index: editor.c

+/* Definition of available filters for Open and Save dialogues */
+#define EDITORFILEFILTER "R files (*.R)\0*.R\0S files (*.q, *.ssc, *.S)\0*.q;*.ssc;*.S\0Vignette files (*.Rnw,*.Snw)\0*.Rnw;*.Snw\0All files (*.*)\0*.*\0\0"

  static EditorData neweditordata (int file, char *filename)   {

      EditorData p;
@@ -149,7 +152,7 @@

      EditorData p = getdata(t);
      char *current_name = (p->file ? p->filename : "");
      char *name;

- setuserfilter("R files (*.R)\0*.R\0S files (*.q, *.ssc, *.S)\0*.q;*.ssc;*.S\0All files (*.*)\0*.*\0\0"); + setuserfilter( EDITORFILEFILTER);
      name = askfilesave(G_("Save script as"), current_name);
      if (name == NULL)

@@ -337,7 +340,7 @@

      char *name;
      int i; textbox t; EditorData p;

- setuserfilter("R files (*.R)\0*.R\0S files (*.q, *.ssc, *.S)\0*.q;*.ssc;*.S\0All files (*.*)\0*.*\0\0"); + setuserfilter(EDITORFILEFILTER);
      name = askfilename("Open script", default_name); /* returns NULL if open dialog cancelled */
      if (name) {
  	/* check if file is already open in an editor. If so, close and open again */

R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 16 Oct 2007 - 15:53:33 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 25 Oct 2007 - 11:37:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.