@@@ R default menu

menupos= 0 0

item=SciViews R
cmd=NULL

separator

submenu=File
	
	item=_Source R code...
	cmd=sh -c 'Rfile=`zenity --file-selection --title="Select file to source" --file-filter="R files (*.R) | *.R *.r" --file-filter="S files (*.q, *.ssc, *.S) | *.q *.ssc *.S" --file-filter="All files (*.*) | *.*"` && xvkbd -text "source(\""$Rfile"\")\r"'
	
	item=_New script
	cmd=gedit # Should be nice to set syntax highlighting to R directly, but how?
	
	item=_Open script...
	cmd=sh -c 'Rfile=`zenity --file-selection --title="Open script" --file-filter="R files (*.R) | *.R *.r"  --file-filter="S files (*.q, *.ssc, *.S) | *.q *.ssc *.S" --file-filter="All files (*.*) | *.*"` && gedit "$Rfile"'
	
	item=_Display file...
	cmd=sh -c 'File=`zenity --file-selection --title="Select a file"` && zenity --text-info --title="R Pager - $File" --filename="$File" --width=500 --height=500 --ok-label=" Close " --cancel-label="   "'
	@@@ We should use R pager instead: file.show("$File", header="$File", title= "")

	separator
	
	item=_Load Workspace...
	cmd=sh -c 'Rfile=`zenity --file-selection --title="Select image to load" --file-filter="R images (*.RData) | *.RData *.Rdata" --file-filter="R image - old extension (*.rda) | *.rda" --file-filter="All files (*.*) | *.*" filename=".RData"` && xvkbd -text "load(\""$Rfile"\")\r"'
	
	item=_Save Workspace...
	cmd=sh -c 'File=`zenity --file-selection --title="Save image in" --save --confirm-overwrite --file-filter="R images (*.RData) | *.RData *.Rdata" --file-filter="All files (*.*) | *.*" --filename=".RData"` && xvkbd -text "save.image(\"$File\")\r"'
	
	separator
	
	item=_Load History...
	cmd=sh -c 'Rfile=`zenity --file-selection --title="Select history to load" --file-filter="All files (*.*) | *.*" --filename=".Rhistory"` && xvkbd -text "loadhistory(\""$Rfile"\")\r"'
	
	item=_Save History...
	cmd=sh -c 'File=`zenity --file-selection --title="Save history in" --save --confirm-overwrite --file-filter="All files (*.*) | *.*" --filename=".Rhistory"` && xvkbd -text "savehistory(\"$File\")\r"'
	
	separator
	
	item=_Change dir...
	cmd=sh -c 'File=`zenity --file-selection --title="Change working dir to" --directory` && xvkbd -text ".odir <- setwd(\"$File\")\r"'
	
	separator
	
	item=_Print...
	cmd=NULL
	
	item=_Save to File...
	cmd=NULL @@@ lastsave.txt - Text file (*.txt)
	
	separator
	
	item=_Exit
	cmd=sh -c 'zenity --question --title="Exit SciViews R" --text="Are you sure?" --ok-label=OK --cancel-label=Cancel && (zenity --question --title="Exit SciViews R" --text="Save workspace image?" && xvkbd -text "q(\"yes\")\r" || xvkbd -text "q(\"no\")\r")'

submenu=_Edit

	item=Copy
	cmd=xvkbd -text "\CC" @@@ Default shortcut in gnome-terminal is Ctrl-Shift-C
	@@@ Note: this will not work if shortcut is changed!
	
	item=Paste
	cmd=xvkbd -text "\CV" @@@ Default shortcut in gnome-terminal is Ctrl-Shift-V
	@@@ Note: this will not work if shortcut is changed!
	
	item=Paste commands only
	cmd=NULL
	
	item=Copy and Paste
	cmd=xvkbd -text "\CC\CV" @@@ Same note as for copy / paste
	
	item=Select all
	cmd=NULL
	
	item=Clear console
	cmd=xvkbd -text "system(\"clear\") # Or menu Terminal -> Reset and clear\r"
	@@@ Clear the console, but does not reset its content per se.
	@@@ Use gnome-terminal menu entry Terminal -> Reset and Clear 
	
	separator
	
	item=Data editor...
	cmd=sh -c 'Data=`zenity --entry --title="R data editor" --text="Name of a data frame or matrix"` && xvkbd -text "fix($Data)\r"'
	
