| 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 |
* file preferences.c
|
3 |
* file preferences.c
|
| 4 |
* Copyright (C) 2000 Guido Masarotto and Brian Ripley
|
4 |
* Copyright (C) 2000 Guido Masarotto and Brian Ripley
|
| 5 |
* 2004-8 R Core Team
|
5 |
* 2004-13 R 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
|
| 10 |
* (at your option) any later version.
|
10 |
* (at your option) any later version.
|
| Line 302... |
Line 302... |
| 302 |
askok(G_("The overall console properties cannot be changed\non a running console.\n\nSave the preferences and restart Rgui to apply them.\n"));
|
302 |
askok(G_("The overall console properties cannot be changed\non a running console.\n\nSave the preferences and restart Rgui to apply them.\n"));
|
| 303 |
|
303 |
|
| 304 |
if(strcmp(newGUI->language, curGUI.language)) {
|
304 |
if(strcmp(newGUI->language, curGUI.language)) {
|
| 305 |
char *buf = malloc(50);
|
305 |
char *buf = malloc(50);
|
| 306 |
askok(G_("The language for menus cannot be changed on a\n running console.\n\nSave the preferences and restart Rgui to apply to menus.\n"));
|
306 |
askok(G_("The language for menus cannot be changed on a\n running console.\n\nSave the preferences and restart Rgui to apply to menus.\n"));
|
| 307 |
sprintf(buf, "LANGUAGE=%s", newGUI->language);
|
307 |
snprintf(buf, 50, "LANGUAGE=%s", newGUI->language);
|
| 308 |
putenv(buf);
|
308 |
putenv(buf);
|
| 309 |
}
|
309 |
}
|
| 310 |
|
310 |
|
| 311 |
|
311 |
|
| 312 |
/* Set a new font? */
|
312 |
/* Set a new font? */
|
| Line 327... |
Line 327... |
| 327 |
/* Don't delete font: open pagers may be using it */
|
327 |
/* Don't delete font: open pagers may be using it */
|
| 328 |
if (strcmp(fontname, "FixedFont"))
|
328 |
if (strcmp(fontname, "FixedFont"))
|
| 329 |
consolefn = gnewfont(NULL, fontname, fontsty, pointsize, 0.0, 1);
|
329 |
consolefn = gnewfont(NULL, fontname, fontsty, pointsize, 0.0, 1);
|
| 330 |
else consolefn = FixedFont;
|
330 |
else consolefn = FixedFont;
|
| 331 |
if (!consolefn) {
|
331 |
if (!consolefn) {
|
| 332 |
sprintf(msg,
|
332 |
snprintf(msg, LF_FACESIZE + 128,
|
| 333 |
G_("Font %s-%d-%d not found.\nUsing system fixed font"),
|
333 |
G_("Font %s-%d-%d not found.\nUsing system fixed font"),
|
| 334 |
fontname, fontsty | FixedWidth, pointsize);
|
334 |
fontname, fontsty | FixedWidth, pointsize);
|
| 335 |
R_ShowMessage(msg);
|
335 |
R_ShowMessage(msg);
|
| 336 |
consolefn = FixedFont;
|
336 |
consolefn = FixedFont;
|
| 337 |
}
|
337 |
}
|
| 338 |
/* if (!ghasfixedwidth(consolefn)) {
|
338 |
/* if (!ghasfixedwidth(consolefn)) {
|
| 339 |
sprintf(msg,
|
339 |
sprintf(msg,
|
| Line 354... |
Line 354... |
| 354 |
consoler = newGUI->crows;
|
354 |
consoler = newGUI->crows;
|
| 355 |
consolec = newGUI->ccols;
|
355 |
consolec = newGUI->ccols;
|
| 356 |
r.width = (consolec + 1) * FW;
|
356 |
r.width = (consolec + 1) * FW;
|
| 357 |
r.height = (consoler + 1) * FH;
|
357 |
r.height = (consoler + 1) * FH;
|
| 358 |
resize(RConsole, r);
|
358 |
resize(RConsole, r);
|
| 359 |
sprintf(buf, "%d", ROWS); settext(f_crows, buf);
|
359 |
snprintf(buf, 20, "%d", ROWS); settext(f_crows, buf);
|
| 360 |
sprintf(buf, "%d", COLS); settext(f_ccols, buf);
|
360 |
snprintf(buf, 20, "%d", COLS); settext(f_ccols, buf);
|
| 361 |
}
|
361 |
}
|
| 362 |
if (p->lbuf->dim != newGUI->cbb || p->lbuf->ms != newGUI->cbl)
|
362 |
if (p->lbuf->dim != newGUI->cbb || p->lbuf->ms != newGUI->cbl)
|
| 363 |
xbufgrow(p->lbuf, newGUI->cbb, newGUI->cbl);
|
363 |
xbufgrow(p->lbuf, newGUI->cbb, newGUI->cbl);
|
| 364 |
|
364 |
|
| 365 |
/* Set colours and redraw */
|
365 |
/* Set colours and redraw */
|
| Line 824... |
Line 824... |
| 824 |
if (gui->tt_font) check(tt_font);
|
824 |
if (gui->tt_font) check(tt_font);
|
| 825 |
settext(f_font, gui->font);
|
825 |
settext(f_font, gui->font);
|
| 826 |
|
826 |
|
| 827 |
l_point = newlabel("size", rect(310, 100, 30, 20), AlignLeft);
|
827 |
l_point = newlabel("size", rect(310, 100, 30, 20), AlignLeft);
|
| 828 |
d_point = newdropfield(PointsList, rect(345, 100, 50, 20), scrollPoints);
|
828 |
d_point = newdropfield(PointsList, rect(345, 100, 50, 20), scrollPoints);
|
| 829 |
sprintf(buf, "%d", gui->pointsize);
|
829 |
snprintf(buf, 100, "%d", gui->pointsize);
|
| 830 |
settext(d_point, buf);
|
830 |
settext(d_point, buf);
|
| 831 |
l_style = newlabel("style", rect(410, 100, 40, 20), AlignLeft);
|
831 |
l_style = newlabel("style", rect(410, 100, 40, 20), AlignLeft);
|
| 832 |
f_style = newdroplist(StyleList, rect(450, 100, 80, 20), scrollStyle);
|
832 |
f_style = newdroplist(StyleList, rect(450, 100, 80, 20), scrollStyle);
|
| 833 |
setlistitem(f_style, cmatch(gui->style, StyleList));
|
833 |
setlistitem(f_style, cmatch(gui->style, StyleList));
|
| 834 |
|
834 |
|
| 835 |
/* Console size, set widthonresize */
|
835 |
/* Console size, set widthonresize */
|
| 836 |
l_crows = newlabel("Console rows", rect(10, 150, 100, 20), AlignLeft);
|
836 |
l_crows = newlabel("Console rows", rect(10, 150, 100, 20), AlignLeft);
|
| 837 |
sprintf(buf, "%d", gui->crows);
|
837 |
snprintf(buf, 100, "%d", gui->crows);
|
| 838 |
f_crows = newfield(buf, rect(110, 150, 30, 20));
|
838 |
f_crows = newfield(buf, rect(110, 150, 30, 20));
|
| 839 |
l_ccols = newlabel("columns", rect(150, 150, 60, 20), AlignLeft);
|
839 |
l_ccols = newlabel("columns", rect(150, 150, 60, 20), AlignLeft);
|
| 840 |
sprintf(buf, "%d", gui->ccols);
|
840 |
snprintf(buf, 100, "%d", gui->ccols);
|
| 841 |
f_ccols = newfield(buf, rect(220, 150, 30, 20));
|
841 |
f_ccols = newfield(buf, rect(220, 150, 30, 20));
|
| 842 |
l_cx = newlabel("Initial left", rect(270, 150, 70, 20), AlignLeft);
|
842 |
l_cx = newlabel("Initial left", rect(270, 150, 70, 20), AlignLeft);
|
| 843 |
sprintf(buf, "%d", gui->cx);
|
843 |
snprintf(buf, 100, "%d", gui->cx);
|
| 844 |
f_cx = newfield(buf, rect(350, 150, 40, 20));
|
844 |
f_cx = newfield(buf, rect(350, 150, 40, 20));
|
| 845 |
l_cy = newlabel("top", rect(430, 150, 30, 20), AlignLeft);
|
845 |
l_cy = newlabel("top", rect(430, 150, 30, 20), AlignLeft);
|
| 846 |
sprintf(buf, "%d", gui->cy);
|
846 |
snprintf(buf, 100, "%d", gui->cy);
|
| 847 |
f_cy = newfield(buf, rect(480, 150, 40, 20));
|
847 |
f_cy = newfield(buf, rect(480, 150, 40, 20));
|
| 848 |
|
848 |
|
| 849 |
c_resize = newcheckbox("set options(width) on resize?",
|
849 |
c_resize = newcheckbox("set options(width) on resize?",
|
| 850 |
rect(20, 175, 200, 20), NULL);
|
850 |
rect(20, 175, 200, 20), NULL);
|
| 851 |
if(gui->setWidthOnResize) check(c_resize);
|
851 |
if(gui->setWidthOnResize) check(c_resize);
|
| 852 |
|
852 |
|
| 853 |
l_cbb = newlabel("buffer chars", rect(270, 175, 70, 20), AlignLeft);
|
853 |
l_cbb = newlabel("buffer chars", rect(270, 175, 70, 20), AlignLeft);
|
| 854 |
sprintf(buf, "%d", gui->cbb);
|
854 |
snprintf(buf, 100, "%d", gui->cbb);
|
| 855 |
f_cbb = newfield(buf, rect(350, 175, 60, 20));
|
855 |
f_cbb = newfield(buf, rect(350, 175, 60, 20));
|
| 856 |
l_cbl = newlabel("lines", rect(430, 175, 50, 20), AlignLeft);
|
856 |
l_cbl = newlabel("lines", rect(430, 175, 50, 20), AlignLeft);
|
| 857 |
sprintf(buf, "%d", gui->cbl);
|
857 |
snprintf(buf, 100, "%d", gui->cbl);
|
| 858 |
f_cbl = newfield(buf, rect(480, 175, 40, 20));
|
858 |
f_cbl = newfield(buf, rect(480, 175, 40, 20));
|
| 859 |
|
859 |
|
| 860 |
c_buff = newcheckbox("buffer console by default?",
|
860 |
c_buff = newcheckbox("buffer console by default?",
|
| 861 |
rect(20, 190, 200, 20), NULL);
|
861 |
rect(20, 190, 200, 20), NULL);
|
| 862 |
if(gui->buffered) check(c_buff);
|
862 |
if(gui->buffered) check(c_buff);
|
| Line 867... |
Line 867... |
| 867 |
f_blink = newdroplist(BlinkList, rect(350, 200, 80, 20), NULL);
|
867 |
f_blink = newdroplist(BlinkList, rect(350, 200, 80, 20), NULL);
|
| 868 |
setlistitem(f_blink, gui->cursor_blink);
|
868 |
setlistitem(f_blink, gui->cursor_blink);
|
| 869 |
|
869 |
|
| 870 |
/* Pager size */
|
870 |
/* Pager size */
|
| 871 |
l_prows = newlabel("Pager rows", rect(10, 230, 100, 20), AlignLeft);
|
871 |
l_prows = newlabel("Pager rows", rect(10, 230, 100, 20), AlignLeft);
|
| 872 |
sprintf(buf, "%d", gui->prows);
|
872 |
snprintf(buf, 100, "%d", gui->prows);
|
| 873 |
f_prows = newfield(buf, rect(110, 230, 30, 20));
|
873 |
f_prows = newfield(buf, rect(110, 230, 30, 20));
|
| 874 |
l_pcols = newlabel("columns", rect(150, 230, 60, 20), AlignLeft);
|
874 |
l_pcols = newlabel("columns", rect(150, 230, 60, 20), AlignLeft);
|
| 875 |
sprintf(buf, "%d", gui->pcols);
|
875 |
snprintf(buf, 100, "%d", gui->pcols);
|
| 876 |
f_pcols = newfield(buf, rect(220, 230, 30, 20));
|
876 |
f_pcols = newfield(buf, rect(220, 230, 30, 20));
|
| 877 |
|
877 |
|
| 878 |
/* Graphics window */
|
878 |
/* Graphics window */
|
| 879 |
l_grx = newlabel("Graphics windows: initial left",
|
879 |
l_grx = newlabel("Graphics windows: initial left",
|
| 880 |
rect(10, 270, 190, 20), AlignLeft);
|
880 |
rect(10, 270, 190, 20), AlignLeft);
|
| 881 |
sprintf(buf, "%d", gui->grx);
|
881 |
snprintf(buf, 100, "%d", gui->grx);
|
| 882 |
f_grx = newfield(buf, rect(200, 270, 40, 20));
|
882 |
f_grx = newfield(buf, rect(200, 270, 40, 20));
|
| 883 |
l_gry = newlabel("top", rect(270, 270, 30, 20), AlignLeft);
|
883 |
l_gry = newlabel("top", rect(270, 270, 30, 20), AlignLeft);
|
| 884 |
sprintf(buf, "%d", gui->gry);
|
884 |
snprintf(buf, 100, "%d", gui->gry);
|
| 885 |
f_gry = newfield(buf, rect(300, 270, 40, 20));
|
885 |
f_gry = newfield(buf, rect(300, 270, 40, 20));
|
| 886 |
|
886 |
|
| 887 |
/* Font colours */
|
887 |
/* Font colours */
|
| 888 |
l_cols = newlabel("Console and Pager Colours",
|
888 |
l_cols = newlabel("Console and Pager Colours",
|
| 889 |
rect(10, 310, 520, 20), AlignCenter);
|
889 |
rect(10, 310, 520, 20), AlignCenter);
|