IBM
Contents Index Previous Next



Editing Text


General

The drawing area is a container for different types of objects that each may contain zero or more text compartments. In addition, the lines that connect objects also have zero or more textual attribute objects.

The editor allows these textual objects to be edited directly in the drawing area, allowing you to see directly how the textual object resizes to shrink-wrap the text.

To directly edit a textual object in the drawing area, simply position the text insertion cursor at the desired position in the text. To indicate that a textual object is being edited, a thin vertical bar designating the text insertion cursor appears at the selected text insertion point. As soon as you type some text, the keyboard input mode will change to text editing mode. This is indicated by a flashing and thicker insertion bar.

In text editing mode, all accelerator keys are interpreted as input to the text. As an example, the <Delete> key will in text editing mode delete a character, but in non-text editing mode it will remove (Clear) an entire symbol. This means that you can only use text editing keyboard accelerators like <Home>, <End>, <Ctrl+A> and <Ctrl+E> in text editing mode only.

While useful for quickly editing small texts, direct editing in the drawing area suffers from some restrictions:

To alleviate these and other limitations, the editor offers a text window that provides a more complete set of text editing features. See Text Window for more information. In addition, it is possible to use an external text editor for larger amounts of texts; see Connect to Text Editor.

Regardless of whether editing takes place directly in the drawing area or in the text window, the editor makes sure that the contents of both displayed texts are consistent, which makes it convenient to use both text editing mechanisms in the same diagram.

Textual Syntax Checks

Some texts in the editor are subject to syntactic checks as soon as they are changed. Errors detected during syntax checks will be displayed in the textual object by underlining the first characters at the position where the first syntax error was detected.

Minimum Size of Textual Symbols

While symbols are resized automatically to fit the containing text, the editor defines a minimum size for each symbol, ensuring that even empty symbols will be recognizable:

Delayed Updating of the Drawing Area

When you edit the text in the text window, the updating of the drawing area is at least delayed for the value of the preference FontText*MinimumTextUpdateDelay.

If the text is large, the update delay is extended proportionally. The text window is however always updated immediately.

In addition, any attempt to enter an illegal character will always result in an audible warning.

Text Window

The text window works in the same way for OM, SC, DP, MSC and HMSC diagrams. There is one text window common for OM, SC, DP and HMSC diagrams, and a separate text window for MSC diagrams.

On UNIX, the text window is a pane of the editor window and can be resized vertically.

In Windows, the text window is a resizable and moveable window that can be placed anywhere on the screen, not necessary within the limits of the editor window. A single text window is shared by all instances of the editor currently running.

If you select one object in the editor window, the text window is updated to contain the text associated with that object, but not if you select more than one text object.

Each line (except for the last line) in the text window is terminated by a carriage return, and may consist of any number of legal characters.

The text window provides a menu bar with two menus which are described in:

Hiding and Showing the Text Window

You can hide and show the text window with the Window Options command from the View menu, or by using a quick-button.

In Windows: When visible, the text window will always be placed on top of the editor window.

Searching and Replacing Text in an MSC

The text window provides standardized functions for searching and replacing text in an MSC.

If all the textual objects you want to search in are not visible (i.e. instance name, instance kind, instance composition, message name and message parameters) adjust the Diagram Options.

Copying, Cutting and Pasting Text

The text window provides standardized clipboard functions for copying, cutting and pasting text between different symbols, lines and text attributes. These functions do not interfere with the clipboard functions for cutting, copying and pasting objects.

Programmable Function Keys (UNIX only)

On UNIX, it is allowed to tie a function key to a defined text string. When typing that defined function key, the programmed text string will be inserted at the current cursor location. You can customize your own programming of function keys.

Global X Resources

The function keys are set up as X resources. It is possible to set up both system default and user-defined X resources, allowing you to customize your environment. The X resources are defined in a file that is common for all users, namely

/usr/lib/X11/app-defaults/SDT 

To program the function keys, insert the following lines anywhere into the SDT file:

/* Any suitable comment */
SDT*XmText.translations: #override \n\
<Key>F1: insert-string("F1Text") \n\
<Key>F2: insert-string("F2Text") \n\
<Key>F3: insert-string("F3Text") \n\
<Key>F4: insert-string("F4Text") \n\
<Key>F5: insert-string("F5Text") \n\
<Key>F6: insert-string("F6Text") \n\
<Key>F7: insert-string("F7Text") \n\
<Key>F8: insert-string("F8Text") \n\
<Key>F9: insert-string("F9Text")
/* Note the absence of \n\ on line 9 */

