~ubuntu-branches/ubuntu/hardy/texmacs/hardy

« back to all changes in this revision

Viewing changes to plugins/r/r/TeXmacs/R/TeXmacs

  • Committer: Bazaar Package Importer
  • Author(s): Ralf Treinen
  • Date: 2004-04-19 20:34:00 UTC
  • Revision ID: james.westby@ubuntu.com-20040419203400-g4e34ih0315wcn8v
Tags: upstream-1.0.3-R2
ImportĀ upstreamĀ versionĀ 1.0.3-R2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.First.lib<-function(dir,package)
 
2
  {
 
3
    options(pager="cat")
 
4
    ps.options(pointsize=10)
 
5
  }
 
6
"end.view" <-
 
7
function()
 
8
  {
 
9
    dev.off()
 
10
    op <- options("texmacs")$texmacs
 
11
    op$nox11 <- F
 
12
    options(texmacs=op)
 
13
    unlink(op$file)
 
14
  }
 
15
"linev" <-
 
16
function(...) {
 
17
  line(...);v()
 
18
}
 
19
"plotv" <-
 
20
function(...) {
 
21
  plot(...);v()
 
22
}
 
23
"pointsv" <-
 
24
function(...) {
 
25
  points(...);v()
 
26
}
 
27
"start.view" <-
 
28
function(width=0,height=0,file=0,...){
 
29
  op <- options("texmacs")$texmacs
 
30
  if( length(op) <= 1 ) {
 
31
    op <- list()
 
32
    if( width > 0 ) {
 
33
      op$width <- width
 
34
    } else {
 
35
      op$width <-  4
 
36
    }
 
37
    if( height > 0 ) {
 
38
      op$height <- height
 
39
    } else {
 
40
      op$height <-  4
 
41
    }
 
42
    if( file==0) {
 
43
      op$file <-tempfile("postscript")
 
44
    } else {
 
45
      op$file <-  file
 
46
      
 
47
    }
 
48
    cat(op$file)
 
49
  }
 
50
  op$nox11 <- T
 
51
  postscript(file=op$file,one=F,horiz=F,width=op$width,height=op$height,...)
 
52
  options(texmacs=op)
 
53
}
 
54
"v" <-
 
55
function(width=F,height=F,...) {
 
56
  op <- options("texmacs")$texmacs
 
57
  got.par=T
 
58
  if( width== F ) { width=4;height=4;got.par=F }
 
59
  if( length(op) <= 1 ) {
 
60
    op <- list()
 
61
    op$width <- 4
 
62
    op$height <- 4
 
63
    op$nox11 <- F
 
64
  } else {
 
65
    if( !got.par ) {
 
66
      width = op$width
 
67
      height = op$height
 
68
    }
 
69
  }
 
70
  if( op$nox11 ) {
 
71
    dev.off()
 
72
    cat("\2ps:") ;
 
73
    system(paste("cat",op$file))
 
74
    cat("\5\n")
 
75
    postscript(file=op$file,one=F,horiz=F,width=width,height=height,...)
 
76
  } else {
 
77
    x<-recordPlot()
 
78
    op$file<-tempfile("postscript")
 
79
    postscript(command="echo",file=op$file,one=F,print.it=F,horiz=F,width=width,height=height,...) 
 
80
    replayPlot(x)
 
81
    dev.off()
 
82
    cat("\2ps:") ;
 
83
    system(paste("cat",op$file))
 
84
    cat("\5\n")
 
85
    unlink(op$file)
 
86
  }
 
87
  options(texmacs=op)
 
88
}