%%
%% This is the original source file advi-annot.sty
%%
%% Package `advi-annot' to use with LaTeX 2e
%%
%% Copyright Roberto Di Cosmo, Jun Furuse, Didier Remy, and Pierre Weis
%% All rights reserved.

%% $Id: advi-annot.sty,v 1.23 2006/11/13 09:43:15 remy Exp $

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{advi-annot}
         [2003/02/05 v1.40 Active-DVI Annot Package for advi Previewer]

%%% Advi Annotations
%% Identification
%% Preliminary declarations

%% Options

\DeclareOption {ps}{\PassOptionsToPackage{ps}{bubble}}
\ProcessOptions

\RequirePackage {advi}
\RequirePackage {bubble}

%% More declarations

%%% advi -> bubbles

\def \advi@@anchor {\advi@anchor{\the\advi@c@annot}}
\def \advi@@bubble #1{%
  \advi@ifadvi {\advi@record{\the\advi@c@annot}{#1}}{}}
\newcount \advi@c@annot

\newcommand {\advi@annot@text}[2][]{%
  \global \advance \advi@c@annot by 1%
  \leavevmode
  \bbb@[#1,from=bbb@from\the\advi@c@annot,to=bbb@to\the\advi@c@annot,%
        anchor=\advi@@anchor,bubble=\advi@@bubble]%
       {\advi@anchor{advi@annot\the\advi@c@annot}{#2}}}

%%% advi ignore -> footnotes


\def \advi@skipparen #1(#2){#1}
\newcommand{\advi@slashslash}[1][]{}
\newcommand {\advi@annot@footi}[2][]{\footnote {\let \\\advi@slashslash#2}}
\newcommand {\advi@annot@nofooti}[2][]{}

\newcommand {\advi@annot@foot}[2][]%
    {{#2}\@ifnextchar({\advi@skipparen{\advi@annot@footi}}%
      {\advi@annot@footi}}


\newcommand {\advi@annot@nofoot}[2][]%
    {{#2}\@ifnextchar({\advi@skipparen{\advi@annot@nofooti}}%
      {\advi@annot@nofooti}}

\newcommand {\advi@annot@pause}[2][]%
    {\@ifnextchar({\advi@annot@pausei{#2}}
                  {\advi@annot@pausei{#2}(1,1)}}

\def \advi@annot@pausei#1(#2,#3)#4{\ifpause
        {\bbb@{#1}(#2,#3){#4}}{\leavevmode\hbox{#1}}\pause} 

\newif \ifAdviFootnote
\AdviFootnotetrue
\newif \ifAdviAnnotPause
\AdviAnnotPausetrue

%% So...

\def \advi@annot {\advi@ifadvi {\advi@annot@text}{\ifAdviAnnotPause
        \let \@do \advi@annot@pause\else \ifAdviFootnote
        \let \@do \advi@annot@foot  \else \let \@do \advi@annot@nofoot
        \fi \fi \@do}}

%% exports

\advi@export \adviannot \advi@annot 