Note:

Omitting to define some of the function keys is permissible.

User-Defined X Resources

You can define your own function keys. This is done by defining the X-resources described above in a personal copy of the definition file and to store that file into your home directory:

 ~username/SDT

Alternatively, any directory designated by environment variable XAPPLRESDIR can be used.

Restrictions

  1. Only one line for each function key can be defined. Attempting to define more than one line into one function key may cause an unpredictable result when pressing that key.
    For instance, it is not certain that the following line will produce the expected result:
    <Key>F1: insert-string("F1Line1\nLine2") \n\ 
    
      
    
  2. Only the keys F1-F9 can be defined.

Changing Fonts on Text Objects

You may change the font faces and font sizes used in the textual objects displayed by the editor. All textual objects use the same font faces and font sizes, meaning that they cannot be changed individually and cannot be changed during an editor session.

The font faces which are available depend on the target system on which you are running the SDL Suite.

Defining What Font to Use

To modify the desired font size and font face, you must use the Preference Manager. See Managing Preferences.

Textual Objects Preferences

When the setting is in effect, the SDL Suite diagram editors will use the font face names given by the preference settings

OME*ScreenFontFamily
OME*PrintFontFamily

to select font face names. Note that in this way you can select different font names for screen and for print.

On UNIX, if you leave the Editor*FontText*ScreenFontFamily preference setting empty, you will edit your documents using the SDT Draft font, but print them using the font you specified with the Editor*FontText*PrintFontFamily setting.

Supported Font Faces

On UNIX, the availability of font faces is determined by the version of the X Windows server which is running. With revision 5 or higher (X11 R5), scalable fonts are supported. In that case, the available list of predefined font faces would be:

In Windows, the availability of font faces is determined by the TrueType fonts that are currently installed on the computer (use for instance the Windows Control Panel to determine what is available).

Default Font Face

The default font face is Helvetica (see the preferences ScreenFontFamily and PrintFontFamily described in OM/SC/HMSC/MSC/DP Editor Preferences).

On UNIX, if scalable fonts are not supported, the font face will be replaced by a Schumacher font which may be used in all circumstances (MSC only).

Default Font Size

Font sizes are described in NameTextHeight and TextHeight.

They are used as follows:

Common Font Sizes

Text Object Font Size Other

Heading symbol

NameTextHeight


Text symbol

TextHeight


OM Font Sizes

Text Object Font Size Other

Class symbol name

NameTextHeight

Bold

Object symbol name

NameTextHeight

Bold

Stereotype text

TextHeight


Properties text

TextHeight

Italic

SC Font Sizes

Text Object Font Size Other

State symbol name

NameTextHeight

Bold

DP Font Sizes

Text Object Font Size Other

Symbol name

NameTextHeight

Bold

Stereotype text

TextHeight


Properties text

TextHeight

Italic

HMSC Font Sizes

Text Object Font Size

Reference Symbol

TextHeight

Condition symbol

TextHeight

MSC Font Sizes

Text Object Font Size

All MSC special symbols

TextHeight

Determining Which Scalable Fonts Your Server Can Access (UNIX only)

On UNIX, use the xlsfonts command to list installed fonts. Font names containing 0 for width and height are scalable.

Example 313 : How to determine which fonts are available

From the OS prompt, typing:

hostname% xlsfonts | grep "\-0\-0\-" | more

will return a list of accessible scalable fonts.

Scalable Fonts Under R5 Servers

To use scalable fonts under X11R5 you must normally first connect to a font server.

Example 314 : How to Start the Font Server

  1. Start the font server on any local host:
    hostname% fs
    
  2. Connect the server to fs indicating which host the font server is running on (which can be the same host that the X server is running on):
    hostname2% xset +fp tcp/<hostname>:7000
    

For further information see the X11R5 documentation or use man fs to read the manual page describing the font server you are running.

Disabling Font Scaling (UNIX only)

On UNIX, if the fonts look poor on the screen, a possible work-around is to disable the scaling option.

Note:

Disabling font scaling effectively disables WYSIWYG!

To do this, you should edit the SDT resource file.

  1. Open the file SDT in a text editor.
  2. Locate the line with the text: SDT*sdtUseScalableFonts
  3. Change the line to SDT*sdtUseScalableFonts: false
  4. Save the file and restart the SDL Suite environment.

http://www.ibm.com/rational
Contents Index Previous Next