Specification of ASHE



next
Next: Description of the Up: Implementation Details Previous: Description of the

Specification of ASHE

This program is based on a simple editor. Most of the main key bindings for emacs are implemented here with the purpose that the user can easily move and edit a file without using the mouse.

The visual interface of the program is based on a widget hierarchy where the main_widget is the child of the top_level_widget. The main_widget has two children a menubar and workarea. The menubar widget has all menus as a children. The workarea is a paned widget with the purpose to let the user resize the windows any time.

The workarea has as a main child ,the text widget, where the user is going to write the HTML document. Other children are the label widgets to send messages to the user such as errors, title of the documents and name of the files.

The Text Widget in Motif is very powerful but has some limitations such as text can not have several colors or fonts at the same time. Most of the functions of the Text Widget were used in this program such as XmTextInsert, XmTextGetSelection, XmTextGetString, XmTextSetString, XmTextHightlight.

The functions to handle files were the C functions open,create and read since they are fast in reading a file. Several errors were notified such as non existing files, permission denied and size of the file bigger than the buffer. If a file is saved with a new name, a new file is created with the new name.

The program only has one level of undo, so only the last command can be canceled. A structure undo_struct keeps track of the last command and what was inserted for this command. As soon as a character is inserted in the text window a ModifyVerifyCallback is called and the structure is updated.

To implement the Edit menu, the LosingFocusCallback is used to verify if a selection is done so the Cut and Copy item menus are sensitives. As soon as the text is unselected, the options Cut and Copy are inhibited and only the option Paste can be executed. The function XmTextCut, XmTextCopy and XmTextPaste were used to implement these options.

For almost each option from the menus HTML, Styles and Lists the sequence is to select a text, a dialog window verify if the information is right and the correspondent HTML are inserted in the text. Mainly the option Title, Header, Header and Link are implemented different.

Title always verify for existing title in the documents to replace it. It also updates the Title window to show the current title of the Document. A dialog prompt widget is used to enter the text of the title. The user also can select a text and this can be copy as a title of the document.

Header uses a radio box widget to set the size of the header between 1 to 6. This number is saved in the global variable header_num to be used for the header tag.

Link uses a SelectionBoxDialog to set two text fields, one for the URL name and the other for the reference name. The selected text is displayed as a label of the dialog widget.

Image uses a toggle button to set the position of the image (Top or bottom) referenced to the text and a Prompt Dialog widget to enter the URL name of the image file.

To Underline all the tags, the program keep track of each tag so when a character is inserted the tags will continue underlined. This is done also in the ModifyVerifyCallback so a function that update the position of the tags is called when the text widget is modified. This function is only called when the toggle button mark tags is on. The global variable toggle_mark_tag save the state of this button. When a file is read this flag is verified and the position of the tags is updated.



next
Next: Description of the Up: Implementation Details Previous: Description of the



Computer Science Department at Rensselaer
www@cs.rpi.edu