The R Project SVN R

Rev

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

Rev 46784 Rev 46826
Line 291... Line 291...
291
}
291
}
292
 
292
 
293
 
293
 
294
/* console */
294
/* console */
295
 
295
 
296
rgb guiColors[numGuiColors] = { 
296
rgb guiColors[numGuiColors] = {
297
	White, Black, gaRed, /* consolebg, consolefg, consoleuser, */
297
	White, Black, gaRed, /* consolebg, consolefg, consoleuser, */
298
	White, Black, gaRed, /* pagerbg, pagerfg, pagerhighlight,  */
298
	White, Black, gaRed, /* pagerbg, pagerfg, pagerhighlight,  */
299
	White, Black, gaRed, /* dataeditbg, dataeditfg, dataedituser */
299
	White, Black, gaRed, /* dataeditbg, dataeditfg, dataedituser */
300
	White, Black         /* editorbg, editorfg                 */
300
	White, Black         /* editorbg, editorfg                 */
301
};
301
};
Line 331... Line 331...
331
    }
331
    }
332
    p->bm = NULL;
332
    p->bm = NULL;
333
    p->rows = rows;
333
    p->rows = rows;
334
    p->cols = cols;
334
    p->cols = cols;
335
    for (int i=0; i<numGuiColors; i++)
335
    for (int i=0; i<numGuiColors; i++)
336
    	p->guiColors[i] = guiColors[i];
336
	p->guiColors[i] = guiColors[i];
337
    p->f = f;
337
    p->f = f;
338
    FH = fontheight(f);
338
    FH = fontheight(f);
339
    FW = fontwidth(f);
339
    FW = fontwidth(f);
340
    WIDTH = (COLS + 1) * FW;
340
    WIDTH = (COLS + 1) * FW;
341
    HEIGHT = (ROWS + 1) * FH + 1; /* +1 avoids size problems in MDI */
341
    HEIGHT = (ROWS + 1) * FH + 1; /* +1 avoids size problems in MDI */
Line 475... Line 475...
475
    wchar_t *s, *stmp, *p0;
475
    wchar_t *s, *stmp, *p0;
476
    int   insel, len, col1, d;
476
    int   insel, len, col1, d;
477
    int   c1, c2, c3, x0, y0, x1, y1;
477
    int   c1, c2, c3, x0, y0, x1, y1;
478
    rect r;
478
    rect r;
479
    int   bg, fg, highlight, base;
479
    int   bg, fg, highlight, base;
480
    
480
 
481
    if (p->kind == CONSOLE) base = consolebg;
481
    if (p->kind == CONSOLE) base = consolebg;
482
    else if (p->kind == PAGER) base = pagerbg;
482
    else if (p->kind == PAGER) base = pagerbg;
483
    else base = dataeditbg;
483
    else base = dataeditbg;
484
    
484
 
485
    bg = p->guiColors[base];
485
    bg = p->guiColors[base];
486
    fg = p->guiColors[base+1];
486
    fg = p->guiColors[base+1];
487
    highlight = p->guiColors[base+2];
487
    highlight = p->guiColors[base+2];
488
 
488
 
489
    if ((i < 0) || (i >= NUMLINES)) return 0;
489
    if ((i < 0) || (i >= NUMLINES)) return 0;
Line 603... Line 603...
603
 
603
 
604
    ll = min(NUMLINES, ROWS);
604
    ll = min(NUMLINES, ROWS);
605
    if(!BM) return;;     /* This is a workaround for PR#1711.
605
    if(!BM) return;;     /* This is a workaround for PR#1711.
606
			    BM should never be null here */
606
			    BM should never be null here */
607
    if (p->kind == PAGER)
607
    if (p->kind == PAGER)
608
    	gfillrect(BM, p->guiColors[pagerbg], getrect(BM));
608
	gfillrect(BM, p->guiColors[pagerbg], getrect(BM));
609
    else
609
    else
610
    	gfillrect(BM, p->guiColors[consolebg], getrect(BM));
610
	gfillrect(BM, p->guiColors[consolebg], getrect(BM));
611
    if(!ll) return;;
611
    if(!ll) return;;
612
    for (i = 0; i < ll; i++) {
612
    for (i = 0; i < ll; i++) {
613
	wd = WRITELINE(NEWFV + i, i);
613
	wd = WRITELINE(NEWFV + i, i);
614
	if(wd > maxwd) maxwd = wd;
614
	if(wd > maxwd) maxwd = wd;
615
    }
615
    }
Line 660... Line 660...
660
    }
660
    }
