\documentstyle[12pt, psfig, epsfig]{article}
%\renewcommand{\baselinestretch}{2.0}


\input epsf
\input psfig.tex
\title{}
\author{}
\thispagestyle{empty}
\begin{document}
\pagestyle{empty}
\thispagestyle{empty}

\listoffigures
\maketitle
\newpage

Picture drawing software comes in two different varieties:

\begin{itemize}
	\item	batch, such as {\bf Pic}, and

	\item	WYSIWYG (What You See Is What You Get) direct manipulation,
		such as {\it xfig}, {\it MSdraw}, {\it MacDraw}, etc.

\end{itemize}

\noindent The advantages of batch drawing software are:  
\begin{itemize}
   \item  The user can insert or delete an element or change its size or location without destroying the entire picture.
   \item It is easier to manipulate large groups of elements treated as a unit.
\end{itemize}

\noindent The disadvantages of batch drawing software are:
\begin{itemize}
   \item The user cannot see the picture as it is being composed, and because of it he/she could have problems with proportions, sizes, text string lengths, etc.
   \item It is easier to make an error.
\end{itemize}

\noindent The advantages of WYSIWYG, direct-manipulation drawing software are:
\begin{itemize}
  \item  The user can see  the whole  picture. 
  \item It is easier to make decisions about such matters as exact types of elements (for example {\bf box} or {\bf circle}), element sizes, positions of text string, etc., and to avoid  obvious errors.
\end{itemize}

\noindent The disadvantages of WYSIWYG, direct-manipulation drawing software are:
\begin{itemize}
  \item A change of one element can destroy an entire picture.
  \item It is not comfortable to manipulate  large groups of elements, for example changing the default size for all {\bf boxes} or changing the direction of elements in the picture. 
\end{itemize}
   \newline

We want to get the best of both worlds in the form of a combination batch,
WYSIWYG, direct-manipulation drawing program, called  WD-pic ({\bf W}YSIWYG, {\bf D}irect-manipulation {\bf Pic} drawing program), an
enhancement of the well-known batch {\bf Pic} program that works with the
same {\bf Pic} language. The internal representation of any picture is an
editable {\bf Pic} language description of the picture of the style that a human would enter. \newline

WD-pic is a UNIX system line drawing program. It is intended chiefly for
technical document illustration, such as flow charts, state diagrams and so on.
Pictures, interactively created by WD-pic can be saved as batch {\bf Pic} program,
and batch {\bf Pic} programs can be displayed and edited interactively with the help of
WD-pic.
In WYSIWYG drawing software, which is used in Graphical User Interface (GUI)
environments it is possible to make all screen drawing with the help of the mouse
and to use keyboard input to insert text. Each action with the mouse or keyboard is
called an event.
 The principal execution steps in WD-pic in going from a GUI event to the picture on the screen are shown in Fig 1. 
 \begin{enumerate}
   \item  WD-pic gives to each kind of event, invoked by the user interface, a unique number,  called a token.
   \item The {\bf Pic} interpreter belonging to  WD-pic transforms  the unique number
 into drawing data structures and simultaneously into an internal representation in the the {\bf Pic}
 language. \newline

      When the {\bf Pic} compiler translates {\bf Pic} text
into TROFF format it creates data structures,
for producing  text in TROFF format.  When we run the {\bf Pic}
compiler on  {\bf Pic} text, created by  WD-pic, we get drawing data structures. These data structures are equivalent to the drawing data 
structures created by  WD-pic itself.

\begin{figure}
%\epsfbox{PicPicture/Design.ps}
\epsffile[0 0 500 250]{PicPicture/Design.ps}
\caption{Principal execution steps in WD-pic from GUI event to the picture}
\label{Fig. 1}
\end{figure}

   \item  The drawing data structures are used for  drawing  the picture on the screen. 
  Of course, this picture is the same as the picture created by {\bf Pic}, TROFF, etc. given as input the {\bf Pic} text produced by  WD-pic.
\end{enumerate} 
\newline \newline
     There are two ways to create a picture and its representation
in the WD-pic:
\begin{itemize}
 \item Using the WYSIWYG graphic interface to draw the picture.
 \item Writing a textual description of the picture in the {\bf Pic} language.
