IBM
Contents Index Previous Next



Editing Text


General

There are several ways of editing text in the SDL Editor, i.e.

Two support functions are provided, namely:

Editing in the Drawing Area and Text Window

The SDL Editor allows you to edit textual objects directly in the drawing area.

If you select a text attribute to an object in the SDL Editor window, a text cursor is inserted directly in the text associated with the object, and the text window will be updated to contain the text. This is explained in Selecting a Symbol That Has Associated Objects and Selecting a Line That Has Associated Objects.

When you type text in the drawing area, 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.

When editing text directly in the drawing area it is possible to select text by dragging the mouse over the text or select words by double-clicking. You can extend or reduced the selection by clicking while pressing the <shift> key.

To edit large texts it might be more convenient to use the Text Window to edit the text. If you select more than one text object, the text window is not updated. 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.

Regardless of whether you edit directly in the drawing area or in the text window, the SDL Editor makes sure that the contents of both displayed texts are consistent.

A context sensitive syntax check is performed on all texts being edited. If a syntax error is found a red bar underlining the text will appear where the first error occurs in the text. See also Syntax Rules when Editing.

You can also edit text in an external text editor by using the Connect to Text Editor command in the Tools menu. This allows you to use the Text Editor, the Emacs text editor (on UNIX) or MS Word (in Windows) to edit large pieces of text.

The SDL Editor also supports editing text outside its context, by transferring text to / from a file.

Text Window

On UNIX, the text window is a pane of the SDL Editor window.

In Windows, the text window is a floating, resizeable and moveable window that can be placed anywhere on the screen. A single text window is shared by all instances of the SDL Editor currently running.

The text window contains two menus described in:

Hiding and Showing the Text Window

You can hide or 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 SDL Editor window.

Basic Text Editing Functions

Delayed Updating of the Drawing Area

When you edit text in the text window, both the text window and corresponding text in the drawing area will be updated. The the drawing area will be updated after a slight time delay and this can be set by an editor preference.

If you try to type an illegal character, you will be warned by a beep.

Standardized Text Editing Functions

When you edit text, you can:

Searching and Replacing Text

In the SDL editor, you can search for and replace text in a page or in a diagram. In the Organizer, you can search for and replace text in a diagram or in a diagram structure that is managed by the Organizer. In both the SDL editor and the Organizer, there are two search variants:

Searching for Text in a Diagram using Dialog Search