submenu=_Misc
	
	item=Stop current computation
	cmd=xvkbd -text "\Cc"
	
	item=Stop all computations
	cmd=NULL
	
	separator
	
	item=List objects
	cmd=xvkbd -text "ls()\r"
	
	item=Remove all objects
	cmd=sh -c 'zenity --question --title="Remove all objects" --text="Are you sure?" && xvkbd -text "rm(list = ls(all = TRUE))\r"'
	
	item=List search path
	cmd=xvkbd -text "search()\r"
	
submenu=_Packages
	
	item=Load package...
	cmd=xvkbd -text "local({pkg <- select.list(sort(.packages(all.available = TRUE)), graphics = TRUE)\r    if (nchar(pkg)) library(pkg, character.only = TRUE)})\r"
	
	separator
	
	item=Set CRAN mirror...
	cmd=xvkbd -text "chooseCRANmirror()\r"
	
	item=Select repositories...
	cmd=xvkbd -text "setRepositories()\r"
	
	item=Install package(s)...
	cmd=xvkbd -text "local({pkg <- select.list(rownames(available.packages()), graphics = TRUE, multiple = TRUE, title = \"Install package(s)\")\r    if (nchar(pkg[1])) install.packages(pkg)})\r"
	
	item=Update packages...
	cmd=xvkbd -text "update.packages(ask = 'graphics', checkBuild = TRUE)\r"
	
	separator
	
	item=Install package from local file...
	cmd=sh -c 'Rpackages=`zenity --file-selection --title="Select one R package" --file-filter="R package source (*.tar.gz) | *.tar.gz" file-filter="All files (*.*) | *.*"` && xvkbd -text "install.packages(\""$Rpackages"\", repos = NULL)\r"'
	
submenu=_Windows
	
	item=New graph
	cmd=xvkbd -text "dev.new()\r"
	
	item=Activate next graph
	cmd=xvkbd -text "dev.set()\r"
	
	item=Close all graphs
	cmd=xvkbd -text "graphics.off()\r"
	
submenu=_Help
	
	item=Console
	cmd=xvkbd -text "\[F1]"
	
	separator
	
	item=FAQ on R
	cmd=R -e 'utils::RShowDoc("R-FAQ")'
	
	submenu=_Manuals (in PDF)
		
		item=An introduction to R
		cmd=R -e 'utils::RShowDoc("R-intro")'
		
		item=R Reference Manual
		cmd=R -e 'system2(getOption("pdfviewer"), shQuote(file.path(R.home("doc"), "manual", "refman.pdf")), wait = FALSE)'
		
		item=R Data Import/Export
		cmd=R -e 'utils::RShowDoc("R-data")'
		
		item=R Language Definition
		cmd=R -e 'utils::RShowDoc("R-lang")'
		
		item=Writing R Extensions
		cmd=R -e 'utils::RShowDoc("R-exts")'
		
		item=R Internals
		cmd=R -e 'utils::RShowDoc("R-ints")'
		
		item=R Installation and Administration
		cmd=R -e 'utils::RShowDoc("R-admin")'
		
		item=Sweave User
		cmd=R -e 'system2(getOption("pdfviewer"), shQuote(system.file("doc", "Sweave.pdf", package = "utils")), wait = FALSE)'
		
	separator
	
	item=R functions (text)...
	cmd=sh -c 'Topic=`zenity --entry --title="R help" --text="Show help for"` && xvkbd -text "help(\"$Topic\")\r"'
	
	item=Html help
	cmd=xvkbd -text "help.start()\r"
	
	item=Search help...
	cmd=sh -c 'Topic=`zenity --entry --title="Search help" --text="Expression to search for"` && xvkbd -text "help.search(\"$Topic\")\r"'
	
	item=search.r-project.org...
	cmd=sh -c 'Topic=`zenity --entry --title="R Site Search" --text="Search for words in help list archives and documentation"` && xvkbd -text "RSiteSearch(\"$Topic\")\r"'
	
	separator
	
	item=Apropos...
	cmd=sh -c 'Topic=`zenity --entry --title="Apropos" --text="Expression to search for"` && xvkbd -text "apropos(\"$Topic\")\r"'
	
	separator
	
	item=R project home page
	cmd=firefox -new-window 'http://www.r-project.org'  @@@ Should use browser set in R!
	
	item=CRAN home page
	cmd=firefox -new-window 'http://cran.r-project.org'  @@@ Should use browser set in R! 
	
	separator
	
	item=About
	cmd=sh -c 'Rversion=`R --version`; zenity --info --title="About R" --text="$Rversion\n\nSciViews R extension using svDialogs." --timeout=10'
	

