home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / tex / lametex_.z / lametex_ / lametex / src / Environment.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-02  |  1.4 KB  |  60 lines

  1. /* Environment.C
  2.  *
  3.  * The environment is the current set up of the page in terms of font type,
  4.  * page number, and many other general numbers to keep track of.
  5.  *
  6.  * Copyright 1992 Jonathan Monsarrat. Permission given to freely distribute,
  7.  * edit and use as long as this copyright statement remains intact.
  8.  *
  9.  */
  10.  
  11. #include "Environment.h"
  12. #include "Counter.h"
  13. #include "Document.h"
  14. #include "Font.h"
  15. #include "Justify.h"
  16. #include "Length.h"
  17.  
  18. Environment::Environment()
  19. {
  20.    // Same order as enumerator ParamTypes
  21.    params[PCounter] = new Counter();
  22.    params[PDocument] = new Document();
  23.    params[PFont] = new Font();
  24.    params[PJustify] = new Justify();
  25.    params[PLength] = new Length();
  26. }
  27.  
  28. Environment::~Environment()
  29. {
  30.    for(int x=0; x < LastType; x++)
  31.       delete params[x];
  32. }
  33.  
  34. Environment::Environment(Environment *e)
  35. {
  36.    for(int paramtype=0; paramtype < LastType; paramtype++)
  37.       params[paramtype] = e->get_param(paramtype)->copy();
  38. }
  39.  
  40. void Environment::revert(Environment *from)
  41. {
  42.    for(int paramtype=0; paramtype < LastType; paramtype++)
  43.       params[paramtype]->revert(from->get_param(paramtype));
  44. }
  45.  
  46. void Environment::set(int paramtype, int subtype, float value, char *replacestr)
  47. {
  48.    params[paramtype]->set(subtype, value, replacestr);
  49. }
  50.  
  51. float Environment::get(int paramtype, int subtype, char *comparestr)
  52. {
  53.    return params[paramtype]->get(subtype, comparestr);
  54. }
  55.  
  56. Param* Environment::get_param(int paramtype)
  57. {
  58.    return params[paramtype];
  59. }
  60.