METAGRAF is an application to create MetaPost files in a simple, straight forward and quickly way without the need to write by hand the different steps of the drawing, as was necessary before. It is a must for some people that need the exceptional quality of metapost but don't have the time to create by hand all their drawings, as myself. Inasmuch MG gives some new capabilities to MP making use of facilities outside MetaPost scope but available for other programming languages, in particular Java. Nevertheless, it must be emphasized the fact that MG will never subtitute MP as a whole. For very special drawings, the need to "write by hand" will be always maintained. And, what is more important, many people find a special joy in doing that. (MG has not been created to distroy any kind of human joys).
Having stated the goal of MG it is time now to know how the final drawings, the files with the drawings at medium or final state, are manipulated: saved, named, recovered...etc. This chapter is about all that.
As MG is NOT a WYSIWYG graphical editor, (althought it could be, always with some differences to the final "product"), the usual way of working with it is using quite frequently the "GV"/"GHOSTVIEW" application. And this is so to see the aspect of the "real" drawing at any stage. (Having been written in Linux, the use of "gv" is extremely simple and very quick. Sometimes, testing MG in Win* it has been remarked a not so quick launching of ghostview. This problem is out of our scope and it would be a nice service if "someone" could improve that). As, by the time, MG has not an "undo" capability, the system used is to save the drawing everytime the ghostview application is called. In this way, there will be enough stages of the drawing saved to recover it if something wrong has been done after one of the savings.
When a drawing is saved in MG, it is "totally" saved and so, it can be "totally" recovered. The way that all that works is as follows:
- The tree of directories created when installing METAGRAF is very simple: A principal one where it is included the "launcher" called MG, that has the name "metagraf". Inside "metagraf" there are some other directories. For our present interest, there are two of special interest: One called "files" and another called "scripts".
- When "gv" is invoqued (the small-ghost-button is clicked), two effects are produced. One of those is the launching of ghostview screen where the up-to-the-moment drawing can be seen. The other is the saving of the metapost and java files corresponding to this drawing and this is saved in directory "files". The name of those files will always be "graf_(number).mp" and the same with extension "bmg". The first correspond to the metapost file. The second to the java file. The (number) will be some number corresponding to the number of times that ghostview has been invoqued.
- The metapost file is just the transcription of the drawing to MP language and its graphical translation is what is shown in ghostview screen. The java file is the metagraf file that can be recovered at any moment.
- There are two ways of recovering a drawing. The first one is "pasting" the drawing with what is already in screen. This is usefull for create a macro-library that can be used at any time. The second way of recovering an image is by "substituting" what is in the screen by the imported file. This is used when some mistake has been done after the (usually) last saving.
- Recovering a file and pasting or substituting it with the actual drawing is done as follows:
- Click the "open-file" button (besides the "diskette-save" one). A file-chooser will appear open in the directory "files". If our drawing to be pasted is inside this directory (as it must), clicking on its name and then the OK button will put the drawing on the screen in exactly the same position as it was when saved. (To group the whole drawing before saving is a good habit. Just clicking on the top, red-border button).
- If the file is in another directory the only difference is to "go" to this directory with the file-chooser, select the file and click OK.
- When the goal is tu substitue, not to paste, the only difference is that before clicking the "open" button, the CTRL-key must be pressed. The rest is exactly the same.
- One point to remark is that when closing METAGRAF using the "exit" button, all the files in the directory "files" and with the name "graf*" will be erased. (So, BEWARE!). Not so with files with other names, as "files" is the right place to save the eventual macros. In short, if the session is closed with the exit button, MG "guess" that the files created along the session are not needed anymore and delete them. If for some reason it is preferred to maintain those files, MG can be closed closing the principal window. In that case, everything will be maintained untouched in directory "files", but if another session begun, the existing graf_1.* , graf_2.* ...etc., files will be overwritten when the ghost button is clicked.
- Once the drawing is finished it must be saved with the name wanted in the directory chosen. For doing that, the "save" button must be clicked and the file chooser will open in our home directory.
- If for some reason, this last step is forgotten and MG closed, don't panic. There is always a copy of the last metapost file in the "scripts" directory under the name "graf.mp" and another of the same file after compilation trough mpost in the same directory with the name "graf.1", ready to be included in any latex file (using " \includegraphics{graf.1}" for example.) Those files will be overwritten in next session with MG.
Before the end of the chapter, some remarks must be done in relation with the launching of ghostview/gv and the button "GV-PS" at right. Clicking this button the small window below will show alternatively "gv-tex" or "gv-ps". The former, default one, means that the metapost file will be processed trough "mpost" and then trough "latex", "dvips" and shown the resulting "ps". It is the right position if some text is included in the drawing. Otherwise, the position "gv-ps" is preferred as in this case the file is processed only trough "mpost" and the drawing will be in the same position as in the screen