To search for text in the current page from the SDL editor:

  1. Select Search from the SDL editor's Tools menu or click the SDL editor quick-button for Search. The Search dialog is issued.

  1. Specify the text to be found in the Search for text field.
    • Click the Consider case button on to search case sensitive.
    • Click the Wildcard search button on to use wildcard matching, where an asterisk (`*') matches a sequence of zero or more characters of any kind.
    • Turn the Search all pages button on to specify that the scope of search should comprise all pages in the diagram. If you turn the button off, the scope of search will only comprise the current page.
    • Click the Whole word search button on to search only whole words.
  2. Click the Search button. The object where the next occurrence of text is found will be selected and the text window updated accordingly.
    • The diagram that the tool is currently processing is displayed to the right of the Search In field.
  3. Click Close.

Searching and Replacing Text using Dialog Search

  1. Open the Search dialog as described in Searching for Text in a Diagram using Dialog Search.
  2. Specify the text to be found in the Search for text field.
  3. Specify the text to be replaced with in the Replace with text field.
  4. Click the Search button to find the first occurrence.
  5. If the text is found, the object where the next occurrence of text is found will be selected and the text window updated accordingly. You may use any of the following options:
    • Search further by clicking Search repeatedly
    • Replace the text by clicking Replace
    • Replace and continue search with the Replace & Search button.
    • Replace all occurrences with the Replace All button.
  6. Close the Search dialog by clicking Close.

Fast Search

Fast search is like dialog search but without the dialog. The setting from the last dialog search is used for Wildcard search. Fast search do never consider case, and does always search all objects and all pages. To invoke Fast search, type ctrl+F when the SDL editor is not in text editing mode. If you are in text editing mode, you can click in the diagram background first to get out of text editing mode.

When Fast search is invoked, the message area displays the text that will be searched for. Initially, the text is Search for:. When you type on the keyboard with the mouse pointer over the drawing area, the characters will turn up in the message area. When you have typed the text pattern to search for, press enter or return to start the search operation.

The same search operation as for Dialog search is used. If the search operation finds a match, you can search for another match by pressing enter or return once more.

To finish the Fast search operation, click in the drawing area or select another operation.

The next time Fast search is invoked with ctrl+F, the search text that was used the last time is proposed as a search text once more. To use it, press enter or return. To use another search text, press ctrl+F once more or the delete key several times, to erase the search text.

Editing Text by Using an External Text Editor

Whenever a text object is selected and the text is visible in the text window, the command Connect to Text Editor in the Tools menu is available. This command opens an external text editor containing the text of the selected object. Which external text editor to start is defined by the preference SDT*TextEditor, which can be set either to the Text Editor or to the Emacs text editor (on UNIX).

From this point on, you can only edit the text by using the external text editor.

The text in the SDL Editor is updated every time the external text editor saves the text. When the text is no longer edited in the external text editor, the editing control returns to the SDL Editor.

Importing / Exporting Text

The SDL Suite allows you to import and export text from / to a file. You can, for instance, import text from files that contain SDL/PR into text symbols and export the contents of text symbols to files.

Importing Text from a File

Caution!

Importing text from a file replaces existing text as well. Use the Undo facility to revert to the original text, as long as the symbol is selected - deselecting the symbol will disable Undo.

You can import the contents of a text file into an object managed by the SDL Editor in the following way:

  1. Select the object where you want to import the contents of a file.
  2. Select Import from the text window's File menu.
  3. Specify the file to import.
  4. Click OK. This replaces the contents of the text window with the contents of the file you have specified in the file selection dialog.

Exporting Text from a File

To export the contents of the text window into a file:

  1. Select the object which text you want to export to a file.
  2. Select Export from the text window's File menu.
  3. Specify the file to export the text to.
  4. Clicking OK possibly creates a new file and replaces the contents of the file with the contents of the text window.

Copying, Cutting and Pasting Text

In the text window, you can cut, copy and paste text between different symbols, lines and text attributes. You can also transfer text between different applications.

Programmable Function Keys (UNIX only)

On UNIX, the SDL Suite allows to tie a function key to a defined text string. When you type 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 SDL Suite 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 SDL Suite users, namely

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

To program the function keys, insert 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 Resources

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

 ~username/SDT

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

Restrictions

Changing Fonts on Text Objects

You may change the font faces and font sizes used in the textual objects displayed by the SDL Editor. All textual objects use the same font faces and font sizes, meaning that you can neither change them individually nor change them during an SDL Editor session.

There is one exception though - it is possible to use a separate font for text symbols. This is useful in process diagrams where you may want a proportional font in most symbols to save space, while you may want a non-proportional font in text symbols to be able to align words on different lines.

The font faces 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 will use the font face names given by the preference settings

Editor*FontText*ScreenFontFamily
Editor*FontText*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.

Text Symbol Preference

For text symbols, the preference Editor*FontText*TextSymbolFontFamily is used both for on-screen viewing and printing.

Supported Font Faces

On UNIX, the availability of font faces is determined by the version of the X Windows server which is running. With a 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. On UNIX, if scalable fonts are not supported, the font face will be replaced by a Schumacher font (which can be used in all circumstances).

Default Font Sizes

The default font sizes are as follows:

Page Font Sizes (except overview pages)
Text Object: Font Size

Kernel heading, texts in reference symbols, channel names, signal route names, gate names

12 points

Other text objects

9 points

Overview Page Font Sizes
Text Object: Font Size:

All texts except signal lists

10 points

Signal list symbol

8 points

Setting Alignment

Normally the alignment of the text inside symbols are automatically set. However, you can use the preference setting Editor*FontText*TaskSymbolLeftAligned to set the alignment for the task symbol, procedure call symbol, macro call symbol, create request symbol and the save symbol. The default value is "off", meaning that the text will be centered, but if you set it to "on" the text in these symbols will be left aligned.

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.

How to Determine what Fonts are Available

From the OS prompt, typing:

hostname% xlsfonts | grep "\-0\-O\-" | 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.

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