\end{itemize}
  From the user's point of view, these two ways are equivalent in the final effect. 
\begin{enumerate}
  \item When the user draws a picture on a screen using the graphic interface, he/she simultaneously creates the picture's internal representation in the
{\bf Pic} language. This internal representation not only saves the  geometric and drawing characteristics of a picture's elements, such as coordinates of center, sizes, line style, etc., but also the relationship between elements. 
The graphic interface
allows  placing one element relative to another, specifying the size of one element relative to that of another, etc.  

  \item When the user changes the {\bf Pic} file corresponding to a picture  with the help
of a text editor, he/she immediately sees a changed picture
on the screen. After that the user can continue to work with the picture
using the graphic interface. The WD-pic interface allows  passing freely from WYSIWYG picture drawing to editing of the internal representation and vice versa
\end{enumerate}

 At any given time
the picture on the screen is the same as the picture created via {\bf Pic}, TROFF, etc. with accumulated internal representation as input. For each picture
element all its parameters, for example size, line style, etc., can be
defined explicitly with the help of the WD-pic interface. If a parameter
is not defined then it is assigned the corresponding {\bf Pic} default value.
Each new element is placed always at the current insertion point, which
is by default the end point of the last element. WD-pic allows  placing the element in any place in a picture, using explicit instruction, that redefine the current insertion point while describing a new element. Simultaneously, the description of
this element in  {\bf Pic} format is added to the current insertion point in the internal representation.  The current insertion point has a visual manifestation as well as being the place in the internal representation after which the new token go. At any time this accumulated internal representation (AIR) can be converted into a {\bf Pic} file by adding  special symbols to the beginning and to the end. After the insertion of a new element, 
the picture displayed on the screen is the same as that generated on paper by 
submitting the AIR to {\bf Pic} piped to TROFF, with the geographic center of the two pictures being the same. 
 \newline 


 It is convenient for our purposes to divide the main elements of the {\bf Pic} 
language into  five groups:
\begin{itemize}
 \item {\bf Pic} tokens. 
 \item Drawing directions, parameters, that influence the rest of the picture. There are four such parameters.
 \item  Element parameters, some of them can be united into groups. 
 \item Default values: 
 \item Operators. 
\end{itemize}
\newline
   According to this classification the user interface of WD-pic was created.
The main window of WD-pic consists of three parts:
 \begin{itemize}
     \item the button panel in the left part of  the main window.
     \item the menu bar
     \item the drawing area with vertical and horizontal scrollbars, used to reveal 
additional parts of the drawing area
   \end{itemize}

   The button panel is divided into three parts in accordance with the {\bf Pic} language classification, which was given earlier.
    \begin{itemize}
     \item {\bf Pic} tokens
     \item Drawing directions
     \item Element parameters
    \end {itemize}
  The menu bar contains five popup menus: 
\begin{itemize}
  \item {\it File}
 \item {\it Edit}
 \item {\it View}
 \item {\it Structures}
 \item {\it Defaults}
\end{itemize}
\newline
The menu bar can be divided into two parts. The first part, containing
the  {\it File, Edit,} and {\it View} popup menus, corresponds to the interaction of the graphic
interface with the file and the displayed picture.  The second part, containing the {\it Structures} and {\it Defaults} popup menus, corresponds to the operator group and default 
group of {\bf Pic} language elements.   
\newline 


  In this work the existing {\bf Pic} compiler was used.
 Using {\bf Pic} compiler data structures, we created  the WD-pic data
structures, allowing  us to store all necessary information  for
working with a picture via both graphical interface and a text editor interface. After that,
we modified the {\bf Pic} compiler data structures in order that they conform  to the 
WD-pic data structures. Also, we changed  the {\bf Pic} compiler code
so that it supports the modified data structures. 
\newline


    WD-pic's perfomance was compared with writing  in {\bf Pic} language, using
text editor, and
{\it xfig} perfomance. The auther compared her perfomance in drawing a variety of pictures using WD-pic, {\bf Pic}, and {\it xfig} and found some advantages and some disadvantages to using WD-pic.
\end{document}
