W3C home > Mailing lists > Public > www-amaya-dev@w3.org > November 2003

Trouble with simple HTML extension

From: C. Greg Hagerty <cgreg@cgreg.com>
Date: Mon, 17 Nov 2003 23:25:55 -0500
To: www-amaya-dev@w3.org
Message-id: <200311180425.hAI4PtGR013727@infolab.umdnj.edu>


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?). 

  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 },

--------------------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);
     }
*/

--------------------
Received on Monday, 17 November 2003 23:26:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:49:01 GMT