The R Project SVN R

Rev

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

Rev 44186 Rev 44345
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Langage for Statistical Data Analysis
2
 *  R : A Computer Langage for Statistical Data Analysis
3
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
3
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1998--2007  Robert Gentleman, Ross Ihaka and the
4
 *  Copyright (C) 1998--2008  Robert Gentleman, Ross Ihaka and the
5
 *                            R Development Core Team
5
 *                            R Development Core Team
6
 *
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  the Free Software Foundation; either version 2 of the License, or
Line 73... Line 73...
73
typedef enum { UP, DOWN, LEFT, RIGHT } DE_DIRECTION;
73
typedef enum { UP, DOWN, LEFT, RIGHT } DE_DIRECTION;
74
 
74
 
75
typedef enum {UNKNOWNN, NUMERIC, CHARACTER} CellType;
75
typedef enum {UNKNOWNN, NUMERIC, CHARACTER} CellType;
76
 
76
 
77
/* EXPORTS : */
77
/* EXPORTS : */
78
SEXP RX11_dataentry(SEXP call, SEXP op, SEXP args, SEXP rho);
78
SEXP in_RX11_dataentry(SEXP call, SEXP op, SEXP args, SEXP rho);
79
 
79
 
80
/* Global variables needed for the graphics */
80
/* Global variables needed for the graphics */
81
static Display *iodisplay = NULL;
81
static Display *iodisplay = NULL;
82
static XContext deContext;
82
static XContext deContext;
83
static int nView = 0; /* number of open data windows */
83
static int nView = 0; /* number of open data windows */
Line 196... Line 196...
196
#ifdef USE_FONTSET
196
#ifdef USE_FONTSET
197
static Status           status;
197
static Status           status;
198
static XFontSet         font_set;
198
static XFontSet         font_set;
199
static XFontStruct	**fs_list;
199
static XFontStruct	**fs_list;
200
static int		font_set_cnt;
200
static int		font_set_cnt;
201
static char             *fontset_name="-*-fixed-medium-r-normal--13-*-*-*-*-*-*-*";
201
static char             fontset_name[]="-*-fixed-medium-r-*-*-*-120-*-*-*-*-*-*";
202
static XIM		ioim;
202
static XIM		ioim;
203
static XIMStyle         ioim_style;
203
static XIMStyle         ioim_style;
204
static XIMStyles        *ioim_styles;
204
static XIMStyles        *ioim_styles;
205
 
205
 
206
/*
206
/*
Line 302... Line 302...
302
{
302
{
303
    DEstruct DE = (DEstruct) data;
303
    DEstruct DE = (DEstruct) data;
304
    closewin(DE);
304
    closewin(DE);
305
}
305
}
306
 
306
 
307
SEXP RX11_dataentry(SEXP call, SEXP op, SEXP args, SEXP rho)
307
SEXP in_RX11_dataentry(SEXP call, SEXP op, SEXP args, SEXP rho)
308
{
308
{
309
    SEXP colmodes, tnames, tvec, tvec2, work2;
309
    SEXP colmodes, tnames, tvec, tvec2, work2;
310
    SEXPTYPE type;
310
    SEXPTYPE type;
311
    int i, j, cnt, len, nprotect;
311
    int i, j, cnt, len, nprotect;
312
    RCNTXT cntxt;
312
    RCNTXT cntxt;
Line 1917... Line 1917...
1917
#ifdef USE_FONTSET
1917
#ifdef USE_FONTSET
1918
    if(mbcslocale) {
1918
    if(mbcslocale) {
1919
	int  missing_charset_count;
1919
	int  missing_charset_count;
1920
	char **missing_charset_list;
1920
	char **missing_charset_list;
1921
	char *def_string;
1921
	char *def_string;
1922
 
-
 
1923
	char opt_fontset_name[512];
1922
	char opt_fontset_name[512];
1924
 
1923
 
1925
	/*
-
 
1926
	  options("X11fonts")[1] read font name
1924
	/* options("X11fonts")[1] read font name */
1927
	*/
-
 
1928
	const char *s = CHAR(STRING_ELT(GetOption(install("X11fonts"),
1925
	SEXP opt = GetOption(install("X11fonts"), R_NilValue);
1929
                                                  R_NilValue), 0));
-
 
1930
 
-
 
1931
	if (s == NULL) {
1926
	if(isString(opt)) {
1932
	    strcpy(opt_fontset_name,fontset_name);
1927
	    const char *s = CHAR(STRING_ELT(opt, 0));
1933
	} else {
-
 
1934
	    sprintf(opt_fontset_name,s,"medium","r",12);
1928
	    sprintf(opt_fontset_name, s, "medium", "r", 12);
1935
	}
-
 
-
 
1929
	} else strcpy(opt_fontset_name, fontset_name);
1936
 
1930
 
1937
	font_set = XCreateFontSet(iodisplay, opt_fontset_name,
1931
	font_set = XCreateFontSet(iodisplay, opt_fontset_name,
1938
				  &missing_charset_list,
1932
				  &missing_charset_list,
1939
				  &missing_charset_count, &def_string);
1933
				  &missing_charset_count, &def_string);
1940
	if (missing_charset_count) XFreeStringList(missing_charset_list);
1934
	if (missing_charset_count) XFreeStringList(missing_charset_list);
1941
	if (font_set == NULL) {
1935
	if (font_set == NULL) {
1942
	    warning("unable to create fontset %s", fontset_name);
1936
	    warning("unable to create fontset %s", opt_fontset_name);
1943
	    return TRUE; /* ERROR */
1937
	    return TRUE; /* ERROR */
1944
	}
1938
	}
1945
    } else
1939
    } else
1946
#endif
1940
#endif
1947
    {
1941
    {