[Rd] Windows menu entries

Duncan Murdoch murdoch@stats.uwo.ca
Thu, 06 Dec 2001 10:13:09 -0500


The convention in Windows menus is that items which do something are
listed plain, and items that lead to dialogs (to which you're expected
to give input, and from which you're allowed to back out without doing
anything) are listed with dots after the name.  The Rgui menu never
uses dots.

As far as I know, in Windows the dots aren't generally used in the
popup help hints on toolbars.

I think the following is what they should look like, to follow the
dots convention:

 File
	Source R code...
	Display file...
	Load Workspace...
	Save Workspace...
	Load History...
	Save History...
	Change dir...
	Print...
	Save to File...
	Exit
 Edit
	Copy
	Paste
	Copy and paste
	Select all
	Clear console
	GUI preferences
 Misc
	Stop current computation
	Buffered output
	List objects
	Remove all objects
	List search path
 Packages
	Load package...
	Install package from CRAN...
	Install package from local zip file...
	Update packages from CRAN
 Help
	Console
	FAQ on R
	FAQ on R for Windows
	R language (standard)...
	R language (HTML)
	Manuals
		An introduction to R
		R reference manual
		R data import/export
		R language manual
		Writing R extensions
	Apropos...
	About				

(I haven't got the correct case on lots of words above; the menus are
inconsistent about that, and I typed in a hurry.)

The menus are set up in the setupui() function in rui.c.  The block of
code below implements these changes.	

    MCHECK(newmenu("File"));
    MCHECK(msource = newmenuitem("Source R code...", 0, menusource));
    MCHECK(mdisplay = newmenuitem("Display file...", 0, menudisplay));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mload = newmenuitem("Load Workspace...", 0,
menuloadimage));
    MCHECK(msave = newmenuitem("Save Workspace...", 0,
menusaveimage));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mloadhistory = newmenuitem("Load History...", 0,
menuloadhistory));
    MCHECK(msavehistory = newmenuitem("Save History...", 0,
menusavehistory));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(newmenuitem("Change dir...", 0, menuchangedir));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(newmenuitem("Print...", 0, menuprint));
    MCHECK(newmenuitem("Save to File...", 0, menusavefile));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(newmenuitem("Exit", 0, menuexit));

    MCHECK(newmenu("Edit"));
    MCHECK(mcopy = newmenuitem("Copy", 'C', menucopy));
    MCHECK(mpaste = newmenuitem("Paste", 'V', menupaste));
    MCHECK(mcopypaste = newmenuitem("Copy and Paste", 'X',
menucopypaste));
    MCHECK(newmenuitem("Select all", 0, menuselectall));
    MCHECK(newmenuitem("Clear console", 'L', menuclear));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mconfig = newmenuitem("GUI preferences...", 0,
menuconfig));

    MCHECK(newmenu("Misc"));
    MCHECK(newmenuitem("Stop current computation           \tESC", 0,
menukill));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mlazy = newmenuitem("Buffered output", 'W', menulazy));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mls = newmenuitem("List objects", 0, menuls));
    MCHECK(mrm = newmenuitem("Remove all objects", 0, menurm));
    MCHECK(msearch = newmenuitem("List &search path", 0, menusearch));

    MCHECK(newmenu("Packages"));
    MCHECK(mpkgl = newmenuitem("Load package...", 0, menupkgload));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mpkgi = newmenuitem("Install package from CRAN...", 0, 
			       menupkginstallcran));
    MCHECK(mpkgil = newmenuitem("Install package from local zip
file...", 0, 
				menupkginstalllocal));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mpkgu = newmenuitem("Update packages from CRAN", 0, 
			       menupkgupdate));
#ifdef USE_MDI
    newmdimenu();
#endif
    MCHECK(m = newmenu("Help"));
    MCHECK(newmenuitem("Console", 0, menuconsolehelp));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mFAQ = newmenuitem("FAQ on R", 0, menuFAQ));
    if (!check_doc_file("doc/html/faq.html")) disable(mFAQ);
    MCHECK(mrwFAQ = newmenuitem("FAQ on R for &Windows", 0,
menurwFAQ));
    if (!check_doc_file("doc/html/rw-faq.html")) disable(mrwFAQ);
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mhelp = newmenuitem("R language (standard)...", 0,
menuhelp));
    MCHECK(mhelpstart = newmenuitem("R language (&html)", 0,
menuhelpstart));
    if (!check_doc_file("doc/html/rwin.html")) disable(mhelpstart);
    MCHECK(mman = newsubmenu(m, "Manuals"));
    MCHECK(mmanintro = newmenuitem("An &Introduction to R", 0,
menumainman));
    lmanintro = check_doc_file("doc/manual/R-intro.pdf");
    if (!lmanintro) disable(mmanintro);
    MCHECK(mmanref = newmenuitem("R &Reference Manual", 0,
menumainref));
    lmanref = check_doc_file("doc/manual/refman.pdf");
    if (!lmanref) disable(mmanref);
    MCHECK(mmandata = newmenuitem("R Data Import/Export", 0,
menumaindata));
    lmandata = check_doc_file("doc/manual/R-data.pdf");
    if (!lmandata) disable(mmandata);
    MCHECK(mmanlang = newmenuitem("R Language Manual", 0,
menumainlang));
    lmanlang = check_doc_file("doc/manual/R-lang.pdf");
    if (!lmanlang) disable(mmanlang);
    MCHECK(mmanext = newmenuitem("Writing R Extensions", 0,
menumainext));
    lmanext = check_doc_file("doc/manual/R-exts.pdf");
    if (!lmanext) disable(mmanext);
    if (!lmanintro && !lmanref && !lmanlang && !lmanext)
