Monday, October 21, 2002 Jens-Uwe Morawski wrote:

JUM> On Sun, 20 Oct 2002 23:59:31 +0200
JUM> Hans Hagen <[EMAIL PROTECTED]> wrote:

>> i come back to the tooltips later

JUM> before i forget it, i would like to give here an additional idea
JUM> about this topic:

JUM> IMO, the whole thing should be more general, maybe by calling it
JUM> 'balloons' or 'balloonwidget'. The usage in \footnote, \tooltip or
JUM> \cite is only an instance of the more general balloon-object.

JUM> For example, i would like to use such a ballon-widget as a
JUM> dropdown-menu in an interactive document that contains
JUM> a list of chapters, ...:

JUM> \balloon[placement={below,centered},
JUM>         frameclass=DropMenu,
JUM>         opendirection=down,
JUM>         openaction=OnClick]
JUM>         {Chapters}
JUM>         {\placelist
JUM>             [chapter]
JUM>             [criterium=all,
JUM>              alternative=a,
JUM>              pagenumber=no,
JUM>              interaction=all]}

JUM> and tooltips are then:
JUM> \defineballoon[tooltip][...]

I have a draft implementation for this.

By now, the only thing
that can be configured is the framecommand. I decided to use this
instead of a frameclass because it's even more flexible
(with frameclass, you need to define a different frame class for each
different ballon type, even if changes are small; this way, small
changes can be applied more easily when defining new tooltips.)

Put the following code in your cont-new.tex file or in your
cont-loc.tex file (whichever you use for customizations), until
Hnas decides to pass it to the core. I hope to come out myself
with more customization options, but I would have to study fields
and co. Maybe I'll leave that to Hans though.

BTW, your stuff seems to more oriented towards what Hans called
"helps" rather than tooltips, but I don't know much about this
feature.

Anyway, here's the code for custom balloons. Hope I didn't
reinvent the wheel ...

===== BEGIN CODE =====
% Redefine tooltips as a subclass of the more generic balloon
% class

\startconstants              all
               framecommand: framecommand
\stopconstants


\def\defineballoon[#1][#2]{%
  \@EA\def\csname#1\endcsname
    {\dodoubleempty\doballoon[#1]}%
  \@EA\def\csname\e!stel#1\e!in\endcsname
    {\dodoubleempty\setupballon[#1]}%
  \setupballoon[#1][#2]}

% Currently only supports framecommand
\def\setupballoon[#1][#2]{%
  \getparameters[balloon:#1:][#2]
}


\def\doballoon[#1][#2]#3#4%
  {\bgroup
   \setupfields[\v!reset]%
   \useJSscripts[fld]%
   \setbox0\hbox
     {\mindermeldingen
      \nextsystemfield
      \trialtypesettingtrue
        \setbox0=\hbox{#3}%
      \trialtypesettingfalse
      \definesymbol
        [\currentsystemfield:txt]
        [{\getvalue{balloon:#1:\c!framecommand}{#4}}]%
      \trialtypesettingtrue
        \setbox2=\hbox{\symbol[\currentsystemfield:txt]}%
      \trialtypesettingfalse
      \definefield
        [\currentsystemfield:txt][check]
        [dummy][\currentsystemfield:txt][\currentsystemfield:txt]%
      \setupfield
        [dummy]
        [\c!kader=\v!uit,
         \c!gebieduit=JS(Hide_Field{\currentsystemfield:txt}),
         \c!optie=\v!verborgen]%
      \hbox to \zeropoint
         {\dimen0\wd2\advance\dimen0 -\wd0
          \doifelse{#2}\v!links
            {\hskip-\dimen0}
            {\doif{#2}\v!midden
               {\hskip-.5\dimen0}}%
          \lower\openlineheight % this needs to be configurable
          \hbox to \zeropoint
            {\fitfield[\currentsystemfield:txt]}}%
      \dimen0=\ifdim\wd0=\zeropoint 3em\else\wd0\fi
      % Should the following be configurable too?
      \definesymbol
        [\currentsystemfield:but]
        [{\framed[\c!hoogte=2ex,\c!breedte=\dimen0,\c!kader=\v!uit]{}}]%
      \definefield
        [\currentsystemfield:but][push]
        [dummy][\currentsystemfield:but][\currentsystemfield:but]%
      \setupfield
        [dummy]
        [\c!kader=\v!uit,
         \c!optie=,
         \c!gebiedin=JS(Vide_Field{\currentsystemfield:txt}),
         \c!gebieduit=JS(Hide_Field{\currentsystemfield:txt})]%
       \lower2ex % this should be configurable
       \hbox to \zeropoint
         {\fitfield[\currentsystemfield:but]}%
      #3}%
  \ht0=\ht\strutbox\dp0=\dp\strutbox\box0
  \egroup}

% Redefines the old tooltip with the new command ...

\defineballoon[tooltip][\c!framecommand={\inframed[\c!kader=\v!uit,\c!achtergrond=\v!raster]}]

===== END CODE =====

-- 
Giuseppe "Oblomov" Bilotta

_______________________________________________
ntg-context mailing list
[EMAIL PROTECTED]
http://ref.ntg.nl/mailman/listinfo/ntg-context

Reply via email to