2000-07-31 12:30:10 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* =================================================
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2000-07-31 12:30:10 +00:00
|
|
|
* LyX, The Document Processor
|
|
|
|
* Copyright 1995 Matthias Ettrich.
|
2002-01-29 09:26:24 +00:00
|
|
|
* Copyright 1995-2002 The LyX Team.
|
2000-07-31 12:30:10 +00:00
|
|
|
*
|
2002-01-29 09:26:24 +00:00
|
|
|
* \author Baruch Even
|
|
|
|
* \author Herbert Voss <voss@lyx.org>
|
2000-07-31 12:30:10 +00:00
|
|
|
* ================================================= */
|
|
|
|
|
|
|
|
#ifndef INSETGRAPHICSPARAMS_H
|
|
|
|
#define INSETGRAPHICSPARAMS_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
2002-03-21 17:09:55 +00:00
|
|
|
#endif
|
2000-08-08 09:18:39 +00:00
|
|
|
|
2000-07-31 12:30:10 +00:00
|
|
|
#include "LString.h"
|
|
|
|
|
|
|
|
#include "buffer.h"
|
|
|
|
#include "lyxlex.h"
|
|
|
|
|
2002-06-28 11:22:56 +00:00
|
|
|
namespace grfx {
|
|
|
|
class Params;
|
|
|
|
}
|
2002-05-28 11:50:04 +00:00
|
|
|
|
2000-07-31 12:30:10 +00:00
|
|
|
/// This struct holds all the parameters needed by insetGraphics.
|
2000-08-14 09:44:53 +00:00
|
|
|
struct InsetGraphicsParams
|
|
|
|
{
|
|
|
|
/// How do we display the image?
|
|
|
|
enum DisplayType {
|
2002-02-01 18:53:50 +00:00
|
|
|
DEFAULT, // whatever is in lyxrc.display_graphics
|
2002-01-29 09:26:24 +00:00
|
|
|
COLOR, // full color range
|
|
|
|
GRAYSCALE, // 256 shades of gray
|
|
|
|
MONOCHROME, // In black and white.
|
|
|
|
NONE // only keep a frame in place.
|
2000-08-14 09:44:53 +00:00
|
|
|
};
|
2002-02-01 18:53:50 +00:00
|
|
|
///
|
2002-02-11 10:42:11 +00:00
|
|
|
enum sizeType { // for latex and/or lyx
|
2002-01-29 09:26:24 +00:00
|
|
|
DEFAULT_SIZE, // like none
|
|
|
|
WH, // width/height values
|
|
|
|
SCALE // percentage value
|
|
|
|
};
|
|
|
|
/// Image filename.
|
|
|
|
string filename;
|
2000-08-14 09:44:53 +00:00
|
|
|
/// Do we have a subcaption?
|
|
|
|
bool subcaption;
|
|
|
|
/// The text of the subcaption.
|
|
|
|
string subcaptionText;
|
2002-02-05 18:43:28 +00:00
|
|
|
/// Do we rotate?
|
|
|
|
bool rotate;
|
|
|
|
/// Origin point of rotation
|
|
|
|
string rotateOrigin;
|
|
|
|
/// Rotation angle.
|
|
|
|
float rotateAngle;
|
2002-03-21 17:09:55 +00:00
|
|
|
/// clip image
|
2002-01-29 09:26:24 +00:00
|
|
|
bool clip;
|
|
|
|
/// draft mode
|
|
|
|
bool draft;
|
2002-02-11 10:42:11 +00:00
|
|
|
/// what to do with zipped files
|
|
|
|
bool noUnzip;
|
|
|
|
/// The bounding box with "xLB yLB yRT yRT ", divided by a space!
|
|
|
|
string bb;
|
2002-03-21 17:09:55 +00:00
|
|
|
/// Type of rescaling
|
2002-02-11 10:42:11 +00:00
|
|
|
sizeType size_type;
|
|
|
|
/// three possible values for rescaling (latex)
|
2002-01-29 09:26:24 +00:00
|
|
|
LyXLength width;
|
|
|
|
///
|
|
|
|
LyXLength height;
|
|
|
|
///
|
|
|
|
int scale;
|
2000-08-14 09:44:53 +00:00
|
|
|
/// Keep the ratio between height and width when resizing.
|
|
|
|
bool keepAspectRatio;
|
2002-02-11 10:42:11 +00:00
|
|
|
/// any userdefined special command
|
|
|
|
string special;
|
|
|
|
/// How to display the image inside lyx
|
|
|
|
DisplayType display;
|
|
|
|
/// Typ of the LyXView, same as for latex
|
|
|
|
sizeType lyxsize_type;
|
2002-05-01 10:23:51 +00:00
|
|
|
/// the size for the view inside lyx
|
2002-01-29 09:26:24 +00:00
|
|
|
LyXLength lyxwidth;
|
|
|
|
///
|
|
|
|
LyXLength lyxheight;
|
2002-07-19 21:44:14 +00:00
|
|
|
/// Keep the ratio between lyxheight and lyxwidth when resizing.
|
|
|
|
bool keepLyXAspectRatio;
|
2002-02-11 10:42:11 +00:00
|
|
|
/// Typ of rescaling the Screen inside lyx
|
2002-02-05 12:19:32 +00:00
|
|
|
int lyxscale;
|
2000-09-14 17:53:12 +00:00
|
|
|
///
|
2000-08-14 09:44:53 +00:00
|
|
|
InsetGraphicsParams();
|
2000-09-14 17:53:12 +00:00
|
|
|
///
|
2000-08-14 09:44:53 +00:00
|
|
|
InsetGraphicsParams(InsetGraphicsParams const &);
|
2000-09-14 17:53:12 +00:00
|
|
|
///
|
|
|
|
InsetGraphicsParams & operator=(InsetGraphicsParams const &);
|
2000-08-14 09:44:53 +00:00
|
|
|
/// Save the parameters in the LyX format stream.
|
2002-03-25 11:04:34 +00:00
|
|
|
void Write(std::ostream & os) const;
|
2000-08-14 09:44:53 +00:00
|
|
|
/// If the token belongs to our parameters, read it.
|
2002-03-22 16:37:52 +00:00
|
|
|
bool Read(LyXLex & lex, string const & token);
|
2002-06-24 20:28:12 +00:00
|
|
|
/// convert
|
2002-05-28 12:03:42 +00:00
|
|
|
// Only a subset of InsetGraphicsParams is needed for display purposes.
|
|
|
|
// This function also interrogates lyxrc to ascertain whether
|
|
|
|
// to display or not.
|
2002-06-28 11:22:56 +00:00
|
|
|
grfx::Params as_grfxParams(string const & filepath) const;
|
2000-07-31 12:30:10 +00:00
|
|
|
|
|
|
|
private:
|
2000-08-14 09:44:53 +00:00
|
|
|
/// Initialize the object to a default status.
|
|
|
|
void init();
|
|
|
|
/// Copy the other objects content to us, used in copy c-tor and assignment
|
|
|
|
void copy(InsetGraphicsParams const & params);
|
2000-07-31 12:30:10 +00:00
|
|
|
};
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
///
|
|
|
|
bool operator==(InsetGraphicsParams const &, InsetGraphicsParams const &);
|
2001-03-28 13:16:37 +00:00
|
|
|
///
|
|
|
|
bool operator!=(InsetGraphicsParams const &, InsetGraphicsParams const &);
|
2000-07-31 12:30:10 +00:00
|
|
|
|
2002-03-21 17:09:55 +00:00
|
|
|
#endif
|