1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/*
|
|
|
|
figinset.h - Figure inset header - part of LyX project
|
2000-03-09 03:36:48 +00:00
|
|
|
Copyright 1996 by Ivan Schreter
|
1999-09-27 18:44:28 +00:00
|
|
|
*/
|
|
|
|
|
1999-11-24 22:14:46 +00:00
|
|
|
#ifndef FIGINSET_H
|
|
|
|
#define FIGINSET_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#include "form1.h"
|
|
|
|
#include "LString.h"
|
1999-12-13 07:33:00 +00:00
|
|
|
#include "buffer.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "LaTeXFeatures.h"
|
1999-12-07 00:44:53 +00:00
|
|
|
#include "insets/lyxinset.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
/* the rest is figure stuff */
|
|
|
|
|
|
|
|
struct Figref;
|
|
|
|
|
|
|
|
///
|
|
|
|
class InsetFig: public Inset {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
InsetFig(int tmpx, int tmpy, Buffer *);
|
|
|
|
///
|
|
|
|
~InsetFig();
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int ascent(BufferView *, LyXFont const & font) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int descent(BufferView *, LyXFont const & font) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int width(BufferView *, LyXFont const & font) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-06-23 15:02:46 +00:00
|
|
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
void Write(Buffer const *, std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
void Read(Buffer const *, LyXLex & lex);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
int Latex(Buffer const *, std::ostream &, bool fragile, bool free_space) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
int Ascii(Buffer const *, std::ostream &) const;
|
2000-04-24 20:58:23 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
int Linuxdoc(Buffer const *, std::ostream &) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2000-06-12 11:27:15 +00:00
|
|
|
int DocBook(Buffer const *, std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Updates needed features for this inset.
|
1999-11-24 22:14:46 +00:00
|
|
|
void Validate(LaTeXFeatures & features) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// what appears in the minibuffer when opening
|
2000-04-04 00:19:15 +00:00
|
|
|
char const * EditMessage() const;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-02-25 12:06:15 +00:00
|
|
|
void Edit(BufferView *, int, int, unsigned int);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-03-08 13:52:57 +00:00
|
|
|
EDITABLE Editable() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
bool Deletable() const;
|
|
|
|
///
|
|
|
|
Inset::Code LyxCode() const;
|
|
|
|
///
|
1999-11-24 22:14:46 +00:00
|
|
|
Inset * Clone() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void CallbackFig(long arg);
|
|
|
|
///
|
1999-11-24 22:14:46 +00:00
|
|
|
void Preview(char const * p);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// browse for file
|
|
|
|
void BrowseFile();
|
|
|
|
|
|
|
|
/// form for user input
|
1999-11-24 22:14:46 +00:00
|
|
|
FD_Figure * form;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// width and height in pixels on screen
|
|
|
|
int wid, hgh;
|
|
|
|
/// width and height in postscript units (1/72 inch)
|
|
|
|
int pswid, pshgh;
|
|
|
|
/// width of raw figure w/o rotation
|
|
|
|
int raw_wid;
|
|
|
|
/// heigt of raw figure w/o rotation
|
|
|
|
int raw_hgh;
|
|
|
|
/// x and y coordinate in ps units
|
|
|
|
int psx, psy;
|
|
|
|
|
|
|
|
/// .eps file name
|
1999-10-02 16:21:10 +00:00
|
|
|
string fname;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// changed filename -> for recompute
|
|
|
|
bool changedfname;
|
|
|
|
|
|
|
|
///
|
|
|
|
enum HWTYPE {
|
|
|
|
///
|
|
|
|
DEF,
|
|
|
|
///
|
|
|
|
CM,
|
|
|
|
///
|
|
|
|
IN,
|
|
|
|
///
|
|
|
|
PER_PAGE,
|
|
|
|
///
|
|
|
|
PER_COL
|
|
|
|
};
|
|
|
|
|
|
|
|
/// width and height types: 0-default, 1-cm, 2-in, 3-%of page
|
|
|
|
/// For width, there is also: 4-% of col
|
|
|
|
HWTYPE wtype;
|
|
|
|
///
|
|
|
|
HWTYPE htype;
|
|
|
|
|
|
|
|
/// temporary w and h type
|
|
|
|
HWTYPE twtype;
|
|
|
|
///
|
|
|
|
HWTYPE thtype;
|
|
|
|
|
|
|
|
/// width and height
|
|
|
|
float xwid, xhgh;
|
|
|
|
|
|
|
|
/// rotation angle
|
|
|
|
float angle;
|
|
|
|
|
|
|
|
/// graphics command, latex version
|
2000-02-18 22:22:42 +00:00
|
|
|
mutable string cmd;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Caption for subfigure package
|
1999-10-02 16:21:10 +00:00
|
|
|
string subcaption;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// various flags
|
|
|
|
int flags;
|
2000-03-12 10:35:05 +00:00
|
|
|
///
|
|
|
|
bool subfigure;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// figure reference
|
1999-11-24 22:14:46 +00:00
|
|
|
Figref * figure;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// temporary flags
|
|
|
|
int pflags;
|
2000-03-12 10:35:05 +00:00
|
|
|
///
|
|
|
|
bool psubfigure;
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
///
|
1999-11-24 22:14:46 +00:00
|
|
|
Buffer * owner;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// restore values on the form
|
|
|
|
void RestoreForm();
|
|
|
|
/// recompute screen params
|
|
|
|
void Recompute();
|
|
|
|
/// regenerate \includegraphics{} command
|
2000-02-18 22:22:42 +00:00
|
|
|
void Regenerate() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// regenerate \inlcudegraphics{} command in temporary buffer
|
|
|
|
void TempRegenerate();
|
|
|
|
/// get sizes from .eps file
|
|
|
|
void GetPSSizes();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
struct figdata {
|
|
|
|
/// bitmap data
|
|
|
|
Pixmap bitmap;
|
|
|
|
/// reference count for this bitmap
|
|
|
|
int ref;
|
|
|
|
/// rotation angle
|
|
|
|
float angle;
|
|
|
|
/// width of raw figure w/o rotation
|
|
|
|
int raw_wid;
|
|
|
|
/// heigt of raw figure w/o rotation
|
|
|
|
int raw_hgh;
|
|
|
|
/// width and height on screen
|
|
|
|
int wid, hgh;
|
|
|
|
/// pointer to file name
|
1999-10-02 16:21:10 +00:00
|
|
|
string fname;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// type; 0-none, 1-B/W, 2-Grayscale, 3-Color
|
|
|
|
char flags;
|
|
|
|
/// reading request is pending on this figure
|
|
|
|
bool reading;
|
|
|
|
/// could not read it, because it's broken
|
|
|
|
bool broken;
|
|
|
|
/// when gs was killed, this says that image is ok
|
|
|
|
bool gsdone;
|
|
|
|
/// gs pid for reading
|
|
|
|
int gspid;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
struct Figref {
|
|
|
|
/// figure data (image)
|
1999-11-24 22:14:46 +00:00
|
|
|
figdata * data;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// inset of this figure
|
1999-11-24 22:14:46 +00:00
|
|
|
InsetFig * inset;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|