@@@ Graph device menu...
@@@submenu=_File
@@@
@@@	submenu=_Save as
@@@
@@@		item=Metafile...
@@@		cmd=NULL
@@@
@@@		item=Postscript...
@@@		cmd=NULL
@@@
@@@		item=PDF...
@@@		cmd=NULL
@@@
@@@		item=Png...
@@@		cmd=NULL
@@@
@@@		item=Bmp...
@@@		cmd=NULL
@@@
@@@		item=TIFF...
@@@		cmd=NULL
@@@
@@@		submenu=_Jpeg
@@@
@@@			item=50% quality...
@@@			cmd=NULL
@@@
@@@			item=75% quality...
@@@			cmd=NULL
@@@
@@@			item=100% quality...
@@@			cmd=NULL
@@@
@@@	submenu=_Copy to the clipboard
@@@
@@@		item=as a Bitmap
@@@		cmd=NULL
@@@
@@@		item=as a Metafile
@@@		cmd=NULL
@@@
@@@	separator
@@@
@@@	item=Print...
@@@	cmd=NULL
@@@
@@@	separator
@@@
@@@	item=close Device
@@@	cmd=NULL
@@@
@@@submenu=_History
@@@
@@@	item=Recording
@@@	cmd=NULL
@@@
@@@	separator
@@@
@@@	item=Add
@@@	cmd=NULL
@@@
@@@	item=Replace
@@@	cmd=NULL
@@@
@@@	separator
@@@
@@@	item=Previous
@@@	cmd=NULL
@@@
@@@	item=Next
@@@	cmd=NULL
@@@
@@@	separator
@@@
@@@	item=Save to variable...
@@@	cmd=NULL
@@@
@@@	item=Get from variable...
@@@	cmd=NULL
@@@
@@@	separator
@@@
@@@	item=Clear history
@@@	cmd=NULL
@@@
@@@submenu=_Resize
@@@
@@@	item=R mode
@@@	cmd=NULL
@@@
@@@	item=Fit to window
@@@	cmd=NULL
@@@
@@@	item=Fixed size
@@@	cmd=NULL
@@@
@@@context menu:
@@@item=Copy as metafile
@@@cmd=NULL
@@@
@@@item=Copy as bitmap
@@@cmd=NULL
@@@
@@@separator
@@@
@@@item=Save as metafile...
@@@cmd=NULL
@@@
@@@item=Save as postscript...
@@@cmd=NULL
@@@
@@@separator
@@@
@@@item=Stay on top
@@@cmd=NULL
@@@
@@@separator
@@@
@@@item=Print...
@@@cmd=NULL
	
