Re: Trouble with simple HTML extension

On Mon, 17 Nov 2003 23:25:55 -0500
"C. Greg Hagerty" <cgreg@cgreg.com> wrote:

> 
> 
> I'm having trouble trying to make a simple extension to HTML, modeling
> a "statement" element after the "strong" element.
> I've made the following edits to amaya-src-8.2-pre.tgz under Windows.
> It compiles through the Thot compilers, builds, and the generated
> files such as Windows/amaya/EDITOR.h, EDITORAPP.c seem to reflect the
> changes, but the new menu item just doesn't appear - it seems to be
> supressed somehow (something to do with context?). 

Yes the new menu entry must be added in the file Amaya/config/amaya.profiles.

>   Help?
> 	 ...Greg
> 
> 
> --------------------DTD Extension
> 
> HTML.S:  [It would be better to create an actual extension structure]
>   [Phrase case]  Statement = Basic_Set;
> 
> HTMLT.T: Statement rule, same as emphasis or strong
> HTMLP.P: Statement rule, same as emphasis or strong
> 
> HTMLnames.h:
>    {"statement", SPACE, HTML_EL_Statement, L_BasicValue, TRUE},
> 
> html2thot.c: character level element HTML_EL_Statement
> 
> HTML.en: 
>   Statement: statement
> 
> Amaya\libwww\Library\src\HTMLPDTD.h:
>   HTML_ENTITIES 101
>   enum _HTMLElement HTML_Statement
> 
> Amaya\libwww\Library\src\HTMLPDTD.c:
>     { "STATEMENT"	, gen_attr,	HTML_GEN_ATTRIBUTES,	SGML_MIXED },

These files (HTMLPDTD.h and HTMLPDTD.c) are not used by Amaya.

> --------------------Editor Menu Extension
> 
> EDITOR.A: 
>   Types.Phrase toggle:TStatement -> SetOnOffStatement;
>   [...after TStrong; also tried after BAddress:]  Types button:TStatement -> SetOnOffStatement;
>   [and an extra Separator does appear when thrown in]
> 
> HTMLedit.c:
>       elType.ElTypeNum != HTML_EL_Statement &&
>       elType.ElTypeNum == HTML_EL_Statement ||
> 
> /* SetOnOffStatement adapted from SetOnOfStrong */
> void SetOnOffStatement (Document document, View view)
>  {
>   Element             selectedEl;
>   ElementType         elType;
>   int                 firstSelectedChar, lastSelectedChar;
> 	    
>   TtaGiveFirstSelectedElement (document, &selectedEl, &firstSelectedChar,
> 			       &lastSelectedChar);
>   if (selectedEl)
>     {
>     elType = TtaGetElementType (selectedEl);
>     if (!strcmp(TtaGetSSchemaName (elType.ElSSchema), "HTML"))
>        /* it's a HTML element */
>        SetCharFontOrPhrase (document, HTML_EL_Statement);
>     else if (!strcmp(TtaGetSSchemaName (elType.ElSSchema), "MathML"))
>        /* it's a MathML element */
>        SetMathCharFont (document, MathML_ATTR_fontweight);
>     }
> }
> 
> 
> f/HTMLedit_f.h:
>   extern void SetOnOffStatement ( Document document,  View view );
> 
> config/en-amayadialogue: [numbered lines correspond to EDITOR.A entries]
>   Statement [line inserted and all lines renumbered]
> 
> config/amaya.kb: [optional?]
>   Ctrl <Key>t , Ctrl <Key>u:         SetOnOffStatement() 
> 
> --------------------Beginnings of support for a corresponding button
> 
> amaya.h:
>   THOT_EXPORT int iStatement;
>   THOT_EXPORT ThotBool   SelectionInSTATEMENT ;
> 
> init.c:
>    SelectionInSTATEMENT = FALSE;
> /*
>    iStatement =  TtaAddButton (doc, 1, iconB, SetOnOffStatement, "SetOnOffStatement",
>      something like strong, use AM_BUTTON_STATEMENT?
> */
> 
> amayamsg.h: [somehow generated?] #define AM_BUTTON_STATEMENT
> 
> HTMLactions.c:  
> /* SOMETHING LIKE THIS WHEN WE FIGURE MORE OUT
>    if (SelectionInSTATEMENT != NewSelInElem)
>      {
> 	SelectionInSTATEMENT = NewSelInElem;
> 	TtaSetToggleItem (doc, 1, Types, TStatement, NewSelInElem);
> 	TtaSwitchButton (doc, 1, iStatement);
>      }
> */
> 
> --------------------


     Irene.
-----
Irène Vatton                     INRIA Rhône-Alpes
INRIA                               ZIRST
e-mail: Irene.Vatton@inria.fr       655 avenue de l'Europe
Tel.: +33 4 76 61 53 61             Montbonnot
Fax:  +33 4 76 61 52 07             38334 Saint Ismier Cedex - France

Received on Tuesday, 18 November 2003 08:52:40 UTC