home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
cstepm.zip
/
sgmltags.e
< prev
next >
Wrap
Text File
|
1994-07-18
|
12KB
|
250 lines
compile if not defined(SMALL) -- If SMALL not defined, then being separately compiled
define INCLUDING_FILE = 'SGMLTAGS.E'
const
tryinclude 'MYCNF.E' -- the user's configuration customizations.
compile if not defined(SITE_CONFIG)
const SITE_CONFIG = 'SITECNF.E'
compile endif
compile if SITE_CONFIG
tryinclude SITE_CONFIG
compile endif
compile if EVERSION >= 6
EA_comment "CUSTEPM's SGML tags menu & support code."
compile endif
compile endif
const
compile if not defined(COMPANY_NAME)
; COMPANY_NAME = 'IBM ' -- Include a trailing blank if a company name is given.
COMPANY_NAME = ''
compile endif
compile if not defined(WANT_DYNAMIC_PROMPTS)
WANT_DYNAMIC_PROMPTS = 1
compile endif
compile if EVERSION < '5.21'
TILDE_CHAR = ''
compile else
TILDE_CHAR = '~'
compile endif
AF_CHAR = 1 -- key style constants (from STDCONST.E)
AF_ALT = 32
const -- Text defined separately, for easier NLS translation
SGMLTAGS_BAR__MSG = TILDE_CHAR'SGML '
PARAGRAPH_MENU__MSG = '~Paragraph'
LIST_ITEM_MENU__MSG = '~List item'
QUOTE_MENU__MSG = '~Quote'
OLIST_MENU__MSG = '~Ordered list'
ULIST_MENU__MSG = '~Unordered list'
SLIST_MENU__MSG = '~Simple list'
DLIST_MENU__MSG = '~Definition list'
FIGURE_MENU__MSG = '~Figure'
HEADS_MENU__MSG = '~Heading levels'
HEAD0_MENU__MSG = 'Heading ~0'
HEAD1_MENU__MSG = 'Heading ~1'
HEAD2_MENU__MSG = 'Heading ~2'
HEAD3_MENU__MSG = 'Heading ~3'
HEAD4_MENU__MSG = 'Heading ~4'
HEAD5_MENU__MSG = 'Heading ~5'
EM_MENU__MSG = '~Emphasize phrase'
EM2_MENU__MSG = 'He~avy emphasis'
TYPES_MENU__MSG = '~Typestyles'
TYPE_R_MENU__MSG = '~Roman'
TYPE_I_MENU__MSG = '~Italic'
TYPE_B_MENU__MSG = '~Bold'
TYPE_M_MENU__MSG = '~Monospace'
TYPE_SC_MENU__MSG = '~Small caps'
TYPE_SUB_MENU__MSG= 'S~ubscript'
TYPE_SUP_MENU__MSG= 'Su~perscript'
DOC_MENU__MSG = 'Docu~ments'
SIMDOC_MENU__MSG = '~SIMDOC'
HTMLDOC_MENU__MSG = '~HTML'
compile if WANT_DYNAMIC_PROMPTS
SGMLTAGS_BARP__MSG = \1'Create SGML tags'
PARAGRAPH_MENUP__MSG = \1'Insert paragraph tag after current line'
LIST_ITEM_MENUP__MSG = \1'Insert list item tag after current line'
QUOTE_MENUP__MSG = \1'Insert quote tags around block or char. mark, or current word'
OLIST_MENUP__MSG = \1'Create ordered list'
ULIST_MENUP__MSG = \1'Create unordered list'
SLIST_MENUP__MSG = \1'Create simple list'
DLIST_MENUP__MSG = \1'Create definition list'
FIGURE_MENUP__MSG = \1'Create a figure'
HEADS_MENUP__MSG = \1'Insert heading levels at beginning of current line'
HEAD0_MENUP__MSG = \1'[New page / 5 spaces after][Capitalize][Underscore][Bold][TOC]'
HEAD1_MENUP__MSG = \1'[New page / 3 spaces after][Capitalize][Underscore][Bold][TOC]'
HEAD2_MENUP__MSG = \1'[3 spaces before / 2 spaces after][Capitalize][Underscore][Bold][TOC]'
HEAD3_MENUP__MSG = \1'[3 spaces before / 2 spaces after][Underscore][Bold][TOC]'
HEAD4_MENUP__MSG = \1'[3 spaces before / 2 spaces after][Bold][TOC]'
HEAD5_MENUP__MSG = \1'[1 space before / Text follows on same line][Bold][no TOC]'
EM_MENUP__MSG = \1'Emphasize a phrase - block or char. mark, or current word'
EM2_MENUP__MSG = \1'Heavily emphasize a phrase - block or char. mark, or current word'
TYPES_MENUP__MSG = \1'Change the typestyle of a phrase - block or char. mark, or current word'
TYPE_x_MENUP__MSG = \1'Change block or char. mark, or current word, to indicated typestyle'
DOC_MENUP__MSG = \1'Create a document'
SIMDOC_MENUP__MSG = \1'Create a SIMDOC'
HTMLDOC_MENUP__MSG = \1'Create an HTML document'
compile else
SGMLTAGS_BARP__MSG = ''
PARAGRAPH_MENUP__MSG = ''
LIST_ITEM_MENUP__MSG = ''
QUOTE_MENUP__MSG = ''
OLIST_MENUP__MSG = ''
ULIST_MENUP__MSG = ''
SLIST_MENUP__MSG = ''
DLIST_MENUP__MSG = ''
FIGURE_MENUP__MSG = ''
HEADS_MENUP__MSG = ''
HEAD0_MENUP__MSG = ''
HEAD1_MENUP__MSG = ''
HEAD2_MENUP__MSG = ''
HEAD3_MENUP__MSG = ''
HEAD4_MENUP__MSG = ''
HEAD5_MENUP__MSG = ''
EM_MENUP__MSG = ''
EM2_MENUP__MSG = ''
TYPES_MENUP__MSG = ''
TYPE_x_MENUP__MSG = ''
DOC_MENUP__MSG = ''
SIMDOC_MENUP__MSG = ''
HTMLDOC_MENUP__MSG = ''
compile endif -- WANT_DYNAMIC_PROMPTS
CANCEL__MSG = 'Cancel' -- This is also in ENGLISH.E
SECURITY_TITLE__MSG = 'Document security'
SECURITY_PROMPT__MSG = 'Select the desired security level'
SECURITY_LEVELS__MSG = '/Unclassified/'COMPANY_NAME'Internal Use Only/'COMPANY_NAME'Confidential/'COMPANY_NAME'Confidential-Restricted/Registered 'COMPANY_NAME'Confidential'
SELECT__MSG = '~Select'
NONE__MSG = '~None'
definit
universal defaultmenu, activemenu
universal activeaccel
universal SGML_tags_menu_flag
deletemenu defaultmenu, 6, 0, 0 -- delete the existing Help menu (we want it to stay at the right)
buildsubmenu defaultmenu, 40, SGMLTAGS_BAR__MSG, SGMLTAGS_BARP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4000, PARAGRAPH_MENU__MSG, 'SGML_IL <p>'PARAGRAPH_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4001, \0, '', 4, 0
buildmenuitem defaultmenu, 40, 4002, LIST_ITEM_MENU__MSG, 'SGML_IL <li>'LIST_ITEM_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4003, QUOTE_MENU__MSG, 'SGML_em q'QUOTE_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4006, \0, '', 4, 0
buildmenuitem defaultmenu, 40, 4010, OLIST_MENU__MSG, 'SGML_IML |<list form=disp seq=ord>|<li>|<li>|</list>'OLIST_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4011, ULIST_MENU__MSG, 'SGML_IML |<list form=disp seq=unord>|<li>|<li>|</list>'ULIST_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4012, SLIST_MENU__MSG, 'SGML_IML |<list form=bare seq=unord>|<li>|<li>|</list>'SLIST_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4013, DLIST_MENU__MSG, 'SGML_IML |<list form=def seq=unord>|<lt>|<li>|</list>'DLIST_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4015, \0, '', 4, 0
buildmenuitem defaultmenu, 40, 4016, FIGURE_MENU__MSG, 'SGML_IML |<fig>||<cap>|</fig>'FIGURE_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4019, \0, '', 4, 0
buildmenuitem defaultmenu, 40, 4020, HEADS_MENU__MSG, HEADS_MENUP__MSG, 17, 0
buildmenuitem defaultmenu, 40, 4021, HEAD0_MENU__MSG, 'SGML_pref <h0>'HEAD0_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4022, HEAD1_MENU__MSG, 'SGML_pref <h1>'HEAD1_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4023, HEAD2_MENU__MSG, 'SGML_pref <h2>'HEAD2_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4024, HEAD3_MENU__MSG, 'SGML_pref <h3>'HEAD3_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4025, HEAD4_MENU__MSG, 'SGML_pref <h4>'HEAD4_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4026, HEAD5_MENU__MSG, 'SGML_pref <h5>'HEAD5_MENUP__MSG, 32769, 0
buildmenuitem defaultmenu, 40, 4030, EM_MENU__MSG, 'SGML_EM e'EM_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4031, EM2_MENU__MSG, 'SGML_EM h'EM_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4032, TYPES_MENU__MSG, TYPES_MENUP__MSG, 17, 0
buildmenuitem defaultmenu, 40, 4033, TYPE_R_MENU__MSG, 'SGML_EM r'TYPE_x_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4034, TYPE_I_MENU__MSG, 'SGML_EM r'TYPE_x_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4035, TYPE_B_MENU__MSG, 'SGML_EM b'TYPE_x_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4036, TYPE_M_MENU__MSG, 'SGML_EM m'TYPE_x_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4037, TYPE_SC_MENU__MSG, 'SGML_EM sc'TYPE_x_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4038, TYPE_SUB_MENU__MSG, 'SGML_EM sub'TYPE_x_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4039, TYPE_SUP_MENU__MSG, 'SGML_EM sup'TYPE_x_MENUP__MSG, 32769, 0
buildmenuitem defaultmenu, 40, 4050, DOC_MENU__MSG, DOC_MENUP__MSG, 17, 0
buildmenuitem defaultmenu, 40, 4051, SIMDOC_MENU__MSG, 'SGML_SIMDOC'SIMDOC_MENUP__MSG, 0, 0
buildmenuitem defaultmenu, 40, 4052, HTMLDOC_MENU__MSG, 'SGML_IML |<html>|<head>|<TITLE>|</TITLE>|</head>|<body>||</body>|</html>'HTMLDOC_MENUP__MSG, 0, 0
call readd_help_menu()
SGML_tags_menu_flag = 1
-- Following not necessary; this duplicates the 'Search' accelerator in the English version.
;; buildacceltable activeaccel, 'dokey a+S', AF_CHAR+AF_ALT, 83, 4098 -- a+S
;; buildacceltable activeaccel, 'dokey a+S', AF_CHAR+AF_ALT, 115, 4099 -- a+s
;; activateacceltable activeaccel
defc SGML_IL = -- InsertLine
insertline arg(1), .line+1
'+1'
end_line
defc SGML_pref = -- Prefix line with arg
replaceline arg(1) || textline(.line), .line
.col = length(arg(1))+1
defc SGML_IML = -- Insert Many Lines
parse value strip(arg(1),'L') with delim 2 rest
nextline = .line+1
do while rest <> ''
parse value rest with line (delim) rest
insertline line, nextline
nextline = nextline + 1
enddo
'+2'
end_line
defc SGML_em
level = arg(1)
call SGML_insert_tags('<'level'>', '</'level'>')
defproc SGML_insert_tags(start_tag, end_tag)
mt = marktype()
if pos(leftstr(mt,1), 'BC') then -- Block or Character mark
getfileid fid
getmark firstline,lastline,firstcol,lastcol,fileid
if fid<>fileid then
sayerror 'Wrong file - check mark'
return
endif
else
firstline = .line; lastline = .line;
call pend_word(); lastcol = .col
call pbegin_word(); firstcol = .col
endif
.col=lastcol+1
lastline
i_s = insert_state()
if not i_s then insert_toggle; endif
keyin end_tag
firstline
.col=firstcol
keyin start_tag
if pos(leftstr(mt,1), 'BC') then -- Block or Character mark
l = length(start_tag)
call pset_mark(firstline, lastline, firstcol+l, lastcol+(l*(lastline=firstline)), mt, fileid)
endif
if not i_s then insert_toggle; endif
defc SGML_SIMDOC
if not SGML_security(security) then
return
endif
if security<>'' then
security = " sec='"security"'"
endif
start_line = .line
start_size = .last
'SGML_IML |<simdoc'security'>|<title>|<titlem>|<date>|<abstract>|</abstract>|<author>|<address>|<line>|</address>|</titlep>'
start_line + .last - start_size
'SGML_IML |<frontm>|<h1>Preface>|<h1>Table of Contents|<collect h>|<h1>Figure List|<collect fig>|<body>|<backm>|<app>|<h1>Index|<collect ie>|</simdoc>'
start_line+4; end_line
defproc SGML_security(var security)
parse value listbox(SECURITY_TITLE__MSG, SECURITY_LEVELS__MSG,
'/'SELECT__MSG'/'NONE__MSG'/'Cancel__MSG,1,5,5,0,
compile if EVERSION >= 5.60
atol(0) || atoi(1) || atoi(1) || atoi(0) || SECURITY_PROMPT__MSG) with button 2 security \0
compile else
atoi(1) || atoi(1) || atoi(0) || atol(0) || SECURITY_PROMPT__MSG) with button 2 security \0
compile endif
if button=\2 then -- None
security = ''
elseif button<>\1 then -- Other than Select or None means Cancel or Close
return 0
endif
return 1