home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / lyx-0.13.2.tar.gz / lyx-0.13.2.tar / lyx-0.13.2 / src / insetfig.h < prev    next >
C/C++ Source or Header  |  1998-04-23  |  3KB  |  137 lines

  1. // -*- C++ -*-
  2.  
  3. #ifndef INSETFIG_H_
  4. #define INSETFIG_H_
  5.  
  6. #include "lyxinset.h"
  7. #include "buffer.h"
  8. #include "LString.h"
  9. #include "LaTeXFeatures.h"
  10. #include "figinset.h"
  11. #include "figlist.h"
  12.  
  13. ///
  14. class InsetFig: public Inset {
  15. public:
  16.     ///
  17.     InsetFig(int tmpx, int tmpy, Buffer *);
  18.     ///
  19.     ~InsetFig();
  20.     ///
  21.     int Ascent(LyXFont const &font) const;
  22.     ///
  23.     int Descent(LyXFont const &font) const;
  24.     ///
  25.     int Width(LyXFont const &font) const;
  26.     ///
  27.     void Draw(LyXFont font, LyXScreen &scr, int baseline, float &x);
  28.     ///
  29.     void Write(FILE *file);
  30.     ///
  31.     void Read(LyXLex &lex);
  32.     ///
  33.     int Latex(FILE *file, signed char fragile);
  34.     ///
  35.     int Latex(LString &file, signed char fragile);
  36.     /// Updates needed features for this inset.
  37.     void Validate(LaTeXFeatures &features) const;
  38.  
  39.     /// what appears in the minibuffer when opening
  40.     LString EditMessage() {return "Opened figure";}
  41.     ///
  42.     void Edit(int, int);
  43.     ///
  44.     unsigned char Editable() const;
  45.     ///
  46.     bool Deletable() const;
  47.     ///
  48.     Inset::Code LyxCode() const;
  49.     ///
  50.     Inset* Clone();
  51.     ///
  52.     void CallbackFig(long arg);
  53.     ///
  54.     void Preview(char const *p);
  55.     /// browse for file
  56.     void BrowseFile();
  57.  
  58.     /// form for user input
  59.     FD_Figure *form;
  60.     /// width and height in pixels on screen
  61.     int wid, hgh;
  62.     /// width and height in postscript units (1/72 inch)
  63.     int pswid, pshgh;
  64.     /// width of raw figure w/o rotation
  65.     int raw_wid;
  66.     /// heigt of raw figure w/o rotation
  67.     int raw_hgh;
  68.     /// x and y coordinate in ps units
  69.     int psx, psy;
  70.  
  71.     /// .eps file name
  72.     LString fname;
  73.     /// changed filename -> for recompute
  74.     bool changedfname;
  75.  
  76.     ///
  77.     enum HWTYPE {
  78.         ///
  79.         DEF,
  80.         ///
  81.         CM,
  82.         ///
  83.         IN,
  84.         ///
  85.         PER_PAGE,
  86.         ///
  87.         PER_COL
  88.     };
  89.     
  90.     /// width and height types: 0-default, 1-cm, 2-in, 3-%of page
  91.         /// For width, there is also: 4-% of col
  92.     HWTYPE wtype;
  93.     ///
  94.     HWTYPE htype;
  95.  
  96.     /// temporary w and h type
  97.     HWTYPE twtype;
  98.     ///
  99.     HWTYPE thtype;
  100.  
  101.     /// width and height
  102.     float xwid, xhgh;
  103.  
  104.     /// rotation angle
  105.     float angle;
  106.     
  107.     /// graphics command, latex version
  108.     LString cmd;
  109.     
  110.     /// Caption for subfigure package
  111.     LString subcaption;
  112.  
  113.     /// various flags
  114.     int flags;
  115.     bool subfigure : 1;
  116.     /// figure reference
  117.     FigureList::Figref *figure;
  118.     /// temporary flags
  119.     int pflags;
  120.     bool psubfigure : 1;
  121. private:
  122.     ///
  123.     Buffer *owner;
  124.     /// restore values on the form
  125.     void RestoreForm();
  126.     /// recompute screen params
  127.     void Recompute();
  128.     /// regenerate \includegraphics{} command
  129.     void Regenerate();
  130.     /// regenerate \inlcudegraphics{} command in temporary buffer
  131.     void TempRegenerate();
  132.     /// get sizes from .eps file
  133.     void GetPSSizes();
  134. };
  135.  
  136. #endif
  137.