home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xhyper10.zip / XHyper_v1.0 / src / TextView.h < prev   
C/C++ Source or Header  |  1992-12-08  |  4KB  |  105 lines

  1. /*
  2.  * Copyright (c) 1992 U.S. Geological Survey (USGS)
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided that
  6.  * the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of USGS not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  USGS makes no representations about the
  11.  * suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * USGS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  15.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL USGS
  16.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  17.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  18.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  19.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  20.  *
  21.  */
  22.  
  23. #ifndef TextView_h
  24. #define TextView_h
  25.  
  26. #include <InterViews/handler.h>
  27. #include <InterViews/monoglyph.h>
  28.  
  29. #include <stdio.h>
  30.  
  31. class Color;
  32. class Composition;
  33. class Deck;
  34. class FontTag;
  35. class HyperViewer;
  36. class Listener;
  37. class ParaTag;
  38. class Patch;
  39. class TextInfo_List;
  40.  
  41. //
  42. // *** text information list item
  43. //
  44. class TextInfo
  45.    {
  46.    public:
  47.       unsigned char  _code;
  48.       unsigned char  _tocindex;
  49.    };
  50.  
  51. class TextView : public MonoGlyph, public Handler 
  52.    {
  53.    public:
  54.       TextView (HyperViewer*,char*,int); // constructor
  55.       ~TextView ();            // destructor 
  56.       virtual void view_page(int);    // changes currently view page
  57.       virtual void draw(Canvas*, const Allocation&)const;
  58.                     // draws the current page
  59.       virtual void event(Event&);    // catches mouse events
  60.       virtual void printout();        // generates PostScript
  61.       void         jump_to(int);    // jump to page with given offset 
  62.       int       last_page();        // jump to page with given offset 
  63.       int       Count();        // returns number of pages
  64.       const char*  MMLFile();        // returns filename
  65.  
  66.       int       _numfont;        // number of font tags
  67.       int       _numpar;        // number of paragraph tags
  68.       ParaTag*     parlist[100];    // tag list
  69.       FontTag*     fontlist[100];    // tag list
  70.  
  71.    protected:
  72.       virtual void   wordhit(GlyphIndex);
  73.                     // processes mouse click for hypertext
  74.       virtual void   read(FILE*);    // reads a MML file
  75.       boolean        parse_command(char*, FILE*);
  76.                     // parses an MML command in <>
  77.       virtual void   make_defaults();    // creates default tags
  78.       virtual void   define(const char*, FILE*);
  79.                     // defines a tag
  80.       virtual void   fontstyle(const char*);
  81.                     // changes font style (e.g. bold)
  82.       virtual void   appendchar(const char);
  83.                     // adds a character to list
  84.  
  85.    private:
  86.       HyperViewer*    _parent;        // Controlling helpview instance
  87.       char*          _home;        // directory containing document
  88.       char*          _file;        // current document file
  89.       const Color*   _fg;        // foreground text color
  90.       const Color*   _bg;        // background text color
  91.       TextInfo_List* _text;        // text information list
  92.       Patch*         _patch;        // main patch
  93.       Listener*      _listener;        // event listener
  94.       Composition*   _lines;        // lines of character glyphs
  95.       Composition*   _characters;    // character glyphs
  96.       Deck*            _pages;        // stack of pages
  97.       ParaTag*       _partag;        // current paragraph tag
  98.       FontTag*       _fonttag;        // current font tag
  99.       boolean        _ishyper;        // flag for defining hypertext
  100.       int         _curpage;        // currently viewed page
  101.       int         _tocindex;        // Table of contents index
  102.    };
  103.  
  104. #endif
  105.