661
    else if (ds == -1) {
661
    else if (ds == -1) {
662
	gscroll(BM, pt(0, FH), RMLINES(0, ROWS - 1));
662
	gscroll(BM, pt(0, FH), RMLINES(0, ROWS - 1));
663
	if (p->kind == PAGER)
663
	if (p->kind == PAGER)
664
	    gfillrect(BM, p->guiColors[pagerbg], RLINE(0));
664
	    gfillrect(BM, p->guiColors[pagerbg], RLINE(0));
665
	else	
665
	else
666
	    gfillrect(BM, p->guiColors[consolebg], RLINE(0));
666
	    gfillrect(BM, p->guiColors[consolebg], RLINE(0));
667
	WRITELINE(fv, 0);
667
	WRITELINE(fv, 0);
668
    }
668
    }
669
    RSHOW(getrect(c));
669
    RSHOW(getrect(c));
670
    FV = fv;
670
    FV = fv;
Line 832... Line 832...
832
	return;
832
	return;
833
    }
833
    }
834
    if (p->numkeys >= NKEYS) {
834
    if (p->numkeys >= NKEYS) {
835
	gabeep();
835
	gabeep();
836
	return;;
836
	return;;
837
     }
837
    }
838
     p->kbuf[(p->firstkey + p->numkeys) % NKEYS] = k;
838
    p->kbuf[(p->firstkey + p->numkeys) % NKEYS] = k;
839
     p->numkeys++;
839
    p->numkeys++;
840
}
840
}
841
 
841
 
842
static void storetab(control c)
842
static void storetab(control c)
843
{
843
{
844
    ConsoleData p = getdata(c);
844
    ConsoleData p = getdata(c);
Line 999... Line 999...
999
	p->needredraw = 1;
999
	p->needredraw = 1;
1000
	REDRAW;
1000
	REDRAW;
1001
    }
1001
    }
1002
    storekey(c, BEGINLINE);
1002
    storekey(c, BEGINLINE);
1003
    storekey(c, KILLRESTOFLINE);
1003
    storekey(c, KILLRESTOFLINE);
1004
    {
1004
    if(isUnicodeWindow(c)) {
1005
	size_t sz = (strlen(cmd) + 1) * sizeof(wchar_t);
1005
	size_t sz = (strlen(cmd) + 1) * sizeof(wchar_t);
1006
	wchar_t *wcs = (wchar_t *) alloca(sz);
1006
	wchar_t *wcs = (wchar_t *) alloca(sz);
1007
	memset(wcs, 0, sz);
1007
	memset(wcs, 0, sz);
1008
	mbstowcs(wcs, cmd, sz-1);
1008
	mbstowcs(wcs, cmd, sz-1);
1009
	for(i = 0; wcs[i]; i++) storekey(c, wcs[i]);
1009
	for(i = 0; wcs[i]; i++) storekey(c, wcs[i]);
-
 
1010
    } else {
-
 
1011
	const char *ch;
-
 
1012
	for (ch = cmd; *ch; ch++) storekey(c, (unsigned char) *ch);
1010
    }
1013
    }
1011
    storekey(c, '\n');
1014
    storekey(c, '\n');
1012
/* if we are editing we save the actual line */
1015
/* if we are editing we save the actual line
-
 
1016
   FIXME: not right if Unicode */
1013
    if (p->r > -1) {
1017
    if (p->r > -1) {
1014
	char buf[2000], *cp; /* maximum 2 bytes/char */
1018
	char buf[2000], *cp; /* maximum 2 bytes/char */
1015
	wchar_t *wc = &(p->lbuf->s[p->lbuf->ns - 1][prompt_len]);
1019
	wchar_t *wc = &(p->lbuf->s[p->lbuf->ns - 1][prompt_len]);
1016
	memset(buf, 0, 2000);
1020
	memset(buf, 0, 2000);
1017
	wcstombs(buf, wc, 1000);
1021
	wcstombs(buf, wc, 1000);
Line 1930... Line 1934...
1930
    consoler = rows;
1934
    consoler = rows;
1931
    consolec = cols;
1935
    consolec = cols;
1932
    consolex = consx;
1936
    consolex = consx;
1933
    consoley = consy;
1937
    consoley = consy;
1934
    for (int i=0; i<numGuiColors; i++)
1938
    for (int i=0; i<numGuiColors; i++)
1935
    	guiColors[i] = nguiColors[i];
1939
	guiColors[i] = nguiColors[i];
1936
    pagerrow = pgr;
1940
    pagerrow = pgr;
1937
    pagercol = pgc;
1941
    pagercol = pgc;
1938
    pagerMultiple = multiplewindows;
1942
    pagerMultiple = multiplewindows;
1939
    setWidthOnResize = widthonresize;
1943
    setWidthOnResize = widthonresize;
1940
    consolebufb = bufbytes;
1944
    consolebufb = bufbytes;