home *** CD-ROM | disk | FTP | other *** search
- /**************** Foreign-Character Macros **************************
-
- For TSE (The Semware Editor), pre-release version 1.0
-
- Author: David Mayerovitch
- 7 June 1993
-
- Description:
-
- This pair of macros provides a quick and convenient way of entering
- foreign-language and other special characters.
-
- mSelectLanguage() presents a menu of languages or other
- special-character sets for the user to choose from. I have assigned
- this macro to <Alt `>.
-
- mAccenter() enables the entry of the special characters belonging to
- the selected set. I have assigned this macro to the key <`>. Call
- this the trigger key.
-
- These macros do what you do when writing foreign characters by hand:
- first write the basic letterform, then add the diacritical mark.
-
- Example: If the selected language is French and you want to enter
- the character <é> (e with accent aigu): type the basic character
- <e>, then press the trigger key. A menu appears:
-
- ┌──────────┐
- │ Aigu é │
- │ Grave è │
- │ Circ ê │
- └──────────┘
-
- The hotkeys A, G, and C generate the three possible e-based accented
- characters in French. Press <A> and the <e> just typed will be
- replaced with <é>.
-
- When there is only one possible accented version of the character
- just typed (e.g. ü in German), the macro automatically inserts it
- without presenting a menu.
-
- The macros as presented here offer the following character sets:
- French: à â ç Ç é è ê É î ô û
- German: ä Ä ö ü Ü
- International (German + French): à â ä Ä ç Ç é è ê É î ô ö û ü Ü
- Currency: c/C --> ¢ (cents) l/L --> £ (pounds) y/Y --> ¥ (yen)
-
- You may easily edit the macros to provide any substitutions
- you want, arranged in languages or character sets of your
- choice. Strings as well as single characters may be
- substituted.
-
- If a printable key such as <`> is chosen as the trigger for
- mAccenter(), the Literal() command (assigned to <Ctrl P> in
- the factory configuration of TSE) may be used whenever the
- character itself is required in the text.
-
- Comments and improvements are welcome.
-
- ********************************************************************/
-
- // global variable:
- integer language = 1 // French is default
-
- // LANGUAGE SELECTION ROUTINES:
-
- menu langMenu()
- history
- "&French" "&German" "&International"
- "", , Divide "&Currency"
- end
-
- proc mSelectLanguage()
- langMenu()
- language = MenuOption()
- end
-
- // CHARACTER SUBSTITUTION ROUTINES:
-
- proc sub(string newstring)
- // replaces current char by newstring, forcing insert.
- DelChar()
- InsertText(newstring,_insert_)
- end
-
- menu FrenchAMenu()
- "&Grave à", sub('à') "&Circ â", sub('â')
- end
-
- menu IntlAMenu()
- "&Grave à", sub('à')
- "&Circ â", sub('â') "&Umlaut ä", sub('ä')
- end
-
- menu IntlOMenu()
- "&Circ ô", sub('ô') "&Umlaut ö", sub('ö')
- end
-
- menu IntlUMenu()
- "&Circ û", sub('û') "&Umlaut ü", sub('ü')
- end
-
- menu FrenchEMenu()
- "&Aigu é", sub('é') "&Grave è", sub('è') "&Circ ê", sub('ê')
- end
-
- proc French()
- case Chr(CurrChar())
- when 'a' FrenchAMenu() when 'e' FrenchEMenu()
- when 'E' sub('É') when 'c' sub('ç') when 'C' sub('Ç')
- when 'i' sub('î') when 'o' sub('ô') when 'u' sub('û')
- otherwise Right()
- endcase
- end
-
- proc German()
- case Chr(CurrChar())
- when 'a' sub('ä') when 'A' sub('Ä') when 'o' sub('ö')
- when 'O' sub('Ö') when 'u' sub('ü') when 'U' sub('Ü')
- otherwise Right()
- endcase
- end
-
- proc International()
- case Chr(CurrChar())
- when 'e' FrenchEMenu() when 'a' IntlAMenu()
- when 'o' IntlOMenu() when 'u' IntlUMenu()
- when 'A' sub('Ä') when 'c' sub('ç') when 'C' sub('Ç')
- when 'i' sub('î') when 'E' sub('É') when 'O' sub('Ö')
- when 'U' sub('Ü')
- otherwise Right()
- endcase
- end
-
- proc Currency()
- case UpCase(Chr(CurrChar()))
- when 'C' sub('¢') // cents
- when 'L' sub('£') // pounds
- when 'Y' sub('¥') // yen
- otherwise Right()
- endcase
- end
-
- proc mAccenter()
- Left()
- Case language
- when 1 French() when 2 German() when 3 International()
- when 5 Currency()
- endcase
- end
- <`> mAccenter()
- <Alt `> mSelectLanguage()
-
- /************************** End of macros **************************/
-
-