disable(mman);
    addto(m);

    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(mapropos = newmenuitem("Apropos...", 0, menuapropos));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(newmenuitem("About", 0, menuabout));


The Graphics window menu items should be similarly edited:

 File
	Save as
		Metafile...
		Postscript...
		PDF...
		Png...
		Bmp...
		Jpeg
			50% quality...
			75% quality...
			100% quality...
	Copy to the clipboard
		as a Bitmap
		as a Metafile
	Print...
	close Device
 History
	Recording
	Add
	Replace
	Previous
	Next
	Save to variable...
	Get from variable...
	Clear History
 Resize
	R mode
	Fit to window
	Fixed size

And the popup:
	Copy as metafile
	Copy as bitmap
	Save as metafile...
	Save as postscript...
	Print...

These are in devga.c; here are the changes above:	
	
    MCHECK(m = newmenu("File"));
    MCHECK(xd->msubsave = newsubmenu(m, "Save as"));
    MCHECK(xd->mwm = newmenuitem("Metafile...", 0, menuwm));
    MCHECK(xd->mps = newmenuitem("Postscript...", 0, menups));
    MCHECK(xd->mpdf = newmenuitem("PDF...", 0, menupdf));
    MCHECK(xd->mpng = newmenuitem("Png...", 0, menufilebitmap));
    MCHECK(xd->mbmp = newmenuitem("Bmp...", 0, menufilebitmap));
    MCHECK(newsubmenu(xd->msubsave,"Jpeg"));
    MCHECK(xd->mjpeg50 = newmenuitem("50% quality...", 0,
menufilebitmap));
    MCHECK(xd->mjpeg75 = newmenuitem("75% quality...", 0,
menufilebitmap));
    MCHECK(xd->mjpeg100 = newmenuitem("100% quality...", 0,
menufilebitmap));
    MCHECK(newsubmenu(m, "Copy to the clipboard"));
    MCHECK(xd->mclpbm = newmenuitem("as a Bitmap\tCTRL+C", 0,
menuclpbm));
    MCHECK(xd->mclpwm = newmenuitem("as a Metafile\tCTRL+W", 0,
menuclpwm));
    addto(m);
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(xd->mprint = newmenuitem("Print...\tCTRL+P", 0,
menuprint));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(xd->mclose = newmenuitem("close Device", 0, menuclose));
#ifdef PLOTHISTORY
    MCHECK(newmenu("History"));
    MCHECK(xd->mrec = newmenuitem("Recording", 0, menurec));
    if(recording) check(xd->mrec);
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(xd->madd = newmenuitem("Add\tINS", 0, menuadd));
    MCHECK(xd->mreplace = newmenuitem("Replace", 0, menureplace));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(xd->mprev = newmenuitem("Previous\tPgUp", 0, menuprev));
    MCHECK(xd->mnext = newmenuitem("Next\tPgDown", 0, menunext));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(xd->msvar = newmenuitem("Save to variable...", 0,
menusvar));
    MCHECK(xd->mgvar = newmenuitem("Get from variable...", 0,
menugvar));
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(xd->mclear = newmenuitem("Clear history", 0, menuclear));
#endif
    MCHECK(newmenu("Resize"));
    MCHECK(xd->mR = newmenuitem("R mode", 0, menuR));
    if(resize == 1) check(xd->mR);
    MCHECK(xd->mfit = newmenuitem("Fit to window", 0, menufit));
    if(resize == 2) check(xd->mfit);
    MCHECK(xd->mfix = newmenuitem("Fixed size", 0, menufix));
    if(resize == 3) check(xd->mfix);
    newmdimenu();

    /* Normal popup */
    MCHECK(xd->grpopup = newpopup(NULL));
    MCHECK(m = newmenuitem("Copy as metafile", 0, menuclpwm));
    setdata(m, (void *) dd);
    MCHECK(m = newmenuitem("Copy as bitmap", 0, menuclpbm));
    setdata(m, (void *) dd);
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(m = newmenuitem("Save as metafile...", 0, menuwm));
    setdata(m, (void *) dd);
    MCHECK(m = newmenuitem("Save as postscript...", 0, menups));
    setdata(m, (void *) dd);
    MCHECK(newmenuitem("-", 0, NULL));
    MCHECK(m = newmenuitem("Print...", 0, menuprint));
    setdata(m, (void *) dd);
    gchangepopup(xd->gawin, xd->grpopup);


In the help pager:

 File
	Print...
	Save to File...
	Close
 Edit
	Copy
	Paste to console
	Select all

with source from pager.c:
	
    MCHECK(newmenu("File"));
    MCHECK(m = newmenuitem("Print...", 0, pagerprint));
    setdata(m, c);
    MCHECK(m = newmenuitem("Save to File...", 0, pagersavefile));
    setdata(m, c);
    MCHECK(m = newmenuitem("-", 0, NULL));
    MCHECK(m = newmenuitem("Close", 0, pagerclose));
    setdata(m, c);
    MCHECK(newmenu("Edit"));
    MCHECK(p->mcopy = newmenuitem("Copy", 'C', pagercopy));
    setdata(p->mcopy, c);
    MCHECK(p->mpaste = newmenuitem("Paste to console", 'V',
pagerpaste));
    setdata(p->mpaste, c);
    MCHECK(m = newmenuitem("Select all", 0, pagerselectall));



The data entry editor also has a menu, but I don't see any problems
there.  
I think those are all the menus!

One other comment about the menus:

There should be an Edit menu entry to invoke the data.editor.  I
didn't even know the data editor existed, until I went searching for
menus.

Duncan
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._